public function managerAction() { $this->view->headTitle(Vi_Language::translate('Order manager')); $this->view->menu = array('order'); $config = Vi_Registry::getConfig(); $numRowPerPage = Vi_Registry::getConfig("defaultNumberRowPerPage"); $currentPage = $this->_getParam("page", 1); $displayNum = $this->_getParam('displayNum', false); /** * Get number of order per page */ if (false === $displayNum) { $displayNum = $this->session->orderDisplayNum; } else { $this->session->orderDisplayNum = $displayNum; } if (null != $displayNum) { $numRowPerPage = $displayNum; } /** * Get condition */ $condition = $this->_getParam('condition', false); if (false === $condition) { $condition = $this->session->orderCondition; } else { $this->session->orderCondition = $condition; $currentPage = 1; } if (false == $condition) { $condition = array(); } /** * Load all orders */ $objOrder = new Models_Order(); $allOrders = $objOrder->getAllOrders($condition, 'order_id DESC', $numRowPerPage, ($currentPage - 1) * $numRowPerPage); /** * Count all orders */ $count = count($objOrder->getAllOrders($condition)); /** * Modify all orders */ foreach ($allOrders as &$order) { if (null != $order['created_date']) { $order['created_date'] = date($config['dateFormat'], $order['created_date']); } } unset($order); /** * Set values for tempalte */ $this->setPagination($numRowPerPage, $currentPage, $count); $this->view->allOrders = $allOrders; $this->view->orderMessage = $this->session->orderMessage; $this->session->orderMessage = null; $this->view->condition = $condition; $this->view->displayNum = $numRowPerPage; }