Esempio n. 1
0
 public function executeSaveRegulation()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id'));
     $this->forward404Unless($course_schedule);
     $params = array();
     foreach (explode('&', $this->getRequestParameter('formula_list_ser')) as $p) {
         $p = explode('=', $p);
         $params[rawurldecode($p[0])][] = rawurldecode($p[1]);
     }
     if (array_key_exists('formulas', $params)) {
         foreach ($params['formulas'] as $formula_id) {
             $course_regulation = new CourseRegulation();
             $course_regulation->setId($this->getRequestParameter('id'));
             $course_regulation->setClassGroupId($course_schedule->getClassGroupId());
             $course_regulation->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
             $course_regulation->setSubjectCurrId($course_schedule->getSubjectCurrId());
             $course_regulation->setKkm($this->getRequestParameter('kkm'));
             $course_regulation->setFormulaId($formula_id);
             $course_regulation->save();
         }
     }
     return $this->redirect('course_score_new/listRegulation?course_id=' . $course_schedule->getId());
 }
Esempio n. 2
0
 public function executeSaveAll()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     $academic_calendar = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('academic_calendar_id'));
     $this->forward404Unless($academic_calendar);
     $params = array();
     foreach (explode('&', $this->getRequestParameter('subject_list_ser')) as $p) {
         $p = explode('=', $p);
         $params[rawurldecode($p[0])][] = rawurldecode($p[1]);
     }
     if (array_key_exists('subjects', $params)) {
         foreach ($params['subjects'] as $course_id) {
             $course_schedule = CourseSchedulePeer::retrieveByPK($course_id);
             $this->forward404Unless($course_schedule);
             $cw = new Criteria();
             $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
             $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
             $cw->add(CourseRegulationPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
             $course_regulation = CourseRegulationPeer::doSelectOne($cw);
             if ($course_regulation == null) {
                 $course_regulation = new CourseRegulation();
             }
             $course_regulation->setId($this->getRequestParameter('id'));
             $course_regulation->setClassGroupId($course_schedule->getClassGroupId());
             $course_regulation->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
             $course_regulation->setSubjectCurrId($course_schedule->getSubjectCurrId());
             $course_regulation->setKkm($this->getRequestParameter('kkm'));
             $course_regulation->setFormulaId($this->getRequestParameter('formula_id'));
             $course_regulation->save();
         }
     }
     return $this->redirect('score_admin/createAllRegulation');
 }