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(); } } } }
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; }
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"); }
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"); }
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"); }
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"); }
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"); }
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"); }
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"); }
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"); }
public function getDiploms() { $result = new CArrayList(); foreach ($this->diploms->getItems() as $diplom) { $result->add($diplom->getId(), $diplom); } return $result; }
/** * @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; }
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"); }
public function getActiveOrders() { $result = new CArrayList(); foreach ($this->orders->getItems() as $order) { if ($order->isActive()) { $result->add($order->getId(), $order); } } return $result; }
/** * Отображение организационной структуры. * * Параметры вызова: * 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'])); }
/** * @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; }
/** * Все дисциплины учебного плана в алфавитном порядке * * @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; }
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"); }
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"); }
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"); }
public function actionIndex() { $set = CActiveRecordProvider::getAllFromTable(TABLE_PRINT_FORMS); $forms = new CArrayList(); foreach ($set->getPaginated()->getItems() as $item) { $form = new CPrintForm($item); $forms->add($form->getId(), $form); } $this->setData("forms", $forms); $this->setData("paginator", $set->getPaginator()); $this->renderView("_print/form/index.tpl"); }
public function actionIndex() { $tables = new CArrayList(); $set = CActiveRecordProvider::get2AllFromTable(TABLE_ACL_TABLES); foreach ($set->getPaginated()->getItems() as $item) { $table = new CACLTable($item); $tables->add($table->getId(), $table); } $this->setData("tables", $tables); $this->setData("paginator", $set->getPaginator()); $this->renderView("_acl_manager/tables/index.tpl"); }
/** * @return CArrayList */ public static function getCommissions() { $res = new CArrayList(); $ids = CRequest::getString("id"); $ids = explode(":", $ids); foreach ($ids as $id) { $comm = self::getCommission($id); if (!is_null($comm)) { $res->add($comm->getId(), $comm); } } return $res; }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $personList = array(); $currentPerson = null; $query->select("t.*")->from(TABLE_PUBLICATIONS . " as t")->order("t.id asc"); if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) { $query->innerJoin(TABLE_PUBLICATION_BY_PERSONS . " as p", "p.izdan_id = t.id"); $query->condition("p.kadri_id=" . CSession::getCurrentPerson()->getId()); $currentPerson = CSession::getCurrentPerson()->getId(); $personList[$currentPerson] = CSession::getCurrentPerson()->getName(); } else { $personList = array(); $personQuery = new CQuery(); $personQuery->select("person.id, person.fio")->from(TABLE_PERSON . " as person")->innerJoin(TABLE_PUBLICATION_BY_PERSONS . " as p", "p.kadri_id = person.id")->order("person.fio asc"); foreach ($personQuery->execute()->getItems() as $arr) { $personList[$arr["id"]] = $arr["fio"]; } if (CRequest::getInt("person") != 0) { $currentPerson = CRequest::getInt("person"); $query->innerJoin(TABLE_PUBLICATION_BY_PERSONS . " as p", "p.izdan_id = t.id"); $query->condition("p.kadri_id=" . $currentPerson); } } if (CRequest::getString("order") == "year") { $direction = "asc"; if (CRequest::getString("direction") == "desc") { $direction = "desc"; } $query->order('STR_TO_DATE(year, "%Y") ' . $direction); } $objects = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $object = new CPublication($ar); $objects->add($object->getId(), $object); } $this->setData("currentPerson", $currentPerson); $this->setData("personList", $personList); $this->setData("objects", $objects); $this->setData("paginator", $set->getPaginator()); /** * Генерация меню */ $this->addActionsMenuItem(array(array("title" => "Добавить публикацию", "link" => "publications.php?action=add", "icon" => "actions/list-add.png"), array("title" => "Печать по шаблону", "link" => "#", "icon" => "devices/printer.png", "template" => "formset_publications"))); /** * Отображение представления */ $this->renderView("_staff/publications/index.tpl"); }
/** * Массив ключ-значение сотрудников с указанными ролями */ public function actionGetStaffWithRoles() { // получаем из POST-запроса роли $res = array(); $roles = new CArrayList(); foreach (explode(",", CRequest::getString("roles")) as $val) { $roles->add($val, $val); } $persons = CStaffManager::getPersonsWithTypes($roles); foreach ($persons->getItems() as $person) { $res[$person->getId()] = $person->getName(); } echo json_encode($res); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("t.*")->from(TABLE_GRANTS . " as t")->order("t.id asc"); $objects = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $object = new CGrant($ar); $objects->add($object->getId(), $object); } $this->setData("objects", $objects); $this->setData("paginator", $set->getPaginator()); $this->renderView("__public/_grants/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("*")->from(TABLE_CORE_VALIDATORS); $items = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $v = new CCoreValidator($ar); $items->add($v->getId(), $v); } $this->setData("validators", $items); $this->setData("paginator", $set->getPaginator()); $this->renderView("_core/validator/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("m.*")->from(TABLE_CORE_MODELS . " as m"); $models = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $model = new CCoreModel($ar); $models->add($model->getId(), $model); } $this->setData("models", $models); $this->setData("paginator", $set->getPaginator()); $this->renderView("_core/model/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $query->select("r.*")->from(TABLE_RATES . " as r")->order("r.id desc"); $set->setQuery($query); $rates = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $rate = new CRate($ar); $rates->add($rate->getId(), $rate); } $this->setData("rates", $rates); $this->setData("paginator", $set->getPaginator()); $this->renderView("_rates/rate/index.tpl"); }
public function actionIndex() { $set = new CRecordSet(); $query = new CQuery(); $set->setQuery($query); $query->select("*")->from(TABLE_USER_ROLES . "")->order("name asc"); $tasks = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $task = new CUserRole($ar); $tasks->add($task->getId(), $task); } $this->setData("tasks", $tasks); $this->setData("paginator", $set->getPaginator()); $this->renderView("_users/tasks/index.tpl"); }