/** * 编辑工作流 * * @access public */ public function edit(Process $process) { if (Request::method() == 'POST') { return $this->updateWorkflow(); } $id = (int) Request::input('id'); $info = $process->workflowInfo(['id' => $id]); if (empty($info)) { return Js::error(Lang::get('workflow.workflow_not_found')); } $formUrl = route('workflow.index.edit'); return view('admin.workflow.add', compact('info', 'formUrl', 'id')); }
/** * 工作流步骤管理 */ public function index() { $workflowId = Request::input('id'); if (!$workflowId or !is_numeric($workflowId)) { return Js::error(Lang::get('common.illegal_operation'), true); } $manger = new Process(); $workflowInfo = $manger->workflowInfo(['id' => $workflowId]); if (empty($workflowInfo)) { return Js::error(Lang::get('common.illegal_operation'), true); } $list = $manger->workflowStepInfos(['workflow_id' => $workflowId, 'join_user' => true]); $page = $list->setPath('')->appends(Request::all())->render(); return view('admin.workflow_step.detail', compact('workflowInfo', 'list', 'page')); }
/** * 编辑工作流 * * @access public */ public function edit() { if (Request::method() == 'POST') { return $this->updateDatasToDatabase(); } $id = Request::input('id'); if (!$id or !is_numeric($id)) { return Js::error(Lang::get('common.illegal_operation'), true); } $manger = new Process(); $info = $manger->workflowInfo(['id' => $id]); if (empty($info)) { return Js::error(Lang::get('workflow.workflow_not_found')); } $formUrl = R('common', 'workflow.index.edit'); return view('admin.workflow.add', compact('info', 'formUrl', 'id')); }
/** * 增加工作流步骤用户关联时的日志记录 */ 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']]))); } }
/** * 编辑工作流步骤 * * @access public */ public function edit(Process $manger) { if (Request::method() == 'POST') { return $this->updateWorkflowStep(); } $stepId = (int) Request::input('stepid'); $workflow_Id = (int) Request::input('workflow_id'); if (!$stepId) { return Js::error(Lang::get('common.illegal_operation'), true); } $workflowInfo = $manger->workflowInfo(['id' => $workflow_Id]); if (empty($workflowInfo)) { return Js::error(Lang::get('common.illegal_operation'), true); } $stepList = $manger->workflowStepLevelList(); $info = $manger->workflowStepInfo(['id' => $stepId]); if (empty($info)) { return Js::error(Lang::get('workflow.step_not_found'), true); } $formUrl = route('workflow.step.edit'); return view('admin.workflow_step.add', compact('info', 'formUrl', 'stepId', 'stepList', 'workflow_Id', 'workflowInfo')); }