예제 #1
0
	public function find($userId,System_Models_User $user)
	{
		$resultSet = $this->getDbTable()->find($userId);

		if (0 == count($resultSet)) {

			return;
		}

		$row = $resultSet->current();

		$user->setId($row->id)
				->setUserName($row->username)
				->setGroupId($row->groupId)
				->setPassword($row->password)
				->setSalt($row->salt)
				->setContactId($row->contactId)
				->setCreatorId($row->creatorId);
		$creatorCid = $this->getContactId($user->getCreatorId());
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($user->getContactId());
		$creatorCname = $contacts->findContactName($creatorCid);
		$user->setContactName($contactName);
		$user->setCreatorCid($creatorCid);
		$user->setCreatorCname($creatorCname);
		$ugs = new System_Models_UsergroupMapper();
		$groupName = $ugs->getGroupName($user->getGroupId());
		$user->setGroupName($groupName);
	}
예제 #2
0
	public function ajaxaddAction()
	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		$mtrId = $this->_getParam('mtrId',0);
		$cmt = $this->_getParam('comment',0);
		if($mtrId != null)
		{
			$userId = $this->getUserId();
			$users = new System_Models_UserMapper();
			$contactId = $users->getContactId($userId);
			$comments = new Pment_Models_CommentMapper();
			$comment = new Pment_Models_Comment();
			$comment->setMtrId($mtrId);
			$comment->setComment($cmt);
			$comment->setContactId($contactId);
			$comment->setAddDate(date('Y-m-d,H:i'));
			$id = $comments->save($comment);
			$contacts = new Employee_Models_ContactMapper();
			$contactName = $contacts->findContactName($contactId);
			$json['addDate'] = $comment->getAddDate();
			$json['contactId'] = $comment->getContactId();
			$json['contactName'] = $contactName;
			$json['cId'] = $id;
			$json = Zend_Json::encode($json);
			echo $json;
			}
			else
			{
				$this->_redirect('/pment/mplan');
				}
	}
예제 #3
0
	public function findMtncJoin($mtnId,Vehicle_Models_Mtnc $mtnc) 
	{
		$row = $this->getDbTable()->fetchRow('mtnId = '.$mtnId);

		if (0 == count($row)){
			return;
			}
			
		$mtnc->setMtnId($row->mtnId)
				->setVeId($row->veId)
				->setRDate($row->rDate)
				->setDetail($row->detail)
				->setContactId($row->contactId)
				->setMile($row->mile)
				->setAmount($row->amount)
				->setRemark($row->remark)
				->setCTime($row->cTime);
		$veId = $mtnc->getVeId();
		$vehicles = new Vehicle_Models_VehicleMapper();
		$plateNo = $vehicles->findPlateNo($veId);
		$mtnc->setPlateNo($plateNo);
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($mtnc->getContactId());
		$mtnc->setContactName($contactName);
	}
예제 #4
0
	public function find($id,System_Models_Improvement $improvement)
	{
		$resultSet = $this->getDbTable()->find($id);

		if (0 == count($resultSet)) {

			return;
		}

		$row = $resultSet->current();

		$improvement->setId($row->imprId)
				->setTypeId($row->typeId)
				->setUserId($row->userId)
				->setPriority($row->priority)
				->setDescription($row->description)
				->setITime($row->iTime)
				->setModId($row->modId)
				->setStatus($row->status);
		$status = $improvement->getStatus();
		if($status == 0)
		{
			$improvement->setStatusCh('等待处理');
			}
			elseif($status == 1)
			{
				$improvement->setStatusCh('处理中');
			}
			elseif($status == 2)
			{
				$improvement->setStatusCh('已解决');
				}
			elseif($status == 3)
			{
				$improvement->setStatusCh('暂时不能解决');
				}
		$users = new System_Models_UserMapper();
		$contactId = $users->getContactId($improvement->getUserId());
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($contactId);
		$modnames = new System_Models_ModnameMapper();
		$modNameCh = $modnames->getModNameCh($improvement->getModId());
		$imptypes = new System_Models_ImptypeMapper();
		$typeName = $imptypes->getTypeName($improvement->getTypeId());
		
		$improvement->setContactId($contactId);
		$improvement->setContactName($contactName);
		$improvement->setTypeName($typeName);
		$improvement->setModNameCh($modNameCh);
	}
