コード例 #1
0
	public function displayAction()
	{
		$contacts = new Employee_Models_ContactMapper();
		$contactId = $this->_getParam('id',0);
		if($contactId >0)
		{
			$contact = new Employee_Models_Contact();
			$contacts->findComplete($contactId,$contact);
			$this->view->id = $contact->getContactId();
			$this ->view->contact = $contact;
			}
			else
			{
				$this->_redirect('/employee');
				}
	}
コード例 #2
0
	protected function pageEmployeeAjaxDisplay($pdf,$page,$font)
	{
		//put the personal information to the pdf
		$contacts = new Employee_Models_ContactMapper();
		$contactId = $this->_getParam('id',0);
		$contact = new Employee_Models_Contact();
		$contacts->findComplete($contactId,$contact);
		$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($contact->getName(), $x+50, $y, 'UTF-8')

				->drawText("性别:", $x, $y-=20, 'UTF-8')
				->drawText($contact->getGender(), $x+50, $y, 'UTF-8')

				->drawText("生日:", $x, $y-=20, 'UTF-8')
				->drawText($contact->getBirth(), $x+50, $y, 'UTF-8')

				->drawText("部门:", $x, $y-=20, 'UTF-8')
				->drawText($contact->getDeptName(), $x+50, $y, 'UTF-8')

				->drawText("职务:", $x, $y-=20, 'UTF-8')
				->drawText($contact->getDutyName(), $x+50, $y, 'UTF-8')

				->drawText("入职时间:", $x, $y-=20, 'UTF-8')
				->drawText($contact->getEnroll(), $x+100, $y, 'UTF-8')

				->drawText("手机号码:", $x, $y-=20, 'UTF-8')
				->drawText($contact->getPhoneMob(), $x+100, $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;
	}