ajaxswitchermenu.html.php 1.5 KB

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