ajaxgetspacemenu.html.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * The ajaxgetspacemenu view file of doc 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 Guangming Sun <sunguangming@easycorp.ltd>
  7. * @package doc
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. /**
  12. * 定义每个分组下的选项数据列表。
  13. * Define the grouped data list.
  14. */
  15. $data = array('normal' => array());
  16. /* 处理分组数据。Process grouped data. */
  17. foreach($spaces as $id => $name)
  18. {
  19. $item = array();
  20. $item['id'] = $id;
  21. $item['text'] = $name;
  22. $item['selected'] = $id == $libID;
  23. $item['keys'] = zget(common::convert2Pinyin(array($name)), $name, '');
  24. $data['normal'][] = $item;
  25. }
  26. /**
  27. * 定义每个分组名称信息,包括可展开的已关闭分组。
  28. * Define every group name, include expanded group.
  29. */
  30. $tabs = array();
  31. $tabs[] = array('name' => 'normal', 'text' => '');
  32. /**
  33. * 定义最终的 JSON 数据。
  34. * Define the final json data.
  35. */
  36. if($extra == 'doctemplate')
  37. {
  38. $link = $this->createLink('doctemplate', 'browse', "objectID=%s");
  39. }
  40. else
  41. {
  42. $link = $this->createLink('doc', 'teamSpace', "objectID=%s");
  43. }
  44. $json = array();
  45. $json['data'] = $data;
  46. $json['tabs'] = $tabs;
  47. $json['searchHint'] = $lang->searchAB;
  48. $json['link'] = sprintf($link, '{id}');
  49. $json['itemType'] = 'doc';
  50. /**
  51. * 渲染 JSON 字符串并发送到客户端。
  52. * Render json data to string and send to client.
  53. */
  54. renderJson($json);