public function executeIndex(sfWebRequest $request) { #security if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Member'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getUri()); $this->redirect('dashboard/index'); } $this->email_lists = EmailListPeer::doSelect(new Criteria()); $this->role_widget = new sfWidgetFormPropelChoiceMany(array('model' => 'Role', 'method' => 'getTitle')); }
public function executeIndex(sfWebRequest $request) { $this->person = PersonPeer::retrieveByPK($this->getUser()->getId()); if ($pilot_id = $this->getUser()->getPilotId()) { $this->pilot = PilotPeer::retrieveByPK($pilot_id); } else { $this->pilot = null; } if ($member_id = $this->getUser()->getMemberId()) { $this->member = MemberPeer::retrieveByPK($member_id); // Farazi Renewal date calculation $date_now = strtotime("NOW"); $date_ren = strtotime($this->member->getRenewalDate()); $sub = $date_ren - $date_now; $preday = 0; if ($sub >= 86400) { $pday = $sub / 86400; $preday = explode('.', $pday); } else { $pday = $sub / 86400; $preday = explode('.', $pday); } $this->due_day = $preday[0]; //End Farazi Renewal date calculation } else { $this->member = null; } if ($this->member !== null && $this->pilot !== null) { $this->availability = $this->member->getAvailability(); } if (!$this->availability instanceof Availability) { $this->availability = new Availability(); } $this->email_lists = EmailListPeer::doSelect(new Criteria()); $this->subscribed_list = EmailListPersonPeer::getEmailListIdsByPersonId($this->person->getId()); }
/** * Displays a person information * CODE: person_view * @param sfWebRequest $request * @return unknown_type */ public function executeView(sfWebRequest $request) { #security if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Pilot', 'Coordinator', 'Volunteer'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } $this->person = PersonPeer::retrieveByPK($request->getParameter('id')); $this->forward404Unless($this->person); $this->requester = RequesterPeer::getByPersonId($this->person->getId()); $this->camp_id = $request->getParameter('camp_id'); if ($this->getUser()->hasCredential(array('Administrator', 'Staff', 'Pilot', 'Coordinator', 'Volunteer'), false)) { # get all roles $roles = RolePeer::getForSelect(); # get assigned roles $person_roles = PersonRolePeer::getByPersonId($this->person->getId()); $assoc_roles = array(); foreach ($person_roles as $person_role) { $assoc_roles[] = $person_role->getRoleId(); } $this->assoc_roles = $assoc_roles; # prepare widget $this->widget = new sfWidgetFormSelectDoubleList(array('choices' => $roles, 'label_unassociated' => 'Full List', 'label_associated' => 'Assigned Roles', 'associate' => 'lt;', 'associate_class' => 'btn-right', 'unassociate' => 'gt;', 'unassociate_class' => 'btn-left', 'template' => <<<EOF <div class="%class%" style="padding-top: 0px;"> <div class="holder"> <h4>%label_unassociated%</h4> %unassociated% </div> <ul class="btn-switch"> <li>%associate%</li> <li>%unassociate%</li> </ul> <div class="holder"> <h4>%label_associated%</h4> %associated% </div> <br style="clear: both" /> <script type="text/javascript"> sfDoubleList.init(document.getElementById('%id%'), '%class_select%'); </script> </div> EOF )); $this->form = new PersonForm(); } # email lists associated to the person $this->email_lists = EmailListPeer::doSelect(new Criteria()); $this->subscribed_list = EmailListPersonPeer::getEmailListIdsByPersonId($this->person->getId()); }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(EmailListPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(EmailListPeer::DATABASE_NAME); $criteria->add(EmailListPeer::ID, $pks, Criteria::IN); $objs = EmailListPeer::doSelect($criteria, $con); } return $objs; }
public function executeWingslist(sfWebRequest $request) { $this->flight_statuses = sfConfig::get('app_flight_statuses', array()); $this->email_lists = EmailListPeer::doSelect(new Criteria()); $this->wings = WingPeer::doSelect(new Criteria()); $this->states = sfConfig::get('app_states'); }
/** * Gets an array of EmailList objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Wing has previously been saved, it will retrieve * related EmailLists from storage. If this Wing is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array EmailList[] * @throws PropelException */ public function getEmailLists($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(WingPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collEmailLists === null) { if ($this->isNew()) { $this->collEmailLists = array(); } else { $criteria->add(EmailListPeer::WING_ID, $this->id); EmailListPeer::addSelectColumns($criteria); $this->collEmailLists = EmailListPeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(EmailListPeer::WING_ID, $this->id); EmailListPeer::addSelectColumns($criteria); if (!isset($this->lastEmailListCriteria) || !$this->lastEmailListCriteria->equals($criteria)) { $this->collEmailLists = EmailListPeer::doSelect($criteria, $con); } } } $this->lastEmailListCriteria = $criteria; return $this->collEmailLists; }