Esempio n. 1
0
 public static function doSelectByStudentAll()
 {
     $student = StudentPeer::retrieveByPK(sfContext::getInstance()->getRequest()->getParameter('student_id'));
     if (!$student) {
         return array();
     }
     $c = new Criteria();
     $c->add(VStudentCoursePeer::STUDENT_ID, $student->getId());
     return VStudentCoursePeer::doSelect($c);
 }
Esempio n. 2
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(VStudentCoursePeer::ID, $pks, Criteria::IN);
         $objs = VStudentCoursePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 3
0
 public function getVStudentCoursesJoinAcademicCalendar($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseVStudentCoursePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collVStudentCourses === null) {
         if ($this->isNew()) {
             $this->collVStudentCourses = array();
         } else {
             $criteria->add(VStudentCoursePeer::SUBJECT_CURR_ID, $this->getId());
             $this->collVStudentCourses = VStudentCoursePeer::doSelectJoinAcademicCalendar($criteria, $con);
         }
     } else {
         $criteria->add(VStudentCoursePeer::SUBJECT_CURR_ID, $this->getId());
         if (!isset($this->lastVStudentCourseCriteria) || !$this->lastVStudentCourseCriteria->equals($criteria)) {
             $this->collVStudentCourses = VStudentCoursePeer::doSelectJoinAcademicCalendar($criteria, $con);
         }
     }
     $this->lastVStudentCourseCriteria = $criteria;
     return $this->collVStudentCourses;
 }
Esempio n. 4
0
 public function executeListByEmployee()
 {
     $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
     $employee = EmployeePeer::retrieveByPK($employee_id);
     $this->forward404Unless($employee);
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $student_id = $this->getRequestParameter('student_id');
     $student = StudentPeer::retrieveByPK($student_id);
     $this->student = $student;
     $this->forward404Unless($student);
     $c = new Criteria();
     $c->add(VStudentCoursePeer::STUDENT_ID, $student->getId());
     $this->student = $student;
     $this->sort($c);
     if ($this->getRequest()->hasParameter('filters')) {
         $filters = $this->getRequestParameter('filters');
         if ($filters == 'clear') {
             $this->filters = null;
         } else {
             $defined_filter = false;
             foreach ($filters as $f) {
                 if (is_array($f)) {
                     if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
                         $defined_filter = true;
                         break;
                     }
                 } else {
                     if ($f != null && $f != '') {
                         $defined_filter = true;
                         break;
                     }
                 }
             }
             if ($defined_filter) {
                 $this->filters = $filters;
                 $this->filter($c, $this->getRequestParameter('filters'));
             }
         }
     }
     $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student_course'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'student_course');
     $pager = new sfPropelPager('VStudentCourse', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student_course'));
     $this->getUser()->setAttribute('page', $page, 'student_course');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $actions = array(array('name' => 'filter', 'color' => 'white'));
     array_unshift($actions, array('name' => 'back', 'url' => 'counseling/listStudentByEmployee?counseling_id=' . $counseling->getId(), 'color' => 'black'));
     $filter_string = "";
     if ($this->filters) {
         foreach ($this->filters as $key => $val) {
             $filter_string .= "&filters[{$key}]={$val}";
         }
         $filter_string = preg_replace('/^&/', '', $filter_string);
     }
     $this->actions = $actions;
     $this->counseling_id = $counseling_id;
     // do we need to display bank_transfer_confirmation link?
     $c = new Criteria();
     $c->add(VStudentCoursePeer::STATUS, StudentCourse::STATUS_APPROVED);
     $this->approved_sc = VStudentCoursePeer::doCount($c) > 0;
 }
Esempio n. 5
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = VStudentCoursePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setStudentId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setSubjectAccalId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setSubjectCurrId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setClassGroupId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setStatus($arr[$keys[6]]);
     }
 }