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


PHP CArrayList::getItem方法代码示例

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


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

示例1: getTitle

 /**
  * Название значения показателя
  *
  * @return mixed
  */
 public function getTitle()
 {
     if ($this->isFromTaxonomy()) {
         if (!is_null($this->parentIndex)) {
             $manager = $this->parentIndex->manager_class;
             $method = $this->parentIndex->manager_method;
             if ($manager != "" && $method != "") {
                 $list = new CArrayList();
                 $str = '$list = ' . $manager . '::' . $method . ';';
                 eval($str);
                 $value = $list->getItem($this->title);
                 if (!is_null($value)) {
                     return $value->getValue();
                 }
             }
         }
     } else {
         return $this->title;
     }
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:25,代码来源:CRatingIndexValue.class.php

示例2: getTerm

 /**
  * Ищет термин в указанной таксономии. Если не находит - создает
  *
  * @param $taxonomy
  * @param $key
  * @return CTerm
  */
 private function getTerm($taxonomyName, $key)
 {
     if ($taxonomyName == "education_form") {
         $forms = new CArrayList();
         /**
          * Пересортируем формы обучения в другом порядке, чтобы ключом
          * было название
          */
         foreach (CTaxonomyManager::getCacheEducationForms()->getItems() as $form) {
             $forms->add(mb_strtolower($form->getValue()), $form);
         }
         if ($forms->hasElement(mb_strtolower($key))) {
             $term = $forms->getItem(mb_strtolower($key));
         } else {
             $term = new CTerm();
             $term->setTable(TABLE_EDUCATION_FORMS);
             $term->setValue($key);
             $term->save();
             CTaxonomyManager::getCacheEducationForms()->add($term->getId(), $term);
         }
     } elseif ($taxonomyName == "gender") {
         $genders = new CArrayList();
         foreach (CTaxonomyManager::getCacheGenders()->getItems() as $gender) {
             $genders->add(mb_strtoupper($gender->getValue()), $gender);
         }
         if ($genders->hasElement(mb_strtoupper($key))) {
             $term = $genders->getItem(mb_strtoupper($key));
         }
     } else {
         $taxonomy = CTaxonomyManager::getTaxonomy($taxonomyName);
         $term = $taxonomy->getTerm($key);
         if (is_null($term)) {
             $term = new CTerm();
             $term->taxonomy_id = $taxonomy->getId();
             $term->setValue($key);
             $term->save();
             $taxonomy->addTerm($term);
         }
     }
     return $term;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:48,代码来源:CStudentImportForm.class.php

示例3: getIndPlansByYears

 /**
  * @param $restrict
  * @return CArrayList
  */
 public function getIndPlansByYears($restrict = 0)
 {
     $result = new CArrayList();
     foreach ($this->loads->getItems() as $load) {
         $year = new CArrayList();
         if ($result->hasElement($load->year_id)) {
             $year = $result->getItem($load->year_id);
         }
         $year->add($load->getId(), $load);
         $result->add($load->year_id, $year);
     }
     /**
      * Если есть ограничение, то все, которые под него не попадают
      * исключаем из результатов
      */
     if ($restrict > 0) {
         foreach ($result->getItems() as $year => $load) {
             if ($year != $restrict) {
                 $result->removeItem($year);
             }
         }
     }
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:28,代码来源:CPerson.class.php

示例4: getLabWorks

 /**
  * Все лабораторные работы, сгруппированные по семестрам
  *
  * @return CArrayList
  */
 public function getLabWorks()
 {
     $labs = new CArrayList();
     /**
      * @var $module CWorkPlanContentModule
      * @var $section CWorkPlanContentSection
      * @var $load CWorkPlanContentSectionLoad
      * @var $topic CWorkPlanContentSectionLoadTopic
      */
     $loads = new CArrayList();
     foreach ($this->modules->getItems() as $module) {
         foreach ($module->sections->getItems() as $section) {
             foreach ($section->loads->getItems() as $load) {
                 if ($load->loadType->getAlias() == "labwork") {
                     if ($load->topics->getCount() > 0) {
                         $loads->add($load->getId(), $load);
                     }
                 }
             }
         }
     }
     foreach ($loads as $load) {
         $term_id = $load->term_id;
         $termData = new CArrayList();
         if ($labs->hasElement($term_id)) {
             $termData = $labs->getItem($term_id);
         }
         foreach ($load->topics->getItems() as $topic) {
             $termData->add($topic->getId(), $topic);
         }
         $labs->add($term_id, $termData);
     }
     return $labs;
 }
开发者ID:Trozeman,项目名称:ASUPortalPHP,代码行数:39,代码来源:CWorkPlan.class.php

示例5: getFilter

 /**
  * Получить значение фильтра
  *
  * @param $name
  * @return null|int
  */
 public static function getFilter($name)
 {
     $filters = new CArrayList();
     foreach (explode("_", CRequest::getString("filter")) as $filter) {
         $values = explode(":", $filter);
         if (count($values) > 1) {
             if ($values[1] != 0) {
                 $filters->add($values[0], $values[1]);
             }
         }
     }
     return $filters->getItem($name);
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:19,代码来源:CRequest.class.php

示例6: actionTasks

 public function actionTasks()
 {
     $roles = new CArrayList();
     foreach (CSession::getCurrentUser()->getRoles()->getItems() as $role) {
         if ($role->hidden != 1) {
             $roles->add($role->getId(), $role);
         }
     }
     $sort = new CArrayList();
     foreach ($roles->getItems() as $i) {
         $sort->add($i->name, $i->getId());
     }
     $tasks = new CArrayList();
     foreach ($sort->getSortedByKey(true)->getItems() as $i) {
         $item = $roles->getItem($i);
         $tasks->add($item->getId(), $item);
     }
     $this->setData("tasks", $tasks);
     $this->renderView("_dashboard/tasks.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:20,代码来源:CDashboardController.class.php


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