public function executeEdit() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $payment_student = PaymentJournalPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($payment_student); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'payment_student/delete?id=' . $payment_student->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'payment_student/list', 'color' => 'white')); $this->subtitle = $payment_student->toString() . ' - id:' . $payment_student->getId(); $this->type = 'edit'; $this->payment_student = $payment_student; $this->actions = $actions; $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo'); $depts = $dept->getChildRecurs(array()); $this->academic_costs = array(); $c = new Criteria(); $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $depts, Criteria::IN); $c->addJoin(AcademicCalendarPeer::ID, VAcademicCostPeer::ACADEMIC_CALENDAR_ID); $costs = VAcademicCostPeer::doSelect($c); foreach ($costs as $cost) { $academic_costs[$cost->getId()] = $cost->toStringCap(); } $this->academic_costs = $academic_costs; }
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(VAcademicCostPeer::ID, $pks, Criteria::IN); $objs = VAcademicCostPeer::doSelect($criteria, $con); } return $objs; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = VAcademicCostPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setCode($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setAmount($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setAcademicCalendarId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setAcademicCostComponentId($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setAcademicProcessId($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setBankAccountId($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setDescription($arr[$keys[7]]); } }