public function actionClasses()
 {
     $resultp = MrClass::model()->findAll('status="Y" AND course_id=' . $_POST['courseid']);
     $html = '<select name="classes" id="classes">';
     $list = CHtml::listData($resultp, 'id', 'start_date');
     $list1 = CHtml::listData($resultp, 'id', 'end_date');
     $list2 = CHtml::listData($resultp, 'id', 'class_details');
     foreach ($list as $key => $lst) {
         $html .= '<option value="' . $key . '">' . $list2[$key] . " From:" . date("d-m-Y", strtotime($lst)) . " To " . date("d-m-Y", strtotime($list1[$key])) . '</option>';
     }
     $html .= '</select>';
     echo $html;
     Yii::app()->end();
 }
Esempio n. 2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return MrClass the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = MrClass::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }