public function indexAction() { $projects = new Project_Models_ProjectMapper(); $errorMsg = null; if($this->getRequest()->isPost()) { $arrayProjects = array(); $formData = $this->getRequest()->getPost(); $key = trim($formData['key']); if($key!=null) { $condition = $formData['condition']; $arrayProjects = $projects->fetchAllJoin($key,$condition); if(count($arrayProjects) == 0) { $errorMsg = General_Models_Text::$text_searchErrorNr; } } else { $errorMsg = General_Models_Text::$text_searchErrorNi; } } else { $arrayProjects = $projects->fetchAllJoin(); } if(count($arrayProjects) != 0) { $pageNumber = $this->_getParam('page'); $arrayProjects->setCurrentPageNumber($pageNumber); $arrayProjects->setItemCountPerPage('20'); } $this->view->messages = $this->_helper->flashMessenger->getMessages(); $this->view->arrayProjects = $arrayProjects; $this->view->errorMsg = $errorMsg; $this->view->modelName = "工程概况"; }
public function indexAction() { $projects = new Project_Models_ProjectMapper(); $vehicles = new Vehicle_Models_VehicleMapper(); $arrayProjects = $projects->fetchAllJoin(); $arrayVehicles = $vehicles->fetchAllJoin(); $this->view->arrayProjects = $arrayProjects; $this->view->arrayVehicles = $arrayVehicles; $messages = new Admin_Models_MessageMapper(); $validations = new Pment_Models_MplanMapper(); $userId = $this->getUserId(); $arrayMessages = $messages->fetchAllNews($userId); $arrayValidations = $validations->fetchAllValidations($userId); $this->view->arrayMessages = $arrayMessages; $this->view->arrayValidations = $arrayValidations; }
protected function pageProjectIndex($pdf,$page,$font) { $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE); //put the personal information to the pdf $projects = new Project_Models_ProjectMapper(); $arrayProjects = $projects->fetchAllJoin(); $count = 1;//every page show approximately 20 pieces; //$arrayCount = count($arrayContacts); $totalItems = $arrayProjects->getTotalItemCount(); $arrayProjects->setItemCountPerPage($totalItems); $pageNumber = ceil($totalItems / 15); $x = 0; $y = 535; $currentpage = 1; foreach($arrayProjects as $project) { if($count == 1) { $page->setLineWidth(0.5); $page->drawLine(50, 550, 780, 550); $page->drawLine(50, 75, 780, 75); $page->setFont($font,13) ->drawText("工程编号", 50, $y, 'UTF-8') ->drawText("工程名称", 110, $y, 'UTF-8') ->drawText("工程状态", 400, $y, 'UTF-8') ->drawText("结构类型", 470, $y, 'UTF-8') ->drawText("开工时间", 540, $y, 'UTF-8') ->drawText("项目经理", 610, $y, 'UTF-8') ->drawText("施工许可证号", 680, $y, 'UTF-8'); $time = Date("Y-m-d,H:i"); $users = new System_Models_UserMapper(); $contactId = $users->getContactId($this->getUserId()); $contacts = new Employee_Models_ContactMapper(); $contactName = $contacts->findContactName($contactId); $page->setFont($font,11) ->drawText("工程管理总览", 390, 560, 'UTF-8') ->drawText("导出人:".$contactName, 50, 60, 'UTF-8') ->drawText("导出日期:".$time, 350, 60, 'UTF-8') ->drawText("页数:".$currentpage."(".$pageNumber.")", 690, 60, 'UTF-8'); } $y -= 25;$count++; $page->setFont($font, 11) ->drawText($project->projectId, $x+=50, $y, 'UTF-8') ->drawText($project->name, $x+=60, $y, 'UTF-8') ->drawText($project->status, $x+=290, $y, 'UTF-8') ->drawText($project->structype, $x+=70, $y, 'UTF-8') ->drawText($project->startDate, $x+=70, $y, 'UTF-8') ->drawText($project->contactName, $x+=70, $y, 'UTF-8') ->drawText($project->license, $x+=70, $y, 'UTF-8'); if($count >= 15) { $pdf->pages[] = $page; $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE); $count = 1; $y = 750; $currentpage++; } $x = 0; } $pdf->pages[] = $page; $name_string = "工程管理总览".time().".pdf"; $name_stringEn = urlencode("工程管理总览".time()).".pdf"; $url = 'tmp/'.$name_string; $urlEn='tmp/'.$name_stringEn; $pdf->save($url); return $urlEn; }