app->tab},") !== false and strpos(',bug,testcase,testtask,ajaxselectstory,', ",{$this->app->rawMethod},") !== false and isset($products[0])) ? true : false; $isFeedbackModel = strpos(',feedback,', ",{$this->app->tab},") !== false ? true : false; if(count($products) <= 2 and isset($products[0])) { unset($products[0]); $productID = key($products); } if(empty($products)) return; if($this->app->tab == 'project' and strpos(',zeroCase,browseUnits,groupCase,', ",$currentMethod,") !== false) $isQaModule = true; $this->app->loadLang('product'); if(!$isQaModule and !$productID and !$isFeedbackModel) { unset($this->lang->product->menu->settings['subMenu']->branch); return; } $isMobile = $this->app->viewType == 'mhtml'; $productID = $productID == 'all' ? 0 : $productID; setcookie("lastProduct", $productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); if($productID) $currentProduct = $this->getById($productID); if($isQaModule and $this->app->tab == 'project') { if($this->app->tab == 'project') $extra = strpos(',testcase,groupCase,zeroCase,', ",$currentMethod,") !== false ? $extra : $this->session->project; if($this->app->tab == 'execution') $extra = $this->session->execution; } if($isQaModule and !$productID) { $currentProduct = new stdclass(); $currentProduct->name = $products[$productID]; $currentProduct->type = 'normal'; } if($isFeedbackModel and !$productID) { $currentProduct = new stdclass(); $currentProduct->name = isset($products[$productID]) ? $products[$productID] : current($products); $currentProduct->type = 'normal'; } $this->session->set('currentProductType', $currentProduct->type); $output = ''; if(!empty($products)) { $moduleName = 'product'; if($isQaModule) $moduleName = 'bug'; if($isFeedbackModel) $moduleName = 'feedback'; $dropMenuLink = helper::createLink($moduleName, 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra"); $output = "
"; if($isMobile) $output = "{$currentProduct->name} "; if($currentProduct->type == 'normal' || !$withBranch) unset($this->lang->product->menu->settings['subMenu']->branch); if($currentProduct->type != 'normal' && $currentModule != 'programplan' && $withBranch) { $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$currentProduct->type]); $this->lang->product->menu->settings['subMenu']->branch = str_replace('@branch@', $this->lang->product->branch, $this->lang->product->menu->settings['subMenu']->branch); $branches = $this->loadModel('branch')->getPairs($productID, 'all'); $branchName = $branches[$branch]; if(!$isMobile) { $params = explode(',', $extra); $dropMenuLink = helper::createLink('branch', 'ajaxGetDropMenu', "objectID=$productID&branch=$branch&module=$currentModule&method=$currentMethod&extra={$params[0]}"); $output .= "
"; } else { $output .= "{$branchName} "; } } if(!$isMobile) $output .= '
'; } return $output; }