PageRenderTime 51ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/library/Tudu/Tudu/Extension/Flow.php

https://github.com/polokk/tudu-web-1
PHP | 1987 lines | 1210 code | 294 blank | 483 comment | 256 complexity | 0c9edfc89510f9445be3eab29d3445e1 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * Tudu Library
  4. *
  5. * LICENSE
  6. *
  7. *
  8. * @category Tudu
  9. * @package Tudu_Model
  10. * @copyright Copyright (c) 2009-2010 Shanghai Best Oray Information S&T CO., Ltd.
  11. * @link http://www.oray.com/
  12. * @version $Id: Flow.php 2755 2013-02-22 09:50:47Z chenyongfa $
  13. */
  14. /**
  15. * 工作流扩展
  16. *
  17. * @category Tudu
  18. * @package Tudu_Tudu_Storage
  19. * @copyright Copyright (c) 2009-2010 Shanghai Best Oray Information S&T CO., Ltd.
  20. */
  21. class Tudu_Tudu_Extension_Flow extends Tudu_Tudu_Extension_Abstract
  22. {
  23. /**
  24. *
  25. * @var string
  26. */
  27. const NODE_HEAD = '^head';
  28. const NODE_END = '^end';
  29. const NODE_BREAK = '^break';
  30. const NODE_UPPER = '^upper';
  31. /**
  32. *
  33. * @var 部门列表
  34. */
  35. protected $_depts;
  36. /**
  37. * 创建步骤
  38. *
  39. * @param $tuduId
  40. * @param $params
  41. */
  42. public function createStep(array $params)
  43. {
  44. return $this->getDao('Dao_Td_Tudu_Step')->createStep($params);
  45. }
  46. /**
  47. * 更新步骤
  48. *
  49. * @param $tuduId
  50. * @param $stepId
  51. * @param $params
  52. */
  53. public function updateStep($tuduId, $stepId, array $params)
  54. {
  55. return $this->getDao('Dao_Td_Tudu_Step')->updateStep($tuduId, $stepId, $params);
  56. }
  57. /**
  58. * 获取步骤数据
  59. *
  60. * @param $tuduId
  61. * @param $stepId
  62. */
  63. public function getStepById($tuduId, $stepId)
  64. {
  65. return $this->getDao('Dao_Td_Tudu_Step')->getStep(array('tuduid' => $tuduId, 'stepid' => $stepId));
  66. }
  67. /**
  68. * 获取步骤列表
  69. *
  70. * @param $tuduId
  71. */
  72. public function getSteps($tuduId)
  73. {
  74. return $this->getDao('Dao_Td_Tudu_Step')->getSteps(array('tuduid' => $tuduId), null, 'ordernum ASC');
  75. }
  76. /**
  77. * 获取工作流
  78. *
  79. * @param $flowId
  80. */
  81. public function getFlowById($flowId)
  82. {
  83. return $this->getDao('Dao_Td_Flow_Flow')->getFlow(array('flowid' => $flowId));
  84. }
  85. /**
  86. *
  87. * @param $orgId
  88. * @param $uniqueId
  89. * @param $users
  90. */
  91. public function prepareRecipients($orgId, $uniqueId, array $users)
  92. {
  93. $addressBook = Tudu_AddressBook::getInstance();
  94. $recipients = array();
  95. foreach ($users as $key => $item) {
  96. $user = $addressBook->searchUser($orgId, $item['email']);
  97. if (null === $user) {
  98. $user = $addressBook->searchContact($uniqueId, $item['email'], $item['truename']);
  99. if (null === $user) {
  100. $user = $addressBook->prepareContact($item['email'], $item['truename']);
  101. }
  102. }
  103. $user['accepterinfo'] = $user['email'] . ' ' . $user['truename'];
  104. $user['percent'] = isset($item['percent']) ? (int) $item['percent'] : 0;
  105. if (isset($item['processindex'])) {
  106. $user['processindex'] = $item['processindex'];
  107. }
  108. if (isset($item['stepstatus'])) {
  109. $user['stepstatus'] = $item['stepstatus'];
  110. }
  111. $recipients[$user['uniqueid']] = $user;
  112. }
  113. return $recipients;
  114. }
  115. /**
  116. * 添加步骤用户
  117. *
  118. * @param $tuduId
  119. * @param $stepId
  120. * @param $users
  121. */
  122. public function addStepUsers($tuduId, $stepId, array $users, $startIndex = null)
  123. {
  124. /* @var $daoStep Dao_Td_Tudu_Step */
  125. $daoStep = $this->getDao('Dao_Td_Tudu_Step');
  126. $isOrder = is_int($startIndex);
  127. $count = 0;
  128. foreach ($users as $item) {
  129. $processIndex = isset($item['processindex'])
  130. ? $item['processindex']
  131. : ($isOrder ? ++$startIndex : 0);
  132. $status = isset($item['stepstatus'])
  133. ? $item['stepstatus']
  134. : ($isOrder && $count == 0 ? 1 : 0);
  135. $params = array(
  136. 'tuduid' => $tuduId,
  137. 'stepid' => $stepId,
  138. 'uniqueid' => $item['uniqueid'],
  139. 'userinfo' => $item['accepterinfo'],
  140. 'status' => $status,
  141. 'processindex' => $processIndex
  142. );
  143. if (array_key_exists('percent', $item)) {
  144. $params['percent'] = (int) $item['percent'];
  145. }
  146. $daoStep->addUser($params);
  147. $count ++;
  148. }
  149. return $count > 0;
  150. }
  151. /**
  152. *
  153. * @param string $tuduId
  154. * @param string $stepId
  155. * @param string $uniqueId
  156. * @param array $params
  157. * @return boolean
  158. */
  159. public function updateStepUser($tuduId, $stepId, $uniqueId, array $params)
  160. {
  161. return $this->getDao('Dao_Td_Tudu_Step')->updateUser($tuduId, $stepId, $uniqueId, $params);
  162. }
  163. /**
  164. *
  165. * @param string $tuduId
  166. */
  167. public function getTuduStepUsers($tuduId)
  168. {
  169. return $this->getDao('Dao_Td_Tudu_Step')->getTuduStepUsers($tuduId);
  170. }
  171. /**
  172. * 获取步骤执行人列表
  173. *
  174. * @param string $tuduId
  175. * @param string $stepId
  176. */
  177. public function getStepUsers($tuduId, $stepId)
  178. {
  179. return $this->getDao('Dao_Td_Tudu_Step')->getUsers($tuduId, $stepId);
  180. }
  181. /**
  182. *
  183. * @param string $tuduId
  184. * @param string $stepId
  185. * @param string $uniqueId
  186. */
  187. public function getStepUser($tuduId, $stepId, $uniqueId)
  188. {
  189. return $this->getDao('Dao_Td_Tudu_Step')->getCurrentStep($tuduId, $stepId, $uniqueId);
  190. }
  191. /**
  192. * 删除步骤执行人
  193. *
  194. * @param $tuduId
  195. * @param $stepId
  196. * @param $uniqueId
  197. */
  198. public function removeStepUsers($tuduId, $stepId, $uniqueId = null)
  199. {
  200. return $this->getDao('Dao_Td_Tudu_Step')->deleteUsers($tuduId, $stepId, $uniqueId);
  201. }
  202. /**
  203. * 更新步骤用户
  204. *
  205. * @param $tuduId
  206. * @param $stepId
  207. * @param $users
  208. */
  209. public function updateStepUsers(Tudu_Tudu_Storage_Tudu &$tudu, $stepId, array $users)
  210. {
  211. $currentUsers = $this->getStepUsers($tudu->tuduId, $stepId);
  212. /* @var $daoTudu Dao_Td_Tudu_Tudu */
  213. $daoTudu = $this->getDao('Dao_Td_Tudu_Tudu');
  214. $processIndex = null;
  215. $removes = array();
  216. foreach ($currentUsers as $item) {
  217. list($email, $trueName) = explode(' ', $item['userinfo'], 2);
  218. if ($item['status'] == 2 && !array_key_exists($email, $users)) {
  219. $processIndex = (int) $item['processindex'];
  220. } else {
  221. if (null === $processIndex) {
  222. $processIndex = (int) $item['processindex'] - 1;
  223. }
  224. $removes[] = $item['uniqueid'];
  225. }
  226. // 正在审批的移除待审批标签
  227. if ($item['status'] == 1) {
  228. $daoTudu->deleteLabel($tudu->tuduId, $item['uniqueid'], '^e');
  229. if (!array_key_exists($email, $tudu->to)
  230. && !array_key_exists($email, $tudu->cc)
  231. && $email != $tudu->sender)
  232. {
  233. $daoTudu->deleteLabel($tudu->tuduId, $item['uniqueid'], '^i');
  234. }
  235. }
  236. }
  237. foreach ($users as $k => $item) {
  238. $users[$k]['processindex'] = $users[$k]['processindex'] + $processIndex;
  239. }
  240. if ($removes) {
  241. $this->removeStepUsers($tudu->tuduId, $stepId, $removes);
  242. }
  243. // 添加审批人
  244. $recipients = $this->prepareRecipients($tudu->orgId, $stepId, $users);
  245. $this->addStepUsers($tudu->tuduId, $stepId, $recipients, $processIndex);
  246. }
  247. /**
  248. * 删除步骤
  249. *
  250. * @param $tuduId
  251. * @param $stepId
  252. */
  253. public function deleteStep($tuduId, $stepId)
  254. {
  255. return $this->getDao('Dao_Td_Tudu_Step')->deleteStep($tuduId, $stepId);
  256. }
  257. /**
  258. * 删除后续步骤
  259. *
  260. * @param string $tuduId
  261. * @param string $stepId
  262. */
  263. public function deleteNextSteps($tuduId, $stepId)
  264. {
  265. return $this->getDao('Dao_Td_Tudu_Step')->removeNextSteps($tuduId, $stepId);
  266. }
  267. /**
  268. * 删除所有步骤
  269. *
  270. * @param $tuduId
  271. * @param $stepId
  272. */
  273. public function deleteAllSteps($tuduId)
  274. {
  275. return $this->getDao('Dao_Td_Tudu_Step')->deleteSteps($tuduId);
  276. }
  277. /**
  278. * 设置图度当前步骤
  279. *
  280. * @param $tuduId
  281. * @param $stepId
  282. */
  283. public function flowToStep($tuduId, $stepId)
  284. {
  285. //return $this->getDao('Dao_Td_Tudu_Tudu')->updateTudu($tuduId, array('stepid' => $stepId));
  286. }
  287. /**
  288. *
  289. * @param $tudu
  290. * @param $stepId
  291. * @param $users
  292. */
  293. public function cancelStep(Tudu_Tudu_Storage_Tudu &$tudu, $stepId)
  294. {
  295. $this->updateStep($tudu->tuduId, $stepId, array('status' => 4));
  296. $users = $this->getStepUsers($tudu->tuduId, $stepId);
  297. /* @var $daoTudu Dao_Td_Tudu_Tudu */
  298. $daoTudu = $this->getDao('Dao_Td_Tudu_Tudu');
  299. foreach ($users as $item) {
  300. list($email, $trueName) = explode(' ', $item['userinfo'], 2);
  301. // 正在审批的移除待审批标签
  302. if ($item['status'] == 1) {
  303. $daoTudu->deleteLabel($tudu->tuduId, $item['uniqueid'], '^e');
  304. if (!array_key_exists($email, $tudu->to)
  305. && !array_key_exists($email, $tudu->cc)
  306. && $email != $tudu->sender)
  307. {
  308. $daoTudu->deleteLabel($tudu->tuduId, $item['uniqueid'], '^i');
  309. }
  310. }
  311. }
  312. }
  313. /**
  314. *
  315. * @param Tudu_Tudu_Storage_Tudu $tudu
  316. * @param array $params
  317. * @return array
  318. */
  319. public function onPrepare(Tudu_Tudu_Storage_Tudu &$tudu, array $params)
  320. {
  321. if ($tudu->flowId && !$tudu->stepId) {
  322. $this->onPrepareFlow($tudu);
  323. }
  324. if ($tudu->reviewer && !$tudu->to && $tudu->type != 'notice') {
  325. $tudu->to = Tudu_Tudu_Storage::formatRecipients($tudu->from);
  326. }
  327. }
  328. /**
  329. * 整理工作步骤
  330. *
  331. * @param Tudu_Tudu_Storage_Tudu $tudu
  332. */
  333. public function onPrepareFlow(Tudu_Tudu_Storage_Tudu &$tudu)
  334. {
  335. $flow = $this->getFlowById($tudu->flowId);
  336. if (null !== $flow) {
  337. $flow = $flow->toArray();
  338. // 没有步骤
  339. if (count($flow['steps']) <= 0) {
  340. require_once 'Tudu/Tudu/Exception.php';
  341. throw new Tudu_Tudu_Exception('Flow has not any steps', Tudu_Tudu_Exception::CODE_FLOW_STEP_NULL);
  342. }
  343. // 整理抄送人
  344. if (!empty($flow['cc'])) {
  345. $cc = array();
  346. foreach ($flow['cc'] as $key => $item) {
  347. if (false !== strpos($key, '@')) {
  348. $cc[$key] = array('email' => $key, 'truename' => $item[0]);
  349. } else {
  350. $cc[$key] = array('groupid' => $key, 'truename' => $item[0]);
  351. }
  352. }
  353. $tudu->cc = array_merge($tudu->cc, $cc);
  354. }
  355. // 第一步骤ID
  356. $steps = $flow['steps'];
  357. $prevUsers = array(array('email' => $tudu->email));
  358. $prevType = 0;
  359. $addressBook = Tudu_AddressBook::getInstance();
  360. $depts = $this->_getDepartments($tudu->orgId);
  361. $tuduSteps = array();
  362. $orderNum = 1;
  363. foreach ($steps as $key => $step) {
  364. $stepId = $step['id'];
  365. if ($step['type'] == 1) {
  366. // 上级审批
  367. if ($step['users'] == '^upper') {
  368. // 上一步是审批
  369. $reviewerIds = array();
  370. if ($prevType == 1) {
  371. foreach ($prevUsers as $item) {
  372. foreach ($item as $user) {
  373. $user = $addressBook->searchUser($tudu->orgId, $user['email']);
  374. if (!$user) {
  375. require_once 'Tudu/Tudu/Exception.php';
  376. throw new Tudu_Tudu_Exception('User is not exists', Tudu_Tudu_Exception::CODE_NOT_EXISTS_USER);
  377. }
  378. $moderatorIds = $this->_getUpper($user['email'], $tudu->orgId, $user['deptid']);
  379. foreach ($moderatorIds as $uid) {
  380. $reviewerIds[] = $uid;
  381. }
  382. }
  383. }
  384. } else {
  385. foreach ($prevUsers as $user) {
  386. $user = $addressBook->searchUser($tudu->orgId, $user['email']);
  387. if (!$user) {
  388. require_once 'Tudu/Tudu/Exception.php';
  389. throw new Tudu_Tudu_Exception('User is not exists', Tudu_Tudu_Exception::CODE_NOT_EXISTS_USER);
  390. }
  391. $moderatorIds = $this->_getUpper($user['email'], $tudu->orgId, $user['deptid']);
  392. foreach ($moderatorIds as $uid) {
  393. $reviewerIds[] = $uid;
  394. }
  395. }
  396. }
  397. if (empty($reviewerIds)) {
  398. require_once 'Tudu/Tudu/Exception.php';
  399. throw new Tudu_Tudu_Exception('Upper is not exists', Tudu_Tudu_Exception::CODE_NOT_EXISTS_UPPER);
  400. }
  401. $reviewers = array();
  402. $reviewerIds = array_unique($reviewerIds);
  403. foreach ($reviewerIds as $uId) {
  404. $user = $addressBook->searchUser($tudu->orgId, $uId . '@' . $tudu->orgId);
  405. if (empty($user)) {
  406. require_once 'Tudu/Tudu/Exception.php';
  407. throw new Tudu_Tudu_Exception('User is not exists', Tudu_Tudu_Exception::CODE_NOT_EXISTS_USER);
  408. }
  409. $reviewers[] = $user;
  410. }
  411. $users = array($reviewers);
  412. $prevUsers = $users;
  413. // 指定
  414. } else {
  415. $prevUsers = $users = Tudu_Tudu_Storage::formatReviewer($step['users']);
  416. foreach ($users as $item) {
  417. foreach ($item as $u) {
  418. $user = $addressBook->searchUser($tudu->orgId, $u['email']);
  419. if (!$user) {
  420. require_once 'Tudu/Tudu/Exception.php';
  421. throw new Tudu_Tudu_Exception('User is not exists', Tudu_Tudu_Exception::CODE_NOT_EXISTS_USER);
  422. }
  423. }
  424. }
  425. }
  426. $recipients = array();
  427. $processIndex = 1;
  428. foreach ($users as $item) {
  429. foreach ($item as $user) {
  430. $recipients[] = array(
  431. 'email' => $user['email'],
  432. 'truename' => $user['truename'],
  433. 'processindex' => $processIndex,
  434. 'stepstatus' => $processIndex == 1 ? 1 : 0
  435. );
  436. }
  437. $processIndex ++;
  438. }
  439. $tuduSteps[$stepId] = array(
  440. 'orgid' => $tudu->orgId,
  441. 'tuduid' => $tudu->tuduId,
  442. 'uniqueid' => $tudu->uniqueId,
  443. 'stepid' => $stepId,
  444. 'type' => Dao_Td_Tudu_Step::TYPE_EXAMINE,
  445. 'prevstepid' => $step['prev'],
  446. 'nextstepid' => $step['next'],
  447. 'users' => $recipients,
  448. 'ordernum' => $orderNum ++,
  449. 'createtime' => time()
  450. );
  451. } else {
  452. $prevUsers = $users = Tudu_Tudu_Storage::formatRecipients($step['users']);
  453. foreach ($prevUsers as $u) {
  454. $user = $addressBook->searchUser($tudu->orgId, $u['email']);
  455. if (!$user) {
  456. require_once 'Tudu/Tudu/Exception.php';
  457. throw new Tudu_Tudu_Exception('User is not exists', Tudu_Tudu_Exception::CODE_NOT_EXISTS_USER);
  458. }
  459. }
  460. $tuduSteps[$stepId] = array(
  461. 'orgid' => $tudu->orgId,
  462. 'tuduid' => $tudu->tuduId,
  463. 'uniqueid' => $tudu->uniqueId,
  464. 'stepid' => $stepId,
  465. 'type' => $step['type'] == 2 ? Dao_Td_Tudu_Step::TYPE_CLAIM : Dao_Td_Tudu_Step::TYPE_EXECUTE,
  466. 'prevstepid' => $step['prev'],
  467. 'nextstepid' => $step['next'],
  468. 'users' => $users,
  469. 'ordernum' => $orderNum ++,
  470. 'createtime' => time()
  471. );
  472. }
  473. $prevType = $step['type'];
  474. }
  475. $tudu->steps = $tuduSteps;
  476. // 第一步骤ID
  477. $firstStep = reset($tuduSteps);
  478. $tudu->stepId = $firstStep['stepid'];
  479. if ($firstStep['type'] == 1) {
  480. $users = $firstStep['users'];
  481. $reviewers = array();
  482. foreach ($users as $user) {
  483. if ($user['processindex'] == 1) {
  484. $reviewers[] = $user;
  485. }
  486. }
  487. $tudu->reviewer = array($reviewers);
  488. } else {
  489. $tudu->to = $firstStep['users'];
  490. }
  491. $tudu->status = Dao_Td_Tudu_Tudu::STATUS_DOING;
  492. }
  493. }
  494. /**
  495. * 根据工作流创建图度步骤
  496. *
  497. * @param $tudu
  498. */
  499. public function createFlowSteps(Tudu_Tudu_Storage_Tudu &$tudu)
  500. {
  501. if ($tudu->flowId && $tudu->steps) {
  502. $steps = $tudu->steps;
  503. // 第一步骤ID
  504. /*$firstStep = reset($steps);
  505. $tudu->stepId = $firstStep['stepid'];
  506. if ($firstStep['type'] == 1) {
  507. $users = $firstStep['users'];
  508. $reviewers = array();
  509. foreach ($users as $user) {
  510. if ($user['processindex'] == 1) {
  511. $reviewers[] = $user;
  512. }
  513. }
  514. $tudu->reviewer = array($reviewers);
  515. } else {
  516. $tudu->to = $firstStep['users'];
  517. }*/
  518. } else {
  519. $steps = array();
  520. $currentStepId = null;
  521. $orderNum = 1;
  522. if ($tudu->reviewer) {
  523. $reviewers = $tudu->reviewer;
  524. $users = array();
  525. $processIndex = 1;
  526. foreach ($reviewers as $item) {
  527. foreach ($item as $reviewer) {
  528. $users[] = array(
  529. 'email' => $reviewer['email'],
  530. 'truename' => $reviewer['truename'],
  531. 'processindex' => $processIndex,
  532. 'stepstatus' => $processIndex == 1 ? 1 : 0
  533. );
  534. }
  535. $processIndex ++;
  536. }
  537. $stepId = Dao_Td_Tudu_Step::getStepId();
  538. $steps[$stepId] = array(
  539. 'orgid' => $tudu->orgId,
  540. 'tuduid' => $tudu->tuduId,
  541. 'uniqueid' => $tudu->uniqueId,
  542. 'stepid' => $stepId,
  543. 'type' => Dao_Td_Tudu_Step::TYPE_EXAMINE,
  544. 'prevstepid' => self::NODE_HEAD,
  545. 'nextstepid' => self::NODE_END,
  546. 'users' => $users,
  547. 'ordernum' => $orderNum ++,
  548. 'createtime' => time()
  549. );
  550. $currentStepId = $stepId;
  551. }
  552. if ($tudu->to) {
  553. $stepId = Dao_Td_Tudu_Step::getStepId();
  554. $prevId = self::NODE_HEAD;
  555. if ($currentStepId) {
  556. $steps[$currentStepId]['nextstepid'] = $stepId;
  557. $prevId = $currentStepId;
  558. } else {
  559. $currentStepId = $stepId;
  560. }
  561. $steps[$stepId] = array(
  562. 'orgid' => $tudu->orgId,
  563. 'tuduid' => $tudu->tuduId,
  564. 'uniqueid' => $tudu->uniqueId,
  565. 'stepid' => $stepId,
  566. 'type' => $tudu->acceptMode ? Dao_Td_Tudu_Step::TYPE_CLAIM : Dao_Td_Tudu_Step::TYPE_EXECUTE,
  567. 'prevstepid' => $prevId,
  568. 'nextstepid' => self::NODE_END,
  569. 'users' => $tudu->to,
  570. 'ordernum' => $orderNum ++,
  571. 'createtime' => time()
  572. );
  573. }
  574. }
  575. /*
  576. foreach ($tudu->steps as $key => $step) {
  577. $stepId = $step['id'];
  578. if ($step['type'] == 1) {
  579. $users = array();
  580. $processIndex = 1;
  581. $reviewers = array();
  582. if ($step['users'] == self::NODE_UPPER) {
  583. // 取上一步骤
  584. $prevStep = $tudu->steps[$key - 1];
  585. if (isset($prevStep)) {
  586. $addressBook = Tudu_AddressBook::getInstance();
  587. $reviewerIds = array();
  588. if ($prevStep['type'] == 1) {
  589. $prevUsers = Tudu_Tudu_Storage::formatReviewer($prevStep['users']);
  590. foreach ($prevUsers as $item) {
  591. foreach ($item as $user) {
  592. $user = $addressBook->searchUser($tudu->orgId, $user['email']);
  593. if ($user) {
  594. $dept = $this->getDepartment($tudu->orgId, $user['deptid']);
  595. if (empty($dept->moderators)) {
  596. continue;
  597. }
  598. foreach ($dept->moderators as $m) {
  599. $reviewerIds[] = $m;
  600. }
  601. }
  602. }
  603. }
  604. } else {
  605. $prevUsers = Tudu_Tudu_Storage::formatRecipients($prevStep['users']);
  606. foreach ($prevUsers as $user) {
  607. $user = $addressBook->searchUser($tudu->orgId, $user['email']);
  608. if ($user) {
  609. $dept = $this->getDepartment($tudu->orgId, $user['deptid']);
  610. if (empty($dept->moderators)) {
  611. continue;
  612. }
  613. foreach ($dept->moderators as $m) {
  614. $reviewerIds[] = $m;
  615. }
  616. }
  617. }
  618. }
  619. if (empty($reviewerIds)) {
  620. //throw new Zend_Controller_Action_Exception('', 404);
  621. }
  622. $reviewerIds = array_unique($reviewerIds);
  623. foreach ($reviewerIds as $userId) {
  624. $user = $addressBook->searchUser($tudu->orgId, $userId . '@' . $tudu->orgId);
  625. if ($user) {
  626. end($reviewers);
  627. $last = key($reviewers);
  628. $reviewers[$last][] = array('email' => $user['email'], 'truename' => $user['truename']);
  629. }
  630. }
  631. }
  632. } else {
  633. $reviewers = Tudu_Tudu_Storage:: _formatReviewer($step['users']);
  634. }
  635. foreach ($reviewers as $item) {
  636. foreach ($item as $reviewer) {
  637. $users[] = array(
  638. 'email' => $reviewer['email'],
  639. 'truename' => $reviewer['truename'],
  640. 'processindex' => $processIndex,
  641. 'stepstatus' => $processIndex == 1 ? 1 : 0
  642. );
  643. }
  644. $processIndex ++;
  645. }
  646. $steps[$stepId] = array(
  647. 'orgid' => $tudu->orgId,
  648. 'tuduid' => $tudu->tuduId,
  649. 'uniqueid' => $tudu->uniqueId,
  650. 'stepid' => $stepId,
  651. 'type' => Dao_Td_Tudu_Step::TYPE_EXAMINE,
  652. 'prevstepid' => $step['prev'],
  653. 'nextstepid' => $step['next'],
  654. 'users' => $users,
  655. 'ordernum' => $orderNum ++
  656. );
  657. } else {
  658. $recipients = Tudu_Tudu_Storage::formatRecipients($step['users']);
  659. $steps[$stepId] = array(
  660. 'orgid' => $tudu->orgId,
  661. 'tuduid' => $tudu->tuduId,
  662. 'uniqueid' => $tudu->uniqueId,
  663. 'stepid' => $stepId,
  664. 'type' => $step['type'] == 2 ? Dao_Td_Tudu_Step::TYPE_CLAIM : Dao_Td_Tudu_Step::TYPE_EXECUTE,
  665. 'prevstepid' => $step['prev'],
  666. 'nextstepid' => $step['next'],
  667. 'users' => $recipients,
  668. 'ordernum' => $orderNum ++
  669. );
  670. }
  671. }
  672. */
  673. foreach ($steps as $step) {
  674. if ($this->createStep($step)) {
  675. $recipients = $this->prepareRecipients($tudu->orgId, $tudu->uniqueId, $step['users']);
  676. $processIndex = $step['type'] == Dao_Td_Tudu_Step::TYPE_EXAMINE ? 0 : null;
  677. $this->addStepUsers($tudu->tuduId, $step['stepid'], $recipients, $processIndex);
  678. }
  679. }
  680. $tudu->stepNum = count($steps);
  681. return true;
  682. }
  683. /**
  684. * 更新图度工作流后续步骤
  685. *
  686. * @param $tudu
  687. */
  688. public function updateFlowSteps(Tudu_Tudu_Storage_Tudu &$tudu)
  689. {
  690. /*if ($tudu->stepId != self::NODE_HEAD && $tudu->stepId != self::NODE_BREAK && !$tudu->isDraft()) {
  691. return false;
  692. }*/
  693. $steps = $this->getSteps($tudu->tuduId)->toArray('stepid');
  694. $currentStep = $tudu->stepId && false === strpos($tudu->stepId, '^') ? $steps[$tudu->stepId] : array_pop($steps);
  695. $stepNum = count($steps);
  696. $newSteps = array();
  697. // 当前为审批步骤
  698. if ($currentStep['type'] == Dao_Td_Tudu_Step::TYPE_EXAMINE) {
  699. $stepId = $currentStep['stepid'];
  700. $reviewer = array();
  701. $pidx = null;
  702. // 获取步骤审批人
  703. $users = $this->getStepUsers($tudu->tuduId, $stepId);//var_dump($users);exit;
  704. foreach ($users as &$user) {
  705. if ($user['status'] == 2) {
  706. continue;
  707. }
  708. $userInfo = explode(' ', $user['userinfo']);
  709. if ($pidx == $user['processindex']) {
  710. end($reviewer);
  711. $last = key($reviewer);
  712. $reviewer[$last][] = array('email' => $userInfo[0], 'truename' => $userInfo[1]);
  713. } else {
  714. $reviewer[] = array(array('email' => $userInfo[0], 'truename' => $userInfo[1]));
  715. }
  716. $pidx = $user['processindex'];
  717. }
  718. $tudu->reviewer = $reviewer;
  719. $tudu->stepId = $stepId;
  720. var_dump($tudu->reviewer);
  721. // 其他
  722. } else {
  723. }
  724. exit;
  725. }
  726. /**
  727. * 创建图度步骤
  728. *
  729. * @param Tudu_Tudu_Storage_Tudu $tudu
  730. */
  731. public function createTuduSteps(Tudu_Tudu_Storage_Tudu &$tudu)
  732. {
  733. $steps = array();
  734. $currentStepId = null;
  735. $orderNum = 1;
  736. if ($tudu->reviewer) {
  737. $reviewers = $tudu->reviewer;
  738. $users = array();
  739. $processIndex = 1;
  740. foreach ($reviewers as $item) {
  741. foreach ($item as $reviewer) {
  742. $users[] = array(
  743. 'email' => $reviewer['email'],
  744. 'truename' => $reviewer['truename'],
  745. 'processindex' => $processIndex,
  746. 'stepstatus' => $processIndex == 1 ? 1 : 0
  747. );
  748. }
  749. $processIndex ++;
  750. }
  751. $stepId = Dao_Td_Tudu_Step::getStepId();
  752. $steps[$stepId] = array(
  753. 'orgid' => $tudu->orgId,
  754. 'tuduid' => $tudu->tuduId,
  755. 'uniqueid' => $tudu->uniqueId,
  756. 'stepid' => $stepId,
  757. 'type' => Dao_Td_Tudu_Step::TYPE_EXAMINE,
  758. 'prevstepid' => self::NODE_HEAD,
  759. 'nextstepid' => self::NODE_END,
  760. 'users' => $users,
  761. 'ordernum' => $orderNum ++,
  762. 'createtime' => time()
  763. );
  764. $currentStepId = $stepId;
  765. }
  766. if ($tudu->to) {
  767. $stepId = Dao_Td_Tudu_Step::getStepId();
  768. $prevId = self::NODE_HEAD;
  769. if ($currentStepId) {
  770. $steps[$currentStepId]['nextstepid'] = $stepId;
  771. $prevId = $currentStepId;
  772. } else {
  773. $currentStepId = $stepId;
  774. }
  775. if ($tudu->stepto) {
  776. $countTo = count($tudu->stepto);
  777. $i = 0;
  778. foreach ($tudu->stepto as $item) {
  779. $i++;
  780. $users = array();
  781. foreach ($item as $to) {
  782. $users[] = array(
  783. 'email' => $to['email'],
  784. 'truename' => $to['truename']
  785. );
  786. }
  787. $nextStepId = Dao_Td_Tudu_Step::getStepId();
  788. $steps[$stepId] = array(
  789. 'orgid' => $tudu->orgId,
  790. 'tuduid' => $tudu->tuduId,
  791. 'uniqueid' => $tudu->uniqueId,
  792. 'stepid' => $stepId,
  793. 'type' => $tudu->acceptMode ? Dao_Td_Tudu_Step::TYPE_CLAIM : Dao_Td_Tudu_Step::TYPE_EXECUTE,
  794. 'prevstepid' => $prevId,
  795. 'nextstepid' => $countTo == $i ? self::NODE_END : $nextStepId,
  796. 'users' => $users,
  797. 'ordernum' => $orderNum ++,
  798. 'createtime' => time()
  799. );
  800. $prevId = $stepId;
  801. $stepId = $nextStepId;
  802. }
  803. }
  804. }
  805. foreach ($steps as $step) {
  806. if ($this->createStep($step)) {
  807. $recipients = $this->prepareRecipients($tudu->orgId, $tudu->uniqueId, $step['users']);
  808. $processIndex = $step['type'] == Dao_Td_Tudu_Step::TYPE_EXAMINE ? 0 : null;
  809. $this->addStepUsers($tudu->tuduId, $step['stepid'], $recipients, $processIndex);
  810. }
  811. }
  812. $tudu->stepId = $currentStepId;
  813. $tudu->stepNum = count($steps);
  814. return true;
  815. }
  816. /**
  817. * 更新图度后续步骤
  818. *
  819. * @param $tudu
  820. */
  821. public function updateTuduSteps(Tudu_Tudu_Storage_Tudu &$tudu, $cancelCurrent = true)
  822. {
  823. // 草稿
  824. if ($tudu->isDraft() || $tudu->stepId == self::NODE_HEAD || $tudu->stepId == self::NODE_BREAK) {
  825. $this->deleteAllSteps($tudu->tuduId);
  826. if ($tudu->flowId) {
  827. $this->onPrepareFlow($tudu);
  828. if ($tudu->isChange('to')) {
  829. $manager = Tudu_Tudu_Manager::getInstance();
  830. $to = $tudu->getAttribute('to');
  831. $to = isset($to) ? Tudu_Tudu_Storage::formatReceiver($to) : null;
  832. $manager->updateTudu($tudu->tuduId, array('to' => $to));
  833. }
  834. return $this->createFlowSteps($tudu);
  835. } else {
  836. return $this->createTuduSteps($tudu);
  837. }
  838. }
  839. if ($tudu->flowId) {
  840. return true;
  841. //return $this->updateFlowSteps($tudu);
  842. }
  843. $steps = $this->getSteps($tudu->tuduId)->toArray('stepid');
  844. if ($tudu->stepId && false === strpos($tudu->stepId, '^')) {
  845. $currentStep = $steps[$tudu->stepId];
  846. } else {
  847. foreach ($steps as $step) {
  848. if ($step['stepstatus'] != 4) {
  849. $currentStep = $step;
  850. break;
  851. }
  852. }
  853. }
  854. //$currentStep = $tudu->stepId && false === strpos($tudu->stepId, '^') ? $steps[$tudu->stepId] : array_pop($steps);
  855. // 当前为审批步骤
  856. $stepNum = count($steps);
  857. $newSteps = array();
  858. $updatePrevStepId = null;
  859. if (isset($currentStep) && $currentStep['type'] == Dao_Td_Tudu_Step::TYPE_EXAMINE) {
  860. $nextStepId = $currentStep['stepid'];
  861. $execStepId = Dao_Td_Tudu_Step::getStepId();
  862. if ($tudu->reviewer) {
  863. $reviewers = $tudu->reviewer;
  864. $users = array();
  865. $processIndex = 1;
  866. foreach ($reviewers as $item) {
  867. foreach ($item as $reviewer) {
  868. $users[] = array(
  869. 'email' => $reviewer['email'],
  870. 'truename' => $reviewer['truename'],
  871. 'processindex' => $processIndex,
  872. 'stepstatus' => $processIndex == 1 ? 1 : 0
  873. );
  874. }
  875. $processIndex ++;
  876. }
  877. // 更新审批步骤审批人
  878. $this->updateStepUsers($tudu, $currentStep['stepid'], $users);
  879. $updatePrevStepId = $prevStepId = $currentStep['stepid'];
  880. $tudu->stepId = $currentStep['stepid'];
  881. } else {
  882. // 审批步骤作废
  883. //$this->cancelStep($tudu, $currentStep['stepid']);
  884. $this->updateStepUsers($tudu, $currentStep['stepid'], array());
  885. $updatePrevStepId = $prevStepId = $currentStep['prevstepid'];
  886. $tudu->stepId = $execStepId;
  887. }
  888. if ($tudu->type != 'notice') {
  889. $updateNextStepId = $stepId = $execStepId;
  890. if ($tudu->stepto) {
  891. $countTo = count($tudu->stepto);
  892. $i = 0;
  893. $orderNum = $currentStep['ordernum'];
  894. foreach ($tudu->stepto as $item) {
  895. $i++;
  896. $users = array();
  897. foreach ($item as $to) {
  898. $users[] = array(
  899. 'email' => $to['email'],
  900. 'truename' => $to['truename']
  901. );
  902. }
  903. $nextStepId = Dao_Td_Tudu_Step::getStepId();
  904. $newSteps[] = array(
  905. 'orgid' => $tudu->orgId,
  906. 'tuduid' => $tudu->tuduId,
  907. 'uniqueid' => $tudu->uniqueId,
  908. 'stepid' => $stepId,
  909. 'type' => $tudu->acceptMode ? Dao_Td_Tudu_Step::TYPE_CLAIM : Dao_Td_Tudu_Step::TYPE_EXECUTE,
  910. 'prevstepid' => $prevStepId,
  911. 'nextstepid' => $countTo == $i ? self::NODE_END : $nextStepId,
  912. 'users' => $users,
  913. 'ordernum' => ++$orderNum,
  914. 'createtime' => time()
  915. );
  916. $prevStepId = $stepId;
  917. $stepId = $nextStepId;
  918. }
  919. }
  920. $nextStepId = $stepId;
  921. } else {
  922. $updateNextStepId = $nextStepId = self::NODE_END;
  923. }
  924. // 其他
  925. } else {
  926. $isChangeTo = false;
  927. // 比较图度执行人
  928. $stepUsers = $this->getTuduStepUsers($tudu->tuduId);
  929. $stepTo = array(); //修改前的步骤执行人
  930. $stepSize = 0; //修改前的步骤个数
  931. $tempStepId = null;
  932. foreach ($stepUsers as &$u) {
  933. if ($tudu->stepId == $u['stepid'] && $u['type'] == Dao_Td_Tudu_Step::TYPE_EXECUTE && $u['stepstatus'] != 4) {
  934. if ($tempStepId != $u['stepid']) {
  935. $stepSize++;
  936. }
  937. $tempStepId = $u['stepid'];
  938. $info = explode(' ', $u['userinfo']);
  939. $u['email'] = $info[0];
  940. $u['truename'] = $info[1];
  941. $stepTo[$u['email']] = $u;
  942. }
  943. }
  944. $currentTo = array(); //当前修改后的执行人
  945. $currentStepSize = 0; //当前修改后步骤个数
  946. foreach ($tudu->stepto as $item) {
  947. foreach ($item as $to) {
  948. $currentTo[$to['email']] = $to;
  949. }
  950. $currentStepSize++;
  951. }
  952. $src = array_keys($stepTo);
  953. $cur = array_keys($currentTo);
  954. $srcCount = count($src);
  955. $isChangeTo = $stepSize != $currentStepSize || count($cur) != $srcCount || count(array_uintersect($src, $cur, "strcasecmp")) != $srcCount;
  956. // 步骤作废
  957. if ($isChangeTo || $tudu->isChange('acceptmode')) {
  958. if ($cancelCurrent) {
  959. $this->updateStep($tudu->tuduId, $currentStep['stepid'], array('status' => 4));
  960. $updatePrevStepId = $prevStepId = $currentStep['prevstepid'];
  961. } else {
  962. $updatePrevStepId = $prevStepId = $currentStep['stepid'];
  963. }
  964. } else {
  965. $updatePrevStepId = $prevStepId = $currentStep['stepid'];
  966. $tudu->stepId = $prevStepId;
  967. }
  968. $updateNextStepId = $nextStepId = null;
  969. $prevId = $prevStepId;
  970. $orderNum = $currentStep['ordernum'];
  971. if ($tudu->reviewer) {
  972. // 前一步骤作废
  973. if ($cancelCurrent) {
  974. $this->updateStep($tudu->tuduId, $prevId, array('status' => 4));
  975. }
  976. $reviewers = $tudu->reviewer;
  977. $users = array();
  978. $processIndex = 1;
  979. foreach ($reviewers as $item) {
  980. foreach ($item as $reviewer) {
  981. $users[] = array(
  982. 'email' => $reviewer['email'],
  983. 'truename' => $reviewer['truename'],
  984. 'processindex' => $processIndex
  985. );
  986. }
  987. $processIndex ++;
  988. }
  989. $stepId = Dao_Td_Tudu_Step::getStepId();
  990. /*插入修改人
  991. $nextStepId = Dao_Td_Tudu_Step::getStepId();
  992. $newSteps[$stepId] = array(
  993. 'orgid' => $tudu->orgId,
  994. 'tuduid' => $tudu->tuduId,
  995. 'stepid' => $stepId,
  996. 'uniqueid' => $tudu->uniqueId,
  997. 'prevstepid' => $prevId,
  998. 'nextstepid' => $nextStepId,
  999. 'type' => Dao_Td_Tudu_Step::TYPE_EXECUTE,
  1000. 'ordernum' => ++$orderNum,
  1001. 'createtime' => time(),
  1002. 'users' => array(0 => array('email' => $tudu->email, 'truename' => $tudu->poster))
  1003. );
  1004. $prevId = $stepId;
  1005. $stepId = $nextStepId;
  1006. */
  1007. $newSteps[$stepId] = array(
  1008. 'orgid' => $tudu->orgId,
  1009. 'tuduid' => $tudu->tuduId,
  1010. 'stepid' => $stepId,
  1011. 'uniqueid' => $tudu->uniqueId,
  1012. 'prevstepid' => $prevId,
  1013. 'nextstepid' => '^end',
  1014. 'type' => Dao_Td_Tudu_Step::TYPE_EXAMINE,
  1015. 'ordernum' => ++$orderNum,
  1016. 'createtime' => time(),
  1017. 'users' => $users
  1018. );
  1019. $prevId = $stepId;
  1020. if (!$nextStepId) {
  1021. $updateNextStepId = $nextStepId = $stepId;
  1022. }
  1023. }
  1024. if ($isChangeTo || count($newSteps) || $tudu->isChange('acceptmode')) {
  1025. $stepId = Dao_Td_Tudu_Step::getStepId();
  1026. if (!$nextStepId) {
  1027. $updateNextStepId = $nextStepId = $stepId;
  1028. }
  1029. if (isset($newSteps[$prevId])) {
  1030. $newSteps[$prevId]['nextstepid'] = $stepId;
  1031. }
  1032. // 转发
  1033. if ($tudu->action == 'forward') {
  1034. $newSteps[$stepId] = array(
  1035. 'orgid' => $tudu->orgId,
  1036. 'tuduid' => $tudu->tuduId,
  1037. 'stepid' => $stepId,
  1038. 'uniqueid' => $tudu->uniqueId,
  1039. 'prevstepid' => $prevId,
  1040. 'nextstepid' => '^end',
  1041. 'type' => $tudu->acceptMode ? Dao_Td_Tudu_Step::TYPE_CLAIM : Dao_Td_Tudu_Step::TYPE_EXECUTE,
  1042. 'ordernum' => ++$orderNum,
  1043. 'createtime' => time(),
  1044. 'users' => $tudu->to
  1045. );
  1046. } else {
  1047. // 修改
  1048. if ($tudu->stepto) {
  1049. $countTo = count($tudu->stepto);
  1050. $i = 0;
  1051. foreach ($tudu->stepto as $item) {
  1052. $i++;
  1053. $users = array();
  1054. foreach ($item as $to) {
  1055. $users[] = array(
  1056. 'email' => $to['email'],
  1057. 'truename' => $to['truename']
  1058. );
  1059. }
  1060. $nextId = Dao_Td_Tudu_Step::getStepId();
  1061. $newSteps[$stepId] = array(
  1062. 'orgid' => $tudu->orgId,
  1063. 'tuduid' => $tudu->tuduId,
  1064. 'uniqueid' => $tudu->uniqueId,
  1065. 'stepid' => $stepId,
  1066. 'type' => $tudu->acceptMode ? Dao_Td_Tudu_Step::TYPE_CLAIM : Dao_Td_Tudu_Step::TYPE_EXECUTE,
  1067. 'prevstepid' => $prevId,
  1068. 'nextstepid' => $countTo == $i ? self::NODE_END : $nextId,
  1069. 'users' => $users,
  1070. 'ordernum' => ++$orderNum,
  1071. 'createtime' => time()
  1072. );
  1073. $prevId = $stepId;
  1074. $stepId = $nextId;
  1075. }
  1076. }
  1077. }
  1078. }
  1079. if ($nextStepId) {
  1080. $tudu->stepId = $updateNextStepId;
  1081. }
  1082. }
  1083. if (!empty($newSteps)) {
  1084. // 移除后随未开始执行的步骤
  1085. foreach ($steps as $step) {
  1086. if ($step['ordernum'] > $currentStep['ordernum']) {
  1087. $this->deleteStep($tudu->tuduId, $step['stepid']);
  1088. $stepNum--;
  1089. }
  1090. }
  1091. foreach ($newSteps as $step) {
  1092. if ($this->createStep($step)) {
  1093. $recipients = $this->prepareRecipients($tudu->orgId, $tudu->uniqueId, $step['users']);
  1094. $processIndex = $step['type'] == Dao_Td_Tudu_Step::TYPE_EXAMINE ? 0 : null;
  1095. $this->addStepUsers($tudu->tuduId, $step['stepid'], $recipients, $processIndex);
  1096. $stepNum++;
  1097. }
  1098. }
  1099. $this->updateStep($tudu->tuduId, $updatePrevStepId, array('nextstepid' => $updateNextStepId));
  1100. }
  1101. $tudu->stepNum = $stepNum;
  1102. /*return $this->getDao('Dao_Td_Tudu_Tudu')->updateTudu($tudu->tuduId,
  1103. array(
  1104. 'stepid' => $tudu->stepId,
  1105. 'stepnum' => $stepNum
  1106. )
  1107. );*/
  1108. }
  1109. /**
  1110. * 更新图度后执行事件
  1111. */
  1112. public function postUpdate(Tudu_Tudu_Storage_Tudu &$tudu)
  1113. {
  1114. if ($this->updateTuduSteps($tudu)) {
  1115. return $this->getDao('Dao_Td_Tudu_Tudu')->updateTudu($tudu->tuduId,
  1116. array(
  1117. 'stepid' => $tudu->stepId,
  1118. 'stepnum' => $tudu->stepNum
  1119. )
  1120. );
  1121. }
  1122. return true;
  1123. }
  1124. /**
  1125. *
  1126. */
  1127. public function postCreate(Tudu_Tudu_Storage_Tudu &$tudu)
  1128. {
  1129. if ($tudu->flowId) {
  1130. $ret = $this->createFlowSteps($tudu);
  1131. } else {
  1132. $ret = $this->createTuduSteps($tudu);
  1133. }
  1134. if ($ret) {
  1135. return $this->getDao('Dao_Td_Tudu_Tudu')->updateTudu($tudu->tuduId,
  1136. array(
  1137. 'stepid' => $tudu->stepId,
  1138. 'stepnum' => $tudu->stepNum
  1139. )
  1140. );
  1141. }
  1142. return true;
  1143. }
  1144. /**
  1145. * 申请审批
  1146. *
  1147. * @param Tudu_Tudu_Storage_Tudu $tudu
  1148. */
  1149. public function onApply(Tudu_Tudu_Storage_Tudu &$tudu)
  1150. {
  1151. if (!$tudu->reviewer) {
  1152. return false;
  1153. }
  1154. if ($this->updateTuduSteps($tudu)) {
  1155. return $this->getDao('Dao_Td_Tudu_Tudu')->updateTudu($tudu->tuduId,
  1156. array(
  1157. 'stepid' => $tudu->stepId,
  1158. 'stepnum' => $tudu->stepNum
  1159. )
  1160. );
  1161. }
  1162. }
  1163. /**
  1164. * 公告审批
  1165. *
  1166. * @param Tudu_Tudu_Storage_Tudu $tudu
  1167. * @param boolean $isAgree
  1168. */
  1169. public function noticeReview(Tudu_Tudu_Storage_Tudu &$tudu, $isAgree)
  1170. {
  1171. // 同意
  1172. if ($isAgree) {
  1173. // 更新当前用户状态
  1174. $this->updateStepUser($tudu->tuduId, $tudu->stepId, $tudu->uniqueId, array('status' => 2));
  1175. $steps = $this->getSteps($tudu->tuduId)->toArray('stepid');
  1176. if (!isset($steps[$tudu->stepId])) {
  1177. return false;
  1178. }
  1179. $step = $steps[$tudu->stepId];
  1180. $users = $this->getStepUsers($tudu->tuduId, $tudu->stepId);
  1181. // 当前审批人
  1182. $nextUser = false;
  1183. $nextStep = true;
  1184. $nextIndex = null;
  1185. $currIndex = null;
  1186. $reviewer = array();
  1187. $tudu->sameReview = false;
  1188. foreach ($users as $user) {
  1189. if ($user['uniqueid'] == $tudu->uniqueId) {
  1190. $currentUser = $user;
  1191. $currIndex = $user['processindex'];
  1192. if (empty($reviewer)) {
  1193. $nextUser = true;
  1194. }
  1195. continue ;
  1196. }
  1197. // 还有用户在审核中,跳过流程
  1198. if ($user['status'] == 1) {
  1199. list ($userName, $trueName) = explode(' ', $user['userinfo']);
  1200. $reviewer[] = array('email' => $userName, 'truename' => $trueName);
  1201. $nextStep = false;
  1202. $nextUser = false;
  1203. $tudu->sameReview = true;
  1204. }
  1205. // 转到本步骤后续执行人
  1206. if ($nextUser) {
  1207. if ($user['status'] == 2) {
  1208. continue ;
  1209. }
  1210. if (null === $nextIndex) {
  1211. $nextIndex = $user['processindex'];
  1212. }
  1213. if (null !== $nextIndex && $user['processindex'] != $nextIndex) {
  1214. break ;
  1215. }
  1216. if (null !== $currIndex && $currIndex == $user['processindex']) {
  1217. break ;
  1218. }
  1219. list ($userName, $trueName) = expl

Large files files are truncated, but you can click here to view the full file