예제 #1
0
 public function actionSeminarDetail()
 {
     $form = new SeminarForm();
     if (isset($_POST['id_seminar']) && $_POST['id_seminar']) {
         $seminar = RsSeminar::model()->findByPk($_POST['id_seminar']);
         if ($seminar) {
             $form->attributes = $seminar->attributes;
             $form->id = $seminar->id;
             $form->start_date = formatDateToJP($form->start_date);
             $form->apply_from_date = formatDateToJP($form->apply_from_date);
             $form->apply_to_date = formatDateToJP($form->apply_to_date);
         }
     }
     $this->renderPartial('_detailSeminar', array('model' => $form));
 }
예제 #2
0
 public function actionEditFinishedSeminarList()
 {
     if (!isset($_POST['s_id'])) {
         echo "There's no such Seminar";
         return;
     }
     $data = array();
     $response = array();
     $s_id = $_POST['s_id'];
     $criteria = new CDbCriteria();
     $criteria->together = true;
     $criteria->with = array('studentSeminars' => array('select' => 'studentSeminars.seminar_id, studentSeminars.apply_code,studentSeminars.attended', 'together' => true));
     $criteria->params = array();
     $criteria->addCondition('seminar_id = :s_id');
     $criteria->addCondition('attended = 1');
     $criteria->params[':s_id'] = $s_id;
     $count = RsStudent::model()->count($criteria);
     $pages = new CPagination($count);
     // results per page
     if (isset($_POST['page']) && (int) $_POST['page'] >= 0) {
         $pages->currentPage = (int) $_POST['page'] - 1;
     }
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     $criteria->order = "reg_code ASC";
     $students = RsStudent::model()->findAll($criteria);
     $data['s_id'] = $s_id;
     $data['pages'] = $pages;
     $data['students'] = $students;
     // print_r($pages); return;
     $response['title'] = $seminar_name = RsSeminar::model()->findByPk($s_id)->name;
     $response['content'] = $this->renderPartial('_editFinishedSeminarList', $data, true);
     //set true to return html string instead of rendering it out.
     echo json_encode($response);
 }
예제 #3
0
 public function getTodaySeminars($per_page)
 {
     $criteria = new CDbCriteria();
     $count = RsSeminar::model()->count($criteria);
     $pages = new CPagination($count);
     // results per page
     $pages->pageSize = $per_page;
     $pages->applyLimit($criteria);
     return $models = RsSeminar::model()->findAll($criteria);
 }