コード例 #1
0
 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");
 }
コード例 #2
0
 /**
  * Студент, для которого протокол
  *
  * @return CStudent
  */
 public function getStudent()
 {
     if (is_null($this->_student)) {
         $this->_student = CStaffManager::getStudent($this->getRecord()->getItemValue("student_id"));
     }
     return $this->_student;
 }
コード例 #3
0
 public function import(CFormModel $source)
 {
     $data = $source->getData();
     $markIds = array();
     $isFirstRow = true;
     foreach ($data as $row) {
         if ($isFirstRow) {
             // это первая строка - в не идентификаторы оценок
             $isFirstRow = false;
             $markIds = $row;
         } else {
             // это все остальные строки - здесь уже студенты
             $student = CStaffManager::getStudent($row[0]);
             if (!is_null($student)) {
                 $isFirstCol = true;
                 foreach ($row as $id => $cell) {
                     if (!$isFirstCol) {
                         if ($cell != "") {
                             // если не пустая, то берем дисциплину
                             $subjectId = $markIds[$id];
                             $subject = CTaxonomyManager::getDiscipline($subjectId);
                             if (!is_null($subject)) {
                                 // если дисциплина есть, то происходит маппинг оценок
                                 $marks = array("2" => "4", "3" => "3", "4" => "2", "5" => "1");
                                 // создаем запись об оценке
                                 $activity = new CStudentActivity();
                                 $activity->subject_id = $subject->getId();
                                 $activity->kadri_id = $source->person;
                                 $activity->student_id = $student->getId();
                                 $activity->date_act = date("Y-m-d", strtotime($source->created));
                                 if (mb_strlen($cell) == 2 || strlen($cell) == 2) {
                                     // это курсовой
                                     $cell = mb_substr($cell, 0, 1);
                                     $activity->study_act_id = 43;
                                     if (array_key_exists($cell, $marks)) {
                                         $activity->study_mark = $marks[$cell];
                                     }
                                 } elseif (array_key_exists($cell, $marks)) {
                                     // это экзамен
                                     $activity->study_act_id = 1;
                                     $activity->study_mark = $marks[$cell];
                                 } else {
                                     // это зачет
                                     $activity->study_act_id = 2;
                                     $activity->study_mark = 5;
                                 }
                                 $activity->save();
                             }
                         }
                     } else {
                         // пропускаем первую ячейку - в ней идентификатор студента
                         $isFirstCol = false;
                     }
                 }
             }
         }
     }
     return true;
 }
コード例 #4
0
 public function import(CFormModel $source)
 {
     $data = $source->getData();
     $isFirstRow = true;
     foreach ($data as $row) {
         if ($isFirstRow) {
             // это первая строка - id студента и рег. номер
             $isFirstRow = false;
         } else {
             // это все остальные строки - здесь уже студенты
             $student = CStaffManager::getStudent($row[0]);
             if (!is_null($student)) {
                 $diplom = CStaffManager::getDiplomByStudent($row[0]);
                 foreach ($row as $id => $cell) {
                     $diplom->student_id = $student->getId();
                     $diplom->diplom_regnum = $row[1];
                     $diplom->diplom_issuedate = date("d/m/Y", strtotime($source->created));
                     $diplom->save();
                 }
             }
         }
     }
     return true;
 }
コード例 #5
0
 /**
  * Сама обработка студентов
  *
  * @param array $source
  */
 private function processStudent(array $source)
 {
     /**
      * Попробуем искать студента. Искать будем по ФИО
      */
     $fio = $source[1] . " " . $source[2] . " " . $source[3];
     $student = CStaffManager::getStudent($fio);
     /**
      * Если студент был, то хорошо, если не был, то создаем
      * и добавляем в список добавленных
      */
     if (is_null($student)) {
         $student = new CStudent();
         $student->fio = $fio;
         $added = new CArrayList();
         if ($this->getResults()->hasElement("Добавлен")) {
             $added = $this->getResults()->getItem("Добавлен");
         }
         $added->add($student->getName(), $student->getName());
         $this->getResults()->add("Добавлен", $added);
     }
     $updated = new CArrayList();
     if ($this->getResults()->hasElement("Обновлен")) {
         $updated = $this->getResults()->getItem("Обновлен");
     }
     $fields = new CArrayList();
     if ($updated->hasElement($student->getName())) {
         $fields = $updated->getItem($student->getName());
     }
     /**
      * Теперь у нас есть студент. В любом случае есть))
      * Проверяем, может что-то не совпадает
      */
     $needSave = false;
     /**
      * Год окончания школы
      */
     if ($source[4] !== "") {
         if (mb_strtolower($student->year_school_end) !== mb_strtolower($source[4])) {
             $needSave = true;
             $student->year_school_end = $source[4];
             $fields->add("Год окончания предыдущего образовательно учреждения", $source[4]);
         }
     }
     /**
      * Предыдущее образовательное учреждение
      */
     if ($source[5] !== "") {
         if (is_null($student->primaryEducation)) {
             $needSave = true;
             $term = $this->getTerm("primary_education", $source[5]);
             $student->primary_education_type_id = $term->getId();
             $fields->add("Предыдущее образовательно учреждение", $source[5]);
         } elseif (mb_strtolower($student->primaryEducation->getValue()) !== mb_strtolower($source[5])) {
             $needSave = true;
             $term = $this->getTerm("primary_education", $source[5]);
             $student->primary_education_type_id = $term->getId();
             $fields->add("Предыдущее образовательно учреждение", $source[5]);
         }
     }
     /**
      * Год поступления в вуз
      */
     if ($source[6] !== "") {
         if (mb_strtolower($student->year_university_start) !== $source[6]) {
             $needSave = true;
             $student->year_university_start = $source[6];
             $fields->add("Год поступления в ВУЗ", $source[6]);
         }
     }
     /**
      * Форма обучения, на которую поступал
      */
     if ($source[7] !== "") {
         if (is_null($student->secondaryEducationStartType)) {
             $needSave = true;
             $term = $this->getTerm("education_form", $source[7]);
             $student->education_form_start = $term->getId();
             $fields->add("Форма обучения, на которую поступали", $source[7]);
         } elseif (mb_strtolower($student->secondaryEducationStartType->getValue()) !== mb_strtolower($source[7])) {
             $needSave = true;
             $term = $this->getTerm("education_form", $source[7]);
             $student->education_form_start = $term->getId();
             $fields->add("Форма обучения, на которую поступали", $source[7]);
         }
     }
     /**
      * Форма обучения, которую заканчивает
      */
     if ($source[8] !== "") {
         if (is_null($student->secondaryEducationEndType)) {
             $needSave = true;
             $term = $this->getTerm("education_form", $source[8]);
             $student->education_form_end = $term->getId();
             $fields->add("Форма обучения, которую заканчивает", $source[8]);
         } elseif (mb_strtolower($student->secondaryEducationEndType->getValue()) !== mb_strtolower($source[8])) {
             $needSave = true;
             $term = $this->getTerm("education_form", $source[8]);
             $student->education_form_end = $term->getId();
             $fields->add("Форма обучения, которую заканчивает", $source[8]);
         }
     }
     /**
      * Пол
      */
     if ($source[9] !== "") {
         if (is_null($student->gender)) {
             $needSave = true;
             $term = $this->getTerm("gender", $source[9]);
             $student->gender_id = $term->getId();
             $fields->add("Пол", $source[9]);
         } elseif (mb_strtolower($student->gender->getValue()) !== mb_strtolower($source[9])) {
             $needSave = true;
             $term = $this->getTerm("gender", $source[9]);
             $student->gender_id = $term->getId();
             $fields->add("Пол", $source[9]);
         }
     }
     /**
      * Номер телефона
      */
     if ($source[10] !== "") {
         if (mb_strtoupper($student->telephone) !== mb_strtoupper($source[10])) {
             $needSave = true;
             $student->telephone = $source[10];
             $fields->add("Телефон", $source[10]);
         }
     }
     /**
      * Место текущей работы
      */
     if ($source[11] !== "") {
         if (mb_strtoupper($student->work_current) !== mb_strtoupper($source[11])) {
             $needSave = true;
             $student->work_current = $source[11];
             $fields->add("Место текущей работы", $source[11]);
         }
     }
     /**
      * Примечания
      */
     if ($source[12] !== "") {
         if (mb_strtoupper($student->comment) !== mb_strtoupper($source[12])) {
             $needSave = true;
             $student->comment = $source[12];
             $fields->add("Примечание", $source[12]);
         }
     }
     /**
      * Номер группы
      */
     if ($source[13] !== "") {
         $source[13] = str_replace(" ", "-", $source[13]);
         $group = CStaffManager::getStudentGroup($source[13]);
         if (is_null($student->getGroup())) {
             if (!is_null($group)) {
                 $student->group_id = $group->getId();
                 $needSave = true;
                 $fields->add("Группа", $source[13]);
             }
         } elseif (mb_strtoupper($student->getGroup()->getName()) !== mb_strtoupper($source[13])) {
             if (!is_null($group)) {
                 $student->group_id = $group->getId();
                 $needSave = true;
                 $fields->add("Группа", $source[13]);
             }
         }
     }
     /**
      * Место предполагаемой работы
      */
     if ($source[14] !== "") {
         if (mb_strtoupper($student->work_proposed) !== mb_strtoupper($source[14])) {
             $needSave = true;
             $student->work_proposed = $source[14];
             $fields->add("Место предполагаемой работы", $source[14]);
         }
     }
     if ($needSave) {
         $student->save();
     }
     $updated->add($student->getName(), $fields);
     $this->getResults()->add("Обновлен", $updated);
 }
