public function indexAction() { $drirecords = new Vehicle_Models_DrirecordMapper(); $errorMsg = null; if($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); $arrayDrirecords = array(); $key = trim($formData['key']); if($key!=null) { $condition = $formData['condition']; $arrayDrirecords = $drirecords->fetchAllJoin($key,$condition); if(count($arrayDrirecords) == 0) { $errorMsg = General_Models_Text::$text_searchErrorNr; //waring a message : no match result } } else { $errorMsg = General_Models_Text::$text_searchErrorNi; //waring a message : please input a key word } } else { $arrayDrirecords = $drirecords->fetchAllJoin(); } if(count($arrayDrirecords) != 0) { $pageNumber = $this->_getParam('page'); $arrayDrirecords->setCurrentPageNumber($pageNumber); $arrayDrirecords->setItemCountPerPage('20'); } $this->view->messages = $this->_helper->flashMessenger->getMessages(); $this->view->arrayDrirecords = $arrayDrirecords; $this->view->errorMsg = $errorMsg; $this->view->modelName = "车辆行驶记录"; }
public function displayAction() { $vehicles = new Vehicle_Models_VehicleMapper(); $veId = $this->_getParam('id',0); if($veId >0) { $vehicle = new Vehicle_Models_Vehicle(); $vehicles->find($veId,$vehicle); $condition = 'veId'; $drirecords = new Vehicle_Models_DrirecordMapper(); $repairs = new Vehicle_Models_RepairMapper(); $mtncs = new Vehicle_Models_MtncMapper(); $verecords = new Vehicle_Models_VerecordMapper(); $arrayDrirecords = $drirecords->fetchAllJoin($veId,$condition); $arrayRepairs = $repairs->fetchAllJoin($veId,$condition); $arrayMtncs = $mtncs->fetchAllJoin($veId,$condition); $conditionVar[0] = '0'; $conditionVar[1] = 'veId'; $arrayVerecords = $verecords->fetchAllJoin($veId,$conditionVar); if(count($arrayDrirecords) != 0) { $pageNumber = $this->_getParam('page'); $arrayDrirecords->setCurrentPageNumber($pageNumber); $arrayDrirecords->setItemCountPerPage('20'); } $this ->view->vehicle = $vehicle; $this ->view->arrayDrirecords = $arrayDrirecords; if(count($arrayRepairs) != 0) { $pageNumber = $this->_getParam('page'); $arrayRepairs->setCurrentPageNumber($pageNumber); $arrayRepairs->setItemCountPerPage('20'); } $this ->view->arrayRepairs = $arrayRepairs; if(count($arrayMtncs) != 0) { $pageNumber = $this->_getParam('page'); $arrayMtncs->setCurrentPageNumber($pageNumber); $arrayMtncs->setItemCountPerPage('20'); } $this ->view->arrayMtncs = $arrayMtncs; if(count($arrayVerecords) != 0) { $pageNumber = $this->_getParam('page'); $arrayVerecords->setCurrentPageNumber($pageNumber); $arrayVerecords->setItemCountPerPage('20'); } $this ->view->arrayVerecords = $arrayVerecords; } else { $this->_redirect('/vehicle'); } }