예제 #5
0
	public function find($id,Pment_Models_Mplan $mplan)
	{
		$result = $this->getDbTable()->find($id);

		if (0 == count($result)) {
			return;
		}
		$row = $result->current();
		$mplan->setPlanId($row->planId)
				->setProjectId($row->projectId)
				->setPlanName($row->planName)
				->setTypeId($row->typeId)
				->setYearNum($row->yearNum)
				->setMonNum($row->monNum)
				->setPDate($row->pDate)
				->setContactId($row->contactId)
				->setTotal($row->total)
				->setApprovcId($row->approvcId)
				->setApprovcDate($row->approvcDate)
				->setApprovcRemark($row->approvcRemark)
				->setApprovfId($row->approvfId)
				->setApprovfDate($row->approvfDate)
				->setApprovfRemark($row->approvfRemark)
				->setStatus($row->status)
				->setRemark($row->remark)
				->setCTime($row->cTime);
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($mplan->getContactId());
		$status = $mplan->getStatus();
		$mstatus = new General_Models_MstatusMapper();
		$statusName = $mstatus->getStatusName($status);
		$mplan->setStatusName($statusName);
		if($status >= 3)
		{
			$approvcName = $contacts->findContactName($mplan->getApprovcId());
			$mplan->setApprovcName($approvcName);
			}
		if($status == 4 || $status ==6)
		{
			$approvfName = $contacts->findContactName($mplan->getApprovfId());
			$mplan->setApprovfName($approvfName);
			}
		$mplan->setContactName($contactName);
		$ptypes = new General_Models_PtypeMapper();
		$typeName = $ptypes->findPtypeName($mplan->getTypeId());
		$mplan->setTypeName($typeName);
	}
예제 #6
0
	public function find($id,System_Models_Online $online)
	{
		$resultSet = $this->getDbTable()->find($id);

		if (0 == count($resultSet)) {

			return;
		}

		$row = $resultSet->current();

		$online->setId($row->id)
				->setUserId($row->userId)
				->setContactId($row->contactId)
				->setTimer($row->timer)
				->setLoginTime($row->loginTime);
		$online = new System_Models_OnlineMapper();
		$contactId = $online->getContactId($online->getContactId());
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($contactId);
		$online->setContactName($contactName);
	}
예제 #7
0
	public function findArrayFile($id)
	{
		$id = (int)$id;
		$row = $this->getDbTable()->fetchRow('file_id = '.$id);
		if(!$row){
			throw new Exception("Could not find row $id");
		}
		
		$contacts = new Employee_Models_ContactMapper();
		$contactId = $row->contactId;
		$contactName = $contacts->findContactName($contactId);
		$row = $row->toArray();
		$row["contactName"] = $contactName;
		return $row;
	}
예제 #8
0
	public function findArrayTraining($id)
	{
		$id = (int)$id;
		$row = $this->getDbTable()->fetchRow('traId = ' . $id);
		if (!$row) {
			throw new Exception("Could not find row $id");
		}
		$row = $row->toArray();
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($row['contactId']);
		$row['contactName'] = $contactName;
		return $row;
	}
