Beispiel #1
0
 public function executeCreate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post'));
     $this->forward404Unless($request->hasParameter("course") && $request->hasParameter("year") && $request->hasParameter("term"));
     $this->courseId = $request->getParameter("course");
     $this->year = $request->getParameter("year") . $request->getParameter("term");
     $this->forward404Unless($course = CoursePeer::retrieveByPk($this->courseId), sprintf("Object course does not exist"));
     $this->form = new ExamForm(new Exam());
     $this->processForm($request, $this->form);
     // at this point, save has failed
     $this->examList = $this->getExamList($this->courseId, $this->year);
     $this->setTemplate('custom');
 }
Beispiel #2
0
 public function executeDelete(sfWebRequest $request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($course = CoursePeer::retrieveByPk($request->getParameter('id')), sprintf('Object course does not exist (%s).', $request->getParameter('id')));
     try {
         $discipline = $course->getCourseDisciplineAssociations();
         if ($discipline !== null) {
             //deleting discipline dependency
             foreach ($discipline as $dis) {
                 $dis->delete();
             }
         }
         $instructorassoc = null;
         $instructorassoc = $course->getCourseInstructorAssociations();
         if ($instructorassoc !== null) {
             //deleting instructor dependency
             foreach ($instructorassoc as $instruct) {
                 $instruct->delete();
             }
         }
         // finally, delete the course obj
         $course->delete();
         $par = "";
         if ($request->hasParameter("page")) {
             $par = "?page=" . $request->getParameter("page");
         }
         $this->redirect('admincourse/index' . $par);
     } catch (Exception $e) {
         $this->globalErrors = $e->getMessage();
         $this->course_list = $this->getCourselist(new Criteria());
         $this->courseDetail = CourseDetailPeer::getObjectForCourseId($course->getId());
         $values = array('edit' => 'true');
         $this->form = new CourseForm($course, $values);
         if ($this->courseDetail !== null) {
             $this->form2 = new CourseDetailForm($this->courseDetail);
         } else {
             $this->form2 = new CourseDetailForm(new CourseDetail());
         }
         $this->setTemplate('index');
     }
 }
Beispiel #3
0
 public function executeCreateCourse(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
     $this->forward404Unless($request->hasParameter("course"));
     $this->courseId = $request->getParameter("course");
     $this->forward404Unless($_course = CoursePeer::retrieveByPk($this->courseId), sprintf('Object course does not exist (%s).', $this->courseId));
     $comment = new CourseComment();
     $values = array('courseid' => $this->courseId);
     $this->form = new CourseCommentForm($comment, $values);
     $this->submitCourseForm($request, $this->form);
     // if we have reached this point, save has failed
     $this->commentList = $this->getCourseList($this->courseId);
     $this->setTemplate('coursecommenting');
 }
Beispiel #4
0
 public function executeSaveClose(sfWebRequest $request)
 {
     // TODO
     // si es mayor que 7 crear el student approved career subject. si no mandarlo a previa.
     sfContext::getInstance()->getConfiguration()->loadHelpers('I18N');
     $this->course = CoursePeer::retrieveByPk($request->getParameter('id'));
     $this->course->pathwayClose();
     $this->getUser()->setFlash('notice', __('The course has been closed successfuly'));
     $this->setTemplate('close');
 }
 public function executeDelete(sfWebRequest $request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($course = CoursePeer::retrieveByPk($request->getParameter('id')), sprintf('Object course does not exist (%s).', $request->getParameter('id')));
     $discipline = null;
     $discipline = $course->getCourseDisciplineAssociations();
     if ($discipline !== null) {
         //deleting discipline dependency
         foreach ($discipline as $dis) {
             $dis->delete();
         }
     }
     $instructorassoc = null;
     $instructorassoc = $course->getCourseInstructorAssociations();
     if ($instructorassoc !== null) {
         //deleting instructor dependency
         foreach ($instructorassoc as $instruct) {
             $instruct->delete();
         }
     }
     $course->delete();
     $this->redirect('admincourse/index');
 }
Beispiel #6
0
 public static function retrievePathwayStudentsCriteria($course_id)
 {
     $course = CoursePeer::retrieveByPk($course_id);
     $c = new Criteria();
     $c->add(CourseSubjectPeer::COURSE_ID, $course_id);
     $c->addJoin(CourseSubjectPeer::ID, CourseSubjectStudentPathwayPeer::COURSE_SUBJECT_ID);
     $c->addJoin(CourseSubjectStudentPathwayPeer::STUDENT_ID, StudentPeer::ID);
     $c->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID);
     $c->addJoin(SchoolYearStudentPeer::STUDENT_ID, StudentPeer::ID);
     $c->add(PersonPeer::IS_ACTIVE, true);
     $c->add(SchoolYearStudentPeer::SCHOOL_YEAR_ID, $course->getSchoolYearId());
     return $c;
 }
Beispiel #7
0
 public function executeMultipleSubjectsCommissionAttendance(sfWebRequest $request)
 {
     $this->course = CoursePeer::retrieveByPk($request->getParameter('course'));
     $this->course_subjects = $this->course->getCourseSubjects();
 }
Beispiel #8
0
 public function executeAddSubject(sfWebRequest $request)
 {
     if ($request->isMethod('post')) {
         $params = $request->getPostParameters();
         $this->course = CoursePeer::retrieveByPk($params['course']['id']);
         $this->form = new SubjectForCommissionForm($this->course);
         $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
         if ($this->form->isValid()) {
             try {
                 $this->form->save();
                 $this->getUser()->setFlash("notice", "New subject added to commission successfully");
                 $this->redirect("@commission");
             } catch (PropelException $e) {
                 $this->getUser()->setFlash('error', 'La materia ya existe en la comisión.');
             }
         }
     } else {
         $this->course = $this->getRoute()->getObject();
         $this->course_subjects = $this->course->getCourseSubjects();
         $this->form = new SubjectForCommissionForm($this->course);
     }
 }
Beispiel #9
0
 public function executeSaveClose(sfWebRequest $request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('I18N');
     $this->course = CoursePeer::retrieveByPk($request->getParameter('id'));
     $this->course->close();
     $this->getUser()->setFlash('notice', __('The course has been closed successfuly'));
     $this->setTemplate('close');
 }