Ejemplo n.º 1
0
 /**
  * 增加工作流步骤用户关联时的日志记录
  */
 public function handler()
 {
     if (Request::method() !== 'POST') {
         return false;
     }
     if (!$this->isLog()) {
         return false;
     }
     $extDatas = $this->getExtDatas();
     if (!isset($extDatas['userIds']) or !is_array($extDatas['userIds']) or empty($extDatas['userIds']) or !isset($extDatas['stepInfo'])) {
         return false;
     }
     $manager = new Process();
     $workflowInfo = $manager->workflowInfo(['id' => $extDatas['stepInfo']['workflow_id']]);
     $userModel = new User();
     foreach ($extDatas['userIds'] as $userId) {
         $userInfo = $userModel->getOneUserById($userId);
         event(new ActionLog(Lang::get('actionlog.set_step_user', ['workflow_step' => $extDatas['stepInfo']['name'], 'workflow' => $workflowInfo['name'], 'username' => $userInfo['realname']])));
     }
 }
Ejemplo n.º 2
0
 /**
  * 删除工作流
  *
  * @access public
  */
 public function delete(Process $manager)
 {
     $id = array_map('intval', (array) Request::input('id'));
     $info = $manager->workflowInfos(['ids' => $id]);
     if (!$manager->deleteWorkflow(['ids' => $id])) {
         return responseJson($manager->getErrorMessage());
     }
     $this->setActionLog(['workflowInfo' => $info]);
     return responseJson(Lang::get('common.action_success'), true);
 }
Ejemplo n.º 3
0
 /**
  * 设置审核步骤与用户的关联
  *
  * @access private
  */
 private function setRelation()
 {
     $this->checkFormHash();
     $stepId = (int) Request::input('stepId');
     $workflowId = (int) Request::input('workflowId');
     $userIds = Request::input('ids');
     if (!$stepId or !$workflowId or !is_array($userIds)) {
         return Js::error(Lang::get('common.illegal_operation'));
     }
     $userIds = array_map('intval', $userIds);
     $manager = new Process();
     $stepInfo = $manager->workflowStepInfo(['id' => $stepId]);
     if (empty($stepInfo)) {
         return Js::error(Lang::get('common.illegal_operation'));
     }
     if ($manager->setRelation($workflowId, $stepId, $userIds)) {
         $this->setActionLog(['userIds' => $userIds, 'stepInfo' => $stepInfo]);
         return Js::alert(Lang::get('common.action_success'));
     }
     return Js::error($manager->getErrorMessage());
 }
Ejemplo n.º 4
0
 /**
  * 删除工作流
  *
  * @access public
  */
 public function delete()
 {
     $id = Request::input('id');
     if (!is_array($id)) {
         if (!$id) {
             return responseJson(Lang::get('common.action_error'));
         }
         $id = array($id);
     }
     $id = array_map('intval', $id);
     $manager = new Process();
     $info = $manager->workflowInfos(['ids' => $id]);
     if ($manager->deleteWorkflow(['ids' => $id])) {
         $this->setActionLog(['workflowInfo' => $info]);
         return responseJson(Lang::get('common.action_success'), true);
     }
     return responseJson($manager->getErrorMessage());
 }