ajaxswitchermenu.html.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * The ajaxSwithcherMenu view file of project 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 Shujie Tian<tianshujie@easycorp.ltd>
  7. * @package project
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. /**
  12. * 定义每个分组下的选项数据列表。
  13. * Define the grouped data list.
  14. */
  15. $data = array('normal' => array(), 'closed' => array());
  16. if($currentMethod != 'zerocase')
  17. {
  18. $defaultItem = array();
  19. $defaultItem['id'] = 0;
  20. $defaultItem['text'] = $lang->product->all;
  21. $defaultItem['active'] = $productID == 0;
  22. $defaultItem['type'] = 'product';
  23. $defaultItem['data-app'] = $app->tab;
  24. $data['normal'][] = $defaultItem;
  25. }
  26. foreach($products as $product)
  27. {
  28. $item = array();
  29. $item['id'] = $product->id;
  30. $item['text'] = $product->name;
  31. $item['active'] = $productID == $product->id;
  32. $item['type'] = 'product';
  33. $item['keys'] = zget(common::convert2Pinyin(array($product->name)), $product->name, '');
  34. $item['data-app'] = $app->tab;
  35. if($product->status == 'closed')
  36. {
  37. $data['closed'][] = $item;
  38. }
  39. else
  40. {
  41. $data['normal'][] = $item;
  42. }
  43. }
  44. /**
  45. * 定义每个分组名称信息,包括可展开的已关闭分组。
  46. * Define every group name, include expanded group.
  47. */
  48. $tabs = array();
  49. $tabs[] = array('name' => 'closed', 'text' => $lang->product->closedProducts);
  50. $tabs[] = array('name' => 'normal', 'text' => '');
  51. $json = array();
  52. $json['data'] = $data;
  53. $json['tabs'] = $tabs;
  54. $json['searchHint'] = $lang->searchAB;
  55. $json['expandName'] = 'closed';
  56. $json['itemType'] = 'product';
  57. $json['link'] = array('product' => sprintf($link, '{id}'));
  58. renderJson($json);