/**
  * Подписант билета
  *
  * @return CPerson
  */
 public function getSigner()
 {
     if (is_null($this->_signer)) {
         $this->_signer = CStaffManager::getPersonById($this->getRecord()->getItemValue("signer_id"));
     }
     return $this->_signer;
 }
 /**
  * Ресурс
  */
 public function setResourceId()
 {
     $this->getRecord()->setItemValue("resource_id", CRequest::getInt("resource_id"));
     if ($this->getType() == "kadri") {
         $this->_resource = CStaffManager::getPersonById($this->getResourceId());
     }
 }
 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 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");
 }
Example #5
0
 /**
  * Объект сотрудника текущего пользователя
  *
  * @static
  * @return CPerson
  */
 public static function getCurrentPerson()
 {
     if (is_null(self::$_person)) {
         if (self::isAuth()) {
             $person = CStaffManager::getPersonById(self::getPersonId());
             if (!is_null($person)) {
                 self::$_person = $person;
             }
         }
     }
     return self::$_person;
 }
Example #6
0
 /**
  * Руководитель текущего сотрудника
  *
  * @return CPerson
  */
 public function getManager()
 {
     if (is_null($this->_manager)) {
         if (!$this->getManagerId() == 0) {
             $person = CStaffManager::getPersonById($this->getManagerId());
             if (!is_null($person)) {
                 $this->_manager = $person;
             }
         }
     }
     return $this->_manager;
 }
 /**
  * Сохранение изменений
  *
  * @return bool
  */
 public function actionManagePersonSave()
 {
     if (!CSession::isAuth()) {
         return true;
     }
     $person = CStaffManager::getPersonById(CRequest::getInt("id"));
     $manager = CStaffManager::getPersonById(CRequest::getInt("manager_id"));
     $role = CTaxonomyManager::getTerm(CRequest::getInt("department_role_id"));
     if (!is_null($manager)) {
         $person->setManager($manager);
     } else {
         $person->setManagerId(0);
     }
     if (!is_null($role)) {
         $person->setRole($role);
     }
     $person->save();
     $this->redirect("?action=manage");
 }
 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");
 }
Example #9
0
 /**
  * Сотрудник, с которым связан пользователь
  *
  * @return CPerson
  */
 public function getPerson()
 {
     if (is_null($this->_person)) {
         if ($this->getRecord()->getItemValue("kadri_id") != 0) {
             $person = CStaffManager::getPersonById($this->getRecord()->getItemValue("kadri_id"));
             if (!is_null($person)) {
                 $this->_person = $person;
             }
         }
     }
     return $this->_person;
 }
 /**
  * Председатель ГАК
  *
  * @return CPerson
  */
 public function getChairman()
 {
     if (is_null($this->_chairman)) {
         $this->_chairman = CStaffManager::getPersonById($this->getRecord()->getItemValue("chairman_id"));
     }
     return $this->_chairman;
 }