Ejemplo n.º 1
0
	public function fetchAllNames($projectId)
	{
		$resultSet = $this->getDbTable()->fetchAllNames($projectId);
		$entries = array();
		foreach($resultSet as $row){
			$entry = new Pment_Models_Mstprg();
			$entry ->setMstprgId($row->mstprgId)
					->setStage($row->stage)
					->setTask($row->task);
			$entries[] = $entry;
		}
		return $entries;
	}
Ejemplo n.º 2
0
	public function editAction()
	{
		$errorMsg = null;
		$editForm = new Pment_Forms_MstprgSave();
		$mstprgs = new Pment_Models_MstprgMapper();
		$editForm->submit->setLabel('保存修改');
		$editForm->submit2->setAttrib('class','hide');
		$mstprgId = $this->_getParam('id',0);
		$projectId =$this->_getProjectId();
		$stage = $mstprgs->findStage($mstprgId);
		$tbStage = $editForm->getElement('stage');
		$tbStage->setValue($stage);
		$editForm = $mstprgs->formValidator($editForm,1);

		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			if($editForm->isValid($formData))
			{
				$array = $mstprgs->dataValidator($formData,1);
				$trigger = $array['trigger'];
				$errorMsg = $array['errorMsg'];
				if($trigger == 0)
				{
					$mstprg = new Pment_Models_Mstprg();
					$mstprg->setMstprgId($mstprgId);
					$mstprg->setProjectId($projectId);
					$mstprg->setStage($stage);
					$mstprg->setTask($editForm->getValue('task'));
					$mstprg->setStartDate($editForm->getValue('startDate'));
					$mstprg->setEndDate($editForm->getValue('endDate'));
					$mstprg->setContactId($editForm->getValue('contactId'));
					$mstprg->setRemark($editForm->getValue('remark'));
					$mstprgs->save($mstprg); 
					$this->_helper->flashMessenger->addMessage('对任务: '.$mstprg->getTask().'的修改成功。');
					$this->_redirect('/pment/mstprg');
					}
					else
					{
						$editForm->populate($formData);
						$tbStage = $editForm->getElement('stage');
						$tbStage->setValue($stage);
						}
				}
				else
				{
					$editForm->populate($formData);
					$tbStage = $editForm->getElement('stage');
					$tbStage->setValue($stage);
					}
			}
			else
			{
				if($mstprgId > 0)
				{
					$arrayMstprg = $mstprgs->findArrayMstprg($mstprgId);
					$editForm->populate($arrayMstprg);
					}
					else
					{
						$this->_redirect('/pment/mstprg');
						}
				}
		$this->view->errorMsg = $errorMsg;
		$this->view->editForm = $editForm;
		$this->view->id = $mstprgId; 
	}