diff --git a/module/program/model.php b/module/program/model.php index f63f80ad5c..afa2b20185 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -1415,4 +1415,48 @@ class programModel extends model { return $this->dao->select('id, name')->from(TABLE_PRODUCT)->where('program')->eq($programID)->andWhere('deleted')->eq('0')->fetchPairs(); } + + /* + * Set program menu. + * + * @param int $programID + * @access public + * @return void + */ + public function setMenu($programID) + { + $this->lang->switcherMenu = $this->getSwitcher($programID); + common::setMenuVars('program', $programID); + } + + /* + * Get program swapper. + * + * @param int $programID + * @access private + * @return string + */ + public function getSwitcher($programID = 0) + { + $currentProgramName = ''; + $currentModule = $this->app->moduleName; + $currentMethod = $this->app->methodName; + + if($programID) + { + helper::setCookie("lastProgram", $programID, $this->config->cookieLife, $this->config->webRoot, '', false, true); + $currentProgram = $this->getById($programID); + $currentProgramName = $currentProgram->name; + } + else + { + $currentProgramName = $this->lang->program->all; + } + + $dropMenuLink = helper::createLink('program', 'ajaxGetDropMenu', "objectID=$programID&module=$currentModule&method=$currentMethod"); + $output = "