コード例 #1
0
ファイル: TestController.php プロジェクト: nguyenvanvu/slu
 public function actionStatus()
 {
     $can_text = "";
     $hideButton = true;
     $user_id = Yii::app()->user->id;
     $infoStudent = RsStudent::model()->findByAttributes(array('reg_code' => $user_id));
     $studentPassedModel = new RsStudentPassed();
     $get_student = $studentPassedModel->studentCanTest($infoStudent->id, $infoStudent->student_code);
     $allData = Yii::app()->db->createCommand($get_student);
     $studentPassed = $allData->queryAll();
     if (count($studentPassed) > 0) {
         $can_text = "合格";
         $hideButton = true;
     } else {
         $can_text = "受講できません";
         $hideButton = false;
     }
     $this->render('status', array('studentPassed' => $can_text, 'hideButton' => $hideButton, 'student_id' => $infoStudent->id));
 }
コード例 #2
0
ファイル: SeminarController.php プロジェクト: nguyenvanvu/slu
 public function actionSeminarIndex()
 {
     /****issue 8220****/
     if (isset($_POST['schedule_date'])) {
         $response = array();
         $schedule_date = $_POST['schedule_date'];
         $user_id = Yii::app()->user->id;
         $infoStudent = RsStudent::model()->findByAttributes(array('reg_code' => $user_id));
         if ($infoStudent->updateAll(array('schedule_date' => $schedule_date), 'reg_code = :user_id', array('user_id' => $user_id))) {
             $response['save'] = "ok";
             echo json_encode($response);
         } else {
             $response['save'] = "fail";
             echo json_encode($response);
         }
         return;
     }
     $can_text = "";
     $user_id = Yii::app()->user->id;
     $infoStudent = RsStudent::model()->findByAttributes(array('reg_code' => $user_id));
     $studentPassedModel = new RsStudentPassed();
     $get_student = $studentPassedModel->studentCanTest($infoStudent->id, $infoStudent->student_code);
     $allData = Yii::app()->db->createCommand($get_student);
     $studentPassed = $allData->queryAll();
     if (count($studentPassed) > 0) {
         $can_text = "合格";
     } else {
         $can_text = "受講できません";
     }
     $user_id = Yii::app()->user->id;
     $infoStudent = RsStudent::model()->findByAttributes(array('reg_code' => $user_id));
     $student_id = $infoStudent->id;
     /*************申し込み中セミナー一覧**********/
     //#8665	141126
     $sSQL = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\trs_seminar,\n\t\t\t\t\trs_student_seminar\n\t\t\t\tWHERE\n\t\t\t\t\trs_seminar.id = seminar_id\n\t\t\t\t\tAND student_id = {$infoStudent->id}\n\t\t\t\t\tAND attended = 0\n\t\t\t\t\tAND to_char(CURRENT_TIMESTAMP,'yyyy-mm-dd') >= to_char(apply_from_date, 'yyyy-mm-dd' ) \n\t\t\t\t\tAND to_char(CURRENT_TIMESTAMP,'yyyy-mm-dd hh24:i:ss') <= ( to_char(start_date, 'yyyy-mm-dd') || ' ' || to_time || ':00') \n\t\t\t\tORDER BY start_date DESC, from_time ASC, to_time ASC\n\t\t\t\t";
     $listRegisted = Yii::app()->db->createCommand($sSQL)->queryAll();
     /*************受講済みセミナー一覧**********/
     $sSQL = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\trs_seminar,\n\t\t\t\t\trs_student_seminar\n\t\t\t\tWHERE\n\t\t\t\t\trs_seminar.id = seminar_id\n\t\t\t\t\tAND student_id = {$infoStudent->id}\n\t\t\t\t\tAND attended = 1\n\t\t\t\t";
     $listAttended = Yii::app()->db->createCommand($sSQL)->queryAll();
     $this->render('seminarIndex', array("student_id" => $student_id, "schedule_date" => $infoStudent->schedule_date, 'studentPassed' => $can_text, 'listAttended' => $listAttended, 'listRegisted' => $listRegisted));
 }