public function actionHistory() { $data = array(); $user_id = Yii::app()->user->id; $infoStudent = RsStudent::model()->findByAttributes(array('reg_code' => $user_id)); //var_dump($infoStudent);exit; if ($infoStudent === null) { $this->redirect($this->createUrl('/login')); } else { $criteria = new CDbCriteria(); $criteria->order = 'date DESC'; $criteria->addCondition('student_id = ' . $infoStudent->id . ''); $count = RsTestResult::model()->count($criteria); $pages = new CPagination($count); if (isset($_POST['page']) && (int) $_POST['page'] >= 0) { $pages->currentPage = (int) $_POST['page'] - 1; } // results per page $pages->pageSize = 10; $pages->applyLimit($criteria); $history = RsTestResult::model()->findAll($criteria); $data['pages'] = $pages; $data['testHistory'] = $history; echo $this->renderPartial('history', $data, true); } }
public function actionEditAttendedStudent() { //$student_seminar = $_POST['id_seminar']; if ($_POST['student_id']) { $criteria = new CDbCriteria(); $student = RsStudent::model()->findByPk($_POST['student_id']); $criteria->addCondition('student_id = :student_id'); $criteria->params = array(); $criteria->params[':student_id'] = $_POST['student_id']; $count = RsTestResult::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 = 'date DESC'; $list_test = RsTestResult::model()->findAll($criteria); $this->renderPartial('_editAttendedStudent', array('student' => $student, 'list_test' => $list_test, "pages" => $pages)); } }