Priority-notifications

From VPOIDS Documentation

Recent notifications

Missions accepted

     //Ziyed Pilot total accepted mission counter
     $c = new Criteria();
     $c->add(PilotRequestPeer::ACCEPTED, 1);     
     $c->add(PilotRequestPeer::MEMBER_ID, $this->memberId);    
     $c->addJoin(PilotRequestPeer::LEG_ID,MissionLegPeer::ID);
     $c->addJoin(MissionLegPeer::MISSION_ID,MissionPeer::ID);
     $c->add(MissionLegPeer::CANCEL_MISSION_LEG, 1);
     $daybefore = date("Y-m-d",strtotime("-30 days"));
     $c->add(MissionPeer::MISSION_DATE,$daybefore,Criteria::GREATER_EQUAL); //mission date must be grater than past 30 days from now
     $this->totalAccepted = PilotRequestPeer::doCount($c);
     //end ziyed    

Missions declined

     //Ziyed Pilot total declined mission counter
     $c = new Criteria();
     $c->add(PilotRequestPeer::ACCEPTED, 0);
     $c->add(PilotRequestPeer::MEMBER_ID, $this->memberId);
     $c->addJoin(PilotRequestPeer::LEG_ID,MissionLegPeer::ID);    
     $c->addJoin(MissionLegPeer::MISSION_ID,MissionPeer::ID);
     $c->add(MissionLegPeer::CANCEL_MISSION_LEG, 1);
     $daybefore = date("Y-m-d",strtotime("-30 days"));
     $c->add(MissionPeer::MISSION_DATE,$daybefore,Criteria::GREATER_EQUAL); //mission date must be grater than past 30 days from now
     $this->totaldeclined = PilotRequestPeer::doCount($c);
     //end ziyed

Canceled

     //Ziyed Pilot total cancelled mission counter
     $c = new Criteria();
     $c->add(MissionLegPeer::PILOT_ID, $this->getUser()->getPilotId());
     $c->add(MissionLegPeer::CANCEL_MISSION_LEG, 0);
     $c->addJoin(MissionLegPeer::MISSION_ID,MissionPeer::ID);
     $daybefore = date("Y-m-d",strtotime("-30 days"));
     $c->add(MissionPeer::MISSION_DATE,$daybefore,Criteria::GREATER_EQUAL);//mission date must be grater than past 30 days from now
     $this->totalMissionCancellation = MissionLegPeer::doCount($c);
     //end ziyed

Priority list notifications

These are the notifications users receive in their priority list in the dashboard, based on their role.

Values calculated in components.class.php

executePriorityList() method



   // missions for this member from or to their home base airport
   if ($pilot->getPrimaryAirportId()) {
     $this->near_mission = MissionLegPeer::getPilotNear($pilot->getPrimaryAirportId());
   }else{
     $this->near_mission = array();
   }
   // missions for this member from or to their home base airport
   if ($pilot->getPrimaryAirportId()) {
     $this->home_base_missions = MissionLegPeer::getPilotNear($pilot->getPrimaryAirportId());
   }else{
     $this->home_base_missions = array();
   }
   // missions for this member from or to their wing
   if ($pilot->getMember()) {
   	$wing_id = $pilot->getMember()->getWingId();
     $this->wing_missions = MissionLegPeer::getByPilotWing($wing_id);
   }else{
     $this->wing_missions = array();
   }


Outstanding pilot requests

Roles: Administrator, Staff

Message: x Pilot Requests will be flown in 1-2 days; please process them.

Links to: url_for('@pilot_request_list')

$this->pilot_request_count = PilotRequestPeer::countIn2Days();

   $query = "SELECT count(*) FROM pilot_request ";
   $query.= "JOIN mission_leg ON pilot_request.leg_id=mission_leg.id ";
   $query.= "JOIN mission ON mission_leg.mission_id=mission.id ";
   $query.= "WHERE pilot_request.accepted != 1  ";
   $query.= "AND mission.mission_date >= NOW() AND datediff(mission_date, now()) < 2 ";


Missions with no pilot in the next 1-2 days

Role: Pilot

Message: <?php echo $no_pilot_count?> Missions are scheduled in 1-2 days and still need pilot; please process them.

Links to: url_for('@request_legs?needs=1');?>">

$this->no_pilot_count = MissionPeer::countNoPilotIn2Days();

Not sure that this is appropriate for pilots.

Missions</a> are scheduled in 1-2 days and still need pilot; please process them.

Does not include any legs that have a pilot request, processed or unprocessed. Not sure if that's appropriate.

Recently canceled legs

Role: Administrator

Message: <?php echo $cancelled_legs?> future mission legs are canceled; please review the changes.

