Esempio n. 1
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; 
	}