示例#1
0
	public function find($techId,Pment_Models_Tech $tech)
	{
		$resultSet = $this->getDbTable()->find($techId);

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

			return;
		}

		$row = $resultSet->current();

		$tech->setTechId($row->techId)
				->setProjectId($row->projectId)
				->setTechDate($row->techDate)
				->setContent($row->content)
				->setName($row->name)
				->setContactId($row->contactId)
				->setRemark($row->remark)
				->setCTime($row->cTime);
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($tech->getContactId());
		$tech->setContactName($contactName);
	}
示例#2
0
	public function editAction()
	{
		$errorMsg = null;
		$editForm = new Pment_Forms_TechSave();
		$techs = new Pment_Models_TechMapper();
		$editForm->submit->setLabel('保存修改');
		$editForm->submit2->setAttrib('class','hide');
		$techId = $this->_getParam('id',0);
		$projectId =$this->_getProjectId();
		
		$editForm = $techs->formValidator($editForm,1);

		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			if($editForm->isValid($formData))
			{
				$array = $techs->dataValidator($formData,1);
				$trigger = $array['trigger'];
				$errorMsg = $array['errorMsg'];
				if($trigger == 0)
				{
					$userId = $this->_getUserId();
					$users = new System_Models_UserMapper();
					$contactId = $users->getContactId($userId); 
					$tech = new Pment_Models_Tech();
					$tech->setTechId($techId);
					$tech->setProjectId($projectId);
					$tech->setTechDate($editForm->getValue('techDate'));
					$tech->setContent($editForm->getValue('content'));
					$tech->setName($editForm->getValue('name'));
					$tech->setContactId($contactId);
					$tech->setRemark($editForm->getValue('remark'));
					$techs->save($tech); 
					$this->_helper->flashMessenger->addMessage('对技术交底信息的修改成功。');
					$this->_redirect('/pment/tech');
					}
					else
					{
						$editForm->populate($formData);
						}
				}
				else
				{
					$editForm->populate($formData);
					}
			}
			else
			{
				if($techId >0)
				{
					$arrayTech = $techs->findarrayTech($techId);
					$editForm->populate($arrayTech);
					}
					else
					{
						$this->_redirect('/pment/tech');
						}
				}
		$this->view->errorMsg = $errorMsg;
		$this->view->editForm = $editForm;
		$this->view->id = $techId; 
	}