public function getComprehensiveReviewersJoinComprehensiveExam($criteria = null, $con = null) { include_once 'lib/model/om/BaseComprehensiveReviewerPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collComprehensiveReviewers === null) { if ($this->isNew()) { $this->collComprehensiveReviewers = array(); } else { $criteria->add(ComprehensiveReviewerPeer::EMPLOYEE_ID, $this->getId()); $this->collComprehensiveReviewers = ComprehensiveReviewerPeer::doSelectJoinComprehensiveExam($criteria, $con); } } else { $criteria->add(ComprehensiveReviewerPeer::EMPLOYEE_ID, $this->getId()); if (!isset($this->lastComprehensiveReviewerCriteria) || !$this->lastComprehensiveReviewerCriteria->equals($criteria)) { $this->collComprehensiveReviewers = ComprehensiveReviewerPeer::doSelectJoinComprehensiveExam($criteria, $con); } } $this->lastComprehensiveReviewerCriteria = $criteria; return $this->collComprehensiveReviewers; }
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(ComprehensiveReviewerPeer::ID, $pks, Criteria::IN); $objs = ComprehensiveReviewerPeer::doSelect($criteria, $con); } return $objs; }
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')) { $comprehensive_exam = new ComprehensiveExam(); } else { $comprehensive_exam = ComprehensiveExamPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($comprehensive_exam); } $comprehensive_exam->setId($this->getRequestParameter('id')); $comprehensive_exam->setStudentId($this->getRequestParameter('student_id')); if ($this->getRequestParameter('exam_date')) { $comprehensive_exam->setExamDate($this->getRequestParameter('exam_date')); } $comprehensive_exam->setStatus($this->getRequestParameter('status')); $comprehensive_exam->save(); $c = new Criteria(); $c->add(ComprehensiveReviewerPeer::COMPREHENSIVE_EXAM_ID, $comprehensive_exam->getId()); ComprehensiveReviewerPeer::doDelete($c); $reviewers = $this->getRequestParameter('isSelected'); if ($reviewers) { foreach ($reviewers as $id) { $cr = new ComprehensiveReviewer(); $cr->setComprehensiveExam($comprehensive_exam); $cr->setEmployeeId($id); $cr->save(); } } if ($comprehensive_exam->getStatus() == ComprehensiveExam::STATUS_ACTIVE) { // add payment journal $job = JobPeer::retrieveByCode($this->getModuleName()); $academic_process = $job->getAcademicProcess(); $c = new Criteria(); $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, $academic_process->getId()); $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $comprehensive_exam->getAcademicCalendarId()); $costs = AcademicCostPeer::doSelect($c); foreach ($costs as $c) { $pj = new PaymentJournal(); $pj->setPayer($comprehensive_exam->getStudent()->getId()); $pj->setAcademicCost($c); $pj->setJob($job); $pj->setAmount($c->getAmount()); $pj->setPaid($c->getAmount()); $pj->setReceivable(0); $pj->setAcademicProcess($academic_process); $pj->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT); $pj->save(); $ph = new PaymentHistory(); $ph->setPaymentJournal($pj); $ph->setAmount($pj->getPaid()); $ph->save(); } } elseif ($comprehensive_exam->getStatus() == ComprehensiveExam::STATUS_PASSED) { $s = $comprehensive_exam->getStudent(); $s->setStatus(Student::STATUS_GRADUATE); $s->save(); $gc = new GradCeremony(); $gc->setStudent($s); $gc->setStatus(GradCeremony::STATUS_UNLISTED); $gc->setAcademicCalendarId($comprehensive_exam->getAcademicCalendarId()); $gc->save(); } return $this->redirect('comprehensive_exam/list'); }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ComprehensiveReviewerPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setComprehensiveExamId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setEmployeeId($arr[$keys[2]]); } }