当前位置: 首页>>代码示例>>PHP>>正文


PHP Model::set方法代码示例

本文整理汇总了PHP中Model::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::set方法的具体用法?PHP Model::set怎么用?PHP Model::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model的用法示例。


在下文中一共展示了Model::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addParamsToModel

 /**
  * @param Model $model
  **/
 public function addParamsToModel(Model $model)
 {
     if ($this->version == '1.1') {
         $model->set('openid.ns.sreg', self::NAMESPACE_1_1);
     }
     $model->set('openid.sreg.optional', implode(',', $this->params));
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:10,代码来源:OpenIdExtensionSreg.class.php

示例2: paginado

 public function paginado(Model $objeto, $numeroRegistros = 0)
 {
     if (!isset($this->params["pg_pagina"])) {
         $objeto->set("pg_pagina", 1);
     } else {
         $objeto->set("pg_pagina", (int) $this->params["pg_pagina"]);
     }
     if ($numeroRegistros) {
         $objeto->set("pg_registros", $numeroRegistros);
     }
 }
开发者ID:cokita,项目名称:srp,代码行数:11,代码来源:Control.php

示例3: criterios

 private static function criterios($sql, Model $producao)
 {
     if (in_array(ControleSessao::$id_cargo, Constantes::$arrVerRegional)) {
         $sql .= " and pr.id_regional = :id_centro_custo_regional ";
         $producao->set('id_centro_custo_regional', ControleSessao::$id_centro_custo);
     } elseif (ControleSessao::$id_cargo == Constantes::$id_supervisor || ControleSessao::$id_cargo == Constantes::$id_assistente_operacional || ControleSessao::$id_cargo == Constantes::$id_estagiario) {
         $sql .= " and pr.id_base = :id_centro_custo_base ";
         $producao->set('id_centro_custo_base', ControleSessao::$id_centro_custo);
     } elseif (ControleSessao::$id_cargo == Constantes::$id_orientador) {
         $sql .= " and pr.id_orientador = :id_orientador ";
         $producao->set('id_orientador', ControleSessao::$id_usuario);
     }
     return $sql;
 }
开发者ID:cokita,项目名称:srp,代码行数:14,代码来源:Producao_DashboardDAO.php

示例4: verificarLogin

 public function verificarLogin()
 {
     $obj = new loginHelper();
     if ($obj->getDataSession("usuario_login") == null) {
         throw new Exception_Form("Você precisa efetuar o login novamente para continuar.");
     } else {
         $model = new Model();
         $model->open();
         $model->set("sql", "\n\t\t\t\t\tINSERT INTO `systemlog` \n\t\t\t\t\t\t(`method`, `url`, `dados`, `login`, `data`) \n\t\t\t\t\t\tVALUES \n\t\t\t\t\t\t(:method,:url,:dados,:login,now())\n\t\t\t\t");
         $model->set('params', array(":method" => $this->_method, ":url" => $_SERVER['REQUEST_URI'], ":dados" => implode(';', $this->_dados), ":login" => $obj->getDataSession("usuario_login")));
         $model->query();
         $model->close();
     }
 }
开发者ID:peterclink,项目名称:webkit-back,代码行数:14,代码来源:SystemLog.php

示例5: test_set

 public function test_set()
 {
     $model = new Model();
     $model->set(array('foo' => 200, 'bar' => 'test'));
     $this->assertEquals(200, $model->foo);
     $this->assertEquals('test', $model->bar);
 }
开发者ID:cheyluna,项目名称:board_exercise,代码行数:7,代码来源:model_test.php

示例6: set

 function set($one, $two = null, $protectFields = true)
 {
     if ($protectFields) {
         if (!$one) {
             return;
         }
         if (is_object($one)) {
             $one = Set::reverse($one);
         }
         if (is_array($one)) {
             if (empty($one[$this->alias])) {
                 if ($this->getAssociated(key($one)) === null) {
                     $one = array($this->alias => $one);
                 }
             }
             foreach ($one as $alias => $data) {
                 if ($alias == $this->alias) {
                     $one[$alias] = $this->filterProtectedFields($data);
                 } else {
                     $associated = $this->getAssociated($alias);
                     if (!empty($associated)) {
                         $model = $associated['className'];
                         $one[$alias] = $this->{$model}->filterProtectedFields($data);
                     }
                 }
             }
         }
     }
     parent::set($one, $two);
 }
开发者ID:bluesky0811,项目名称:cakephp-protected-fields,代码行数:30,代码来源:app_model.php

示例7: set

 public function set($k, $v)
 {
     switch ($k) {
         case 'file':
             $ret = parent::set($k, $v);
             // Clear out the cache
             $this->_file = null;
             // File was updated... load the exif data too!
             // Note, only do this if it was an image!
             $file = $this->getOriginalFile();
             if ($file->isImage() && $file->getExtension() == 'jpg') {
                 $this->_data['exifdata'] = json_encode(exif_read_data($file->getFilename()));
             } else {
                 $this->_data['exifdata'] = null;
             }
             // Also if the file is new and it didn't exist... set the uploader id.
             if (!$this->_exists) {
                 $this->_data['uploaderid'] = \Core\user()->get('id');
             }
             return $ret;
         case 'exifdata':
             // exif data cannot be changed externally!
             return false;
         default:
             return parent::set($k, $v);
     }
 }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:27,代码来源:GalleryImageModel.php

示例8: setLimit

 public function setLimit(Model $Model, $data = array())
 {
     if (!empty($data)) {
         $Model->set($data);
     }
     if (empty($Model->data[$Model->alias])) {
         return false;
     }
     $limitField = $this->settings[$Model->alias]['limitField'];
     if (!isset($Model->data[$Model->alias][$limitField])) {
         $billingPlanModel = new BillingPlan();
         $limitValue = $billingPlanModel->field($limitField, array('id' => $Model->data[$Model->alias]['plan_id']));
         $Model->data[$Model->alias][$limitField] = $limitValue;
     }
     $scope = $this->settings[$Model->alias]['scope'];
     $remoteModel = $this->settings[$Model->alias]['remoteModel'];
     App::import('Model', $remoteModel);
     $remoteModel = new $remoteModel();
     if (in_array($Model->data[$Model->alias]['user_id'], $this->ownersWhitelist)) {
         $Model->data[$Model->alias][$limitField] = 199999999999;
     }
     $result = $remoteModel->updateAll(array($remoteModel->alias . '.' . $this->settings[$Model->alias]['remoteField'] => $Model->data[$Model->alias][$limitField]), array($remoteModel->alias . '.' . $scope => $Model->data[$Model->alias]['user_id']));
     if ($result) {
         //hardcoded group members manipulation
         if ($remoteModel == 'GroupLimit') {
             $this->membersOperate($Model);
         }
         return true;
     }
     return false;
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:31,代码来源:LimitableBehavior.php

示例9: set

 public function set($k, $v)
 {
     switch ($k) {
         case 'status':
             // Update the published date if it's status has changed.
             if ($v == $this->get($k)) {
                 return false;
             }
             if ($v == 'published' && !$this->get('published')) {
                 parent::set('published', Time::GetCurrentGMT());
             } elseif ($v == 'draft' && $this->get('published')) {
                 parent::set('published', '');
             }
             // And resume!
             return parent::set($k, $v);
         case 'published':
             // make sure this is a valid timestamp!
             if ($v != '' && !is_numeric($v)) {
                 $time = strtotime($v);
                 return parent::set($k, $time);
             } else {
                 return parent::set($k, $v);
             }
         default:
             return parent::set($k, $v);
     }
 }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:27,代码来源:BlogArticleModel.php

示例10: set

 public function set($key, $value)
 {
     if ($key == 'requires' || $key == 'provides' || $key == 'screenshots' || $key == 'upgrades') {
         return parent::set($key, serialize($value));
     } else {
         return parent::set($key, $value);
     }
 }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:8,代码来源:PackageRepositoryPackageModel.php

示例11: set

 /** Never change the password if the user did not supply a new value */
 public function set($data)
 {
     if (empty($data['set']['password'])) {
         unset($data['set']['password']);
     } else {
         $data['set']['password'] = md5($data['set']['password']);
     }
     return parent::set($data);
 }
开发者ID:hoelzro,项目名称:Bifrost,代码行数:10,代码来源:user.mdl.php

示例12: beforeSave

 /**
  * Before save hook
  *
  * @param Model $m
  * 
  * @return void
  */
 function beforeSave($m)
 {
     // if new record, then choose volume and generate name
     if (!$m->loaded()) {
         // volume
         $m->set('filestore_volume_id', $m->getAvailableVolumeID());
         // generate random original_filename in case you import file contents as string
         if (!$m['original_filename']) {
             $m->set('original_filename', mt_rand());
         }
         // generate filename (with relative path)
         $m->set('filename', $m->generateFilename());
     }
     // perform import itself
     if ($m->import_mode) {
         $m->performImport();
     }
 }
开发者ID:xavoctechnocratspvtltd,项目名称:svc,代码行数:25,代码来源:File.php

示例13: afterSave

 /**
  * AfterSave of Order Double points and save them
  * @param Model $Model
  * @param bool $created
  * @param array $options
  * @return bool
  * @throws Exception
  */
 public function afterSave($Model, $created, $options)
 {
     /**
      * Double points on new order only
      */
     if ($created && !empty($Model->data) && !empty($Model->data['Order'])) {
         $Model->set('point_total', $Model->data['Order']['point_total'] * 2);
         $Model->save();
     }
     return true;
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:19,代码来源:DoublePointsBehavior.php

示例14: validateSearch

 /**
  * Validate search
  *
  * @param object Model
  * @return boolean always true
  */
 public function validateSearch(Model $model, $data = null)
 {
     if (!empty($data)) {
         $model->set($data);
     }
     $keys = array_keys($model->data[$model->alias]);
     foreach ($keys as $key) {
         if (empty($model->data[$model->alias][$key])) {
             unset($model->data[$model->alias][$key]);
         }
     }
     return true;
 }
开发者ID:abhinand4858,项目名称:ProgrammedV,代码行数:19,代码来源:SearchableBehavior.php

示例15: routineDrop

 /**
  * routineDrop
  *
  */
 public function routineDrop(Model $model, $id, $conditions = array())
 {
     $conditions["{$model->alias}.{$model->primaryKey}"] = $id;
     $current = $model->find('first', array('conditions' => $conditions));
     if (empty($current)) {
         throw new NotFoundException(__('Invalid Access'));
     }
     // for SoftDeletable
     $model->set($current);
     $model->delete($id);
     $count = $model->find('count', array('conditions' => array("{$model->alias}.{$model->primaryKey}" => $id)));
     return $count === 0;
 }
开发者ID:k1low,项目名称:routine,代码行数:17,代码来源:RoutineBehavior.php


注:本文中的Model::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。