Links to: url_for('missionLeg/indexCancelled

$this->cancelled_legs = MissionLegPeer::countCancelled();

For admins:

<?php echo $cancelled_legs?> future mission legs</a> are canceled; please review the changes.

  public static function countCancelled()
  {
    $c = new Criteria();
    $c->addJoin(self::MISSION_ID, MissionPeer::ID);
    $c->add(MissionLegPeer::CANCELLED, null, Criteria::ISNOTNULL);
    $c->add(MissionPeer::MISSION_DATE, date('Y-m-d').' 00:00:00', Criteria::GREATER_EQUAL);
    //$c->add(MissionLegPeer::CANCEL_COMMENT, null, Criteria::ISNULL);
    return MissionLegPeer::doCount($c);
  }

Recently coordinated legs

Note: This is currently commented out. Not sure why.

Roles: Administrator','Staff','Coordinator'

Messages: <?php echo $name;?> has been added to mission <?php echo $mission->getExternalId();?>-<?php echo $mission_leg->getLegNumber();?>

//New Pilot added to the mission leg if($this->getUser()->hasCredential(array('Administrator','Staff','Coordinator'), false)){

  $this->pilots_added = PilotRequestPeer::getPilotsAdded();

}

These are pilot requests which have been processed and were created within the last 24 hours.

       $c = new Criteria();
        $preDate=date('Y-m-d H:i:s', time()-10*86400);
        $c->addJoin(self::LEG_ID,MissionLegPeer::ID,Criteria::LEFT_JOIN);
        $c->addJoin(MissionLegPeer::MISSION_ID,MissionPeer::ID,Criteria::LEFT_JOIN);
        $c->add(self::ACCEPTED , 1);
        $c->addAnd(self::CREATED_AT, ' pilot_request.created_at <= "'.date('Y-m-d H:i:s').'" AND pilot_request.created_at >= "'.$preDate.'"', Criteria::CUSTOM);
        $c->addDescendingOrderByColumn(self::DATE);
        //echo $c->toString();
        //die();
        return self::doSelect($c);


Missions available in your area (for pilots)

Note: This was deprecated in favor of notifications about missions in their wing and from/to their home base.

Roles: Pilot

Message: There <?php if (count($near_mission) == 1) echo "is"; else echo "are"; ?> <a href="/request_legs"><?php echo count($near_mission)?> mission<?php if (count($near_mission) > 1) echo "s"; ?> available</a> in your area.

Links to: <a href="/request_legs"> (pilot request)

