setmenu.hook.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /* Set menu for stage. */
  3. if(empty($executionID))
  4. {
  5. $executions = $this->loadModel('execution')->getPairs(0, 'all', 'nocode');
  6. if(!$executionID and $this->session->execution) $executionID = $this->session->execution;
  7. if(!$executionID or !in_array($executionID, array_keys($executions))) $executionID = key($executions);
  8. }
  9. /* Unset story, bug, build and testtask if type is ops. */
  10. $execution = $this->getByID((int)$executionID);
  11. if($execution and $execution->type == 'stage')
  12. {
  13. $attribute = $execution->attribute;
  14. if($attribute and isset($this->lang->stage->attribute[$attribute]))
  15. {
  16. $this->lang->execution->menu = $this->lang->stage->attribute[$attribute]->menu;
  17. $this->lang->execution->dividerMenu = $this->lang->stage->attribute[$attribute]->dividerMenu;
  18. }
  19. }
  20. $project = !empty($execution) ? $this->loadModel('project')->getByID($execution->project) : null;
  21. $model = isset($project->model) ? $project->model : '';
  22. if(in_array($model, array('scrum', 'agileplus', 'waterfallplus')) && $project->workflowGroup)
  23. {
  24. $this->loadModel('workflowgroup');
  25. $workflowGroup = $this->loadModel('workflowgroup')->fetchByID((int)$project->workflowGroup);
  26. $featureList = $this->config->featureGroup->project;
  27. foreach($featureList as $feature)
  28. {
  29. if(!$this->workflowgroup->hasFeature((int)$project->workflowGroup, $feature, $workflowGroup))
  30. {
  31. if($feature == 'process') $feature = 'pssp';
  32. unset($this->lang->execution->menu->other['dropMenu']->{$feature});
  33. if($feature == 'deliverable') unset($this->lang->execution->menu->auditplan['subMenu']->deliverable);
  34. }
  35. }
  36. }