コード例 #6
0
 public function actionGetObject($id)
 {
     return CStaffManager::getStudent($id);
 }
コード例 #7
0
 public function actionIndex()
 {
     $set = new CRecordSet(false);
     $query = new CQuery();
     $query->select("activity.*")->from(TABLE_STUDENTS_ACTIVITY . " as activity");
     // сортировки по столбцам
     if (CRequest::getString("order") == "") {
         $query->order("activity.id desc");
     } elseif (CRequest::getString("order") == "date_act") {
         if (CRequest::getString("direction") == "") {
             $query->order("activity.date_act desc");
         } else {
             $query->order("activity.id " . CRequest::getString("direction"));
         }
     } elseif (CRequest::getString("order") == "subject_id") {
         $query->leftJoin(TABLE_DISCIPLINES . " as discipline", "activity.subject_id = discipline.id");
         if (CRequest::getString("direction") == "") {
             $query->order("discipline.name asc");
         } else {
             $query->order("discipline.name " . CRequest::getString("direction"));
         }
     } elseif (CRequest::getString("order") == "kadri_id") {
         $query->leftJoin(TABLE_PERSON . " as person", "activity.kadri_id = person.id");
         if (CRequest::getString("direction") == "") {
             $query->order("person.fio asc");
         } else {
             $query->order("person.fio " . CRequest::getString("direction"));
         }
     } elseif (CRequest::getString("order") == "student_id") {
         $query->leftJoin(TABLE_STUDENTS . " as student_f", "student_f.id = activity.student_id");
         if (CRequest::getString("direction") == "") {
             $query->order("student_f.fio asc");
         } else {
             $query->order("student_f.fio " . CRequest::getString("direction"));
         }
     } else {
         $query = new CQuery();
         $query->select("activity.*")->from(TABLE_STUDENTS_ACTIVITY)->order("activity.id desc");
     }
     // запросы для получения списка групп и списка преподавателей
     $personQuery = new CQuery();
     $personQuery->select("distinct(person.id) as id, person.fio as name")->from(TABLE_STUDENTS_ACTIVITY . " as activity")->innerJoin(TABLE_PERSON . " as person", "activity.kadri_id = person.id")->order("person.fio asc");
     $groupQuery = new CQuery();
     $groupQuery->select("distinct(st_group.id) as id, st_group.name as name")->from(TABLE_STUDENTS_ACTIVITY . " as activity")->innerJoin(TABLE_STUDENTS . " as student", "student.id = activity.student_id")->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "st_group.id = student.group_id")->order("st_group.name asc");
     $disciplineQuery = new CQuery();
     $disciplineQuery->select("distinct(subject.id) as id, subject.name as name")->from(TABLE_STUDENTS_ACTIVITY . " as activity")->innerJoin(TABLE_DISCIPLINES . " as subject", "activity.subject_id = subject.id")->order("subject.name asc");
     // фильтры
     $selectedPerson = null;
     $selectedGroup = null;
     $selectedDiscipline = null;
     $selectedStudent = null;
     $selectedControl = null;
     if (CRequest::getString("filter") !== "") {
         $filters = explode("_", CRequest::getString("filter"));
         foreach ($filters as $filter) {
             $f = explode(":", $filter);
             if (count($f) > 1) {
                 $key = $f[0];
                 $value = $f[1];
                 if ($key == "person") {
                     if ($value != 0) {
                         $selectedPerson = $value;
                         $query->condition("kadri_id=" . $value);
                     }
                 } elseif ($key == "group") {
                     if ($value != 0) {
                         $selectedGroup = $value;
                         $query->innerJoin(TABLE_STUDENTS . " as student", "activity.student_id = student.id");
                         $query->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "student.group_id = st_group.id AND st_group.id=" . $value);
                     }
                 } elseif ($key == "discipline") {
                     if ($value != 0) {
                         $selectedDiscipline = $value;
                         $query->innerJoin(TABLE_DISCIPLINES . " as subject", "subject.id = activity.subject_id AND subject.id=" . $value);
                     }
                 } elseif ($key == "student") {
                     if ($value != 0) {
                         $selectedStudent = CStaffManager::getStudent($value);
                         $query->innerJoin(TABLE_STUDENTS . " as student", "activity.student_id = student.id AND student.id=" . $value);
                     }
                 } elseif ($key == "control") {
                     if ($value != 0) {
                         $selectedControl = CTaxonomyManager::getControlType($value);
                         $query->innerJoin(TABLE_STUDENTS_CONTROL_TYPES . " as control", "activity.study_act_id = control.id AND control.id=" . $value);
                     }
                 }
             }
         }
         /**
          * Дополняем фильтры по преподавателям, группам и дисциплинам
          */
         if (!is_null($selectedPerson)) {
             $groupQuery->innerJoin(TABLE_PERSON . " as person", "person.id = activity.kadri_id AND person.id=" . $selectedPerson);
             $disciplineQuery->innerJoin(TABLE_PERSON . " as person", "person.id = activity.kadri_id AND person.id=" . $selectedPerson);
         }
         if (!is_null($selectedGroup)) {
             $personQuery->innerJoin(TABLE_STUDENTS . " as student", "student.id = activity.student_id");
             $personQuery->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "st_group.id = student.group_id and st_group.id=" . $selectedGroup);
             $disciplineQuery->innerJoin(TABLE_STUDENTS . " as student", "student.id = activity.student_id");
             $disciplineQuery->innerJoin(TABLE_STUDENT_GROUPS . " as st_group", "st_group.id = student.group_id and st_group.id=" . $selectedGroup);
         }
         if (!is_null($selectedDiscipline)) {
             $personQuery->innerJoin(TABLE_DISCIPLINES . " as subject", "subject.id = activity.subject_id AND subject.id=" . $selectedDiscipline);
             $groupQuery->innerJoin(TABLE_DISCIPLINES . " as subject", "subject.id = activity.subject_id AND subject.id=" . $selectedDiscipline);
         }
         if (!is_null($selectedStudent)) {
             $personQuery->innerJoin(TABLE_STUDENTS . " as student_s", "student_s.id = activity.student_id AND student_s.id=" . $selectedStudent->getId());
             $groupQuery->innerJoin(TABLE_STUDENTS . " as student_s", "student_s.id = activity.student_id AND student_s.id=" . $selectedStudent->getId());
             $disciplineQuery->innerJoin(TABLE_STUDENTS . " as student_s", "student_s.id = activity.student_id AND student_s.id=" . $selectedStudent->getId());
         }
         if (!is_null($selectedControl)) {
             $personQuery->innerJoin(TABLE_STUDENTS_CONTROL_TYPES . " as control", "activity.study_act_id = control.id AND control.id=" . $selectedControl->getId());
             $groupQuery->innerJoin(TABLE_STUDENTS_CONTROL_TYPES . " as control", "activity.study_act_id = control.id AND control.id=" . $selectedControl->getId());
             $disciplineQuery->innerJoin(TABLE_STUDENTS_CONTROL_TYPES . " as control", "activity.study_act_id = control.id AND control.id=" . $selectedControl->getId());
         }
     }
     /**
      * Ограничения по уровню доступа
      */
     if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_READ_OWN_ONLY) {
         $query->condition("activity.kadri_id=" . CSession::getCurrentPerson()->getId());
     } elseif (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
         $query->condition("activity.kadri_id=" . CSession::getCurrentPerson()->getId());
     }
     $set->setQuery($query);
     // ищем преподавателей, у которых есть оценки в списке
     $persons = array();
     foreach ($personQuery->execute()->getItems() as $item) {
         $persons[$item["id"]] = $item["name"];
     }
     // ищем группы, из которых студенты есть в списке
     $groups = array();
     foreach ($groupQuery->execute()->getItems() as $item) {
         $groups[$item["id"]] = $item["name"];
     }
     // ищем дисциплины, по которым ставились оценки
     $disciplines = array();
     foreach ($disciplineQuery->execute()->getItems() as $item) {
         $disciplines[$item["id"]] = $item["name"];
     }
     // остальные данные
     $items = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $item) {
         $a = new CStudentActivity($item);
         $items->add($a->getId(), $a);
     }
     /**
      * Формируем меню
      */
     $this->addActionsMenuItem(array(array("title" => "Добавить", "link" => "?action=add", "icon" => "actions/list-add.png"), array("title" => "Групповое добавление", "link" => "index.php?action=addGroup", "icon" => "actions/mail-reply-all.png"), array("title" => "Групповые операции", "link" => "#", "icon" => "actions/address-book-new.png", "child" => array(array("title" => "Удалить выбранные", "link" => "index.php", "action" => "removeGroup", "icon" => "actions/edit-clear.png", "form" => "#gradebookForm"))), array("title" => "Мои журналы", "link" => "index.php?action=myGradebooks", "icon" => "actions/format-justify-fill.png")));
     $this->setData("persons", $persons);
     $this->setData("selectedPerson", $selectedPerson);
     $this->setData("groups", $groups);
     $this->setData("selectedGroup", $selectedGroup);
     $this->setData("disciplines", $disciplines);
     $this->setData("selectedDiscipline", $selectedDiscipline);
     $this->setData("selectedStudent", $selectedStudent);
     $this->setData("selectedControl", $selectedControl);
     $this->setData("records", $items);
     $this->setData("paginator", $set->getPaginator());
     $this->renderView("_gradebook/index.tpl");
 }
コード例 #8
0
 public function actionChangeGroupProcess()
 {
     $form = new CStudentChangeGroupForm();
     $form->setAttributes(CRequest::getArray(CStudentChangeGroupForm::getClassName()));
     if ($form->validate()) {
         $group = CStaffManager::getStudentGroup($form->group_id);
         foreach ($form->students as $id) {
             $student = CStaffManager::getStudent($id);
             if (!is_null($student)) {
                 $source = $student->group;
                 $student->group_id = $group->getId();
                 $student->save();
                 $student->createGroupChangeHistoryPoint($source, $group);
             }
         }
         $this->redirect("?action=index");
         return false;
     }
     $this->setData("form", $form);
     $this->addActionsMenuItem(array(array("title" => "Назад", "link" => "?action=index", "icon" => "actions/edit-undo.png")));
     $this->renderView("_students/changeGroup.tpl");
 }