Calls a function in missionLegPeer getPilotNear($airport){

   $c->addAscendingOrderByColumn(self::MISSION_ID);
   $c->addJoin(self::MISSION_ID, MissionPeer::ID);
   $c->add(MissionPeer::MISSION_DATE, date('Y-m-d'), Criteria::GREATER_EQUAL);
   if($airport !=null){
     $criterion = $c->getNewCriterion(self::FROM_AIRPORT_ID, $airport, Criteria::LIKE );
     $criterion->addOR($c->getNewCriterion(self::TO_AIRPORT_ID, $airport, Criteria::LIKE));
     $c->add($criterion);
   }

Missions pending (for pilots)

Roles: Pilot

Message: You have <a href="<?php echo url_for('mission/pendingPilot?pilot_id='.$p_id);?>"><?php echo $pinding?> Missions</a> pending.

Links to: url_for('mission/pendingPilot?pilot_id='.$p_id

Renewal notices

Roles: Pilot, Member

Message:

* if the due date is past today: Your membership renewal is overdue. Please renew now so you can continue flying missions.
* If the due date is coming up in less than 30 days: Your membership renewal is due in less than thirty days. Why not renew now?  

Links to: url_for('renewal/step1') (member renewal)

Unprocessed mission requests

Administrator There <?php if($un_proc_miss_req > 1):?>are <?php else:?>is <?php endif;?> <a href="<?php echo url_for('miss_req');?>"><?php echo $un_proc_miss_req?> unprocessed</a> mission request(s). Please process.

// Get number of un processed mission requests $this->un_proc_miss_req = MissionRequestPeer::getNumberOfNonProcessedMissionRequest();

Unprocessed member applications

Administrator There <?php if($un_proc_mem_apps > 1):?>are <?php else:?>is <?php endif;?><a href="<?php echo url_for('/pending_member');?>"><?php echo $un_proc_mem_apps?> unprocessed</a> member application(s). Please process.

// Get number of un processed member applications $this->un_proc_mem_apps = ApplicationTempPeer::getNonProcessedMemberApplications();

Unprocessed pilot requests

Administrator There <?php if($un_proc_pilot_reqs > 1):?>are <?php else:?>is <?php endif;?><a href="<?php echo url_for('pilot_request_list');?>"><?php echo $un_proc_pilot_reqs?> unprocessed</a> pilot request(s). Please process.

// Get number of un processed pilot requests $this->un_proc_pilot_reqs = PilotRequestPeer::getPager()->getNbResults ();

Upcoming un-coordinated missions

Administrator There <?php if($un_coor_mission_legs > 1):?>are <?php else:?>is <?php endif;?><a href="<?php echo url_for('/leg?noncoordinatedlegs=true');?>"><?php echo $un_coor_mission_legs?></a> afa or linking mission legs, which <?php if($un_coor_mission_legs > 1):?>are <?php else:?>is <?php endif;?>pending but there is not pilot attached and the mission date is less than 5 days from today.

$this->un_coor_mission_legs = MissionLegPeer::getPager(

  10,/* $max*/1 /* page */,null,null,null,
  null, null, null, null, null, null, null,
  null, null, null, null, null, null, null,  true/*$notcoordinated*/
  )->getNbResults ();

in MissionLegPeer:getPager

   if($notcoordinated){
     $c->add(MissionLegPeer::PILOT_ID, null, Criteria::ISNULL);
     $c->addJoin(MissionLegPeer::ID, PilotRequestPeer::LEG_ID,Criteria::LEFT_JOIN);
     $c->add(PilotRequestPeer::ACCEPTED, 1, Criteria::NOT_EQUAL);
     $c->add(MissionLegPeer::CANCELLED, null, Criteria::ISNULL);
     $c->add(MissionLegPeer::ID, "(DATEDIFF(".MissionPeer::MISSION_DATE.", CURDATE()) IN (0, 1, 2, 4, 5))", Criteria::CUSTOM);
   }

Should remove the part about the pilot request. Also, the language refers to afa legs, but this doesn't have anything to do with linking legs.

This would include linking legs, however, since they're not filtered out.

Unprocessed contact requests

Administrator There are <a href="/contact/listRequest"><?php if(isset($un_proce_contact_req)) echo $un_proce_contact_req ;else "0"; ?> unprocessed</a> contact request(s). Please process.

   // ziyed : count unprocessed contact request
    $c = new Criteria();
    $c->add(ContactRequestPeer::PROCESSED,NULL, Criteria::ISNULL);
    $this->un_proce_contact_req = ContactRequestPeer::doCount($c);
   //end

if ($graterThanOneDay > 0) { ?>

There are <a href="/contact/listRequest?graterOneDay=ok"><?php if(isset($graterThanOneDay)) echo $graterThanOneDay ;else "0"; ?> unprocessed</a> contact request(s) more than one day old. Please process.

Administrator','Staff','Coordinator'), false) && $new_contact_requeststs) A new request for information was received <?php echo link_to('Process', 'contact/processRequest?id='.$new_contact_requestst->getId())?>

    //Farazi : new contact requests
    $c = new Criteria();
    $c->add(ContactRequestPeer::PROCESSED,NULL, Criteria::ISNULL);
    $this->new_contact_requeststs = ContactRequestPeer::doSelect($c);
   //end
   
    // ziyed : count unprocessed contact request
    $c = new Criteria();
    $c->add(ContactRequestPeer::PROCESSED,NULL, Criteria::ISNULL);     
    $c->add(ContactRequestPeer::REQUEST_DATE, 'ABS(DATEDIFF( NOW( \'Y-m-d\' ),'.ContactRequestPeer::REQUEST_DATE.') ) > 1', Criteria::CUSTOM);
    $this->graterThanOneDay = ContactRequestPeer::doCount($c);
    //end

Removed from mission (for pilots)

Pilot You were removed from mission <?php echo $mission->getExternalId();?>-<?php echo $mission_leg->getLegNumber();?> .If you feel that this is in error, please contact the office as soon as possible.

$this->removed_pilot = PilotRequestPeer::getRemovedPilot($pilot->getMemberId());

Re-request mission opportunity (for pilots)

Pilot A mission you requested is now in need of a pilot. If you're still interested, please view the mission <a href="/leg_view/<?php echo $req->getLegId();?>"><?php echo $mission->getExternalId();?>-<?php echo $mission_leg->getLegNumber();?></a> and request it again, or contact the office.

$this->revival_pilot = PilotRequestPeer::getRevivalPilot($pilot->getMemberId());

Mission report pending

Pilot'), false) && $mission_report_dues) {?> Thank for your flying an Angel Flight mission recently. Please complete the mission report as soon as possible. <a href="<?php echo url_for('mission_report/index');?>"><?php echo $mission_report_dues?> Mission reports</a>

$c = new Criteria();
$pilotId = $this->getUser()->getPilotId();
$c->add(MissionLegPeer::PILOT_ID,$pilotId, Criteria::EQUAL);
$c->add(MissionLegPeer::MISSION_REPORT_ID,NULL, Criteria::ISNULL);
$c->add(MissionLegPeer::CANCEL_MISSION_LEG,1, Criteria::EQUAL);
$c->addJoin(MissionPeer::ID, MissionLegPeer::MISSION_ID, Criteria::LEFT_JOIN);
$c->add(MissionPeer::MISSION_DATE, 'NOW( \'Y-m-d\' )', Criteria::LESS_THAN);
//echo $c->toString();
$this->mission_report_dues = MissionLegPeer::doCount($c);
//End Farazi