本文整理汇总了PHP中PersonPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP PersonPeer::retrieveByPK方法的具体用法?PHP PersonPeer::retrieveByPK怎么用?PHP PersonPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PersonPeer
的用法示例。
在下文中一共展示了PersonPeer::retrieveByPK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeEdit
public function executeEdit(sfWebRequest $request)
{
if (!$this->getUser()->hasCredential(array('Administrator'), false)) {
$this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
$this->redirect('dashboard/index');
}
$this->forward404Unless($wing_leader = WingLeaderPeer::retrieveByPk($request->getParameter('id')), sprintf('Object wing_leader does not exist (%s).', $request->getParameter('id')));
$this->form = new WingLeaderForm($wing_leader);
$this->wing_leader_id = $request->getParameter("id");
if ($request->getParameter('person_id')) {
$this->person = PersonPeer::retrieveByPK($request->getParameter('person_id'));
}
}
示例2: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
if (!$this->getUser()->hasCredential(array('Administrator'), false)) {
$this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
$this->redirect('dashboard/index');
}
$this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
$this->forward404Unless($wing_job = WingJobPeer::retrieveByPk($request->getParameter('id')), sprintf('Object wing_job does not exist (%s).', $request->getParameter('id')));
$this->form = new WingJobForm($wing_job);
$this->processForm($request, $this->form, 'update');
$this->wing_role_id = $request->getParameter("id");
if ($request->getParameter('person_id')) {
$this->person = PersonPeer::retrieveByPK($request->getParameter('person_id'));
}
}
示例3: getPersonPhoto
private function getPersonPhoto(sfWebRequest $request, $attachment = false)
{
$person = PersonPeer::retrieveByPK($request->getParameter('id'));
if ($person && $person->getPhoto()) {
$filePath = $person->getPhotoFullPath();
$response = $this->getResponse();
$response->setHttpHeader('Pragma', '');
$response->setHttpHeader('Cache-Control', '');
$data = file_get_contents($filePath);
$file_exploded = explode('.', $person->getPhoto());
$file_extension = end($file_exploded);
if ($file_extension == 'jpg') {
$content_type = 'jpeg';
} else {
$content_type = $file_extension;
}
$response->setHttpHeader('Content-Type', 'image/' . $content_type);
if ($attachment) {
$response->setHttpHeader('Content-Disposition', "attachment; filename=\"" . $person->getPhoto() . "\"");
}
$response->setContent($data);
}
}
示例4: foreach
?>
"><a class="btn-close"
href="javascript:close1(<?php
echo $leg->getId();
?>
)">Close</a>
<div class="wrap"><?php
if (isset($leg_discussions)) {
foreach ($leg_discussions as $dis) {
?>
<div class="box">
<ul>
<li>
<h4><?php
if ($dis->getUserId()) {
$person = PersonPeer::retrieveByPK($dis->getUserId());
if (isset($person)) {
echo $person->getTitle() . ', ' . $person->getLastName() . ' ' . $person->getFirstName();
}
}
?>
</h4>
<?php
if ($dis->getIsSplit()) {
?>
<input type="checkbox" checked="checked" disabled="disabled" />
<label style="display:inline" for="split_mission">It is a split mission</label>
<?php
}
?>
<p><?php
示例5: foreach
<td>Flight Status</td>
<td>Action</td>
</tr>
</thead>
<tbody>
<?php
foreach ($members as $member) {
?>
<?php
$person_id = $member->getPersonId();
?>
<?php
if ($person_id) {
?>
<?php
$person = PersonPeer::retrieveByPK($person_id);
?>
<?php
}
?>
<?php
$wing_id = $member->getWingId();
?>
<?php
if ($wing_id) {
?>
<?php
$wing = WingPeer::retrieveByPK($wing_id);
?>
<?php
示例6: echo
<?php
}
?>
</td>
<td class="cell-2">
<?php
if ($miss->getPassengerId()) {
?>
<?php
$passenger = PassengerPeer::retrieveByPK($miss->getPassengerId());
?>
<?php
if ($passenger) {
?>
<?php
$person = PersonPeer::retrieveByPK($passenger->getPersonId());
if ($person) {
echo ($person->getTitle() ? $person->getTitle() . ' . ' : "") . $person->getFirstName() . ' ' . $person->getLastName();
}
?>
<?php
}
?>
<?php
}
?>
</td>
<td class="cell-1">
<!--/ CHECK SECURITY-->
<ul class="action-list">
<li><?php
示例7:
if ($mission_leg->getPilotId()) {
$pilot = PilotPeer::retrieveByPK($mission_leg->getPilotId());
$pilotMember = $pilot->getMember();
$pilot_person = PersonPeer::retrieveByPK($pilotMember->getPersonId());
$pilot_aircrafts = PilotAircraftPeer::getByMemberId($pilot->getMemberId());
}
// Mission Assistant
if ($mission_leg->getMissAssisId()) {
$mission_assistant = MemberPeer::retrieveByPK($mission_leg->getMissAssisId());
$miss_assi_persopn = PersonPeer::retrieveByPK($mission_assistant->getPersonId());
}
// Backup Pilot
if ($mission_leg->getBackupPilotId()) {
$backupPilot = PilotPeer::retrieveByPK($mission_leg->getBackupPilotId());
$backupPilotMember = $pilot->getMember();
$backupPilot_person = PersonPeer::retrieveByPK($backupPilotMember->getPersonId());
}
/*
echo "<pre>";
print_r($pilotMember);
die();
//*/
//Companions information
$companions = CompanionPeer::getByPassId($passenger->getId());
if ($passenger) {
$passenger_type = $passenger->getPassengerType();
}
$is_air = $mission_leg->getTransportation() == 'air_mission';
if ($is_air) {
$to_airport = $mission_leg->getAirportRelatedByToAirportId();
$from_airport = $mission_leg->getAirportRelatedByFromAirportId();
示例8: executeProcessStep3
public function executeProcessStep3(sfWebRequest $request)
{
slot('nav_menu', array('members', 'pending-renewal'));
$this->application_temp = ApplicationTempPeer::retrieveByPk($request->getParameter('id'));
$this->forward404Unless($this->application_temp);
$this->application_temp->getProcessedDate();
//Farazi
//Get Member Class Information
$this->member = MemberPeer::retrieveByPK($this->application_temp->getMemberId());
$this->memberclass = MemberClassPeer::retrieveByPK($this->member->getMemberClassId());
//echo "<pre>";
//print_r($this->memberclass);
$this->person = PersonPeer::retrieveByPK($this->application_temp->getPersonId());
if ($request->isMethod('post')) {
$this->processStep3Check($request);
}
$this->form1 = new ApplicationTempProcessStep1Form($this->application_temp);
$this->form2 = new ApplicationTempProcessStep2Form($this->application_temp);
$this->setTemplate('processSteps');
}
示例9: executeAvailableMissions
public function executeAvailableMissions(sfWebRequest $request)
{
$pilot = PilotPeer::retrieveByPK($this->getUser()->getPilotId());
if (!$pilot instanceof Pilot) {
return sfView::NONE;
}
if ($pilot->getPrimaryAirportId()) {
$this->mission_legs = MissionLegPeer::getPilotNear($pilot->getPrimaryAirportId());
} else {
$this->mission_legs = array();
}
$this->home_airport = $pilot->getAirport();
$ids = array();
foreach ($this->mission_legs as $leg) {
$ids[] = $leg->getId();
}
$c = new Criteria();
$c->add(MissionLegPeer::TRANSPORTATION, 'air_mission');
$c->add(MissionLegPeer::ID, $ids, Criteria::NOT_IN);
$c->add(MissionLegPeer::CANCELLED, null, Criteria::ISNULL);
$c1 = $c->getNewCriterion(MissionLegPeer::PILOT_ID, null, Criteria::ISNULL);
$c2 = $c->getNewCriterion(MissionLegPeer::COPILOT_ID, null, Criteria::ISNULL);
$c->add($c1->addOr($c2));
$c->setLimit(50);
$this->interest_legs = MissionLegPeer::doSelectJoinMission($c);
$c->clear();
$c->addJoin(MissionLegPeer::ID, PilotRequestPeer::LEG_ID, Criteria::LEFT_JOIN);
$c->add(PilotRequestPeer::ACCEPTED, 1, Criteria::NOT_EQUAL);
$c->add(MissionLegPeer::TRANSPORTATION, 'air_mission');
//$c->addAscendingOrderByColumn();
$c->setLimit(50);
$this->pending_legs = MissionLegPeer::doSelectJoinMission($c);
//ziyed
// validity
$person = PersonPeer::retrieveByPK($this->getUser()->getId());
//$this->forward404Unless($person);
$member = $person->getMember();
//$this->forward404Unless($member);
if ($member) {
$pilot = $member->getPilot();
} else {
$pilot = null;
}
// filter related
$this->date_widget = new widgetFormDate(array('format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text'));
if ($pilot) {
$this->personal_flights = $pilot->getPersonalFlights();
} else {
$this->personal_flights = array();
}
$this->wings = WingPeer::doSelect(new Criteria());
$this->idents = AirportPeer::doSelect(new Criteria());
$this->states = sfConfig::get('app_short_states');
$this->mission_types = MissionTypePeer::doSelect(new Criteria());
$this->member = $member;
$this->pilot = $pilot;
if ($pilot) {
$this->airport = $pilot->getAirport();
} else {
$this->airport = null;
}
if ($request) {
$this->processFilterForm($request);
}
if ($request->getParameter('needs') == 1) {
$this->needs_pilot = 1;
}
$this->pager = MissionPeer::getPilotAvailablePager($this->max, $this->airport, $this->page, $this->sort_by, $this->date_range1, $this->date_range2, $this->weekdays, $this->wing_id, $this->ident, $this->city, $this->state, $this->zip, $this->origin, $this->dest, $this->needs_pilot, $this->co_pilot, $this->ifr, $this->selected_types, $this->filled, $this->open, $this->max_pass, $this->max_weight, $this->max_distance, $this->min_efficiency, false, $this->ignore_availability);
$this->miss_array = $this->pager->getResults();
$this->total_mission_available = $this->pager->getNbResults();
$this->missions = MissionPeer::getByMayInterested($this->airport, $this->min_efficiency);
$ident = $request->getParameter('airport_ident');
if (!empty($ident)) {
$this->airport_ident = $request->getParameter('airport_ident');
} else {
$this->airport_ident = "";
}
//end ziyed
}
示例10: executeProcessStep3
public function executeProcessStep3(sfWebRequest $request)
{
//echo $request->getParameter('step3_redirect');die();
slot('nav_menu', array('members', 'pending-application'));
$this->application_temp = ApplicationTempPeer::retrieveByPk($request->getParameter('id'));
$this->forward404Unless($this->application_temp);
$this->person = PersonPeer::retrieveByPK($this->application_temp->getPersonId());
if ($request->isMethod('post')) {
$this->processStep3Check($request);
}
$this->form1 = new ApplicationTempProcessStep1Form($this->application_temp);
$this->form2 = new ApplicationTempProcessStep2Form($this->application_temp);
$this->setTemplate('processSteps');
}
示例11: executePilotMissionLegCancellationView
public function executePilotMissionLegCancellationView(sfWebRequest $request)
{
#security
if (!$this->getUser()->hasCredential(array('Administrator', 'Pilot', 'Staff', 'Coordinator', 'Volunteer'), false)) {
$this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
$this->redirect('dashboard/index');
}
$person = PersonPeer::retrieveByPK($this->getUser()->getId());
$this->forward404Unless($person);
$this->member = $person->getMember();
if ($this->member) {
$pilot = $this->member->getPilot();
} else {
$pilot = null;
}
$this->pilot = $pilot;
if ($pilot) {
$this->airport = $pilot->getAirport();
} else {
$this->airport = null;
}
$c = new Criteria();
$c->add(MissionLegPeer::PILOT_ID, $this->getUser()->getPilotId());
$c->add(MissionLegPeer::CANCEL_MISSION_LEG, 0);
$this->page = $request->getParameter("page", 1);
$this->max = $request->getParameter("max", 10);
$this->pager = new sfPropelPager('MissionLeg', $this->max);
$this->pager->setCriteria($c);
$this->pager->setPage($this->page);
$this->pager->init();
$this->miss_legs = $this->pager->getResults();
$this->url = 'pilotMissionLegCancellationView';
}
示例12: executePrintMissionLeg
public function executePrintMissionLeg(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');
}
if ($request->getParameter('id')) {
$this->leg = MissionLegPeer::retrieveByPK($request->getParameter('id'));
if (isset($this->leg)) {
$this->mission = MissionPeer::retrieveByPK($this->leg->getMissionId());
$this->requester = RequesterPeer::retrieveByPK($this->mission->getRequesterId());
$this->req_person = $this->requester->getPerson();
$this->agency = $this->requester->getAgency();
// Camp information
if ($this->mission->getCampId()) {
$this->camp = CampPeer::retrieveByPK($this->mission->getCampId());
}
//Coordinator
if ($this->mission->getCoordinatorId()) {
$this->coordinator = CoordinatorPeer::retrieveByPK($this->mission->getCoordinatorId());
$this->coordiPerson = PersonPeer::retrieveByPK($this->coordinator->getMember()->getPersonId());
}
if (isset($this->mission)) {
$this->itinerary = ItineraryPeer::retrieveByPK($this->mission->getItineraryId());
$pass = PassengerPeer::retrieveByPK($this->mission->getPassengerId());
//Companions information
$this->companions = CompanionPeer::getByPassId($this->mission->getPassengerId());
if (isset($pass) && $pass instanceof Passenger) {
$this->pass = $pass;
//print_r($this->pass);
//die();
$this->person = PersonPeer::retrieveByPK($pass->getPersonId());
$this->itinerary = $this->mission->getItinerary();
// Pre-define addresses for ground missions
$this->ground_addresses = array('patient' => '', 'facility' => '', 'lodging' => '', 'airport' => '');
$this->ground_addr_sel = sfConfig::get('app_ground_address_type', array());
if ($this->itinerary) {
//$this->ground_addresses['lodging'] = $this->ground_addresses['facility'] = $this->itinerary->getDestCity().', '.$this->itinerary->getDestState();
}
} else {
unset($this->passenger);
}
}
}
if (isset($this->leg) && $this->leg instanceof MissionLeg) {
if ($this->leg->getPilotId()) {
$this->pilot = PilotPeer::retrieveByPK($this->leg->getPilotId());
$this->pilot_member = MemberPeer::retrieveByPK($this->pilot->getMemberId());
$this->copilot = PilotPeer::retrieveByPK($this->leg->getCoPilotId());
$this->mission_assistant = PilotPeer::getByMemberId($this->leg->getMissAssisId());
$this->back_up_mission_assistant = PilotPeer::retrieveByPK($this->leg->getBackupMissAssisId());
}
}
if ($this->getUser()->hasAttribute('pilotAddToLegview')) {
$this->getUser()->setFlash("success", 'Pilot is added to this mission leg successfully !');
$this->getUser()->getAttributeHolder()->remove('pilotAddToLegview');
}
}
}
示例13: executeBoardMemberView
/**
* CODE: board member_view
*/
public function executeBoardMemberView(sfWebRequest $request)
{
if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Volunteer', 'Member'), false)) {
$this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
$this->redirect('dashboard/index');
}
if ($request->getParameter('person_id')) {
$this->person = PersonPeer::retrieveByPK($request->getParameter('person_id'));
}
if ($request->getParameter('id')) {
$b_member = BoardMemberPeer::retrieveByPK($request->getParameter('id'));
$this->title = 'View board member';
$this->person = PersonPeer::retrieveByPK($b_member->getPersonId());
$this->personID = $this->person->getId();
$query = "SELECT * FROM board_member ";
$query .= "WHERE person_id =" . $this->personID;
$con = Propel::getConnection();
$stmt = $con->prepare($query);
$stmt->execute();
$this->value = array();
while ($rs = $stmt->fetch(PDO::FETCH_OBJ)) {
$this->value[] = $rs;
}
}
}
示例14: executeAccept
/**
* Save Accept Pilot Request
* CODE:pilot_request_on_accept
*/
public function executeAccept(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->setTemplate(false);
if ($request->getParameter('id')) {
$req = PilotRequestPeer::retrieveByPK($request->getParameter('id'));
if (isset($req) && $req instanceof PilotRequest) {
if ($req->getAccepted() == 1) {
$req->setAccepted(0);
$req->setProcessed(1);
$req->setOnHold(0);
} else {
$req->setAccepted(1);
$req->setProcessed(1);
$member_id = $req->getMemberId();
$leg_id = $req->getLegId();
$mission_leg = MissionLegPeer::retrieveByPK($leg_id);
$leg_number = $mission_leg->getLegNumber();
$mission_id = $mission_leg->getMissionId();
/// Send Command Pilot Email
if ($member_id) {
$member = MemberPeer::retrieveByPK($member_id);
$person_id = $member->getPersonId();
$externalID = $member->getExternalId();
$person = PersonPeer::retrieveByPK($person_id);
$frist_name = $person->getFirstName();
$last_name = $person->getLastName();
$name = $frist_name . ' ' . $last_name;
$email = $person->getEmail();
if ($person->getEmail()) {
$pilot_type = "Command Pilot";
# send email requested pilot
$this->getComponent('mail', 'pilotRequestAccepted', array('email' => $email, 'name' => $name, 'externalID' => $externalID, 'pilot_type' => $pilot_type, 'leg_number' => $leg_number));
}
}
$req->save();
/// Accepted and Send Mission Assistand Email if pilot want mission assitand
$miss_assis_id = $req->getMissAssisId();
if ($miss_assis_id) {
$member = MemberPeer::retrieveByPK($req->getMissAssisId());
$externalID = $member->getExternalId();
$person = PersonPeer::retrieveByPK($member->getPersonId());
$frist_name = $person->getFirstName();
$last_name = $person->getLastName();
$name = $frist_name . ' ' . $last_name;
$email = $person->getEmail();
// Accept Mission Assistant
$pilot_request = PilotRequestPeer::getPilotRequestByMemberId($req->getMissAssisId(), $leg_id);
if ($pilot_request instanceof PilotRequest) {
$pilot_request->setAccepted(1);
$pilot_request->setProcessed(1);
$pilot_request->save();
} else {
return $this->renderText("not saved");
}
//return $this->renderText('Pilot Request: '.$pilot_request->getId());
if ($person->getEmail()) {
$pilot_type = "Mission Assistant";
# send email requested pilot
$this->getComponent('mail', 'pilotRequestAccepted', array('email' => $email, 'name' => $name, 'externalID' => $externalID, 'pilot_type' => $pilot_type, 'leg_number' => $leg_number));
}
}
$pilot = PilotPeer::getByMemberId($member_id);
$pilot_id = $pilot->getId();
$mission_leg->setPilotId($pilot_id);
$mission_leg->setMissAssisId($req->getMissAssisId());
$mission_leg->save();
$c = new Criteria();
$c->add(PilotRequestPeer::ID, NULL, Criteria::ISNOTNULL);
if ($req->getMissionAssistantWanted() == 1 && $req->getMissAssisId()) {
$getMemberId = $req->getMissAssisId();
$c->add(PilotRequestPeer::MEMBER_ID, $getMemberId, Criteria::NOT_EQUAL);
}
$c->add(PilotRequestPeer::ACCEPTED, 0);
$c->add(PilotRequestPeer::LEG_ID, $leg_id);
$reqs = PilotRequestPeer::doSelect($c);
foreach ($reqs as $reqpilot) {
if ($reqpilot instanceof PilotRequest) {
// Member information
$member = MemberPeer::retrieveByPK($reqpilot->getMemberId());
$externalID = $member->getExternalId();
// Person information
$person = PersonPeer::retrieveByPK($member->getPersonId());
$frist_name = $person->getFirstName();
$last_name = $person->getLastName();
$name = $frist_name . ' ' . $last_name;
$email = $person->getEmail();
$reqpilot->setAccepted(0);
$reqpilot->setProcessed(1);
$reqpilot->setOnHold(0);
$reqpilot->save();
// Mission Leg information
//.........这里部分代码省略.........
示例15: executeToggle
public function executeToggle(sfWebRequest $request)
{
$person = PersonPeer::retrieveByPK($this->getUser()->getId());
$html = '';
switch ($request->getParameter('name')) {
case 'email_blocked':
$person->setEmailBlocked($person->getEmailBlocked() == 1 ? 0 : 1);
if ($person->getEmailBlocked() == 1) {
$html = 'Yesun-block email';
} else {
$html = 'No block email';
}
break;
case 'email_text_only':
$person->setEmailTextOnly($person->getEmailTextOnly() == 1 ? 0 : 1);
if ($person->getEmailTextOnly() == 1) {
$html = 'Yesset to any';
} else {
$html = 'No set to text only';
}
break;
case 'email':
$validator = new sfValidatorEmail(array('required' => true), array('invalid' => 'Email address is invalid: %value%', 'required' => 'Email address is required'));
try {
$email = $validator->clean($request->getParameter('email'));
$person->setEmail($email);
$html = $email;
} catch (sfValidatorError $e) {
$html = '#' . $e->__toString();
}
break;
case 'email_list':
$email_list_person = new EmailListPerson();
$email_list_person->setPersonId($person->getId());
$email_list_person->setListId($request->getParameter('id'));
$result = EmailListPersonPeer::doSelectOne($email_list_person->buildCriteria());
if ($result instanceof EmailListPerson) {
$result->delete();
} else {
$email_list_person->save();
}
if ($email_list_person->isNew()) {
$html = 'subscribe';
} else {
$html = 'un-subscribe';
}
break;
}
$person->save();
return $this->renderText($html);
}