Пример #1
0
	public function find($id,System_Models_Improvement $improvement)
	{
		$resultSet = $this->getDbTable()->find($id);

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

			return;
		}

		$row = $resultSet->current();

		$improvement->setId($row->imprId)
				->setTypeId($row->typeId)
				->setUserId($row->userId)
				->setPriority($row->priority)
				->setDescription($row->description)
				->setITime($row->iTime)
				->setModId($row->modId)
				->setStatus($row->status);
		$status = $improvement->getStatus();
		if($status == 0)
		{
			$improvement->setStatusCh('等待处理');
			}
			elseif($status == 1)
			{
				$improvement->setStatusCh('处理中');
			}
			elseif($status == 2)
			{
				$improvement->setStatusCh('已解决');
				}
			elseif($status == 3)
			{
				$improvement->setStatusCh('暂时不能解决');
				}
		$users = new System_Models_UserMapper();
		$contactId = $users->getContactId($improvement->getUserId());
		$contacts = new Employee_Models_ContactMapper();
		$contactName = $contacts->findContactName($contactId);
		$modnames = new System_Models_ModnameMapper();
		$modNameCh = $modnames->getModNameCh($improvement->getModId());
		$imptypes = new System_Models_ImptypeMapper();
		$typeName = $imptypes->getTypeName($improvement->getTypeId());
		
		$improvement->setContactId($contactId);
		$improvement->setContactName($contactName);
		$improvement->setTypeName($typeName);
		$improvement->setModNameCh($modNameCh);
	}
	public function ajaxaddAction()
	{
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		$description = $this->_getParam('description');
		$typeId = $this->_getParam('typeId');
		$modId = $this->_getParam('modId');
		$priority = $this->_getParam('priority');
		$userId = $this->getUserId();
		$iTime = date("Y-m-d,H:i");
		$status = 0;
		$improvements = new System_Models_ImprovementMapper();
		$improvement = new System_Models_Improvement();
		$improvement->setTypeId($typeId);
		$improvement->setModId($modId);
		$improvement->setPriority($priority);
		$improvement->setUserId($userId);
		$improvement->setDescription($description);
		$improvement->setITime($iTime);
		$improvement->setStatus($status);
		try
		{
			$improvements->save($improvement);
			echo "系统问题提交成功.";
			}
			catch(Exception $e)
			{
				echo "系统问题提交失败,请稍后再试.";
			}	
	}