public function actionSave() { $activity = new CStudentActivity(); $activity->setAttributes(CRequest::getArray($activity::getClassName())); if ($activity->validate()) { $activity->date_act = date("Y-m-d", strtotime($activity->date_act)); // если стоит флаг запоминания данных, то пишем их в куки на месяц if (CRequest::getString("saveValues") == "1") { setcookie("gradebook[single][date_act]", $activity->date_act, time() + 1209600); setcookie("gradebook[single][subject_id]", $activity->subject_id, time() + 1209600); setcookie("gradebook[single][kadri_id]", $activity->kadri_id, time() + 1209600); setcookie("gradebook[single][group_id]", $activity->group_id, time() + 1209600); setcookie("gradebook[single][study_act_id]", $activity->study_act_id, time() + 1209600); setcookie("gradebook[single][student_id]", $activity->student_id, time() + 1209600); setcookie("gradebook[single][study_act_comment]", $activity->study_act_comment, time() + 1209600); setcookie("gradebook[single][study_mark]", $activity->study_mark, time() + 1209600); setcookie("gradebook[single][comment]", $activity->comment, time() + 1209600); } $activity->save(); $this->redirect("?action=index"); return false; } $this->addJSInclude("_core/jquery-ui-1.8.20.custom.min.js"); $this->addCSSInclude("_core/jUI/jquery-ui-1.8.2.custom.css"); $this->addJSInclude("_core/personTypeFilter.js"); $groups = array(); foreach (CStaffManager::getStudentGroupsByYear(CUtils::getCurrentYear())->getItems() as $group) { if ($group->getStudents()->getCount() > 0) { $groups[$group->getId()] = $group->getName(); } } $students = array(); if (!is_null($activity->student)) { foreach ($activity->student->getGroup()->getStudents()->getItems() as $student) { $students[$student->getId()] = $student->getName(); } } $this->setData("students", $students); $this->setData("groups", $groups); $this->setData("activity", $activity); $this->renderView("_gradebook/edit.tpl"); }