tabs.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * The tabs entry point of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Chunsheng Wang <chunsheng@cnezsoft.com>
  8. * @package entries
  9. * @version 1
  10. * @link https://www.zentao.net
  11. */
  12. class tabsEntry extends baseEntry
  13. {
  14. /**
  15. * Get tabs.
  16. *
  17. * @param string $moduleName work|
  18. * @access public
  19. * @return string
  20. */
  21. public function get($moduleName)
  22. {
  23. $menus = array();
  24. if($moduleName == 'work')
  25. {
  26. $this->app->loadLang('my');
  27. $tabs = array('calendar', 'task', 'bug', 'story', 'issue', 'risk', 'myMeeting');
  28. foreach($tabs as $menuKey)
  29. {
  30. if(!isset($this->lang->my->$menuKey)) continue;
  31. if(!common::hasPriv('my', 'work')) continue;
  32. $label = $this->lang->my->$menuKey;
  33. if($menuKey == 'calendar') $label = $this->lang->my->calendarAction;
  34. $menu = new stdclass();
  35. $menu->code = $menuKey;
  36. $menu->name = $label;
  37. $menus[] = $menu;
  38. }
  39. }
  40. elseif($moduleName == 'product')
  41. {
  42. $this->app->loadLang('product');
  43. $tabs = array('story', 'plan', 'project', 'release', 'epic', 'requirement', 'doc', 'view');
  44. foreach($tabs as $menuKey)
  45. {
  46. if($menuKey == 'requirement' and empty($this->config->URAndSR)) continue;
  47. if(isset($this->lang->product->menu->$menuKey))
  48. {
  49. $menuName = $this->lang->product->menu->$menuKey;
  50. if(!isset($menuName['link'])) continue;
  51. list($label, $module, $method) = explode('|', $menuName['link']);
  52. if(!common::hasPriv($module, $method)) continue;
  53. }
  54. else
  55. {
  56. if(!common::hasPriv('product', $menuKey)) continue;
  57. }
  58. $label = zget($this->lang->product, $menuKey, '');
  59. if($menuKey == 'view') $label = $this->lang->overview;
  60. if($menuKey == 'doc') $label = $this->lang->doc->common;
  61. if($menuKey == 'project') $label = $this->lang->project->common;
  62. if($menuKey == 'story') $label = $this->lang->createObjects['story'];
  63. if($menuKey == 'requirement') $label = $this->lang->URCommon;
  64. if($menuKey == 'epic') $label = $this->lang->ERCommon;
  65. $menu = new stdclass();
  66. $menu->code = $menuKey;
  67. $menu->name = $label;
  68. $menus[] = $menu;
  69. }
  70. }
  71. return $this->send(200, array('tabs' => $menus));
  72. }
  73. }