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


PHP CArrayList::getItems方法代码示例

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


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

示例3: 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

示例4: execute

 public function execute($contextObject)
 {
     $result = array();
     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();
         $select = array();
         $select[] = "section.sectionIndex";
         $select[] = "section.name";
         $select[] = "section.content";
         $select[] = "sum(if(term.alias in ('lecture', 'practice', 'labwork', 'ksr'), l.value, 0)) + sum(ifnull(selfedu.question_hours, 0)) as total";
         $select[] = "sum(if(term.alias = 'lecture', l.value, 0)) as lecture";
         $select[] = "sum(if(term.alias = 'practice', l.value, 0)) as practice";
         $select[] = "sum(if(term.alias = 'labwork', l.value, 0)) as labwork";
         $select[] = "sum(if(term.alias = 'ksr', l.value, 0)) as ksr";
         $select[] = "sum(ifnull(selfedu.question_hours, 0)) as selfedu";
         $query->select(join(", ", $select))->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) {
         foreach ($termData as $row) {
             $dataRow = array();
             $dataRow[0] = $row["sectionIndex"];
             $dataRow[1] = $row["name"] . ": " . $row["content"];
             $dataRow[2] = $row["lecture"];
             $dataRow[3] = $row["practice"];
             $dataRow[4] = $row["labwork"];
             $dataRow[5] = $row["ksr"];
             $dataRow[6] = $row["selfedu"];
             $dataRow[7] = $row["total"];
             $dataRow[8] = "";
             $dataRow[9] = "";
             $result[] = $dataRow;
         }
     }
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:46,代码来源:CWorkPlanTermSections.class.php

示例5: execute

 public function execute($contextObject)
 {
     $termSectionsData = new CArrayList();
     foreach ($contextObject->terms->getItems() as $term) {
         $query = new CQuery();
         $query->select("sum(ifnull(selfedu.question_hours, 0)) as selfedu")->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);
         }
     }
     $result = 0;
     foreach ($termSectionsData->getItems() as $termId => $termData) {
         foreach ($termData as $row) {
             $result += $row["selfedu"];
         }
     }
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:19,代码来源:CWorkPlanTermSectionsSelfEdu.class.php

示例6: 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

