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


PHP CList::add方法代码示例

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


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

示例1: createChain

 /**
  * Creates and returns calculation rules chain.
  * 
  * @return CList calculation rules chain
  */
 protected function createChain()
 {
     if (!isset($this->_rules)) {
         $chain = $this->chain();
         $this->_rules = new CList();
         foreach ($chain as $item) {
             $rule = $this->createChainRule($item);
             $this->_rules->add($rule);
         }
     }
     return $this->_rules;
 }
开发者ID:hansenmakangiras,项目名称:disperindag,代码行数:17,代码来源:RatingModelChain.php

示例2: addValidators

 protected function addValidators()
 {
     $validators = new CList();
     foreach ($this->rules() as $rule) {
         if (isset($rule[0], $rule[1])) {
             $validator = CValidator::createValidator($rule[1], $this->_model, $rule[0], array_slice($rule, 2));
             $validators->add($validator);
         } else {
             throw new CException(Yii::t('yii', '{class} has an invalid validation rule. The rule must specify attributes to be validated and the validator name.', array('{class}' => get_class($this))));
         }
     }
     return $validators;
 }
开发者ID:hit-shappens,项目名称:testapp,代码行数:13,代码来源:ExtendedARBehavior.php

示例3: createValidators

 public function createValidators()
 {
     $validators = new CList();
     $rules = $this->rules();
     if ($this->addDefaultRules) {
         $rules = array_merge($rules, $this->defaultRules());
     }
     foreach ($rules as $rule) {
         if (isset($rule[0], $rule[1])) {
             // attributes, validator name
             $validators->add(CValidator::createValidator($rule[1], $this, $rule[0], array_slice($rule, 2)));
         } else {
             throw new CException(Yii::t('yii', '{class} has an invalid validation rule. The rule must specify attributes to be validated and the validator name.', array('{class}' => get_class($this))));
         }
     }
     return $validators;
 }
开发者ID:teknosuper,项目名称:YiiValidateRelation,代码行数:17,代码来源:YiiFormModel.php

示例4: createValueValidatorsByRules

 /**
  * @param array $rules
  * @return CList
  * @throws CException
  */
 private function createValueValidatorsByRules(array $rules)
 {
     $validators = new CList();
     foreach ($rules as $rule) {
         if (isset($rule[0], $rule[1])) {
             if ($rule[1] != 'unique') {
                 $validators->add(CValidator::createValidator($rule[1], $this, $rule[0], array_slice($rule, 2)));
             }
         } else {
             throw new CException(Zurmo::t('ReportsModule', '{class} has an invalid validation rule. The rule must specify ' . 'attributes to be validated and the validator name.', array('{class}' => get_class($this))));
         }
     }
     return $validators;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:19,代码来源:FilterForReportForm.php

示例5: getEavAttributes

 /**
  * @param array attributes key for get.
  * @return array
  */
 public function getEavAttributes($attributes = array())
 {
     // Get all attributes if not specified.
     if (empty($attributes)) {
         $attributes = $this->getSafeAttributesArray();
     }
     // Values array.
     $values = array();
     // Queue for load.
     $loadQueue = new CList();
     foreach ($attributes as $attribute) {
         // Check is safe.
         if ($this->hasSafeAttribute($attribute)) {
             $values[$attribute] = $this->attributes->itemAt($attribute);
             // If attribute not set and not load, prepare array for loaded.
             if (!$this->preload && $values[$attribute] === NULL) {
                 $loadQueue->add($attribute);
             }
         }
     }
     // If array for loaded not empty, load attributes.
     if (!$this->preload && $loadQueue->count() > 0) {
         $this->loadEavAttributes($loadQueue->toArray());
         foreach ($loadQueue as $attribute) {
             $values[$attribute] = $this->attributes->itemAt($attribute);
         }
     }
     // Delete load queue.
     unset($loadQueue);
     // Return values.
     return $values;
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:36,代码来源:EEavBehavior.php

示例6: actionIndex

 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $user = User::model()->findByAttributes(array("username" => Yii::app()->user->getId()));
     $meetingsId = new CList();
     $invitations = VCInvitation::model()->findAllByAttributes(array("invitee_id" => $user->id));
     foreach ($invitations as $inv) {
         $meetingsId->add($inv->videoconference_id);
     }
     $meetings = VideoConference::model()->findAllByAttributes(array("moderator_id" => $user->id));
     foreach ($meetings as $meeting) {
         $meetingsId->add($meeting->id);
     }
     //$dataProvider = new CActiveDataProvider('VideoConference');
     $this->render('index', array('meetingsId' => $meetingsId->toArray()));
 }
开发者ID:acuba001,项目名称:Collaborative-Platform,代码行数:18,代码来源:VideoConferenceController.php

示例7: createEavValidators

 /**
  * Creates validator objects based on the specification in rules of the EAV attribute. This method is mainly used
  * internally.
  * @return CList Validators built based on EavAttribute::getEavValidatorList().
  * @throws CException If the instantiated model does not support EAV attributes.
  */
 public function createEavValidators()
 {
     if (!$this->eavEnable) {
         throw new CException('The method ' . __METHOD__ . '() should not be called. The instantiated model does not
         support EAV attributes.');
     } else {
         $validators = new CList();
         foreach ($this->eavAttributeInstances as $attr) {
             $validatorList = $attr->getEavValidatorList();
             foreach ($validatorList as $validator => $params) {
                 $validators->add(CValidator::createValidator($validator, $this, $attr->name, $params));
             }
         }
         return $validators;
     }
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-spa,代码行数:22,代码来源:EavActiveRecord.php

示例8: findRecursive

 public static function findRecursive($dir, $filters = NULL, $depth = -1, $limit = 0)
 {
     if (!$filters instanceof EFileFilters) {
         $filters = new EFileFilters($filters);
     }
     $list = new CList();
     //TODO: $dir = new DirectoryIterator(dirname(__FILE__)); foreach ($dir as $fileinfo) {}
     $handle = opendir($dir);
     while (($fileName = readdir($handle)) !== FALSE) {
         if ($limit > 0 && $list->count >= $limit) {
             break;
         }
         if ($fileName === '.' || $fileName === '..') {
             continue;
         }
         $file = EFile::getInstance($dir . DIRECTORY_SEPARATOR . $fileName);
         //TODO: подумать о сортировке прямо в цикле поиска
         if ($filters->run($file)) {
             if ($file->isDir && $depth) {
                 $list->mergeWith(self::findRecursive($file->path, $filters, $depth - 1, $limit - $list->count));
             } else {
                 $list->add($file);
             }
         }
     }
     closedir($handle);
     return $list;
 }
开发者ID:sinelnikof,项目名称:yiiext,代码行数:28,代码来源:EFile.php


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