Exemplo n.º 1
0
 public function getThesisAdvisorsJoinStudentThesis($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseThesisAdvisorPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collThesisAdvisors === null) {
         if ($this->isNew()) {
             $this->collThesisAdvisors = array();
         } else {
             $criteria->add(ThesisAdvisorPeer::EMPLOYEE_ID, $this->getId());
             $this->collThesisAdvisors = ThesisAdvisorPeer::doSelectJoinStudentThesis($criteria, $con);
         }
     } else {
         $criteria->add(ThesisAdvisorPeer::EMPLOYEE_ID, $this->getId());
         if (!isset($this->lastThesisAdvisorCriteria) || !$this->lastThesisAdvisorCriteria->equals($criteria)) {
             $this->collThesisAdvisors = ThesisAdvisorPeer::doSelectJoinStudentThesis($criteria, $con);
         }
     }
     $this->lastThesisAdvisorCriteria = $criteria;
     return $this->collThesisAdvisors;
 }
Exemplo 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(ThesisAdvisorPeer::ID, $pks, Criteria::IN);
         $objs = ThesisAdvisorPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemplo n.º 3
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ThesisAdvisorPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setStudentThesisId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setEmployeeId($arr[$keys[2]]);
     }
 }
Exemplo n.º 4
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')) {
         $student_thesis = new StudentThesis();
     } else {
         $student_thesis = StudentThesisPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($student_thesis);
     }
     $student_thesis->setId($this->getRequestParameter('id'));
     $student_thesis->setThesisTitle($this->getRequestParameter('thesis_title'));
     $student_thesis->setStudentId($this->getRequestParameter('student_id'));
     $student_thesis->setStatus($this->getRequestParameter('status'));
     $student_thesis->save();
     $c = new Criteria();
     $c->add(ThesisAdvisorPeer::STUDENT_THESIS_ID, $student_thesis->getId());
     ThesisAdvisorPeer::doDelete($c);
     $advisors = $this->getRequestParameter('isSelected');
     if ($advisors) {
         foreach ($advisors as $id) {
             $ta = new ThesisAdvisor();
             $ta->setStudentThesis($student_thesis);
             $ta->setEmployeeId($id);
             $ta->save();
         }
     }
     if ($student_thesis->getStatus() == StudentThesis::STATUS_DONE) {
         $ce = new ComprehensiveExam();
         $ce->setStudentId($student_thesis->getStudentId());
         $ce->setStatus(ComprehensiveExam::STATUS_PROPOSED);
         $ce->setAcademicCalendarId($student_thesis->getAcademicCalendarId());
         $ce->save();
     }
     return $this->redirect('student_thesis/list');
 }