/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new AttendanceDetail(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['AttendanceDetail'])) { $model->attributes = $_POST['AttendanceDetail']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->ID)); } } $this->render('create', array('model' => $model)); }
public function saveAttendanceDetails($idAttendance, $students, $attendance) { foreach ($students as $student) { $model = new AttendanceDetail(); $model->ID_Attendance = $idAttendance; $model->ID_Student = $student->ID; $model->Note = $attendance['Comment_' . $student->Code]; $model->Status = (int) $attendance['Status_' . $student->Code]; $model->save(); } }