예제 #1
0
 public function actionManage($id)
 {
     $model = new Sch();
     $model->cleanUp($id);
     if (!($group = Group::model()->findByPk($id))) {
         Yii::app()->user->setFlash('danger', Yii::app()->params['errors']['no_group']);
         $this->redirect('/group');
     }
     if (isset($_POST['Sch'])) {
         $model->group_id = $id;
         $model->json = json_encode($_POST['Sch']);
         if ($model->save()) {
             Tch::model()->saveThis($_POST['Sch'], $model->id, $id);
             Yii::app()->user->setFlash('success', "<big><b>Розклад успішно відредаговано!</b></big>");
         }
     }
     $sch_id = isset($_GET['sch_id']) ? htmlentities($_GET['sch_id']) : null;
     $this->render('manage', array('sch' => $model->getSch($id, $sch_id), 'data' => $model->schData(), 'group' => $group));
 }
예제 #2
0
파일: Tch.php 프로젝트: BigMacckk/kepsch
 public function teacherSch($id, $week)
 {
     $sch = array();
     if ($check = Tch::model()->findByAttributes(array('tch_id' => $id))) {
         foreach (Tch::model()->findAllByAttributes(array('tch_id' => $id, 'week' => $week), array('order' => 'day ASC, number ASC')) as $r) {
             $sch[$r->day][$r->number][] = array('aud_id' => $r->aud_id, 'group_id' => $r->group_id, 'lesson_id' => $r->lesson_id);
         }
     }
     return $sch;
 }