zen.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * The control file of desgin module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2024 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Shujie Tian <tianshujie@chandao.com>
  8. * @package desgin
  9. * @link https://www.zentao.net
  10. */
  11. class designZen extends control
  12. {
  13. /**
  14. * 设置设计导航。
  15. * Set design menu.
  16. *
  17. * @param int $projectID
  18. * @param int $productID
  19. * @param string $type
  20. * @access public
  21. * @return void
  22. */
  23. public function setMenu($projectID, $productID = 0, $type = '')
  24. {
  25. $project = $this->loadModel('project')->getByID($projectID);
  26. if(empty($project)) return;
  27. if(!empty($project) and (in_array($project->model, array('waterfall', 'ipd')))) $typeList = 'typeList';
  28. if(!empty($project) and $project->model == 'waterfallplus') $typeList = 'plusTypeList';
  29. if(!isset($typeList)) return;
  30. /* Show custom design types. */
  31. $this->lang->waterfall->menu->design['subMenu'] = new stdclass();
  32. $this->lang->waterfall->menu->design['subMenu']->all = array('link' => "{$this->lang->all}|design|browse|projectID=%s&productID={$productID}&browseType=all", 'exclude' => $type == 'all' ? '' : 'design', 'alias' => $type == 'all' ? $this->app->rawMethod : '');
  33. $count = 1;
  34. foreach(array_filter($this->lang->design->{$typeList}) as $key => $value)
  35. {
  36. $key = strtolower((string)$key);
  37. $exclude = $type == $key ? '' : 'design';
  38. $alias = $type == $key ? $this->app->rawMethod : '';
  39. if($count <= 4) $this->lang->waterfall->menu->design['subMenu']->$key = array('link' => "{$value}|design|browse|projectID=%s&productID={$productID}&browseType={$key}", 'exclude' => $exclude, 'alias' => $alias);
  40. if($count == 5)
  41. {
  42. $this->lang->waterfall->menu->design['subMenu']->more = array('link' => "{$this->lang->design->more}|design|browse|projectID=%s&productID={$productID}&browseType={$key}", 'class' => 'dropdown dropdown-hover', 'exclude' => $exclude, 'alias' => $alias);
  43. $this->lang->waterfall->menu->design['subMenu']->more['dropMenu'] = new stdclass();
  44. }
  45. if($count >= 5) $this->lang->waterfall->menu->design['subMenu']->more['dropMenu']->$key = array('link' => "{$value}|design|browse|projectID=%s&productID={$productID}&browseType={$key}", 'exclude' => $exclude, 'alias' => $alias);
  46. $count ++;
  47. }
  48. if($this->config->edition == 'ipd') $this->lang->ipd->menu->design = $this->lang->waterfall->menu->design;
  49. }
  50. }