public function actionSave()
 {
     $group = new CStudentGroup();
     $group->setAttributes(CRequest::getArray($group::getClassName()));
     if ($group->validate()) {
         $group->save();
         if ($this->continueEdit()) {
             $this->redirect("?action=edit&id=" . $group->getId());
         } else {
             $this->redirect("?action=index");
         }
         return true;
     }
     $students = array();
     foreach ($group->getStudents()->getItems() as $student) {
         $students[$student->getId()] = $student->getName();
     }
     $this->setData("group", $group);
     $this->setData("students", $students);
     $this->renderView("_student_groups/edit.tpl");
 }
 public function actionSave()
 {
     $student = new CStudent();
     $student->setAttributes(CRequest::getArray(CStudent::getClassName()));
     if ($student->validate()) {
         $student->save();
         if ($this->continueEdit()) {
             $this->redirect("?action=edit&id=" . $student->getId());
         } else {
             $this->redirect("?action=index");
         }
         return true;
     }
     $this->addJSInclude("_core/jquery-ui-1.8.20.custom.min.js");
     $this->addCSSInclude("_core/jUI/jquery-ui-1.8.2.custom.css");
     $groups = array();
     foreach (CActiveRecordProvider::getAllFromTable(TABLE_STUDENT_GROUPS, "name asc")->getItems() as $item) {
         $group = new CStudentGroup($item);
         $groups[$group->getId()] = $group->getName();
     }
     $forms = array(1 => "Бюджет", 2 => "Контракт");
     $this->setData("forms", $forms);
     $this->setData("groups", $groups);
     $this->setData("student", $student);
     $this->renderView("_students/edit.tpl");
 }
 public function actionIndex()
 {
     $set = new CRecordSet(false);
     $query = new CQuery();
     $currentCommission = null;
     $currentGroup = null;
     $isArchive = CRequest::getString("isArchive") == "1";
     $query->select("preview.*")->from(TABLE_DIPLOM_PREVIEWS . " as preview")->order("preview.date_preview desc");
     $set->setQuery($query);
     $commQuery = new CQuery();
     $commQuery->select("comm.*")->from(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as comm")->order("comm.name asc")->innerJoin(TABLE_DIPLOM_PREVIEWS . " as preview", "comm.id = preview.comm_id");
     if (!$isArchive) {
         $commQuery->condition('preview.date_preview between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"');
     }
     $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_DIPLOM_PREVIEWS . " as preview", "student.id =  preview.student_id");
     if (!$isArchive) {
         $groupsQuery->condition('preview.date_preview between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"');
     }
     if (CRequest::getString("order") == "student.fio") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->innerJoin(TABLE_STUDENTS . " as student", "preview.student_id=student.id");
         $query->order("student.fio " . $direction);
     } elseif (CRequest::getString("order") == "st_group.name") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->innerJoin(TABLE_STUDENTS . " as student", "preview.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") == "diplom.dipl_name") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->innerJoin(TABLE_DIPLOMS . " as diplom", "diplom.student_id = preview.student_id");
         $query->order("diplom.dipl_name " . $direction);
     } elseif (CRequest::getString("order") == "diplom_percent") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->order("diplom_percent " . $direction);
     } elseif (CRequest::getString("order") == "another_view") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->order("another_view " . $direction);
     } elseif (CRequest::getString("order") == "person.fio") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->innerJoin(TABLE_DIPLOMS . " as diplom", "diplom.student_id = preview.student_id");
         $query->leftJoin(TABLE_PERSON . " as person", "person.id = diplom.recenz_id");
         $query->order("person.fio " . $direction);
     } elseif (CRequest::getString("order") == "date_preview") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->order("date_preview " . $direction);
     } elseif (CRequest::getString("order") == "comm.name") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->innerJoin(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as comm", "preview.comm_id = comm.id");
         $query->order("comm.name " . $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("commission"))) {
         $query->innerJoin(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as comm", "preview.comm_id = comm.id and comm.id = " . CRequest::getFilter("commission"));
         $currentCommission = CRequest::getFilter("commission");
         // фильтруем еще и группы
         $groupsQuery->innerJoin(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as comm", "preview.comm_id = comm.id and comm.id = " . CRequest::getFilter("commission"));
     }
     // фильтр по группе
     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", "preview.student_id=student.id");
         $query->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id and (" . implode(" or ", $arrs) . ")");
         $commQuery->innerJoin(TABLE_STUDENTS . " as student", "preview.student_id = student.id");
         $commQuery->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id and (" . implode(" or ", $arrs) . ")");
     }
     // фильтр по студенту, теме ВКР, рецензенту
     if (!is_null(CRequest::getFilter("student"))) {
         $query->innerJoin(TABLE_STUDENTS . " as student", "preview.student_id=student.id and student.id = " . CRequest::getFilter("student"));
     }
     // фильтр по комментарию
     if (!is_null(CRequest::getFilter("comment"))) {
         $query->condition("preview.id = " . CRequest::getFilter("comment"));
     }
     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)) . '"');
     }
     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" => "?action=addPreview", "icon" => "actions/list-add.png"), array("title" => "Статистика", "link" => "?action=statistic", "icon" => "mimetypes/x-office-spreadsheet.png")));
     //Предзащиты зимой
     if (CRequest::getInt("winterPreviews") == 1) {
         $query->condition('preview.date_preview between "' . (date("Y") - 1) . "-12-01" . '" and "' . date("Y") . "-02-28" . '"');
     }
     //Предзащиты летом
     if (CRequest::getInt("summerPreviews") == 1) {
         $query->condition('preview.date_preview between "' . date("Y") . "-05-01" . '" and "' . date("Y") . "-06-30" . '"');
     }
     //Прошедшие предзащиту зимой
     if (CRequest::getInt("winterCompletePreviews") == 1) {
         $query->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)');
     }
     //Прошедшие предзащиту летом
     if (CRequest::getInt("summerCompletePreviews") == 1) {
         $query->condition('preview.date_preview between "' . date("Y") . "-05-01" . '" and "' . date("Y") . "-06-30" . '" and (preview.diplom_percent!=0 and preview.another_view=0)');
     }
     //Не прошедшие предзащиту зимой
     if (CRequest::getInt("winterNotComplete") == 1) {
         $query->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)');
     }
     //Не прошедшие предзащиту летом
     if (CRequest::getInt("summerNotComplete") == 1) {
         $query->condition('preview.date_preview between "' . date("Y") . "-05-01" . '" and "' . date("Y") . "-06-30" . '" and (preview.diplom_percent=0 or preview.another_view!=0)');
     }
     $previews = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $item) {
         $preview = new CDiplomPreview($item);
         $previews->add($preview->getId(), $preview);
     }
     $commissions = array();
     foreach ($commQuery->execute()->getItems() as $ar) {
         $comm = new CDiplomPreviewComission(new CActiveRecord($ar));
         $secretar = CStaffManager::getPersonById($comm->secretary_id)->fio;
         $commissions[$comm->getId()] = $comm->name . " ({$secretar})";
     }
     $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("studentGroups", $studentGroups);
     $this->setData("commissions", $commissions);
     $this->setData("currentCommission", $currentCommission);
     $this->setData("currentGroup", $currentGroup);
     $this->setData("previews", $previews);
     $this->setData("paginator", $set->getPaginator());
     $this->renderView("_diploms/diplom_preview/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");
     }
 }