示例7: actionSelectLoadTypesByPersonsPlans

 /**
  * На основе выбранных людей, планов у них и выбранного года дадим на выбор
  * типы планов, по которым печатать
  */
 public function actionSelectLoadTypesByPersonsPlans()
 {
     if ($this->getSelectedInPickListDialog()->getCount() == 0) {
         $this->setData("message", "Год не выбран, продолжение невозможно");
         $this->renderView("_flow/dialog.ok.tpl", "", "");
         return true;
     }
     $year_id = $this->getSelectedInPickListDialog()->getFirstItem();
     // соберем всех людей
     $bean = self::getStatefullBean();
     $bean->add("year_id", $year_id);
     $ids = $bean->getItem("id");
     $persons = new CArrayList();
     foreach ($ids->getItems() as $id) {
         $person = CStaffManager::getPerson($id);
         if (!is_null($person)) {
             $persons->add($person->getId(), $person);
         }
     }
     /**
      * @var $person CPerson
      */
     $types = new CArrayList();
     foreach ($persons->getItems() as $person) {
         foreach ($person->getIndPlansByYears($year_id)->getItems() as $year_id => $plans) {
             foreach ($plans->getItems() as $plan) {
                 $types->add($plan->type, $plan->type);
             }
         }
     }
     $this->setData("items", $types);
     $this->setData("multiple", true);
     $this->renderView("_flow/pickList.tpl", get_class($this), "SelectMonthForPersonPlans");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:38,代码来源:CIndPlanPrintController.class.php

示例8: execute

 public function execute($contextObject)
 {
     /**
      * @var $bean CStatefullBean
      */
     $bean = CApp::getApp()->beans->getStatefullBean(CRequest::getString("beanId"));
     $persons = new CArrayList();
     foreach ($bean->getItem("id")->getItems() as $person_id) {
         $person = CStaffManager::getPerson($person_id);
         if (!is_null($person)) {
             $persons->add($person->getId(), $person);
         }
     }
     /**
      * Отфильтруем нужные планы
      */
     $targetPlans = new CArrayList();
     /**
      * @var $person CPerson
      */
     foreach ($persons->getItems() as $person) {
         foreach ($person->getIndPlansByYears($bean->getItem("year_id"))->getItems() as $year_id => $plans) {
             foreach ($plans->getItems() as $plan) {
                 if (in_array($plan->type, $bean->getItem("types")->getItems())) {
                     $targetPlans->add($plan->getId(), $plan);
                 }
             }
         }
     }
     $month = $bean->getItem("month");
     $month = $month->getFirstItem();
     $result = array();
     /**
      * @var $plan CIndPlanPersonLoad
      */
     foreach ($targetPlans->getItems() as $plan) {
         $row = array();
         $row[0] = "";
         $row[1] = "";
         $row[2] = "";
         $row[3] = "";
         $row[4] = "";
         // план на семестр
         if (!array_key_exists(5, $row)) {
             $row[5] = 0;
         }
         $preparedData = array();
         $table = $plan->getStudyLoadTable()->getTable();
         foreach ($table as $r) {
             if ($plan->isSeparateContract()) {
                 // если есть бюджет-контракт, то суммируем их
                 $preparedRow = array();
                 $preparedRow[0] = $r[0];
                 for ($i = 1; $i <= 17; $i++) {
                     $preparedRow[$i] = $r[$i * 2] + $r[$i * 2 - 1];
                 }
                 $preparedData[] = $preparedRow;
             } else {
                 // нет разделения на бюджет-контракт, копируем
                 $preparedData[] = $r;
             }
         }
         if (in_array($month, array(2, 3, 4, 5, 6))) {
             foreach ($preparedData as $preparedRow) {
                 $row[5] += $preparedRow[1];
             }
         } else {
             foreach ($preparedData as $preparedRow) {
                 $row[5] += $preparedRow[8];
             }
         }
         $rows = array(6 => 0, 7 => 1, 8 => 2, 9 => -1, 10 => 4, 11 => -1, 12 => 14, 13 => 3, 14 => 5, 15 => 6, 16 => 7, 17 => 8, 18 => 9, 19 => 10, 20 => 15, 21 => 16);
         foreach ($rows as $target => $source) {
             if (!array_key_exists($target, $row)) {
                 $row[$target] = 0;
             }
             if ($source != -1) {
                 $row[$target] += $preparedData[$source][$month];
             }
         }
         if (!array_key_exists(22, $row)) {
             $row[22] = 0;
         }
         for ($i = 6; $i <= 21; $i++) {
             $row[22] += $row[$i];
         }
         $result[] = $row;
     }
     $sum = array();
     $sum[0] = "Итог";
     for ($i = 1; $i <= 4; $i++) {
         $sum[$i] = "";
     }
     for ($i = 5; $i <= 22; $i++) {
         if (!array_key_exists($i, $sum)) {
             $sum[$i] = 0;
         }
         foreach ($result as $item) {
             $sum[$i] += $item[$i];
         }
//.........这里部分代码省略.........
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:101,代码来源:CIndPlanPersonsReportTableTotal.class.php

示例9: getRolesByTaskByUser

 /**
  * Получить роли по идентификатору задачи выбранного сотрудника 
  * @param CUserRole $key
  * @param CUser $user
  * @return CArrayList
  */
 public static function getRolesByTaskByUser(CUserRole $key, CUser $user)
 {
     $roles = new CArrayList();
     $users = new CArrayList();
     foreach (CActiveRecordProvider::getWithCondition(TABLE_USER_IN_GROUPS, "user_id = '" . $user->getId() . "'")->getItems() as $item) {
         $user = new CUser($item);
         $users->add($user->getId(), $user);
     }
     foreach (CStaffManager::getRolesByTask($key)->getItems() as $role) {
         foreach ($users->getItems() as $user) {
             if ($role->user_group_id == $user->group_id) {
                 $roles->add($role->getId(), $role);
                 self::getCacheRolesGroups()->add($role->id, $role);
             }
         }
     }
     return $roles;
 }
开发者ID:Trozeman,项目名称:ASUPortalPHP,代码行数:24,代码来源:CStaffManager.class.php

示例10: actionSearch

 public function actionSearch()
 {
     $res = array();
     $term = CRequest::getString("term");
     /**
      * Полнотекстовый поиск по текстовым полям
      */
     $fields = array("date", "num", "title", "text", "comment");
     $query = new CQuery();
     $query->select("o.*")->from(TABLE_USATU_ORDERS . " as o")->condition("MATCH (" . implode($fields, ", ") . ") AGAINST ('" . $term . "')")->limit(0, 5);
     $objects = new CArrayList();
     foreach ($query->execute()->getItems() as $ar) {
         $object = new COrderUsatu(new CActiveRecord($ar));
         $objects->add($object->getId(), $object);
     }
     foreach ($objects->getItems() as $object) {
         foreach ($fields as $field) {
             if (strpos($object->{$field}, $term) !== false) {
                 $labels = $object->attributeLabels();
                 if (array_key_exists($field, $labels)) {
                     $label = $labels[$field];
                 } else {
                     $label = $field;
                 }
                 $res[] = array("label" => $object->getName() . " (" . $label . ": " . $object->{$field} . ")", "value" => $object->getName() . " (" . $label . ": " . $object->{$field} . ")", "object_id" => $object->getId(), "filter" => "order");
             }
         }
     }
     echo json_encode($res);
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:30,代码来源:COrderUsatuController.class.php

示例11: 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

示例12: actionGetDataForChart

 public function actionGetDataForChart()
 {
     $data = array();
     if (array_key_exists("data", $_POST)) {
         $data = $_POST["data"];
     }
     // определяем, в каких годах искать
     $years = new CArrayList();
     if (array_key_exists("years", $data)) {
         foreach ($data['years'] as $item) {
             $year = CTaxonomyManager::getYear($item);
             if (!is_null($year)) {
                 $years->add($year->getId(), $year);
             }
         }
     } else {
         $years->add(CUtils::getCurrentYear()->getId(), CUtils::getCurrentYear());
     }
     // по каким показателям показывать
     $indexes = new CArrayList();
     if (array_key_exists("indexes", $data)) {
         foreach ($data["indexes"] as $item) {
             foreach (CRatingManager::getRatingIndexesByName($item)->getItems() as $index) {
                 if ($years->hasElement($index->year_id)) {
                     $indexes->add($index->getId(), $index);
                 }
             }
         }
     } else {
         foreach ($years->getItems() as $year) {
             foreach (CRatingManager::getRatingIndexesByYear($year)->getItems() as $index) {
                 $indexes->add($index->getId(), $index);
             }
         }
     }
     // по каким людям показывать
     $persons = new CArrayList();
     if (array_key_exists("persons", $data)) {
         foreach ($data["persons"] as $item) {
             $person = CStaffManager::getPerson($item);
             if (!is_null($person)) {
                 $persons->add($person->getId(), $person);
             }
         }
     } else {
         // показывать по всем, у кого показатели есть в указанных годах
         foreach (CStaffManager::getAllPersons()->getItems() as $person) {
             foreach ($years->getItems() as $year) {
                 foreach ($person->getRatingIndexesByYear($year)->getItems() as $index) {
                     if ($indexes->hasElement($index->getId())) {
                         $persons->add($person->getId(), $person);
                     }
                 }
             }
         }
     }
     $res = array();
     // начинаем собирать инфу по людям
     // подписи к осям
     $axis = array();
     $i = 0;
     foreach ($persons->getItems() as $person) {
         $i++;
         $axis[] = $person->getName();
         //$axis[] = $i;
     }
     // все показатели, которые есть у выбранных людей (id всех показателей)
     // за все годы
     $resIndexes = array();
     foreach ($persons->getItems() as $person) {
         foreach ($years->getItems() as $year) {
             foreach ($person->getRatingIndexesByYear($year)->getItems() as $index) {
                 if ($indexes->hasElement($index->getId())) {
                     $resIndexes[$index->title] = $index->title;
                 }
             }
         }
     }
     $indicators = array();
     // данные по годам
     // данные должны возвращаться в том же порядке, в котором у нас идут люди
     foreach ($resIndexes as $key => $value) {
         foreach ($years->getItems() as $year) {
             $data = array();
             // собираем данные по каждому человеку
             foreach ($persons->getItems() as $person) {
                 $indexValue = 0;
                 foreach ($person->getRatingIndexesByYear($year)->getItems() as $index) {
                     if ($index->title == $key) {
                         $indexValue = $index->getIndexValue();
                     }
                 }
                 $data[] = $indexValue;
             }
             $indicator = array("name" => $value . " (" . $year->name . ")", "data" => $data, "stack" => $year->name);
             $indicators[] = $indicator;
         }
     }
     $res["axis"] = $axis;
     $res["series"] = $indicators;
//.........这里部分代码省略.........
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:101,代码来源:CRatingJSONController.class.php

示例13: execute

 public function execute($contextObject)
 {
     /**
      * @var $bean CStatefullBean
      */
     $bean = CApp::getApp()->beans->getStatefullBean(CRequest::getString("beanId"));
     $persons = new CArrayList();
     foreach ($bean->getItem("id")->getItems() as $person_id) {
         $person = CStaffManager::getPerson($person_id);
         if (!is_null($person)) {
             $persons->add($person->getId(), $person);
         }
     }
     /**
      * Отфильтруем нужные планы
      */
     $targetPlans = new CArrayList();
     /**
      * @var $person CPerson
      */
     foreach ($persons->getItems() as $person) {
         foreach ($person->getIndPlansByYears($bean->getItem("year_id"))->getItems() as $year_id => $plans) {
             foreach ($plans->getItems() as $plan) {
                 if (in_array($plan->type, $bean->getItem("types")->getItems())) {
                     $targetPlans->add($plan->getId(), $plan);
                 }
             }
         }
     }
     $month = $bean->getItem("month");
     $month = $month->getFirstItem();
     $result = array();
     /**
      * @var $plan CIndPlanPersonLoad
      */
     foreach ($targetPlans->getItems() as $plan) {
         $row = array();
         if (array_key_exists($plan->person_id, $result)) {
             $row = $result[$plan->person_id];
         }
         $row[0] = "АСУ";
         $row[1] = count($result);
         $row[2] = "";
         if (!is_null($plan->person)) {
             if (!is_null($plan->person->getPost())) {
                 $row[2] = $plan->person->getPost()->name_short;
             }
         }
         $row[3] = "";
         if (!is_null($plan->person)) {
             if (!is_null($plan->person->degree)) {
                 $row[3] = $plan->person->degree->comment;
             }
         }
         $row[4] = "";
         if (!is_null($plan->person)) {
             $row[4] = $plan->person->fio_short;
         }
         // план на семестр бюджет
         if (!array_key_exists(5, $row)) {
             $row[5] = 0;
         }
         // план на семестр контракт
         if (!array_key_exists(6, $row)) {
             $row[6] = 0;
         }
         // итого бюджет
         if (!array_key_exists(23, $row)) {
             $row[23] = 0;
         }
         // итого контракт
         if (!array_key_exists(24, $row)) {
             $row[24] = 0;
         }
         $preparedData = array();
         $table = $plan->getStudyLoadTable()->getTable();
         foreach ($table as $r) {
             if ($plan->isSeparateContract()) {
                 // если есть бюджет-контракт, то суммируем их
                 $preparedRow = array();
                 $preparedRow[0] = $r[0];
                 for ($i = 1; $i <= 17; $i++) {
                     $preparedRow[$i] = $r[$i * 2] + $r[$i * 2 - 1];
                 }
                 // не разделяем бюджет-контракт плана на осенний семестр
                 $preparedRow[18] = $r[1];
                 $preparedRow[19] = $r[2];
                 // не разделяем бюджет-контракт плана на весенний семестр
                 $preparedRow[20] = $r[15];
                 $preparedRow[21] = $r[16];
                 // не разделяем бюджет-контракт итога за осенний семестр
                 $preparedRow[20] = $r[13];
                 $preparedRow[21] = $r[14];
                 // не разделяем бюджет-контракт итога за весенний семестр
                 $preparedRow[22] = $r[29];
                 $preparedRow[23] = $r[30];
                 $preparedData[] = $preparedRow;
             } else {
                 // нет разделения на бюджет-контракт, копируем
                 $preparedData[] = $r;
//.........这里部分代码省略.........
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:101,代码来源:CIndPlanPersonsReportTableByTime.class.php

示例14: toGradebookTable

 /**
  * Преобразовать плоскую таблицу в журнал
  *
  * @return CArrayList
  */
 public function toGradebookTable()
 {
     $rows = new CArrayList();
     // шаг 1. определим количество записей в одной строке
     $types = new CArrayList();
     $dates = new CArrayList();
     $comments = new CArrayList();
     foreach ($this->activities->getItems() as $activity) {
         if (!is_null($activity->controlType)) {
             /*
             $types->add($activity->study_act_id."_".str_pad($activity->study_act_comment, 4, "0", STR_PAD_LEFT)."_".date("Ymd", strtotime($activity->getDate())), $activity->controlType->getValue());
             $dates->add($activity->study_act_id."_".str_pad($activity->study_act_comment, 4, "0", STR_PAD_LEFT)."_".date("Ymd", strtotime($activity->getDate())), $activity->getDate());
             $comments->add($activity->study_act_id."_".str_pad($activity->study_act_comment, 4, "0", STR_PAD_LEFT)."_".date("Ymd", strtotime($activity->getDate())), $activity->study_act_comment);
             */
             $types->add($activity->study_act_id . "_" . str_pad($activity->study_act_comment, 4, "0", STR_PAD_LEFT), $activity->controlType->getValue());
             $dates->add($activity->study_act_id . "_" . str_pad($activity->study_act_comment, 4, "0", STR_PAD_LEFT), $activity->getDate());
             $comments->add($activity->study_act_id . "_" . str_pad($activity->study_act_comment, 4, "0", STR_PAD_LEFT), $activity->study_act_comment);
         }
     }
     $types = $types->getSortedByKey(SORT_ASC);
     $dates = $dates->getSortedByKey(SORT_ASC);
     $firstCol = new CArrayList();
     $firstCol->add($firstCol->getCount(), "");
     // добавим все виды деятельности
     foreach ($types->getItems() as $key => $type) {
         $firstCol->add($key, $type);
     }
     $rows->add($rows->getCount(), $firstCol);
     // все номера лабораторных работ
     $col = $firstCol->getCopy();
     foreach ($comments->getItems() as $key => $date) {
         $col->add($key, $date);
     }
     $rows->add($rows->getCount(), $col);
     // шаг 2. пройдемся по всем записям, получим всех студентов
     $students = new CArrayList();
     foreach ($this->activities->getItems() as $activity) {
         if (!is_null($activity->student)) {
             $students->add($activity->student->getName(), $activity->student);
         }
     }
     $students = $students->getSortedByKey(SORT_ASC);
     // шаг 3. создадим на каждого студента по строчке в таблице
     foreach ($students->getItems() as $student) {
         $col = $firstCol->getCopy();
         foreach ($col->getItems() as $key => $value) {
             if ($key !== 0) {
                 $col->add($key, "");
             }
         }
         $col->add(0, $student->getName());
         foreach ($this->activities->getItems() as $activity) {
             if ($activity->student_id == $student->getId()) {
                 $arr = array();
                 if ($col->hasElement($activity->study_act_id . "_" . str_pad($activity->study_act_comment, 4, "0", STR_PAD_LEFT))) {
                     $arr = $col->getItem($activity->study_act_id . "_" . str_pad($activity->study_act_comment, 4, "0", STR_PAD_LEFT));
                 }
                 if (!is_null($activity->mark)) {
                     $arr[] = $activity->mark->getValue();
                 }
                 $col->add($activity->study_act_id . "_" . str_pad($activity->study_act_comment, 4, "0", STR_PAD_LEFT), $arr);
             }
         }
         $rows->add($rows->getCount(), $col);
     }
     // по просьбе ГВ в клетку 1.1 ставим название группы
     if (!is_null($this->group)) {
         $firstCol->add(0, $this->group->getName());
     }
     return $rows;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:76,代码来源:CGradebook.class.php

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