Пример #1
0
 public function actionId($id)
 {
     $data = $this->model->get($id);
     $this->setTitle("Vyučovací předmět " . $data->name);
     $this->template->data = $data;
     $loadsGrid = $this["loadsGrid"];
     $loadsGrid->setModel($this->loadsModel->getSelection()->where(array("sch_subject_id" => $id)));
 }
Пример #2
0
 public function actionImportLoads()
 {
     $result = $this->model->importLoads();
     $data = $result->data;
     $messages = $result->messages;
     $reports = array();
     $this->loadsModel->purge();
     $subjectConversionTable = array();
     $subjectsData = $this->subjectsModel->query("SELECT id, bakalari_code FROM sch_subject")->fetchAll();
     foreach ($subjectsData as $subjectRecord) {
         $subjectConversionTable[$subjectRecord["bakalari_code"]] = $subjectRecord["id"];
     }
     $teacherConversionTable = array();
     $teacherData = $this->teachersModel->query("SELECT user_id, bakalari_code FROM sch_teacher")->fetchAll();
     foreach ($teacherData as $teacherRecord) {
         $teacherConversionTable[$teacherRecord["bakalari_code"]] = $teacherRecord["user_id"];
     }
     $groupConversionTable = array();
     $groupData = $this->groupsModel->query("SELECT id, bakalari_code FROM sch_group")->fetchAll();
     foreach ($groupData as $groupRecord) {
         $groupConversionTable[$groupRecord["bakalari_code"]] = $groupRecord["id"];
     }
     foreach ($data as $record) {
         if (isset($subjectConversionTable[$record->subject_code]) && isset($groupConversionTable[$record->group_code]) && isset($teacherConversionTable[$record->teacher_code])) {
             $this->loadsModel->dumbInsert(array("sch_teacher_id" => $teacherConversionTable[$record->teacher_code], "sch_group_id" => $groupConversionTable[$record->group_code], "sch_subject_id" => $subjectConversionTable[$record->subject_code], "hours" => $record->hours, "bakalari_code" => $record->bakalari_code));
         } else {
             $reports[] = "ERROR: Nekonzistentní data [" . $record->subject_code . ", " . $record->group_code . ", " . $record->teacher_code . "]";
         }
     }
     //$messages = array_merge($result->messages,$result2->messages);
     $this->template->reports = $reports;
     $this->template->messages = $messages;
     $this->setView("result");
 }