예제 #9
0
	public function ajaxpdfAction()
	{
		$this->_helper->layout()->disableLayout();
	//	$this->_helper->viewRenderer->setNoRender(true);
		
		$pdf = new Zend_Pdf();
		$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
		$font = Zend_Pdf_Font::fontWithPath('font/simkai.ttf',(Zend_Pdf_Font::EMBED_SUPPRESS_EMBED_EXCEPTION |
Zend_Pdf_Font::EMBED_DONT_COMPRESS));
		//put the personal information to the pdf
		$contacts = new Employee_Models_ContactMapper();
		$arrayContacts = $contacts->fetchAllJoin();
		$count = 1;//every page show approximately 20 pieces;
		//$arrayCount = count($arrayContacts);
		$totalItems = $arrayContacts->getTotalItemCount();
		$arrayContacts->setItemCountPerPage($totalItems);

		$pageNumber = ceil($totalItems / 25);
		$x = 0; $y = 750;
		$currentpage = 1;
		foreach($arrayContacts as $contact)
		{
			if($count == 1)
			{
				$page->setLineWidth(0.5);
				$page->drawLine(50, 770, 560, 770);
				$page->drawLine(50, 125, 560, 125);
				$page->setFont($font,13)
						->drawText("编号", 50, $y, 'UTF-8')
						->drawText("姓名", 100, $y, 'UTF-8')
						->drawText("性别", 145, $y, 'UTF-8')
						->drawText("生日", 195, $y, 'UTF-8')
						->drawText("部门", 275, $y, 'UTF-8')
						->drawText("职务", 335, $y, 'UTF-8')
						->drawText("入职时间", 415, $y, 'UTF-8')
						->drawText("手机号码", 495, $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');
				}
				$y -= 25;$count++;
				$page->setFont($font, 11)
						->drawText($contact->contactId, $x+=50, $y, 'UTF-8')
						->drawText($contact->contactName, $x+=50, $y, 'UTF-8')
						->drawText($contact->gender, $x+=45, $y, 'UTF-8')
						->drawText($contact->birth, $x+=50, $y, 'UTF-8')
						->drawText($contact->deptName, $x+=80, $y, 'UTF-8')
						->drawText($contact->dutyName, $x+=60, $y, 'UTF-8')
						->drawText($contact->enroll, $x+=80, $y, 'UTF-8')
						->drawText($contact->phoneMob, $x+=80, $y, 'UTF-8');
			if($count >= 25)
			{
				$pdf->pages[] = $page;
				$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
				$count = 1;
				$y = 750;
				$currentpage++;
				}
			$x = 0;
			}
		$pdf->pages[] = $page;
		$name_string = "公司员工信息总览".time().".pdf";
		//server
		$base = General_Models_ServerInfo::$localUrl;
		$url = 'tmp/'.$name_string;
		$pdf->save($url);
		$murl = $base.'/'.$url;
		$this->view->murl = $murl;
		}
예제 #10
0
	public function find($reId,Pment_Models_Reviewer $reviewer)
	{
		$resultSet = $this->getDbTable()->find($reId);

		if (0 == count($resultSet)) {

			return;
		}

		$row = $resultSet->current();

		$reviewer->setReId($row->reId)
				->setPlanId($row->planId)
				->setAddDate($row->addDate)
				->setContactId($row->contactId)
				->setStatus($row->status);
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($reviewer->getContactId());
		$reviewer->setContactName($contactName);
	}
예제 #11
0
	public function findVerecordJoin($recordId,Vehicle_Models_Verecord $verecord)
	{
		$row = $this->getDbTable()->fetchRow('recordId = '.$recordId);
		if (0 == count($row)){
			return;
			}
		$verecord->setRecordId($row->recordId)
				->setVeId($row->veId)
				->setPrjFlag($row->prjFlag)
				->setProjectId($row->projectId)
				->setStartDate($row->startDate)
				->setEndDate($row->endDate)
				->setPeriod($row->period)
				->setRoute($row->route)
				->setMileBf($row->mileBf)
				->setMileAf($row->mileAf)
				->setMile($row->mile)
				->setPurpose($row->purpose)
				->setContactId($row->contactId)
				->setUser($row->user)
				->setMileRef($row->mileRef)
				->setAmount($row->amount)
				->setRemark($row->remark)
				->setCTime($row->cTime);
		$veId = $verecord->getVeId();
		$vehicles = new Vehicle_Models_VehicleMapper();
		$plateNo = $vehicles->findPlateNo($veId);
		$verecord->setPlateNo($plateNo);
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($verecord->getContactId());
		$verecord->setContactName($contactName);
		
		if($verecord->getPrjFlag() == '0')
		{
			$verecord->setPrjFlag(General_Models_Text::$text_verecord_prjFlag_false);
			$verecord->setProjectName(General_Models_Text::$text_verecord_prjFlag_false);
			}
			elseif($verecord->getPrjFlag() == '1')
			{
				$verecord->setPrjFlag(General_Models_Text::$text_verecord_prjFlag_true);
				$projects = new Project_Models_ProjectMapper();
				$verecord->setProjectName($projects->findProjectName($verecord->getProjectId()));
				}
	}
예제 #12
0
	public function findRepairJoin($repId,Vehicle_Models_Repair $repair) 
	{
		$row = $this->getDbTable()->fetchRow('repId = '.$repId);

		if (0 == count($row)){
			return;
			}
			
		$repair->setRepId($row->repId)
				->setVeId($row->veId)
				->setRDate($row->rDate)
				->setReason($row->reason)
				->setDetail($row->detail)
				->setContactId($row->contactId)
				->setSpot($row->spot)
				->setDescr($row->descr)
				->setAmount($row->amount)
				->setInsFlag($row->insFlag)
				->setIndem($row->indem)
				->setRemark($row->remark)
				->setCTime($row->cTime);
		if($repair->getInsFlag() == 1)
			{
				$repair->setInsFlag(General_Models_Text::$text_repair_indem_true);
				}
				else
				{
					$repair->setInsFlag(General_Models_Text::$text_repair_indem_false);
					}
		$veId = $repair->getVeId();
		$vehicles = new Vehicle_Models_VehicleMapper();
		$plateNo = $vehicles->findPlateNo($veId);
		$repair->setPlateNo($plateNo);
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($repair->getContactId());
		$repair->setContactName($contactName);
	}
예제 #13
0
	public function fetchAllNews($toId)
	{
		$resultSet = $this->getDbTable()->fetchAllNews($toId);
		
		$arrayMessages = null;
		foreach($resultSet as $row)
		{
			$message = new Admin_Models_Message();
			$message->setMsgId($row->msgId)
				->setFromId($row->fromId)
				->setTitle($row->title)
				->setSendTime($row->sendTime);
			$users = new System_Models_UserMapper();
			$contactId = $users->getContactId($message->getFromId());
			$contacts = new Employee_Models_ContactMapper();
			$contactName = $contacts->findContactName($contactId);
			$message->setFromCname($contactName);
			$message->setFromCid($contactId);
			$arrayMessages[] = $message;
			}
		return $arrayMessages;
	}
예제 #14
0
	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;
	}
예제 #15
0
	public function findArrayCpp($id)
	{
		$entry = new Pment_Models_Cpp();
		
		$row = $this->getDbTable()->findArrayCpp($id);
		
		$contactId = $row['contactId'];
		$contacts = new Employee_Models_ContactMapper();
		$row['contactName'] = $contacts->FindContactName($contactId);

		return $row;
		}