Example #1
0
 /**
  * CODE: passenger_type_delete
  * TODO: Check related records
  */
 public function executeDeleteType(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');
     }
     if ($request->isMethod('post')) {
         try {
             $type = PassengerTypePeer::retrieveByPK($request->getParameter('id'));
             $this->forward404Unless($type);
             $type->delete();
             $this->getUser()->setFlash('success', 'Passenger type information has been successfully deleted!');
         } catch (Exception $e) {
             $this->getUser()->setFlash('warning', "There are related persons to this passenger type. Please remove them first.");
         }
     }
     return $this->redirect('@ptype');
 }
Example #2
0
             </div>
             <div class="b"></div>
           </div>
         <?php 
 }
 ?>
       </dd>
       
       <dt>Passenger Type:</dt>
       <dd>
         <a href="#">
           <?php 
 if ($passenger) {
     ?>
             <?php 
     $passenger_type = PassengerTypePeer::retrieveByPK($passenger->getPassengerTypeId());
     ?>
             <?php 
     if (isset($passenger_type)) {
         ?>
                 <?php 
         echo $passenger_type->getName();
         ?>
             <?php 
     }
     ?>
           <?php 
 }
 ?>
         </a>
         <?php