Exemplo n.º 1
0
	public function ajaxaddAction()
	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);

		$contactId = $this->_getParam('contactId',0);
		$planId = $this->_getParam('planId',0);
		if($contactId > 0)
		{
			$reviewers = new Pment_Models_ReviewerMapper();
			if($reviewers->checkExist($contactId,$planId))
			{
				$reviewer = new Pment_Models_Reviewer();
				$reviewer->setPlanId($planId);
				$reviewer->setContactId($contactId);
				$reviewer->setStatus(0);
				$id = $reviewers->save($reviewer);
				
				echo $id;
				}
				else
				{
					echo "f";
					}
			}
			else
			{
				$this->_redirect('/pment/mplan');
				}
	}
Exemplo n.º 2
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);
	}
Exemplo n.º 3
0
	public function applyAction()
	{
		$groupId = $this->getGroupId();
		if($groupId != 3) //for test purpose
		{
			$this->_redirect('/pment/mplan');
			}
		$id = $this->_getParam('id',0);
		
		if($id > 0)
		{	
			$errorMsg = null;
			//display plan info
			$mplans = new Pment_Models_MplanMapper();
			$mplan = new Pment_Models_Mplan();
			$mplans->find($id,$mplan);
			$materials = new Pment_Models_MaterialMapper();
			//display material info
			$condition = "planId";
			$arrayMaterials = $materials->fetchAllOrganize($id,$condition);
			if($this->getRequest()->isPost())
			{
				$btClicked = $this->getRequest()->getPost('btMapply');
				//add default manager to the reviewer team.
				if($btClicked == '确认并提交审批')
				{
					
					if(count($arrayMaterials) != 0)
					{
						$contactId = General_Models_ServerInfo::$default_reviewer;
						$reviewers = new Pment_Models_ReviewerMapper();
						$reviewer = new Pment_Models_Reviewer();
						$reviewer->setPlanId($mplan->getPlanId());
						$reviewer->setContactId($contactId);
						//$reviewer->setAddDate(date('Y-m-d,H:i'));
						$reviewer->setStatus(0);
						$reviewers->save($reviewer);
						$mplan->setStatus('1');
						//Add default manager ends
						$mplans->save($mplan);
						$message = General_Models_Text::$text_mplan_apply_sucess;
						$this->_helper->flashMessenger->addMessage($message);
						$this->_redirect('/pment/mplan');
						}
						else
						{
							$errorMsg = General_Models_Text::$text_mplan_apply_failed;
							
							}
					}
					else
					{
						$this->_redirect('/pment/mplan');
						}
			}
			$this->view->mplan = $mplan;
			$this->view->id = $id;
			$this->view->modelName = "材料计划信息"; 
			$this->view->arrayMaterials = $arrayMaterials;
			$this->view->errorMsg = $errorMsg;
			}
			else
			{
				$this->_redirect('/pment/mplan');
				}
	}