public function actionAjaxSave()
 {
     $attendance = array();
     $students = Student::model()->findAll('ID_Class=:idClass', array('idClass' => $_SESSION['idClass']));
     $attendance_status = Domain::getAttendanceStatus();
     $attendance = $_POST['Attendance'];
     $error = array();
     foreach ($students as $student) {
         if (!isset($attendance['Status_' . $student->Code])) {
             $error['Status_' . $student->Code] = 'error';
         }
     }
     if (empty($error)) {
         if ($this->checkAttendanceSession($_SESSION['idSession'], $this->getAttendanceSession(Yii::app()->user->getState('idUser'), $this->getIdClassSubject($_SESSION['idClass'], $_SESSION['idSubject'], Yii::app()->user->getState('idUser'))))) {
             $idAttendance = $this->saveAttendance($attendance, $students);
             $this->saveAttendanceDetails($idAttendance, $students, $attendance);
             echo '<p class="text-success pd-3-15">Điểm danh thành công</p>' . $this->createTableAddtendance($attendance_status, $students, $attendance);
         } else {
             $attendance = Attendance::model()->find('Session=:idSession AND ID_Teacher=:idTeacher AND ID_Class_Subject=:idClassSubject', array('idSession' => $_SESSION['idSession'], 'idTeacher' => Yii::app()->user->getState('idUser'), 'idClassSubject' => $this->getIdClassSubject($_SESSION['idClass'], $_SESSION['idSubject'], Yii::app()->user->getState('idUser'))));
             $this->createTableAddtendance($attendance_status, $students, $attendance, true);
         }
     } else {
         echo '<p class="text-danger pd-3-15">Chưa điểm danh hết học viên</p>' . $this->createTableAddtendance($attendance_status, $students, $attendance);
     }
 }