Пример #1
0
	public function find($seaId,Pment_Models_Seal $seal)
	{
		$resultSet = $this->getDbTable()->find($seaId);

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

			return;
		}

		$row = $resultSet->current();

		$seal->setseaId($row->seaId)
				->setProjectId($row->projectId)
				->setSealDate($row->sealDate)
				->setReturnDate($row->returnDate)
				->setName($row->name)
				->setSealUser($row->sealUser)
				->setSealFile($row->sealFile)
				->setReason($row->reason)
				->setCopy($row->copy)
				->setTakeOut($row->takeOut)
				->setContactId($row->contactId)
				->setRemark($row->remark)
				->setCTime($row->cTime);
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findcontactName($seal->getContactId());
		$seal->setContactName($contactName);
	}
Пример #2
0
	public function editAction()
	{
		$errorMsg = null;
		$editForm = new Pment_Forms_SealSave();
		$seals = new Pment_Models_SealMapper();
		$editForm->submit->setLabel('保存修改');
		$editForm->submit2->setAttrib('class','hide');
		$seaId = $this->_getParam('id',0);
		$projectId =$this->_getProjectId();
		$editForm = $seals->formValidator($editForm,1);
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			if($editForm->isValid($formData))
			{
				$array = $seals->dataValidator($formData,1);
				$trigger = $array['trigger'];
				$errorMsg = $array['errorMsg'];
				if($trigger == 0)
				{
					$seal = new Pment_Models_Seal();
					$seal->setSeaId($seaId);
					$seal->setProjectId($projectId);
					$seal->setName($editForm->getValue('name'));
					$seal->setSealFile($editForm->getValue('sealFile'));
					$seal->setSealUser($editForm->getValue('sealUser'));
					$seal->setReason($editForm->getValue('reason'));
					$seal->setSealDate($editForm->getValue('sealDate'));
					$seal->setSealDate($editForm->getValue('returnDate'));
					$seal->setCopy($editForm->getValue('copy'));
					$seal->setTakeOut($editForm->getValue('takeOut'));
					$seal->setContactId($editForm->getValue('contactId'));
					$seal->setRemark($editForm->getValue('remark'));
					$seals->save($seal); 
					$this->_helper->flashMessenger->addMessage('对印章使用信息的修改成功。');
					$this->_redirect('/pment/seal');
					}
					else
					{
						$editForm->populate($formData);
						}
				}
				else
				{
					$editForm->populate($formData);
					}
			}
			else
			{
				if($seaId >0)
				{
					$arraySeal = $seals->findarraySeal($seaId);
					$editForm->populate($arraySeal);
					}
					else
					{
						$this->_redirect('/pment/seal');
						}
				}
		$this->view->errorMsg = $errorMsg;
		$this->view->editForm = $editForm;
		$this->view->id = $seaId; 
	}