Beispiel #1
0
 public function actionId($user_id)
 {
     $data = $this->model->get($user_id);
     $this->setTitle("Učitel " . $data->firstname . " " . $data->lastname);
     $this->template->data = $data;
     $loadsGrid = $this["loadsGrid"];
     $loadsGrid->setModel($this->loadsModel->getSelection()->where(array("sch_teacher_id" => $user_id)));
 }
 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)));
 }
Beispiel #3
0
 public function actionId($id)
 {
     $get = $this->request->getParameters();
     if (isset($get["sch_group_id"])) {
         $id = $get["sch_group_id"];
     }
     $data = $this->model->get($id);
     $this->setTitle("Studijní skupina " . $data->shortname . " ze třídy " . $data->class);
     $this->template->data = $data;
     $membersGrid = $this["membersGrid"];
     $membersGrid->setModel($this->membersModel->getSelection()->where(array("sch_group_id" => $id))->orderBy("firstname, lastname"));
     $loadsGrid = $this["loadsGrid"];
     $loadsGrid->setModel($this->loadsModel->getSelection()->where(array("sch_group_id" => $id)));
 }
Beispiel #4
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");
 }
Beispiel #5
0
 public function actionId($user_id)
 {
     $data = $this->model->get($user_id);
     $this->setTitle("Student " . $data->firstname . " " . $data->lastname);
     $this->template->data = $data;
     $groupsGrid = $this["groupsGrid"];
     $groupsGrid->setModel($this->groupsModel->getSelection()->where(array("sch_group_membership.user_id" => $user_id)));
     $studentGroups = $this->membershipModel->getStudentsGroupsId($user_id);
     $studentGroupList = array();
     foreach ($studentGroups as $gr) {
         $studentGroupList[] = $gr->sch_group_id;
     }
     $studentGroupString = implode(",", $studentGroupList);
     $loadsGrid = $this["loadsGrid"];
     if ($studentGroupList) {
         $loadsGrid->setModel($this->loadsModel->getSelection()->where("sch_group_id IN(" . $studentGroupString . ")"));
     } else {
         $loadsGrid->setModel($this->loadsModel->getSelection()->where("sch_group_id = 0"));
     }
 }