You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

58 lines
2.3 KiB

<?php
class SplitNodeHandler
{
private $currentNode;
private $flowContext;
function __construct($node, FlowContext $flowContext)
{
$this->currentNode = $node;
$this->flowContext = $flowContext;
}
/**
* 1.从流程图中解析出下个节点的Code 更新
*$assigners 数组结构: array(1) { [0]=> array(2) { [0]=> string(2) "F1" [1]=> string(15) "73502-包 博," } }
*/
function doWork()
{
//解析下层节点\WorkFlowParser::getNextLevelNodes
$nextFlowNodes = $this->flowContext->getWorkFLowParser()
->getNextLevelNodes($this->currentNode->getNodeId());
$sm = new SubflowManager(new Flow($this->flowContext->getFormKey()));
foreach (Node::$nodeTypes as $type) {
if (!array_key_exists($type, $nextFlowNodes)) continue;
$seq = 0;
foreach ($nextFlowNodes[$type] as $node) {
if (method_exists($node, 'getAssignerList')) {
$assigners = $node->getAssignerList($this->flowContext->getWorkFLowParser());
$tmp = (array)(explode('-', $assigners[0][1]));
$emp = $tmp[0];
$nextFlowCode = $node->getFlowCode();
$childFlow = new Flow();
$childFlow->setSystemId($this->flowContext->systemId)
->setFlowId($this->flowContext->flowId)
->setFormId($this->flowContext->formId)
->setFlowCode($nextFlowCode)
->insert();
$subflow = new Subflow($childFlow);
$subflow->setCurrentUser($emp)->insert();
$sm->append($subflow, $this->flowContext->getCurrentUser());
echo "会签 " . $seq++ . ":<a href='http://localhost/fds/index.php/TestAssign2/show_assign_form/"
. $childFlow->getFormKey() . "' >查看下笔链接</a>" . "<BR/>";
}
}
}
$nextAssigner = $this->flowContext->getNextAssigner();
$currentFlow = new Flow($this->flowContext->getFormKey());
Subflow::updateCurrentUser($currentFlow->getParentKey(), $nextAssigner);
//exit();
/**
*遍历所有下层节点 ,执行对应Handler类doWork方法
*/
}
}