Exemplo n.º 1
0
 public function deleteAction()
 {
     $id = $this->_getParam('id', false);
     if (false == $id) {
         $this->_redirect('order/admin/manager');
     }
     $ids = explode('_', trim($id, '_'));
     $objOrder = new Models_Order();
     try {
         foreach ($ids as $id) {
             $objOrder->delete(array('order_id=?' => $id));
         }
         $this->session->orderMessage = array('success' => true, 'message' => Vi_Language::translate('Delete order successfully'));
     } catch (Exception $e) {
         $this->session->orderMessage = array('success' => false, 'message' => Vi_Language::translate('Can NOT delete this order. Please try again'));
     }
     $this->_redirect('order/admin/manager#listoforder');
 }
Exemplo n.º 2
0
 public function deleteAction()
 {
     $resId = Vi_Registry::getRestaurantIdFromLoggedUser();
     if (false == $resId) {
         $this->_redirect('access/index/login');
     }
     $objRes = new Models_Restaurant();
     $res = $objRes->find($resId)->toArray();
     $res = current($res);
     if (false == $res) {
         $this->_redirect('');
     }
     $id = $this->_getParam('id', false);
     if (false == $id) {
         $this->_redirect('order/index/manager');
     }
     $ids = explode('_', trim($id, '_'));
     $objOrder = new Models_Order();
     try {
         foreach ($ids as $id) {
             $objOrder->delete(array('order_id=?' => $id, 'restaurant_id=?' => $resId));
         }
         $this->session->orderMessage = array('success' => true, 'message' => 'Order is deleted successfully');
     } catch (Exception $e) {
         $this->session->orderMessage = array('success' => false, 'message' => Vi_Language::translate('Can NOT delete this order. Please try again'));
     }
     $this->_redirect('order/index/manager#listoforder');
 }