Esempio n. 1
0
 public function executeSave()
 {
     $accal_id = $this->getRequestParameter('accal_id');
     $accal = AcademicCalendarPeer::retrieveByPK($accal_id);
     $this->forward404Unless($accal);
     $this->accal = $accal;
     $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');
     $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 $su_id) {
             $subject_accal = new SubjectAccal();
             $subject_accal->setSubjectId($su_id);
             $subject_accal->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
             $subject_accal->save();
         }
     }
     return $this->redirect('subject_accal/list?accal_id=' . $accal->getId());
 }
Esempio n. 2
0
 public function executeSave()
 {
     $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 $su_id) {
             $subject_academic = new SubjectAccal();
             $subject_academic->setSubjectId($su_id);
             $subject_academic->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
             $subject_academic->save();
         }
     }
     return $this->redirect('subject_academic/list');
 }
Esempio n. 3
0
 public function executeUpdate()
 {
     $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');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $subject = new Subject();
         $subject->setCode($this->getRequestParameter('code'));
         $subject->setName($this->getRequestParameter('name'));
         $subject->setCredit($this->getRequestParameter('credit'));
         $subject->setSubjectGroupId($this->getRequestParameter('subject_group_id'));
         $subject->setDepartmentId($this->getRequestParameter('department_id'));
         $subject->save();
         #$subject_curr = new SubjectCurr();
         #$subject_curr->setSubject($subject);
         #$subject_curr->setCurriculumId($this->getRequestParameter('curriculum_id'));
         #$subject_curr->save();
         #$c = new Criteria();
         #$c->add(AcademicCalendarPeer::CURRICULUM_ID, $this->getRequestParameter('curriculum_id'));
         #$currs = AcademicCalendarPeer::doSelect($c);
         #foreach ($currs as $curr) {
         #	$subject_accal = new SubjectAccal();
         #	$subject_accal->setSubject($subject);
         #	$subject_accal->setAcademicCalendarId($curr->getId());
         #	$subject_accal->setEmployeeId($this->getRequestParameter('employee_id'));
         #	$subject_accal->save();
         #	$subject_accal_lector = new SubjectAccalLector();
         #	$subject_accal_lector->setSubjectAccal($subject_accal);
         #	$subject_accal_lector->setEmployeeId($this->getRequestParameter('employee_id'));
         #	$subject_accal_lector->save();
         #}
         $subject_accal = new SubjectAccal();
         $subject_accal->setSubject($subject);
         $subject_accal->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
         $subject_accal->setEmployeeId($this->getRequestParameter('employee_id'));
         $subject_accal->save();
         #$subject_accal_lector = new SubjectAccalLector();
         #$subject_accal_lector->setSubjectAccal($subject_accal);
         #$subject_accal_lector->setEmployeeId($this->getRequestParameter('employee_id'));
         #$subject_accal_lector->save();
     } else {
         $subject = SubjectPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($subject);
         $subject->setId($this->getRequestParameter('id'));
         $subject->setCode($this->getRequestParameter('code'));
         $subject->setName($this->getRequestParameter('name'));
         $subject->setCredit($this->getRequestParameter('credit'));
         $subject->setSubjectGroupId($this->getRequestParameter('subject_group_id'));
         $subject->setDepartmentId($this->getRequestParameter('department_id'));
         $subject->save();
         $c = new Criteria();
         $c->add(SubjectAccalPeer::ID, $this->getRequestParameter('subject_accal_id'));
         $subject_accal = SubjectAccalPeer::doSelectOne($c);
         #$subject_accal = SubjectAccalPeer::retrieveByPk($this->getRequestParameter('subject_accal_id'));
         #$this->forward404Unless($subject_accal);
         $subject_accal->setId('subject_accal_id');
         $subject_accal->setSubject($subject);
         $subject_accal->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
         $subject_accal->setEmployeeId($this->getRequestParameter('employee_id'));
         $subject_accal->save();
     }
     return $this->redirect('subject/list');
 }