public function displayAction() { $plogs = new Pment_Models_PlogMapper(); $plogId = $this->_getParam('id',0); if($plogId >0) { $plog = new Pment_Models_Plog(); $plogs->find($plogId,$plog); $this ->view->plog = $plog; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } else { $this->_redirect('/pment/plog'); } }
protected function pagePmentPlogDisplay($pdf,$page,$font) { //put the personal information to the pdf $plogs = new Pment_Models_PlogMapper(); $plogId = $this->_getParam('id',0); $plog = new Pment_Models_Plog(); $plogs->find($plogId,$plog); $x = 50; $y = 750; $currentpage = 1; $pageNumber = 1; $page->setLineWidth(0.5); $page->drawLine(50, 770, 560, 770); $page->drawLine(50, 125, 560, 125); $page->setFont($font,13) ->drawText("日期:", $x, $y-=20, 'UTF-8') ->drawText($plog->getLogDate(), $x+150, $y, 'UTF-8') ->drawText("天气(上午):", $x, $y-=20, 'UTF-8') ->drawText($plog->getWeatherAm(), $x+150, $y, 'UTF-8') ->drawText("天气(下午):", $x, $y-=20, 'UTF-8') ->drawText($plog->getWeatherPm(), $x+150, $y, 'UTF-8') ->drawText("最高温度(摄氏度):", $x, $y-=20, 'UTF-8') ->drawText($plog->getTempHi(), $x+150, $y, 'UTF-8') ->drawText("最低温度(摄氏度):", $x, $y-=20, 'UTF-8') ->drawText($plog->getTempLo(), $x+150, $y, 'UTF-8') ->drawText("施工部位:", $x, $y-=20, 'UTF-8') ->drawText($plog->getPart(), $x+150, $y, 'UTF-8') ->drawText("施工人数:", $x, $y-=20, 'UTF-8') ->drawText($plog->getNumber(), $x+150, $y, 'UTF-8') ->drawText("负责操作人:", $x, $y-=20, 'UTF-8') ->drawText($plog->getOperator(), $x+150, $y, 'UTF-8') ->drawText("责任工长:", $x, $y-=20, 'UTF-8') ->drawText($plog->getForeman(), $x+150, $y, 'UTF-8') ->drawText("安全情况:", $x, $y-=20, 'UTF-8') ->drawText($plog->getSafety(), $x+150, $y, 'UTF-8') ->drawText("存在问题:", $x, $y-=20, 'UTF-8') ->drawText($plog->getProblem(), $x+150, $y, 'UTF-8') ->drawText("解决问题:", $x, $y-=20, 'UTF-8') ->drawText($plog->getResolve(), $x+150, $y, 'UTF-8') ->drawText("往来文件:", $x, $y-=20, 'UTF-8') ->drawText($plog->getRelatedFile(), $x+150, $y, 'UTF-8') ->drawText("变更签证:", $x, $y-=20, 'UTF-8') ->drawText($plog->getPart(), $x+150, $y, 'UTF-8') ->drawText("材料设备情况:", $x, $y-=20, 'UTF-8') ->drawText($plog->getMaterial(), $x+150, $y, 'UTF-8') ->drawText("填报人:", $x, $y-=20, 'UTF-8') ->drawText($plog->getContactName(), $x+150, $y, 'UTF-8') ->drawText("备注:", $x, $y-=20, 'UTF-8') ->drawText($plog->getRemark(), $x+150, $y, 'UTF-8') ->drawText("创建时间:", $x, $y-=20, 'UTF-8') ->drawText($plog->getCTime(), $x+150, $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("日志详情", 250, 790, 'UTF-8') ->drawText("导出人:".$contactName, 50, 100, 'UTF-8') ->drawText("导出日期:".$time, 250, 100, 'UTF-8') ->drawText("页数:".$currentpage."(".$pageNumber.")", 500, 100, 'UTF-8'); $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; }