• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CArrayList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: save

 public function save()
 {
     parent::save();
     /**
      * У сотрудников, которых нет приказов по
      * ГАК в году комиссии автоматически устанавливается
      * приказ от комиссии
      */
     if ($this->order_id !== 0) {
         $persons = new CArrayList();
         foreach ($this->members->getItems() as $person) {
             $persons->add($person->getId(), $person);
         }
         if (!is_null($this->manager)) {
             $persons->add($this->manager->getId(), $this->manager);
         }
         foreach ($persons->getItems() as $person) {
             if (is_null($person->getSABOrdersByYear($this->year))) {
                 $ar = new CActiveRecord(array("id" => null, "person_id" => $person->getId(), "year_id" => $this->year->getId(), "order_id" => $this->order_id));
                 $ar->setTable(TABLE_SAB_PERSON_ORDERS);
                 $ar->insert();
             }
         }
     }
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:25,代码来源:CSABCommission.class.php


示例2: execute

 public function execute($contextObject)
 {
     $result = 0;
     if (!is_null($contextObject->terms)) {
         $terms = array();
         foreach ($contextObject->terms->getItems() as $term) {
             $terms[] = $term->number;
         }
     }
     $termSectionsData = new CArrayList();
     foreach ($contextObject->terms->getItems() as $term) {
         $query = new CQuery();
         $query->select("sum(if(term.alias = 'lecture', l.value, 0)) as lecture")->from(TABLE_WORK_PLAN_CONTENT_SECTIONS . " as section")->innerJoin(TABLE_WORK_PLAN_CONTENT_LOADS . " as l", "l.section_id = section.id")->innerJoin(TABLE_TAXONOMY_TERMS . " as term", "term.id = l.load_type_id")->leftJoin(TABLE_WORK_PLAN_SELFEDUCATION . " as selfedu", "selfedu.load_id = l.id")->group("l.section_id")->condition("l.term_id = " . $term->getId());
         $items = $query->execute();
         if ($items->getCount() > 0) {
             $termSectionsData->add($term->getId(), $items);
         }
     }
     foreach ($termSectionsData->getItems() as $termId => $termData) {
         if (CBaseManager::getWorkPlanTerm($termId)->number == $terms[0]) {
             $result = 0;
             foreach ($termData as $row) {
                 $result += $row["lecture"];
             }
         }
     }
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:28,代码来源:CWorkPlanTermSectionsFirstLecture.class.php


示例3: actionWizardCompleted

 public function actionWizardCompleted()
 {
     $speciality = CTaxonomyManager::getCacheSpecialities()->getItem(CRequest::getInt("speciality_id"));
     $year = CTaxonomyManager::getCacheYears()->getItem(CRequest::getInt("year_id"));
     $protocol = CProtocolManager::getDepProtocol(CRequest::getInt("protocol_id"));
     $signer = CStaffManager::getPersonById(CRequest::getInt("signer_id"));
     $disciplines = new CArrayList();
     foreach (CRequest::getArray("discipline") as $i) {
         $disciplines->add($disciplines->getCount(), CDisciplinesManager::getDiscipline($i));
     }
     // бегаем по циклу столько раз, сколько нам билетов нужно
     for ($i = 1; $i <= CRequest::getInt("count"); $i++) {
         $ticket = CFactory::createSebTicket();
         $ticket->setSpeciality($speciality);
         $ticket->setYear($year);
         $ticket->setProtocol($protocol);
         $ticket->setSigner($signer);
         $ticket->setNumber($i);
         foreach ($disciplines->getItems() as $disc) {
             if ($disc->getQuestions()->getCount() == 0) {
                 break;
             }
             $question = $disc->getQuestions()->getShuffled()->getFirstItem();
             $disc->getQuestions()->removeItem($question->getId());
             $ticket->addQuestion($question);
         }
         $ticket->save();
     }
     $this->redirect("?action=index");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:30,代码来源:CSEBTicketsController.class.php


示例4: actionIndex

 public function actionIndex()
 {
     $set = new CRecordSet(false);
     $query = new CQuery();
     $set->setQuery($query);
     $query->select("t.*")->from(TABLE_NMS_PROTOCOL . " as t")->order('STR_TO_DATE(date_text, "%d.%m.%Y") desc');
     if (CRequest::getString("order") == "date_text") {
         $direction = "asc";
         if (CRequest::getString("direction") == "desc") {
             $direction = "desc";
         }
         $query->order('STR_TO_DATE(date_text, "%d.%m.%Y") ' . $direction);
     }
     $objects = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $ar) {
         $object = new CNMSProtocol($ar);
         $objects->add($object->getId(), $object);
     }
     $this->setData("objects", $objects);
     $this->setData("paginator", $set->getPaginator());
     /**
      * Генерация меню
      */
     $this->addActionsMenuItem(array("title" => "Добавить протокол", "link" => "index.php?action=add", "icon" => "actions/list-add.png"));
     /**
      * Отображение представления
      */
     $this->renderView("_protocols_nms/protocol/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:29,代码来源:CNMSProtocolsController.class.php


示例5: actionWizardCompleted

 public function actionWizardCompleted()
 {
     $sign_date = CRequest::getString("sign_date");
     $chairman = CStaffManager::getPersonById(CRequest::getInt("chairman_id"));
     $master = CStaffManager::getPersonById(CRequest::getInt("master_id"));
     $members = new CArrayList();
     foreach (CRequest::getArray("members") as $m) {
         $member = CStaffManager::getPersonById($m);
         $members->add($member->getId(), $member);
     }
     CProtocolManager::getAllSebProtocols();
     // на студента по протоколу
     foreach (CRequest::getArray("student") as $key => $value) {
         $student = CStaffManager::getStudent($key);
         $ticket = CSEBTicketsManager::getTicket($value['ticket_id']);
         $mark = CTaxonomyManager::getMark($value['mark_id']);
         $questions = $value['questions'];
         $protocol = CFactory::createSebProtocol();
         $protocol->setSignDate($sign_date);
         $protocol->setStudent($student);
         $protocol->setChairman($chairman);
         $protocol->setTicket($ticket);
         $protocol->setMark($mark);
         $protocol->setQuestions($questions);
         $protocol->setBoarMaster($master);
         $protocol->setSpeciality($student->getSpeciality());
         foreach ($members->getItems() as $member) {
             $protocol->addMember($member);
         }
         $protocol->setNumber(CProtocolManager::getAllSebProtocols()->getCount() + 1);
         $protocol->save();
         CProtocolManager::getCacheSebProtocols()->add($protocol->getId(), $protocol);
     }
     $this->redirect("?action=index");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:35,代码来源:CSEBProtocolsController.class.php


示例6: actionIndex

 public function actionIndex()
 {
     $set = new CRecordSet();
     $query = new CQuery();
     $set->setQuery($query);
     $query->select("com.*");
     $query->leftJoin(TABLE_DIPLOM_PREVIEW_MEMBERS . " as members", "members.comm_id=com.id")->from(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as com")->order("com.date_act desc");
     $showAll = true;
     if (CRequest::getInt("showAll") != 1) {
         $query->condition('com.date_act between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"');
         $showAll = false;
     }
     if (CRequest::getString("order") == "person.fio") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->innerJoin(TABLE_PERSON . " as person", "com.secretary_id = person.id");
         $query->order("person.fio " . $direction);
     }
     $items = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $ar) {
         $commission = new CDiplomPreviewComission($ar);
         $items->add($commission->getId(), $commission);
     }
     $this->setData("showAll", $showAll);
     $this->setData("commissions", $items);
     $this->setData("paginator", $set->getPaginator());
     $this->addActionsMenuItem(array(array("title" => "Добавить комиссию", "link" => "?action=add", "icon" => "actions/list-add.png")));
     $this->renderView("_diploms/preview_commission/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:31,代码来源:CDiplomPreviewCommissionController.class.php


示例7: actionIndex

 public function actionIndex()
 {
     $set = new CRecordSet();
     $query = new CQuery();
     $query->select("spec.*")->from(TABLE_SPECIALITIES . " as spec")->order("spec.id desc");
     $set->setQuery($query);
     $selectedSpeciality = null;
     /**
      * Фильтры
      */
     if (!is_null(CRequest::getFilter("speciality"))) {
         $query->condition("spec.id = " . CRequest::getFilter("speciality"));
         $selectedSpeciality = CTaxonomyManager::getSpeciality(CRequest::getFilter("speciality"));
     }
     /**
      * Получаем данные
      */
     $specialities = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $item) {
         $speciality = new CSpeciality($item);
         $specialities->add($speciality->getId(), $speciality);
     }
     /**
      * Подключаем скрипты
      */
     $this->addJSInclude(JQUERY_UI_JS_PATH);
     $this->addCSSInclude(JQUERY_UI_CSS_PATH);
     $this->setData("selectedSpeciality", $selectedSpeciality);
     $this->setData("specialities", $specialities);
     $this->setData("paginator", $set->getPaginator());
     $this->renderView("_specialities/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:32,代码来源:CSpecialitiesController.class.php


示例8: actionIndex

 public function actionIndex()
 {
     $set = new CRecordSet();
     $set->setPageSize(10);
     $query = new CQuery();
     $query->select("news.*")->from(TABLE_NEWS . " as news")->order("news.id desc");
     $set->setQuery($query);
     $news = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $ar) {
         $newsItem = new CNewsItem($ar);
         $news->add($newsItem->getId(), $newsItem);
     }
     //проверка доступности виджета вконтакте
     /*$check_url = @get_headers('http://vk.com/js/api/openapi.js');
       $cache_vk_id = "vk_access";
       if (is_null(CApp::getApp()->cache->get($cache_vk_id))) {
       	$vk = strpos($check_url[0],'200');
       	CApp::getApp()->cache->set($cache_vk_id, $vk);
       }
       $vk_access = CApp::getApp()->cache->get($cache_vk_id);
       $this->setData("vk_access", $vk_access);*/
     $this->setData("news", $news);
     $this->setData("paginator", $set->getPaginator());
     $this->renderView("_news/public.index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:25,代码来源:CPublicNewsController.class.php


示例9: actionIndex

 public function actionIndex()
 {
     $set = new CRecordSet();
     $query = new CQuery();
     $set->setQuery($query);
     $query->select("person.*")->innerJoin(TABLE_STAFF_ORDERS . " as orders", "person.id = orders.kadri_id")->innerJoin(TABLE_PERSON_BY_TYPES . " as type", "person.id = type.kadri_id")->from(TABLE_PERSON . " as person")->order("person.fio asc")->condition("orders.order_active=1");
     $PPS = false;
     if (CRequest::getInt("PPS") == 1) {
         $query->condition("type.person_type_id=1 and orders.order_active=1");
         $PPS = true;
     }
     $UVP = false;
     if (CRequest::getInt("UVP") == 1) {
         $query->condition("type.person_type_id=3 and orders.order_active=1");
         $UVP = true;
     }
     $persons = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $ar) {
         $person = new CPersonTime($ar);
         $persons->add($person->getId(), $person);
     }
     $this->setData("paginator", $set->getPaginator());
     $this->setData("PPS", $PPS);
     $this->setData("UVP", $UVP);
     $this->setData("persons", $persons);
     $this->renderView("_staff/time/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:27,代码来源:CStaffTimeController.class.php


示例10: actionIndex

 public function actionIndex()
 {
     $set = new CRecordSet();
     $query = new CQuery();
     $set->setQuery($query);
     $query->select("t.*")->from(TABLE_WORK_PLAN_COMPETENTIONS . " as t")->order("t.id asc")->condition("plan_id=" . CRequest::getInt("plan_id") . " AND type=" . CRequest::getInt("type"));
     $objects = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $ar) {
         $object = new CWorkPlanCompetention($ar);
         $objects->add($object->getId(), $object);
     }
     $this->setData("objects", $objects);
     $this->setData("paginator", $set->getPaginator());
     /**
      * Генерация меню
      */
     $this->addActionsMenuItem(array("title" => "Добавить компетенцию", "link" => "workplancompetentions.php?action=add&id=" . CRequest::getInt("plan_id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/list-add.png"));
     $this->addActionsMenuItem(array("title" => "Обновить", "link" => "workplancompetentions.php?action=index&plan_id=" . CRequest::getInt("plan_id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/view-refresh.png"));
     $this->addActionsMenuItem(array("title" => "Загрузить из дисциплины", "link" => "workplancompetentions.php?action=update&id=" . CRequest::getInt("plan_id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/format-indent-more.png"));
     if (CRequest::getInt("type") == 0) {
         $this->addActionsMenuItem(array("title" => "Скопировать компетенции из РП в УП", "link" => "workplancompetentions.php?action=copyCompetentions&id=" . CRequest::getInt("plan_id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/format-indent-less.png"));
     }
     $this->addActionsMenuItem(array("title" => "Удалить выделенные", "icon" => "actions/edit-delete.png", "form" => "#MainView", "link" => "workplans.php", "action" => "delete"));
     /**
      * Отображение представления
      */
     $this->renderView("_corriculum/_workplan/competentions/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:28,代码来源:CWorkPlanCompetentionsController.class.php


示例11: getDiploms

 public function getDiploms()
 {
     $result = new CArrayList();
     foreach ($this->diploms->getItems() as $diplom) {
         $result->add($diplom->getId(), $diplom);
     }
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:8,代码来源:CPracticePlace.class.php


示例12: getFoldersTopLevel

 /**
  * @return CArrayList
  */
 public static function getFoldersTopLevel()
 {
     $result = new CArrayList();
     foreach (CActiveRecordProvider::getWithCondition(TABLE_DOCUMENT_FOLDERS, "parent_id=0")->getItems() as $ar) {
         $folder = new CDocumentFolder($ar);
         $result->add($folder->getId(), $folder);
     }
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:12,代码来源:CDocumentsManager.class.php


示例13: actionIndex

 public function actionIndex()
 {
     $set = new CRecordSet(false);
     $query = new CQuery();
     $selectedTown = null;
     $query->select("pract.*")->from(TABLE_PRACTICE_PLACES . " as pract")->order("pract.name asc");
     $practics = new CArrayList();
     $set->setQuery($query);
     if (CRequest::getString("order") == "towns.name") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->leftJoin(TABLE_TOWNS . " as towns", "pract.town_id=towns.id");
         $query->order("towns.name " . $direction);
     } elseif (CRequest::getString("order") == "name") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->order("name " . $direction);
     } elseif (CRequest::getString("order") == "comment") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->order("comment " . $direction);
     }
     $townQuery = new CQuery();
     $townQuery->select("distinct(town.id) as id, town.name as name")->from(TABLE_TOWNS . " as town")->innerJoin(TABLE_PRACTICE_PLACES . " as pract", "pract.town_id = town.id")->order("town.name asc");
     // фильтр по городу
     if (!is_null(CRequest::getFilter("town"))) {
         $query->innerJoin(TABLE_TOWNS . " as town", "pract.town_id = town.id and town.id = " . CRequest::getFilter("town"));
         $selectedTown = CRequest::getFilter("town");
     }
     // фильтр по наименованию
     if (!is_null(CRequest::getFilter("name"))) {
         $query->condition("pract.id = " . CRequest::getFilter("name"));
     }
     // фильтр по комментарию
     if (!is_null(CRequest::getFilter("comment"))) {
         $query->condition("pract.id = " . CRequest::getFilter("comment"));
     }
     $towns = array();
     foreach ($townQuery->execute()->getItems() as $item) {
         $towns[$item["id"]] = $item["name"];
     }
     foreach ($set->getPaginated()->getItems() as $ar) {
         $practic = new CPracticePlace($ar);
         $practics->add($practic->getId(), $practic);
     }
     $this->setData("paginator", $set->getPaginator());
     $this->setData("practics", $practics);
     $this->setData("towns", $towns);
     $this->setData("selectedTown", $selectedTown);
     $this->renderView("_pract_bases/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:57,代码来源:CPractPlacesController.class.php


示例14: getActiveOrders

 public function getActiveOrders()
 {
     $result = new CArrayList();
     foreach ($this->orders->getItems() as $order) {
         if ($order->isActive()) {
             $result->add($order->getId(), $order);
         }
     }
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:10,代码来源:CPersonTime.class.php


示例15: display

 /**
  * Отображение организационной структуры.
  *
  * Параметры вызова:
  * array(
  *      'items' => CArrayList,
  *      'itemTemplate' => '_item.html.php'
  * )
  *
  * CArrayList должен содержать объекты типа CPerson
  *
  * @static
  * @param array $arr
  */
 public static function display(array $arr = null)
 {
     $r = new CArrayList();
     foreach ($arr['items']->getItems() as $i) {
         if ($i->getSubordinators()->getCount() > 0 && $i->getManagerId() == 0) {
             $r->add($r->getCount(), $i);
         }
     }
     CUnorderedListWidget::display(array('items' => $r, 'itemTemplate' => '_orgStructureItem.html.php', 'id' => $arr['id'], 'style' => $arr['style']));
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:24,代码来源:COrgStructureWidget.class.php


示例16: getWorksByType

 /**
  * @param $type
  * @return CArrayList
  */
 public function getWorksByType($type)
 {
     $result = new CArrayList();
     foreach ($this->works->getItems() as $work) {
         if ($work->work_type == $type) {
             $result->add($work->getId(), $work);
         }
     }
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:14,代码来源:CIndPlanPersonLoad.class.php


示例17: getDisciplines

 /**
  * Все дисциплины учебного плана в алфавитном порядке
  *
  * @return CArrayList
  */
 public function getDisciplines()
 {
     $disciplines = new CArrayList();
     $query = new CQuery();
     $query->select("d.*")->from(TABLE_CORRICULUM_DISCIPLINES . " as d")->innerJoin(TABLE_CORRICULUM_CYCLES . " as cycle", "d.cycle_id = cycle.id")->condition("cycle.corriculum_id = " . $this->getId())->innerJoin(TABLE_DISCIPLINES . " as discipline", "discipline.id = d.discipline_id")->order("discipline.name");
     foreach ($query->execute() as $ar) {
         $discipline = new CCorriculumDiscipline(new CActiveRecord($ar));
         $disciplines->add($discipline->getId(), $discipline);
     }
     return $disciplines;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:16,代码来源:CCorriculum.class.php


示例18: actionIndex

 public function actionIndex()
 {
     $set = CActiveRecordProvider::getAllFromTable(TABLE_HELP);
     $items = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $item) {
         $help = new CHelp($item);
         $items->add($help->getId(), $help);
     }
     $this->setData("helps", $items);
     $this->setData("paginator", $set->getPaginator());
     $this->renderView("_help/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:12,代码来源:CHelpController.class.php


示例19: actionIndex

 public function actionIndex()
 {
     $set = CActiveRecordProvider::getAllFromTable(TABLE_USER_GROUPS);
     $groups = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $r) {
         $group = new CUserGroup($r);
         $groups->add($group->getId(), $group);
     }
     $this->setData("groups", $groups);
     $this->setData("paginator", $set->getPaginator());
     $this->renderView("_acl_manager/groups/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:12,代码来源:CACLGroupController.class.php


示例20: actionIndex

 public function actionIndex()
 {
     $set = CActiveRecordProvider::getAllFromTable(TABLE_SETTINGS, "title asc");
     $settings = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $item) {
         $setting = new CSetting($item);
         $settings->add($setting->getId(), $setting);
     }
     $this->setData("settings", $settings);
     $this->setData("paginator", $set->getPaginator());
     $this->renderView("_configuration/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:12,代码来源:CConfigurationController.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CBPActivity类代码示例发布时间:2022-05-23
下一篇:
PHP CArrayHelper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap