public function actionView()
 {
     $group = CStaffManager::getStudentGroup(CRequest::getInt("id"));
     $this->addActionsMenuItem(array(array("title" => "Назад", "link" => WEB_ROOT . "_modules/_student_groups/public.php?action=index", "icon" => "actions/edit-undo.png")));
     $this->setData("group", $group);
     $this->renderView("__public/_student_groups/view.tpl");
 }
Example #2
0
 /**
  * Группа, к которой студент относится
  *
  * @return CStudentGroup
  */
 public function getGroup()
 {
     if (is_null($this->_group)) {
         if (array_key_exists("group_id", $this->getRecord()->getItems())) {
             $this->_group = CStaffManager::getStudentGroup($this->getRecord()->getItemValue("group_id"));
         }
     }
     return $this->_group;
 }
 /**
  * Получить всех студентов учебной группы
  */
 public function actionGetStudentsByGroup()
 {
     $group = CRequest::getInt("group");
     $res = array();
     foreach (CStaffManager::getStudentGroup($group)->getStudents()->getItems() as $student) {
         $res[$student->getId()] = $student->getName();
     }
     echo json_encode($res);
 }
 public function actionWizardStep2()
 {
     $this->setData("year_id", CRequest::getInt("year_id"));
     $this->setData("sign_date", CRequest::getString("sign_date"));
     $this->setData("group_id", CRequest::getInt("group_id"));
     $this->setData("chairman_id", CRequest::getInt("chairman_id"));
     $this->setData("master_id", CRequest::getInt("master_id"));
     $this->setData("members", CRequest::getArray("member"));
     $group = CStaffManager::getStudentGroup(CRequest::getInt("group_id"));
     $this->setData("students", $group->getStudents()->getItems());
     $year = CTaxonomyManager::getYear(CRequest::getInt("year_id"));
     $this->setData("year", $year);
     $this->setData("speciality", $group->getSpeciality());
     $this->renderView("_state_exam/_protocols/wizard.step2.tpl");
 }
 /**
  * Сама обработка студентов
  *
  * @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);
 }
 public function actionDelete()
 {
     $group = CStaffManager::getStudentGroup(CRequest::getInt("id"));
     $group->remove();
     $this->redirect("?action=index");
 }
 public function actionGetObject($id)
 {
     return CStaffManager::getStudentGroup($id);
 }
 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");
 }