/** * Все сотрудники кафедры */ public function actionGetAllStaff() { $res = array(); $persons = CStaffManager::getAllPersons(); foreach ($persons->getItems() as $person) { $res[$person->getId()] = $person->getName(); } echo json_encode($res); }
public function actionIndex() { $persons = new CRecordSet(); if (array_key_exists("rated", $_GET)) { $rated = $_GET["rated"]; } else { $rated = 1; } /* $roles = new CArrayList(); if (array_key_exists("types", $_GET)) { if (is_array($_GET["types"])) { foreach ($_GET["types"] as $key=>$value) { $types[$value] = $value; $roles->add(CTaxonomyManager::getTypeById($value)->getId(), CTaxonomyManager::getTypeById($value)); } } else { foreach (explode(";", $_GET["types"]) as $value) { $types[$value] = $value; $roles->add(CTaxonomyManager::getTypeById($value)->getId(), CTaxonomyManager::getTypeById($value)); } } } else { foreach (CTaxonomyManager::getCacheTypes()->getItems() as $type) { $types[$type->getId()] = $type->getId(); $roles->add($type->getId(), $type); } } foreach (CStaffManager::getPersonsWithTypes($roles)->getItems() as $person) { if ($rated == 1) { if ($person->getActiveOrders()->getCount() > 0) { $persons->add($person->getId(), $person); } } else { $persons->add($person->getId(), $person); } } $this->setData("types", $types); $this->setData("types_url", implode(";", $types)); $this->addJSInclude("_modules/_orders/filter.js"); */ foreach (CStaffManager::getAllPersons()->getItems() as $person) { if ($rated == 1) { if ($person->getActiveOrders()->getCount() > 0) { $persons->add($person->getId(), $person); } } else { $persons->add($person->getId(), $person); } } $this->setData("rated", $rated); $this->setData("persons", $persons); $this->renderView("_orders/index.tpl"); }
public function actionIndex() { $persons = new CArrayList(); if (CRequest::getInt("year") == 0) { $year = CUtils::getCurrentYear(); } else { $year = CTaxonomyManager::getYear(CRequest::getInt("year")); } foreach (CStaffManager::getAllPersons()->getItems() as $person) { if ($person->getRatingIndexesByYear($year)->getCount() > 0) { $persons->add($person->id, $person); } } $this->setData("year", $year); $this->setData("persons", $persons); $this->renderView("_rating/person/index.tpl"); }
public function actionIndex() { $persons = new CArrayList(); if (CRequest::getInt("year") == 0) { $year = CUtils::getCurrentYear(); } else { $year = CTaxonomyManager::getYear(CRequest::getInt("year")); } foreach (CStaffManager::getAllPersons()->getItems() as $person) { if ($person->getPublications($year)->getCount() > 0) { $persons->add($person->id, $person); } } $this->addActionsMenuItem(array(array("title" => "Назад", "link" => "index.php", "icon" => "actions/edit-undo.png"))); $this->setData("year", $year); $this->setData("persons", $persons); $this->renderView("_rating_publications/person/index.tpl"); }
public function actionGetViewData() { $result = array(); // выбор сотрудников $withOrder = false; if (in_array("order", $this->properties)) { $withOrder = true; unset($this->properties[array_search("order", $this->properties)]); } // если ничего не выбрано, то выдаем всех $personsArray = array(); if (count($this->properties) == 0) { foreach (CStaffManager::getAllPersons()->getItems() as $person) { $result[$person->getId()] = $person->getName(); $personsArray[] = $person; } } else { $types = new CArrayList(); foreach ($this->properties as $type) { $types->add($type, $type); } foreach (CStaffManager::getPersonsWithTypes($types)->getItems() as $person) { $result[$person->getId()] = $person->getName(); $personsArray[] = $person; } } if ($withOrder) { /** * @var $person CPerson */ foreach ($personsArray as $person) { if (!$person->hasActiveOrder()) { unset($result[$person->getId()]); } } } return $result; }
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; echo json_encode($res); }