public static function getForSelectParent() { $c = new Criteria(); $c->add(PersonPeer::LAST_NAME, null, Criteria::NOT_EQUAL); $c->addJoin(self::PERSON_ID, PersonPeer::ID); $donors = PersonPeer::doSelect($c); $arr = array(); $arr[0] = '-- select --'; foreach ($donors as $donor) { $arr[$donor->getId()] = $donor->getLastName(); } return $arr; }
/** * TODO: Add row to Add Passenger to camp details. * CODE:camp_add_passengers */ public function executeAddPassengerAjax(sfWebRequest $request) { #security if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Coordinator'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } $this->setLayout(false); $this->passenger_fname = trim($this->getRequestParameter('passenger_fname', '*')) == '' ? '*' : trim($this->getRequestParameter('passenger_fname', '*')); $this->passenger_lname = trim($this->getRequestParameter('passenger_lname', '*')) == '' ? '*' : trim($this->getRequestParameter('passenger_lname', '*')); $this->campid = $request->getParameter('id'); $this->persons = PersonPeer::doSelect(new Criteria()); }
public function executeAjaxAddPersonAndPassenger(sfWebRequest $request) { #Security if (!$this->getUser()->hasCredential(array('Administrator', 'Staff'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } //$this->setLayout(false); if ($request->getParameter('add_pass') == 'yes') { $this->person = new Person(); $this->person_title = 'Step 1 : Add person'; if ($request->getParameter('camp_id')) { $this->camp_id = $request->getParameter('camp_id'); } $this->stepped = 1; } if ($request->getParameter('add_pass_iti') == 'yes') { $this->person = new Person(); $this->person_title = 'Step 1 : Add person'; $this->person_itine = 1; } if ($request->getParameter('add_cont') == 'yes') { $this->person = new Person(); $this->person_title = 'Step 1 : Add person'; $this->contact = 1; } if ($request->getParameter('id')) { $this->person = PersonPeer::retrieveByPK($request->getParameter('id')); $this->person_title = 'Edit person'; } else { $this->person = new Person(); $this->person_title = 'Add person'; } # Person Form $this->person_form = new PersonForm($this->person); $this->back = $request->getReferer(); //session $this->key = $request->getParameter('key'); if (!$this->key) { $this->key = rand(1000, 9999); } if (strstr($request->getReferer(), 'person/view')) { if ($this->person) { //session $referer_session = $this->getUser()->getAttribute('ref'); if (!$referer_session) { $referer_session = array($this->key => array()); $this->getUser()->setAttribute('ref', $referer_session); } elseif (!isset($referer_session[$this->key])) { $a = '@person_view?id=' . $this->person->getId(); $referer_session[$this->key] = array('referer' => $a); $this->getUser()->setAttribute('ref', $referer_session[$this->key]); } } } $this->person_referer = $request->getParameter('referer'); if ($request->isMethod('post')) { if ($request->hasParameter('action_from_passenger_or_requester')) { $this->action_from = $request->getParameter('action_from_passenger_or_requester'); } $this->person_referer = $request->getParameter('referer'); $this->person_form->bind($request->getParameter('per')); if ($this->person_form->isValid() && $request->getParameter('per[first_name]') != "" && $request->getParameter('per[last_name]') != "") { $this->person->setTitle($this->person_form->getValue('title')); $this->person->setFirstName($this->person_form->getValue('first_name')); $this->person->setLastName($this->person_form->getValue('last_name')); $this->person->setAddress1($this->person_form->getValue('address1')); $this->person->setAddress2($this->person_form->getValue('address2')); $this->person->setCity($this->person_form->getValue('city')); $this->person->setCounty($this->person_form->getValue('county')); $this->person->setState($this->person_form->getValue('state')); $this->person->setCountry($this->person_form->getValue('country')); $this->person->setZipcode($this->person_form->getValue('zipcode')); $this->person->setDayPhone($this->person_form->getValue('day_phone')); $this->person->setDayComment($this->person_form->getValue('day_comment')); $this->person->setEveningPhone($this->person_form->getValue('evening_phone')); $this->person->setEveningComment($this->person_form->getValue('evening_comment')); $this->person->setMobilePhone($this->person_form->getValue('mobile_phone')); $this->person->setMobileComment($this->person_form->getValue('mobile_comment')); $this->person->setPagerPhone($this->person_form->getValue('paper_phone')); $this->person->setPagerComment($this->person_form->getValue('paper_comment')); $this->person->setOtherPhone($this->person_form->getValue('other_phone')); $this->person->setOtherComment($this->person_form->getValue('other_comment')); $this->person->setFaxPhone1($this->person_form->getValue('fax_phone1')); $this->person->setFaxComment1($this->person_form->getValue('fax_comment1')); $this->person->setAutoFax($this->person_form->getValue('auto_fax')); $this->person->setFaxPhone2($this->person_form->getValue('fax_phone2')); $this->person->setFaxComment2($this->person_form->getValue('fax_comment2')); $this->person->setEmail($this->person_form->getValue('email')); $this->person->setEmailTextOnly($this->person_form->getValue('email_text_only')); $this->person->setEmailBlocked($this->person_form->getValue('email_blocked')); $this->person->setComment($this->person_form->getValue('comment')); //$this->person->setBlockMailings($this->person_form->getValue('block_mailings')==0?null:$this->person_form->getValue('block_mailings')); $this->person->setBlockMailings($this->person_form->getValue('block_mailings')); $this->person->setNewsletter($this->person_form->getValue('newsletter')); $this->person->setGender($this->person_form->getValue('gender')); $this->person->setDeceased($this->person_form->getValue('deceased')); $this->person->setDeceasedComment($this->person_form->getValue('deceased_comment')); $this->person->setSecondaryEmail($this->person_form->getValue('secondary_email')); $this->person->setDeceasedDate($this->person_form->getValue('deceased_date')); $this->person->setMiddleName($this->person_form->getValue('middle_name')); $this->person->setSuffix($this->person_form->getValue('suffix')); $this->person->setNickname($this->person_form->getValue('nickname')); $this->person->setVeteran($this->person_form->getValue('veteran')); if ($this->person->isNew()) { $content = $this->getUser()->getName() . ' added new Person: ' . $this->person->getFirstName(); ActivityPeer::log($content); } $this->person->save(); //////////////////////////////////////#bglobal omar if ($this->person->getId()) { $passenger = new Passenger($this->person->getId()); $passenger->setPersonId($this->person->getId()); $passenger->save(); $c = new Criteria(); $c->add(RoleNotificationPeer::MID, 5); $c->add(RoleNotificationPeer::NOTIFICATION, 1); $c->addOr(RoleNotificationPeer::NOTIFICATION, 3); $c->addJoin(RoleNotificationPeer::ROLE_ID, PersonRolePeer::ROLE_ID); $c->addJoin(PersonRolePeer::PERSON_ID, PersonPeer::ID); $personemail = PersonPeer::doSelect($c); $allemail = array(); $pindex = 0; foreach ($personemail as $getEmail) { if (strlen($getEmail->getEmail()) > 0) { $allemail[$pindex++] = $getEmail->getEmail(); } else { if (strlen($getEmail->getSecondaryEmail()) > 0) { $allemail[$pindex++] = $getEmail->getSecondaryEmail(); } } } //$allemail[$pindex]="*****@*****.**"; /* $email['subject']="New Person added"; $link=$request->getHost()."/person/view/".$this->person->getId(); $body="A new person added in ".$request->getHost()."\r\n" .$this->person->getFirstName()." ".$this->person->getLastName()."\r\n Profile Link: ".$link; $email['body']=$body; $email['sender_email']="*****@*****.**"; $this->getComponent('mail', 'sendBulk', array( 'subject' => $email['subject'], 'recievers' => $allemail, 'sender' => $email['sender_email'], 'body' => $email['body'], ));*/ } ///////////////////////////////////// if ($request->hasParameter('has')) { $data = ''; if ($request->getParameter('camp_id')) { $data = '&camp_id=' . $request->getParameter('camp_id'); } $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!'); $this->redirect('@passenger_create?add_pass='******'has') . '&p_id=' . $this->person->getId() . $data); } if ($request->hasParameter('iti')) { $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!'); $this->redirect('@passenger_create?add_pass_iti=' . $request->getParameter('iti') . '&p_id=' . $this->person->getId()); } if ($request->hasParameter('contact')) { $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add contact!'); $this->redirect('@contact_create?person_id=' . $this->person->getId()); } $this->getUser()->setFlash('success', 'Person information has been successfully saved!'); $last = $request->getParameter('back'); $referer_session = $this->getUser()->getAttribute('ref'); //$back_url = '@person_view?id='.$this->person->getId(); //$this->redirect($back_url); //$this->person_a = $this->person_form->getValue('first_name').' '. $this->person_form->getValue('last_name'); //return $this->renderText('Person information has been successfully saved!'); //return $this->renderText($this->person_form->getValue('first_name').' '. $this->person_form->getValue('last_name')); $this->personpass_id = $this->person->getId(); $this->_passenger = PassengerPeer::getByPersonId($this->personpass_id); $this->personpass_last_name = $this->person->getLastName(); //echo $this->person->getId(); //$this->person_a = $this->person_form->getValue('first_name').' '. $this->person_form->getValue('last_name'); } else { if ($request->getParameter("per[title]") == "") { $this->titleError = "true"; } if ($request->getParameter("per[first_name]") == "") { $this->first_name_error = "true"; } if ($request->getParameter("per[last_name]") == "") { $this->last_name_error = "true"; } } $this->person_form__ = $request->getRequestParameters(); $this->setTemplate("ajaxAddPersonAndPassenger"); } else { # Set referer URL $this->person_referer = $request->getReferer() ? $request->getReferer() : '@person'; } }
public function executeInstrumentNotication(sfWebRequest $request) { $c = new Criteria(); $c->add(PersonRolePeer::PERSON_ID, $this->getUser()->getId()); $c->addJoin(PersonRolePeer::ROLE_ID, RoleNotificationPeer::ROLE_ID); $personNotification = RoleNotificationPeer::doSelect($c); $this->mid = 0; foreach ($personNotification as $key => $value) { $this->mid = $value->getMid(); $this->notification = $value->getNotification(); //5. person add if ($this->mid == 5 && ($this->notification == 2 || $this->notification == 3)) { $c = new Criteria(); $c->addDescendingOrderByColumn(PersonPeer::ID); $c->setLimit(5); $this->newperson = PersonPeer::doSelect($c); } } $this->host = $request->getHost(); $this->memberId = $this->getUser()->getMemberId(); //$query = "SELECT COUNT(pilot_request.accepted) FROM pilot_request "; //$query .="WHERE pilot_request.accepted = 1 AND pilot_request.processed = 1 AND pilot_request.member_id = ".$this->memberId; //$con = Propel::getConnection(); //$stmt = $con->prepare($query); //$stmt->execute(); /*if($rs = $stmt->fetch(PDO::FETCH_NUM)) { $count = (int)$rs[0]; }else{ $count = 0; }*/ $c = new Criteria(); $c->add(PilotRequestPeer::ACCEPTED, 1); $c->add(PilotRequestPeer::PROCESSED, 1); $c->add(PilotRequestPeer::MEMBER_ID, $this->memberId); $this->totalAccepted = PilotRequestPeer::doCount($c); /* $this->memberId = $this->getUser()->getMemberId(); $query = "SELECT COUNT(pilot_request.accepted) FROM pilot_request "; $query .="WHERE pilot_request.accepted = 0 AND pilot_request.member_id = $this->memberId"; $con = Propel::getConnection(); $stmt = $con->prepare($query); $stmt->execute(); if($rs = $stmt->fetch(PDO::FETCH_NUM)) { $count = (int)$rs[0]; }else{ $count = 0; }*/ $c = new Criteria(); $c->add(PilotRequestPeer::ACCEPTED, 0); $c->add(PilotRequestPeer::MEMBER_ID, $this->memberId); $this->totaldeclined = PilotRequestPeer::doCount($c); $c = new Criteria(); $c->add(MissionLegPeer::PILOT_ID, $this->getUser()->getPilotId()); $c->add(MissionLegPeer::CANCEL_MISSION_LEG, 0); $this->totalMissionCancellation = MissionLegPeer::doCount($c); //total signup events count $pilot_id = $this->getUser()->getPilotId(); if ($pilot_id) { $pilot = PilotPeer::retrieveByPK($pilot_id); $member_id = $pilot->getMemberId(); $date = date('Y-m-d'); $c = new Criteria(); $c->add(EventReservationPeer::MEMBER_ID, $member_id, Criteria::EQUAL); $c->addJoin(EventPeer::ID, EventReservationPeer::EVENT_ID); $c->add(EventPeer::EVENT_DATE, $date, Criteria::GREATER_EQUAL); $this->totalSignupEvents = EventReservationPeer::doCount($c); } // }
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(PersonPeer::ID_PERSON, $pks, Criteria::IN); $objs = PersonPeer::doSelect($criteria, $con); } return $objs; }
public static function getNotInPilot() { $c = new Criteria(); $pliots = PilotPeer::doSelect($c); if ($pliots) { foreach ($pliots as $pliot) { $c->addJoin(self::ID, PilotPeer::MEMBER_ID, Criteria::LEFT_JOIN); $c->addJoin(self::PERSON_ID, PersonPeer::ID); $c->add(PilotPeer::MEMBER_ID, null, Criteria::ISNULL); $not_in_pilot_persons = PersonPeer::doSelect($c); } } else { $not_in_pilot_persons = PersonPeer::doSelect($c); } $arr = array(); $arr[0] = '-- select --'; foreach ($not_in_pilot_persons as $not_in_pilot_person) { $arr[$not_in_pilot_person->getId()] = $not_in_pilot_person->getLastName(); } return $arr; }