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(StudentMedicalPeer::ID, $pks, Criteria::IN); $objs = StudentMedicalPeer::doSelect($criteria, $con); } return $objs; }
public function executeListPhysical() { $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); $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $c = new Criteria(); $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c->addJoin(StudentPeer::ID, StudentAccalPeer::STUDENT_ID); $c->add(StudentPeer::STATUS, Student::STATUS_ACTIVE, Criteria::EQUAL); $c->addAscendingOrderByColumn(StudentPeer::CLASS_NAME); $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student')); $this->getUser()->setAttribute('max_per_page', $rpp, 'student'); $pager = new sfPropelPager('Student', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student')); $this->getUser()->setAttribute('page', $page, 'student'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); array_unshift($actions, array('name' => 'batal', 'url' => 'counseling_sd/list?academic_calendar_id=' . $academic_calendar->getId(), 'color' => 'black')); $this->actions = $actions; $actions2 = array(array('name' => '<span>Wali Kelas (2013)</span>', 'url' => 'counseling_sd/list?academic_calendar_id=' . $academic_calendar->getId(), 'color' => 'sun')); array_push($actions2, array('name' => '<span>' . $academic_calendar->toString() . '</span>', 'url' => 'counseling_sd/listPhysical?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sky', 'type' => 'direct')); $this->actions2 = $actions2; $ct = new Criteria(); $ct->add(StudentMedicalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $ct->add(StudentMedicalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $student_medicals = StudentMedicalPeer::doSelect($ct); $stu_medical = array(); foreach ($student_medicals as $student_medical) { $stu_medical[$student_medical->getStudentId()] = $student_medical; } $this->stu_medical = $stu_medical; $this->type = 'edit'; $this->counseling = $counseling; $this->subtitle = $academic_calendar->toString() . ' # ' . $counseling->getClassGroup()->toString(); $this->employee_id = $employee_id; $this->academic_calendar = $academic_calendar; }
public function getStudentMedicals($criteria = null, $con = null) { include_once 'lib/model/om/BaseStudentMedicalPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collStudentMedicals === null) { if ($this->isNew()) { $this->collStudentMedicals = array(); } else { $criteria->add(StudentMedicalPeer::STUDENT_HEALTH_ID, $this->getId()); StudentMedicalPeer::addSelectColumns($criteria); $this->collStudentMedicals = StudentMedicalPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(StudentMedicalPeer::STUDENT_HEALTH_ID, $this->getId()); StudentMedicalPeer::addSelectColumns($criteria); if (!isset($this->lastStudentMedicalCriteria) || !$this->lastStudentMedicalCriteria->equals($criteria)) { $this->collStudentMedicals = StudentMedicalPeer::doSelect($criteria, $con); } } } $this->lastStudentMedicalCriteria = $criteria; return $this->collStudentMedicals; }