Ejemplo n.º 1
0
 public function indexAction()
 {
     try {
         $request = $this->getRequest();
         $deliveryboyMapper = new Application_Model_DeliveryBoyMapper();
         $deliveryBoys = $deliveryboyMapper->getAllDeliveryBoys();
         if (!empty($deliveryBoys)) {
             $paginator = Zend_Paginator::factory($deliveryBoys);
             $paginator->setItemCountPerPage(100);
             $page = $this->getRequest()->getParam("page", 1);
             $paginator->setCurrentPageNumber($page);
         } else {
             $paginator = array();
         }
         $this->view->deliveryBoys = $paginator;
     } catch (Exception $ex) {
         $this->authorised = false;
         $this->view->hasMessage = true;
         $this->view->messageType = "danger";
         $this->view->message = $ex->getMessage();
     }
 }
Ejemplo n.º 2
0
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $this->setMethod('post');
     $this->setElementDecorators($this->elementDecorators);
     $ordersMapper = new Application_Model_OrdersMapper();
     $orders = $ordersMapper->getOrdersByStatus();
     $order_options = array('Select Order');
     if ($orders) {
         foreach ($orders as $order) {
             $order_options[$order->__get("order_id")] = $order->__get("order_id");
         }
     }
     $delboyMapper = new Application_Model_DeliveryBoyMapper();
     $delboys = $delboyMapper->getAllDeliveryBoys();
     $delboy_options = array('Select Delivery Boy');
     if ($delboys) {
         foreach ($delboys as $delboy) {
             $delboy_options[$delboy->__get("delboy_id")] = $delboy->__get("delboy_fname") . " " . $delboy->__get('delboy_lname');
         }
     }
     $this->addElement('select', 'orders', array('label' => 'Order', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Select Order", 'class' => 'mws-textinput', 'multiOptions' => $order_options));
     $this->addElement('select', 'delboy_id', array('label' => 'Choose Delivery Boy', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Choose Delivery boy", 'class' => 'mws-textinput', 'multiOptions' => $delboy_options));
 }