Exemple #1
0
 /**
  * Save Mission's Comment
  * CODE:
  */
 public function executeSaveCommentMission()
 {
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $this->mission = MissionPeer::retrieveByPk($this->getRequestParameter('id'));
         if (isset($this->mission) && $this->mission instanceof Mission) {
             if (trim($this->getRequestParameter('value'))) {
                 //if camp mission comment then set comment to all missions
                 // 2010.05.04
                 if ($this->mission->getCampId() != null) {
                     foreach (MissionPeer::getByCampId($this->mission->getCampId()) as $miss) {
                         $miss->setMissionSpecificComments($this->getRequestParameter('value'));
                         $miss->save();
                     }
                 }
                 $this->mission->setMissionSpecificComments($this->getRequestParameter('value'));
                 $this->mission->save();
                 /*$str = <<<XYZ
                         <script type="text/javascript">
                         window.location.reload();
                         </script>
                 XYZ;*/
                 return $this->renderText($this->getRequestParameter('value'));
             }
         }
     }
 }
Exemple #2
0
    public function executeEditInPlace(sfWebRequest $request)
    {
        if ($this->getRequest()->getMethod() == sfRequest::POST) {
            $this->mission = MissionPeer::retrieveByPk($this->getRequestParameter('id'));
            if (isset($this->mission) && $this->mission instanceof Mission) {
                if (trim($this->getRequestParameter('value'))) {
                    $this->mission->setMissionSpecificComments($this->getRequestParameter('value'));
                    $this->mission->save();
                    $str = <<<XYZ
        <script type="text/javascript">
          window.location.reload();
        </script>
XYZ;
                    return $this->renderText($str);
                }
            }
        }
    }
Exemple #3
0
 /**
  * cancel Mission
  */
 public function executeCancelMission(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');
     }
     //$request->checkCSRFProtection();
     $this->forward404Unless($mission = MissionPeer::retrieveByPk($request->getParameter('id')), sprintf('Object itinerary does not exist (%s).', $request->getParameter('id')));
     $mission = MissionPeer::retrieveByPk($request->getParameter('id'));
     $mLeg = MissionLegPeer::getAllMissionLegByMissionId($request->getParameter('id'));
     //$countLeg = MissionLegPeer::getMissionLegByMissionIdCount($request->getParameter('id'));
     if (isset($mission)) {
         //if(isset($countLeg)){
         foreach ($mLeg as $ml) {
             $ml->setCancelMissionLeg(0);
             $ml->save();
         }
         //}
         $mission->setCancelMission(0);
         $mission->save();
         //mail
         $receivers = retrieveEmailAddressesRelatedToItinerary::getEmailAddressesOfPersonsRelatedToMission($mission);
         $mission_legs = $mission->getMissionLegs();
         foreach ($mission_legs as $mission_leg) {
             $receivers = array_merge($receivers, retrieveEmailAddressesRelatedToItinerary::getEmailAddressesOfPersonsRelatedToMissionLeg($mission_leg));
         }
         //print_r($receivers);    exit ();
         $text = 'Mission ' . $mission->getId() . ' has been cancelled. Regards, Angel Flight West';
         //       unset($receivers);
         //       $receivers[] = '*****@*****.**';
         //       $receivers[] = '*****@*****.**';
         $this->getComponent('mail', 'itinerary_Mission_MissionLegCancel', array('email' => array_unique($receivers), 'subject' => 'Angel Flight West Mission cancel information', 'text' => $text));
     }
     $this->getUser()->setFlash('success', 'The mission ' . $mission->getId() . ' has been cancelled successfully.');
     $this->redirect('mission/index');
 }