ajaxgetdropmenu.html.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * The ajaxgetdropmenu view file of branch module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Sun Guangming<sunguangming@easycorp.ltd>
  7. * @package doc
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $data = array('active' => array(), 'closed' => array());
  12. /* 处理分组数据。Process grouped data. */
  13. foreach($branches as $branchID => $branchName)
  14. {
  15. $item = array();
  16. $item['id'] = $branchID;
  17. $item['text'] = $branchName;
  18. $item['type'] = 'branch';
  19. $item['keys'] = zget($branchesPinyin, $branchName, '');
  20. $item['active'] = $branchID == $currentBranchID || (empty($branchID) && empty($currentBranchID));
  21. if($branchID == 'all' || empty($branchID) || $statusList[$branchID] == 'active')
  22. {
  23. $data['active'][] = $item;
  24. }
  25. else
  26. {
  27. $data['closed'][] = $item;
  28. }
  29. }
  30. $tabs = array();
  31. $tabs[] = array('name' => 'active', 'text' => '');
  32. $tabs[] = array('name' => 'closed', 'text' => $lang->branch->closed);
  33. /**
  34. * 定义最终的 JSON 数据。
  35. * Define the final json data.
  36. */
  37. $json = array();
  38. $json['data'] = $data;
  39. $json['tabs'] = $tabs;
  40. $json['searchHint'] = $lang->searchAB;
  41. $json['link'] = $link;
  42. $json['itemType'] = 'branch';
  43. $json['expandName'] = 'closed';
  44. /**
  45. * 渲染 JSON 字符串并发送到客户端。
  46. * Render json data to string and send to client.
  47. */
  48. renderJson($json);