public function actionGetViewData() { $result = array(); // комиссии по защите дипломов. показываем только комиссии этого года foreach (CActiveRecordProvider::getWithCondition(TABLE_SAB_COMMISSIONS, "year_id=" . CUtils::getCurrentYear()->getId())->getItems() as $ar) { $comm = new CSABCommission($ar); $value = $comm->title; if (!is_null($comm->manager)) { $value .= " " . $comm->manager->getName(); } if (!is_null($comm->secretar)) { $value .= " (" . $comm->secretar->getName() . ")"; } $diplom = CStaffManager::getDiplom(CRequest::getInt("diplom_id")); if (!is_null($diplom)) { $cnt = 0; foreach ($comm->diploms->getItems() as $d) { if (strtotime($diplom->date_act) == strtotime($d->date_act)) { $cnt++; } } $value .= " " . $cnt; } $result[$comm->getId()] = $value; } return $result; }
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 actionAdd() { $commission = new CSABCommission(); $form = new CSABCommissionForm(); $commission->year_id = CUtils::getCurrentYear()->getId(); $form->commission = $commission; $this->setData("form", $form); $this->addActionsMenuItem(array(array("title" => "Назад", "link" => "index.php?action=index", "icon" => "actions/edit-undo.png"))); $this->renderView("_state_attestation/add.tpl"); }
public function actionAddGroup() { $plan = CWorkPlanManager::getWorkplan(CRequest::getInt("id")); $group = new CExamGroupAdd(); $group->plan_id = CRequest::getInt("id"); $group->type = CRequest::getInt("type"); $group->discipline_id = $plan->discipline->id; $group->year_id = CUtils::getCurrentYear()->getId(); $this->setData("group", $group); $this->setData("cources", array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5)); $this->addActionsMenuItem(array("title" => "Назад", "link" => "workplanexamquestions.php?action=index&plan_id=" . CRequest::getInt("id") . "&type=" . CRequest::getInt("type"), "icon" => "actions/edit-undo.png")); $this->renderView("_corriculum/_workplan/examQuestions/groupadd.tpl"); }
/** * Расписание * * @return CArrayList */ public function getSchedule() { if (is_null($this->_schedules)) { $this->_schedules = new CArrayList(); $query = new CQuery(); $query->select("schedule.*")->from(TABLE_SCHEDULE . " as schedule")->condition("schedule.id=" . $this->getId() . " and schedule.year=" . CUtils::getCurrentYear()->getId() . " and schedule.month=" . CUtils::getCurrentYearPart()->getId()); foreach ($query->execute()->getItems() as $item) { $schedule = new CSchedule(new CActiveRecord($item)); $this->_schedules->add($schedule->getId(), $schedule); } } return $this->_schedules; }
public function actionSearch() { $res = array(); $term = CRequest::getString("query"); /** * Ищем группу по названию */ $query = new CQuery(); $query->select("st_group.id, st_group.name")->from(TABLE_STUDENT_GROUPS . " as st_group")->condition("LCASE(st_group.name) like '%" . mb_strtolower($term) . "%' and st_group.year_id =" . CUtils::getCurrentYear()->id)->limit(0, 5); foreach ($query->execute()->getItems() as $item) { $res[] = array("field" => "id", "value" => $item["id"], "label" => $item["name"], "class" => "CStudentGroup"); } echo json_encode($res); }
public function actionGetViewData() { $result = array(); $query = new CQuery(); // комиссии по предзащите дипломов. показываем только комиссии этого года $query->select("comm.*")->from(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as comm")->condition("comm.date_act between '" . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . "' and '" . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . "'"); foreach ($query->execute()->getItems() as $ar) { $comm = new CDiplomPreviewComission(new CActiveRecord($ar)); $value = $comm->name; if (!is_null($comm->secretar)) { $value .= " " . $comm->secretar->fio; } $result[$comm->getId()] = $value; } return $result; }
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 actionIndex() { $set = new CRecordSet(false); $query = new CQuery(); $currentPerson = null; $currentGroup = null; $query->select("diplom.*")->from(TABLE_DIPLOMS . " as diplom")->order("diplom.date_act desc"); $managersQuery = new CQuery(); $managersQuery->select("person.*")->from(TABLE_PERSON . " as person")->order("person.fio asc")->innerJoin(TABLE_DIPLOMS . " as diplom", "person.id = diplom.kadri_id"); $groupsQuery = new CQuery(); $groupsQuery->select("stgroup.*")->from(TABLE_STUDENT_GROUPS . " as stgroup")->order("stgroup.name asc")->innerJoin(TABLE_STUDENTS . " as student", "stgroup.id = student.group_id")->innerJoin(TABLE_DIPLOMS . " as diplom", "student.id = diplom.student_id")->condition('diplom.date_act between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"'); $set->setQuery($query); if (CRequest::getString("order") == "st_group.name") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->innerJoin(TABLE_STUDENTS . " as student", "diplom.student_id=student.id"); $query->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id"); $query->order("st_group.name " . $direction); } elseif (CRequest::getString("order") == "dipl_prew.date_preview") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->innerJoin(TABLE_STUDENTS . " as student", "diplom.student_id=student.id"); $query->leftJoin(TABLE_DIPLOM_PREVIEWS . " as dipl_prew", "student.id = dipl_prew.student_id"); $query->order("dipl_prew.date_preview " . $direction); } elseif (CRequest::getString("order") == "prepod.fio") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->innerJoin(TABLE_PERSON . " as prepod", "diplom.kadri_id = prepod.id"); $query->order("prepod.fio " . $direction); } elseif (CRequest::getString("order") == "student.fio") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->innerJoin(TABLE_STUDENTS . " as student", "diplom.student_id=student.id"); $query->order("student.fio " . $direction); } elseif (CRequest::getString("order") == "diplom_confirm") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("diplom_confirm " . $direction); } elseif (CRequest::getString("order") == "dipl_name") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("dipl_name " . $direction); } elseif (CRequest::getString("order") == "pract_place_id") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("pract_place_id " . $direction); } elseif (CRequest::getString("order") == "date_act") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("date_act " . $direction); } elseif (CRequest::getString("order") == "foreign_lang") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("foreign_lang " . $direction); } elseif (CRequest::getString("order") == "protocol_2aspir_id") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("protocol_2aspir_id " . $direction); } elseif (CRequest::getString("order") == "recenz_id") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("recenz_id " . $direction); } elseif (CRequest::getString("order") == "study_mark") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("study_mark " . $direction); } elseif (CRequest::getString("order") == "gak_num") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("gak_num " . $direction); } elseif (CRequest::getString("order") == "comment") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("comment " . $direction); } // фильтр по руководителю if (!is_null(CRequest::getFilter("person"))) { $query->innerJoin(TABLE_PERSON . " as person", "diplom.kadri_id = person.id and person.id = " . CRequest::getFilter("person")); $currentPerson = CRequest::getFilter("person"); // фильтруем еще и группы $groupsQuery->innerJoin(TABLE_PERSON . " as person", "diplom.kadri_id = person.id and person.id = " . CRequest::getFilter("person")); } // фильтр по группе if (!is_null(CRequest::getFilter("group"))) { $arr = explode(",", CRequest::getFilter("group")); foreach ($arr as $key => $value) { $arrs[] = 'st_group.id = ' . $value; } $currentGroup = CRequest::getFilter("group"); $query->innerJoin(TABLE_STUDENTS . " as student", "diplom.student_id=student.id"); $query->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id and (" . implode(" or ", $arrs) . ")"); $managersQuery->innerJoin(TABLE_STUDENTS . " as student", "diplom.student_id = student.id"); $managersQuery->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id and (" . implode(" or ", $arrs) . ")"); } // фильтр по теме if (!is_null(CRequest::getFilter("theme"))) { $query->condition("diplom.id = " . CRequest::getFilter("theme")); } // фильтр по студенту if (!is_null(CRequest::getFilter("student"))) { $query->innerJoin(TABLE_STUDENTS . " as student", "diplom.student_id=student.id and student.id = " . CRequest::getFilter("student")); } // фильтр по степени утверждения if (!is_null(CRequest::getFilter("confirm"))) { $query->innerJoin(TABLE_DIPLOM_CONFIRMATIONS . " as confirm", "diplom.diplom_confirm = confirm.id and confirm.id = " . CRequest::getFilter("confirm")); } // фильтр по месту практики if (!is_null(CRequest::getFilter("pract"))) { $query->condition("diplom.id = " . CRequest::getFilter("pract")); } // фильтр по месту практики по id if (!is_null(CRequest::getFilter("practId"))) { $query->innerJoin(TABLE_PRACTICE_PLACES . " as pract", "diplom.pract_place_id = pract.id and pract.id = " . CRequest::getFilter("practId")); } // фильтр по ин.яз. if (!is_null(CRequest::getFilter("foreign"))) { $query->innerJoin(TABLE_LANGUAGES . " as lang", "diplom.foreign_lang=lang.id and lang.id = " . CRequest::getFilter("foreign")); } // фильтр по рецензенту if (!is_null(CRequest::getFilter("recenz"))) { $query->innerJoin(TABLE_PERSON . " as person", "diplom.recenz_id = person.id and person.id = " . CRequest::getFilter("recenz")); } // фильтр по оценке if (!is_null(CRequest::getFilter("mark"))) { $query->innerJoin(TABLE_MARKS . " as mark", "diplom.study_mark = mark.id and mark.id = " . CRequest::getFilter("mark")); } // фильтр по комментарию if (!is_null(CRequest::getFilter("comment"))) { $query->condition("diplom.id = " . CRequest::getFilter("comment")); } // получение дипломных тем $diploms = new CArrayList(); $isApprove = CRequest::getString("isApprove") == "1"; $isArchive = CRequest::getString("isArchive") == "1"; if (!$isArchive) { if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) { $query->condition('diplom.kadri_id = "' . CSession::getCurrentPerson()->getId() . '" and diplom.date_act between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"'); } else { $query->condition('diplom.date_act between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"'); } } else { if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) { $query->condition("diplom.kadri_id = " . CSession::getCurrentPerson()->getId()); } } //Не имеющие предзащиты зимой if (CRequest::getInt("winterNotPreviews") == 1) { $query->leftJoin(TABLE_DIPLOM_PREVIEWS . " as preview", "diplom.student_id = preview.student_id"); $query->condition('preview.student_id is null and diplom.date_act between "' . (date("Y") - 1) . "-12-01" . '" and "' . date("Y") . "-02-28" . '"'); } //Не имеющие предзащиты летом if (CRequest::getInt("summerNotPreviews") == 1) { $query->leftJoin(TABLE_DIPLOM_PREVIEWS . " as preview", "diplom.student_id = preview.student_id"); $query->condition('preview.student_id is null and diplom.date_act between "' . date("Y") . "-05-01" . '" and "' . date("Y") . "-06-30" . '"'); } foreach ($set->getPaginated()->getItems() as $item) { $diplom = new CDiplom($item); $diploms->add($diplom->getId(), $diplom); } /** * Формируем меню */ $this->addActionsMenuItem(array(array("title" => "Печать по шаблону", "link" => "#", "icon" => "devices/printer.png", "template" => "formset_diploms_theme"), array("title" => "Добавить тему ВКР", "link" => "?action=add", "icon" => "actions/list-add.png"), array("title" => "Список студентов", "link" => WEB_ROOT . "_modules/_students/index.php", "icon" => "apps/system-users.png"), array("title" => "Групповые операции", "link" => "#", "icon" => "apps/utilities-terminal.png", "child" => array(array("title" => "Удалить выделенные", "icon" => "actions/edit-delete.png", "form" => "#MainView", "link" => "index.php", "action" => "Delete"), array("title" => "Сменить дату защиты", "icon" => "actions/edit-redo.png", "form" => "#MainView", "link" => "index.php", "action" => "changeDateAct"), array("title" => "Сменить место практики", "icon" => "actions/edit-redo.png", "form" => "#MainView", "link" => "index.php", "action" => "changePractPlace"))))); if ($isArchive) { $requestParams = array(); foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) { if ($key != "isArchive") { $requestParams[] = $key . "=" . $value; } } $this->addActionsMenuItem(array(array("title" => "Текущий год", "link" => "?" . implode("&", $requestParams), "icon" => "mimetypes/x-office-calendar.png"))); } else { $requestParams = array(); foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) { $requestParams[] = $key . "=" . $value; } $requestParams[] = "isArchive=1"; $this->addActionsMenuItem(array(array("title" => "Архив", "link" => "?" . implode("&", $requestParams), "icon" => "devices/media-floppy.png"))); } $this->addActionsMenuItem(array(array("title" => "Утверждение темы", "link" => "#", "icon" => "apps/accessories-text-editor.png", "child" => array(array("title" => "Утвердили полностью", "icon" => "actions/edit-find-replace.png", "form" => "#MainView", "link" => "index.php?type=1", "action" => "approveTheme"), array("title" => "Утвердили c правкой", "icon" => "actions/edit-find-replace.png", "form" => "#MainView", "link" => "index.php?type=2", "action" => "approveTheme"), array("title" => "Утвердили c переформулировкой", "icon" => "actions/edit-find-replace.png", "form" => "#MainView", "link" => "index.php?type=3", "action" => "approveTheme"), array("title" => "Не утвердили, но смотрели", "icon" => "actions/edit-find-replace.png", "form" => "#MainView", "link" => "index.php?type=4", "action" => "approveTheme"), array("title" => "Отменить утверждение темы", "icon" => "actions/edit-find-replace.png", "form" => "#MainView", "link" => "index.php?type=0", "action" => "approveTheme"))))); $managers = array(); foreach ($managersQuery->execute()->getItems() as $ar) { $person = new CPerson(new CActiveRecord($ar)); $managers[$person->getId()] = $person->getName(); } $studentGroups = array(); foreach ($groupsQuery->execute()->getItems() as $ar) { $group = new CStudentGroup(new CActiveRecord($ar)); $studentGroups[$group->getId()] = $group->getName(); } $this->setData("isArchive", $isArchive); $this->setData("isApprove", $isApprove); $this->setData("studentGroups", $studentGroups); $this->setData("diplomManagers", $managers); $this->setData("currentPerson", $currentPerson); $this->setData("currentGroup", $currentGroup); $this->setData("diploms", $diploms); $this->setData("paginator", $set->getPaginator()); if (!$isApprove) { $requestParams = array(); foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) { $requestParams[] = $key . "=" . $value; } $requestParams[] = "isApprove=1"; $this->addActionsMenuItem(array(array("title" => "Утверждение тем ВКР", "link" => "?" . implode("&", $requestParams), "icon" => "actions/bookmark-new.png"))); $this->renderView("_diploms/index.tpl"); } else { $requestParams = array(); foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) { if ($key != "isApprove") { $requestParams[] = $key . "=" . $value; } } $this->addActionsMenuItem(array(array("title" => "Список тем ВКР", "link" => "?" . implode("&", $requestParams), "icon" => "actions/format-justify-center.png"))); $this->renderView("_diploms/approve.tpl"); } }
public function actionIndex() { $set = new CRecordSet(false); $query = new CQuery(); $selectedUser = null; $query->select("quest.*")->from(TABLE_QUESTION_TO_USERS . " as quest")->order("quest.datetime_quest desc")->condition("quest.status=5"); $set->setQuery($query); $showAll = false; if (CRequest::getString("order") == "quest.user_id") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->innerJoin(TABLE_USERS . " as user", "quest.user_id = user.id"); $query->order("user.fio " . $direction); } elseif (CRequest::getString("order") == "datetime_quest") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("datetime_quest " . $direction); } elseif (CRequest::getString("order") == "datetime_answ") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("datetime_answ " . $direction); } elseif (CRequest::getString("order") == "question_text") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("question_text " . $direction); } elseif (CRequest::getString("order") == "contact_info") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("contact_info " . $direction); } elseif (CRequest::getString("order") == "st.name") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->leftJoin(TABLE_QUESTION_STATUS . " as st", "quest.status = st.id"); $query->order("st.name " . $direction); } elseif (CRequest::getString("order") == "answer_text") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("answer_text " . $direction); } // фильтр по пользователю if (!is_null(CRequest::getFilter("user"))) { $query->innerJoin(TABLE_USERS . " as user", "quest.user_id = user.id and user.id = " . CRequest::getFilter("user")); $selectedUser = CRequest::getFilter("user"); } // фильтр по вопросу if (!is_null(CRequest::getFilter("question"))) { $query->condition("quest.id = " . CRequest::getFilter("question")); } // фильтр по ответу if (!is_null(CRequest::getFilter("answer"))) { $query->condition("quest.id = " . CRequest::getFilter("answer")); } // фильтр по контактам if (!is_null(CRequest::getFilter("contact"))) { $query->condition("quest.id = " . CRequest::getFilter("contact")); } $quests = new CArrayList(); $isArchive = CRequest::getString("isArchive") == "1"; if (!$isArchive) { if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) { $query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '" and (quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL) and quest.status!=5'); } else { $query->condition('(quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL) and quest.status!=5'); } } else { if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) { $query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '" and quest.status!=5'); } else { $query->condition("quest.status!=5"); } } if (CRequest::getInt("showAll") == 1) { if (!$isArchive) { if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) { $query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '" and (quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL)'); } else { $query->condition('quest.datetime_quest > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" or quest.datetime_quest is NULL'); } } else { if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY or CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) { $query->condition('quest.user_id = "' . CSession::getCurrentUser()->getId() . '"'); } } $showAll = true; } foreach ($set->getPaginated()->getItems() as $ar) { $quest = new CQuestion($ar); $quests->add($quest->getId(), $quest); } if ($isArchive) { $requestParams = array(); foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) { if ($key != "isArchive") { $requestParams[] = $key . "=" . $value; } } $this->addActionsMenuItem(array(array("title" => "Текущий год", "link" => "?" . implode("&", $requestParams), "icon" => "mimetypes/x-office-calendar.png"))); } else { $requestParams = array(); foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) { $requestParams[] = $key . "=" . $value; } $requestParams[] = "isArchive=1"; $this->addActionsMenuItem(array(array("title" => "Архив", "link" => "?" . implode("&", $requestParams), "icon" => "devices/media-floppy.png"))); } $usersQuery = new CQuery(); $usersQuery->select("user.*")->from(TABLE_USERS . " as user")->order("user.fio asc")->innerJoin(TABLE_QUESTION_TO_USERS . " as quest", "user.id = quest.user_id"); $users = array(); foreach ($usersQuery->execute()->getItems() as $ar) { $user = new CUser(new CActiveRecord($ar)); $users[$user->getId()] = $user->getName(); } $this->setData("isArchive", $isArchive); $this->setData("showAll", $showAll); $this->setData("quests", $quests); $this->setData("users", $users); $this->setData("selectedUser", $selectedUser); $this->setData("paginator", $set->getPaginator()); $this->renderView("_question_answ/index.tpl"); }
} </script> <?php //phpinfo(); //session_start(); //------------------------------------------------------------ //include ('sql_connect_empty.php'); /** * $query_all='SELECT time_intervals.name as year_name, time_intervals.date_start,time_intervals.date_end * FROM settings inner join time_intervals on time_intervals.id=settings.year_id * where 1 limit 0,1'; * if ( $res_all=mysql_query($query_all) and mysql_numrows($res_all)>0) {$def_settings=mysql_fetch_array($res_all);} * * Переписано для использования новой системы глобальных настроек */ $query_all = "\r\n select\r\n time_intervals.name as year_name,\r\n time_intervals.date_start,\r\n time_intervals.date_end\r\n from\r\n time_intervals\r\n where\r\n time_intervals.id = " . CUtils::getCurrentYear()->getId(); if ($res_all = mysql_query($query_all) and mysql_numrows($res_all) > 0) { $def_settings = mysql_fetch_array($res_all); } if (isset($_POST['trip_id']) && intval($_POST['trip_id']) > 0) { $trip_id = intval($_POST['trip_id']); $kadri_id = intval($_POST['kadri_id']); if ($kadri_id > 0) { $house_type = intval($_POST['house_type']); $trip_cost = intval($_POST['trip_cost']); $dotation = intval($_POST['dotation']); $onEditRemain_text = ''; $query_string = reset_param_name(reset_param_name($query_string, 'type'), 'item_id'); if (!$onEditRemain) { $onEditRemain_text = ' автопереход к списку через 2 сек. или вручную <a href="' . $curpage . '?' . $query_string . '">по ссылке</a>'; }
public function actionImport() { $thisYear = new CArrayList(); // импортируем показатели должностей $index = new CRatingIndex(); $index->title = "Должность"; $index->manager_class = "CTaxonomyManager"; $index->manager_method = "getPosts()"; $index->person_method = "getPost()"; $index->year_id = CUtils::getCurrentYear()->getId(); $index->isMultivalue = 0; $index->save(); $thisYear->add($index->getId(), $index); foreach (CActiveRecordProvider::getAllFromTable("spr_dolzhnost")->getItems() as $item) { $post = CTaxonomyManager::getPostById($item->getItemValue("id")); if (!is_null($post)) { $value = new CRatingIndexValue(); $value->index_id = $index->id; $value->fromTaxonomy = 1; $value->title = $post->getId(); $value->value = $item->getItemValue("rate"); $value->save(); } } // показатели размножаем на все года foreach (CTaxonomyManager::getYearsList() as $key => $value) { $year = CTaxonomyManager::getYear($key); if ($year->getId() !== $index->year_id) { $newIndex = new CRatingIndex(); $newIndex->title = $index->title; $newIndex->manager_class = $index->manager_class; $newIndex->manager_method = $index->manager_method; $newIndex->person_method = $index->person_method; $newIndex->year_id = $year->getId(); $newIndex->isMultivalue = $index->isMultivalue; $newIndex->save(); foreach ($index->getIndexValues()->getItems() as $value) { $newValue = new CRatingIndexValue(); $newValue->index_id = $newIndex->getId(); $newValue->fromTaxonomy = $value->fromTaxonomy; $newValue->title = $value->title; $newValue->value = $value->value; $newValue->save(); } } } // звания $index = new CRatingIndex(); $index->title = "Звание"; $index->manager_class = "CTaxonomyManager"; $index->manager_method = "getTitles()"; $index->year_id = CUtils::getCurrentYear()->getId(); $index->isMultivalue = 0; $index->person_method = "getTitle()"; $index->save(); $thisYear->add($index->getId(), $index); foreach (CActiveRecordProvider::getAllFromTable("spr_zvanie")->getItems() as $item) { $post = CTaxonomyManager::getTitle($item->getItemValue("id")); if (!is_null($post)) { $value = new CRatingIndexValue(); $value->index_id = $index->id; $value->fromTaxonomy = 1; $value->title = $post->getId(); $value->value = $item->getItemValue("rate"); $value->save(); } } // показатели размножаем на все года foreach (CTaxonomyManager::getYearsList() as $key => $value) { $year = CTaxonomyManager::getYear($key); if ($year->getId() !== $index->year_id) { $newIndex = new CRatingIndex(); $newIndex->title = $index->title; $newIndex->manager_class = $index->manager_class; $newIndex->manager_method = $index->manager_method; $newIndex->year_id = $year->getId(); $newIndex->isMultivalue = $index->isMultivalue; $newIndex->person_method = $index->person_method; $newIndex->save(); foreach ($index->getIndexValues()->getItems() as $value) { $newValue = new CRatingIndexValue(); $newValue->index_id = $newIndex->getId(); $newValue->fromTaxonomy = $value->fromTaxonomy; $newValue->title = $value->title; $newValue->value = $value->value; $newValue->save(); } } } // научно-методическая работа $taxonomy = new CTaxonomy(); $taxonomy->name = "Виды научно-методической и учебной работы"; $taxonomy->alias = "scientificWork"; $taxonomy->save(); $index = new CRatingIndex(); $index->title = "Научно-методическая и учебная работа"; $index->manager_class = "CTaxonomyManager"; $index->manager_method = 'getTaxonomy("scientificWork")->getTerms()'; $index->year_id = CUtils::getCurrentYear()->getId(); $index->isMultivalue = 1; $index->save(); $thisYear->add($index->getId(), $index); foreach (CActiveRecordProvider::getAllFromTable("spr_nauch_met_uch_rab")->getItems() as $item) { $term = new CTerm(); $term->taxonomy_id = $taxonomy->getId(); $term->name = $item->getItemValue("name"); $term->save(); $value = new CRatingIndexValue(); $value->index_id = $index->id; $value->fromTaxonomy = 1; $value->title = $term->getId(); $value->value = $item->getItemValue("rate"); $value->save(); } // показатели размножаем на все года foreach (CTaxonomyManager::getYearsList() as $key => $value) { $year = CTaxonomyManager::getYear($key); if ($year->getId() !== $index->year_id) { $newIndex = new CRatingIndex(); $newIndex->title = $index->title; $newIndex->manager_class = $index->manager_class; $newIndex->manager_method = $index->manager_method; $newIndex->year_id = $year->getId(); $newIndex->isMultivalue = $index->isMultivalue; $newIndex->save(); foreach ($index->getIndexValues()->getItems() as $value) { $newValue = new CRatingIndexValue(); $newValue->index_id = $newIndex->getId(); $newValue->fromTaxonomy = $value->fromTaxonomy; $newValue->title = $value->title; $newValue->value = $value->value; $newValue->save(); } } } // вычеты $taxonomy = new CTaxonomy(); $taxonomy->name = "Виды вычетов"; $taxonomy->alias = "takeouts"; $taxonomy->save(); $index = new CRatingIndex(); $index->title = "Вычеты"; $index->manager_class = "CTaxonomyManager"; $index->manager_method = 'getTaxonomy("takeouts")->getTerms()'; $index->year_id = CUtils::getCurrentYear()->getId(); $index->isMultivalue = 1; $index->save(); $thisYear->add($index->getId(), $index); foreach (CActiveRecordProvider::getAllFromTable("spr_vichet")->getItems() as $item) { $term = new CTerm(); $term->taxonomy_id = $taxonomy->getId(); $term->name = $item->getItemValue("name"); $term->save(); $value = new CRatingIndexValue(); $value->index_id = $index->id; $value->fromTaxonomy = 1; $value->title = $term->getId(); $value->value = $item->getItemValue("rate"); $value->save(); } // показатели размножаем на все года foreach (CTaxonomyManager::getYearsList() as $key => $value) { $year = CTaxonomyManager::getYear($key); if ($year->getId() !== $index->year_id) { $newIndex = new CRatingIndex(); $newIndex->title = $index->title; $newIndex->manager_class = $index->manager_class; $newIndex->manager_method = $index->manager_method; $newIndex->year_id = $year->getId(); $newIndex->isMultivalue = $index->isMultivalue; $newIndex->save(); foreach ($index->getIndexValues()->getItems() as $value) { $newValue = new CRatingIndexValue(); $newValue->index_id = $newIndex->getId(); $newValue->fromTaxonomy = $value->fromTaxonomy; $newValue->title = $value->title; $newValue->value = $value->value; $newValue->save(); } } } }
public function actionSaveGradebook() { $search = new CStudentActivitySearchForm(); $search->setAttributes(CRequest::getArray($search::getClassName())); if ($search->validate()) { $record = new CGradebook(); $record->person_id = CSession::getCurrentUser()->getId(); $record->kadri_id = $search->kadri_id; $record->subject_id = $search->subject_id; $record->group_id = $search->group_id; $record->date_start = $search->date_start; $record->date_end = $search->date_end; $record->save(); $this->redirect("?action=viewGradebook&id=" . $record->getId()); return true; } $this->addJSInclude("_core/jquery-ui-1.8.20.custom.min.js"); $this->addCSSInclude("_core/jUI/jquery-ui-1.8.2.custom.css"); $this->addJSInclude("_core/personTypeFilter.js"); $groups = array(); foreach (CStaffManager::getStudentGroupsByYear(CUtils::getCurrentYear())->getItems() as $group) { if ($group->getStudents()->getCount() > 0) { $groups[$group->getId()] = $group->getName(); } } $this->setData("groups", $groups); $this->setData("search", $search); $this->renderView("_gradebook/gradebook.create.tpl"); }
$query_all = 'select id,name from time_intervals where id="' . $def_settings['year_id'] . '"'; $res_all = mysql_query($query_all); $a = mysql_fetch_array($res_all); $def_settings['year_name'] = $a['name']; $query_all = 'select id,name from time_parts where id="' . $def_settings['part_id'] . '"'; $res_all = mysql_query($query_all); $a = mysql_fetch_array($res_all); $def_settings['part_name'] = $a['name']; } else { /** * Переписано для использования новой системы глобальных настроек */ $def_settings["year_name"] = CUtils::getCurrentYear()->name; $def_settings["date_start"] = CUtils::getCurrentYear()->date_start; $def_settings["date_end"] = CUtils::getCurrentYear()->date_end; $def_settings["year_id"] = CUtils::getCurrentYear()->getId(); $def_settings["part_id"] = CUtils::getCurrentYearPart()->getId(); $def_settings["part_name"] = CUtils::getCurrentYearPart()->name; } if ($_SESSION['auth'] == 1) { if (!$view_all_mode || !$write_mode) { $_SESSION['lect_id'] = $_SESSION['id']; $_SESSION['lect_fio'] = $_SESSION['FIO']; } else { if (isset($_GET['user_id']) && $_GET['user_id'] != 0) { $_SESSION['lect_id'] = $_GET['user_id']; $res = mysql_query('select fio from users where id="' . $_SESSION['lect_id'] . '" limit 0,1'); if (mysql_num_rows($res) > 0) { $a = mysql_fetch_array($res); $_SESSION['lect_fio'] = $a['fio']; }
/** * Все студенты за текущий год * * @return CArrayList */ public static function getAllStudentsThisYear() { $res = new CArrayList(); $query = new CQuery(); $query->select("student.*")->from(TABLE_STUDENTS . " as student")->leftJoin(TABLE_STUDENT_GROUPS . " as st_group", "st_group.id = student.group_id")->condition("st_group.year_id = " . CUtils::getCurrentYear()->getId())->order("student.fio asc"); foreach ($query->execute()->getItems() as $arr) { $student = new CStudent(new CActiveRecord($arr)); $res->add($student->getId(), $student); } return $res; }
/** * Подготовка аспирантов, архив * * @return CArrayList */ public function getAspirantsOld() { if (is_null($this->_aspirantsOld)) { $this->_aspirantsOld = new CArrayList(); $query = new CQuery(); $query->select("disser.*")->from(TABLE_PERSON_DISSER . " as disser")->innerJoin(TABLE_PERSON . " as kadri", "kadri.id=disser.kadri_id")->condition('disser.scinceMan="' . $this->id . '" and disser.scinceMan>0 and (disser.god_zach<"' . date("Y", strtotime(CUtils::getCurrentYear()->date_end)) . '" or disser.god_zach is null)')->order("kadri.fio asc"); foreach ($query->execute()->getItems() as $item) { $aspir = new CPersonPaper(new CActiveRecord($item)); $this->_aspirantsOld->add($aspir->getId(), $aspir); } } return $this->_aspirantsOld; }
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); }
public function actionStatistic() { $set = new CRecordSet(); $query = new CQuery(); $query->select("preview.*")->from(TABLE_DIPLOM_PREVIEWS . " as preview")->order("preview.date_preview desc"); $set->setQuery($query); $isArchive = CRequest::getString("isArchive") == "1"; if (!$isArchive) { $query->condition('preview.date_preview between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"'); } $this->addActionsMenuItem(array("title" => "Назад", "link" => "?action=index", "icon" => "actions/edit-undo.png")); if ($isArchive) { $requestParams = array(); foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) { if ($key != "isArchive") { $requestParams[] = $key . "=" . $value; } } $this->addActionsMenuItem(array(array("title" => "Текущий год", "link" => "?" . implode("&", $requestParams), "icon" => "mimetypes/x-office-calendar.png"))); } else { $requestParams = array(); foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) { $requestParams[] = $key . "=" . $value; } $requestParams[] = "isArchive=1"; $this->addActionsMenuItem(array(array("title" => "Архив", "link" => "?" . implode("&", $requestParams), "icon" => "devices/media-floppy.png"))); } $prevs = array(); foreach ($query->execute()->getItems() as $ar) { $prev = new CDiplomPreview(new CActiveRecord($ar)); $prevs[$prev->getId()] = $prev->date_preview; } $date_previews = array(); $date_previews = array_count_values($prevs); //Общее количество предзащит $count_previews = count($prevs); //Общее количество защит $queryAll = new CQuery(); $queryAll->select("diplom.*")->from(TABLE_DIPLOMS . " as diplom"); if (!$isArchive) { $queryAll->condition('diplom.date_act between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"'); } $count_all = $queryAll->execute()->getCount(); //Всего защит зимой $queryWinterAll = new CQuery(); $queryWinterAll->select("diplom.*")->from(TABLE_DIPLOMS . " as diplom")->condition('diplom.date_act between "' . (date("Y") - 1) . "-12-01" . '" and "' . date("Y") . "-02-28" . '"'); $count_winter_all = $queryWinterAll->execute()->getCount(); //Всего защит летом $querySummerAll = new CQuery(); $querySummerAll->select("diplom.*")->from(TABLE_DIPLOMS . " as diplom")->condition('diplom.date_act between "' . date("Y") . "-05-01" . '" and "' . date("Y") . "-06-30" . '"'); $count_summer_all = $querySummerAll->execute()->getCount(); //Из них не имеющие предзащиты зимой $queryNotPreviewsWinter = new CQuery(); $queryNotPreviewsWinter->select("diplom.*")->from(TABLE_DIPLOMS . " as diplom")->leftJoin(TABLE_DIPLOM_PREVIEWS . " as preview", "diplom.student_id = preview.student_id")->condition('preview.student_id is null and diplom.date_act between "' . (date("Y") - 1) . "-12-01" . '" and "' . date("Y") . "-02-28" . '"'); $count_not_previews_winter = $queryNotPreviewsWinter->execute()->getCount(); //Из них не имеющие предзащиты летом $queryNotPreviewsSummer = new CQuery(); $queryNotPreviewsSummer->select("diplom.*")->from(TABLE_DIPLOMS . " as diplom")->leftJoin(TABLE_DIPLOM_PREVIEWS . " as preview", "diplom.student_id = preview.student_id")->condition('preview.student_id is null and diplom.date_act between "' . date("Y") . "-05-01" . '" and "' . date("Y") . "-06-30" . '"'); $count_not_previews_summer = $queryNotPreviewsSummer->execute()->getCount(); //Количество предзащит зимой $queryWinter = new CQuery(); $queryWinter->select("preview.*")->from(TABLE_DIPLOM_PREVIEWS . " as preview")->condition('preview.date_preview between "' . (date("Y") - 1) . "-12-01" . '" and "' . date("Y") . "-02-28" . '"'); $count_previews_winter = $queryWinter->execute()->getCount(); //Количество предзащит летом $querySummer = new CQuery(); $querySummer->select("preview.*")->from(TABLE_DIPLOM_PREVIEWS . " as preview")->condition('preview.date_preview between "' . date("Y") . "-05-01" . '" and "' . date("Y") . "-06-30" . '"'); $count_previews_summer = $querySummer->execute()->getCount(); //Прошедшие предзащиту зимой $queryWinterComplete = new CQuery(); $queryWinterComplete->select("preview.*")->from(TABLE_DIPLOM_PREVIEWS . " as preview")->condition('preview.date_preview between "' . (date("Y") - 1) . "-12-01" . '" and "' . date("Y") . "-02-28" . '" and (preview.diplom_percent!=0 and preview.another_view=0)'); $count_previews_winter_complete = $queryWinterComplete->execute()->getCount(); //Прошедшие предзащиту летом $querySummerComplete = new CQuery(); $querySummerComplete->select("preview.*")->from(TABLE_DIPLOM_PREVIEWS . " as preview")->condition('preview.date_preview between "' . date("Y") . "-05-01" . '" and "' . date("Y") . "-06-30" . '" and (preview.diplom_percent!=0 and preview.another_view=0)'); $count_previews_summer_complete = $querySummerComplete->execute()->getCount(); //Не прошедшие предзащиту зимой $queryWinterNotComplete = new CQuery(); $queryWinterNotComplete->select("preview.*")->from(TABLE_DIPLOM_PREVIEWS . " as preview")->condition('preview.date_preview between "' . (date("Y") - 1) . "-12-01" . '" and "' . date("Y") . "-02-28" . '" and (preview.diplom_percent=0 or preview.another_view!=0)'); $count_previews_winter_not_complete = $queryWinterNotComplete->execute()->getCount(); //Не прошедшие предзащиту летом $querySummerNotComplete = new CQuery(); $querySummerNotComplete->select("preview.*")->from(TABLE_DIPLOM_PREVIEWS . " as preview")->condition('preview.date_preview between "' . date("Y") . "-05-01" . '" and "' . date("Y") . "-06-30" . '" and (preview.diplom_percent=0 or preview.another_view!=0)'); $count_previews_summer_not_complete = $querySummerNotComplete->execute()->getCount(); $this->setData("date_previews", $date_previews); $this->setData("count_all", $count_all); $this->setData("count_previews", $count_previews); $this->setData("count_winter_all", $count_winter_all); $this->setData("count_summer_all", $count_summer_all); $this->setData("count_not_previews_winter", $count_not_previews_winter); $this->setData("count_not_previews_summer", $count_not_previews_summer); $this->setData("count_previews_winter", $count_previews_winter); $this->setData("count_previews_summer", $count_previews_summer); $this->setData("count_previews_winter_complete", $count_previews_winter_complete); $this->setData("count_previews_winter_not_complete", $count_previews_winter_not_complete); $this->setData("count_previews_summer_complete", $count_previews_summer_complete); $this->setData("count_previews_summer_not_complete", $count_previews_summer_not_complete); $this->renderView("_diploms/diplom_preview/stat.tpl"); }
public function actionFill() { $year = CTaxonomyManager::getYear(CRequest::getInt("year")); if (is_null($year)) { $year = CUtils::getCurrentYear(); } $form = new CPersonRatingAutofillForm(); $form->year_id = $year->getId(); $this->addJSInclude("_core/personTypeFilter.js"); $this->setData("form", $form); $this->renderView("_rating/person/fill.tpl"); }
public function actionIndex() { $set = new CRecordSet(false); $query = new CQuery(); $selectedPerson = null; $query->select("disser.*")->from(TABLE_PERSON_DISSER . " as disser")->innerJoin(TABLE_PERSON . " as person", "disser.kadri_id = person.id")->condition("disser.disser_type = 'кандидат'")->order("person.fio asc"); $set->setQuery($query); if (CRequest::getString("order") == "person.fio") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->innerJoin(TABLE_PERSON . " as person", "disser.kadri_id = person.id"); $query->order("person.fio " . $direction); } elseif (CRequest::getString("order") == "science_spec_id") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("science_spec_id " . $direction); } elseif (CRequest::getString("order") == "study_form_id") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("study_form_id " . $direction); } elseif (CRequest::getString("order") == "scinceMan") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->innerJoin(TABLE_PERSON . " as person", "disser.scinceMan = person.id"); $query->order("person.fio " . $direction); } elseif (CRequest::getString("order") == "tema") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("tema " . $direction); } elseif (CRequest::getString("order") == "god_zach") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("god_zach " . $direction); } elseif (CRequest::getString("order") == "date_end") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("date_end " . $direction); } elseif (CRequest::getString("order") == "comment") { $direction = "asc"; if (CRequest::getString("direction") != "") { $direction = CRequest::getString("direction"); } $query->order("comment " . $direction); } // фильтр по руководителю if (!is_null(CRequest::getFilter("person"))) { $query->innerJoin(TABLE_PERSON . " as person", "disser.scinceMan = person.id and person.id = " . CRequest::getFilter("person")); $selectedPerson = CRequest::getFilter("person"); } // фильтр по ФИО if (!is_null(CRequest::getFilter("fio"))) { $query->innerJoin(TABLE_PERSON . " as person", "disser.kadri_id=person.id and person.id = " . CRequest::getFilter("fio")); } // фильтр по теме if (!is_null(CRequest::getFilter("tema"))) { $query->condition("disser.id = " . CRequest::getFilter("tema")); } // фильтр по комментарию if (!is_null(CRequest::getFilter("comment"))) { $query->condition("disser.id = " . CRequest::getFilter("comment")); } $isArchive = CRequest::getString("isArchive") == "1"; if (!$isArchive) { $query->condition('disser.date_end > "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '"'); } if ($isArchive) { $requestParams = array(); foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) { if ($key != "isArchive") { $requestParams[] = $key . "=" . $value; } } $this->addActionsMenuItem(array(array("title" => "Текущий год", "link" => "?" . implode("&", $requestParams), "icon" => "mimetypes/x-office-calendar.png"))); } else { $requestParams = array(); foreach (CRequest::getGlobalRequestVariables()->getItems() as $key => $value) { $requestParams[] = $key . "=" . $value; } $requestParams[] = "isArchive=1"; $this->addActionsMenuItem(array(array("title" => "Архив", "link" => "?" . implode("&", $requestParams), "icon" => "devices/media-floppy.png"))); } $managersQuery = new CQuery(); $managersQuery->select("person.*")->from(TABLE_PERSON . " as person")->order("person.fio asc")->innerJoin(TABLE_PERSON_DISSER . " as disser", "person.id = disser.scinceMan"); $managers = array(); foreach ($managersQuery->execute()->getItems() as $ar) { $person = new CPerson(new CActiveRecord($ar)); $managers[$person->getId()] = $person->getName(); } $dissers = new CArrayList(); foreach ($set->getPaginated()->getItems() as $ar) { $disser = new CPersonPaper($ar); $dissers->add($disser->getId(), $disser); } $this->setData("isArchive", $isArchive); $this->setData("dissers", $dissers); $this->setData("managers", $managers); $this->setData("selectedPerson", $selectedPerson); $this->setData("paginator", $set->getPaginator()); $this->renderView("_aspirants_view/index.tpl"); }