From cf102db7432e048065c40ddd75174875729ad4a8 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Wed, 8 Sep 2021 17:34:17 +0800 Subject: [PATCH] * Set menu in constructor of every module under devops. --- module/gitlab/control.php | 16 ++++++++++++++-- module/mr/control.php | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/module/gitlab/control.php b/module/gitlab/control.php index cd6d073e68..fc46a8057c 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -11,6 +11,20 @@ */ class gitlab extends control { + /** + * The gitlab constructor. + * @param string $moduleName + * @param string $methodName + */ + public function __construct($moduleName = '', $methodName = '') + { + parent::__construct($moduleName, $methodName); + + /* This is essential when changing tab(menu) from gitlab to repo. */ + /* Optional: common::setMenuVars('devops', $this->session->repoID); */ + $this->loadModel('ci')->setMenu(); + } + /** * Browse gitlab. * @@ -23,8 +37,6 @@ class gitlab extends control */ public function browse($orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { - /* This is essential when changing tab(menu) from gitlab to repo. */ - common::setMenuVars('devops', $this->session->repoID); $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); diff --git a/module/mr/control.php b/module/mr/control.php index 6dac1f64ac..94cd6bc02c 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -1,6 +1,20 @@ session->repoID); */ + $this->loadModel('ci')->setMenu(); + } + /** * Browse mr. * @@ -20,7 +34,6 @@ class mr extends control /* Save current URI to session. */ $this->session->set('mrList', $this->app->getURI(true), 'repo'); - common::setMenuVars('devops', $this->session->repoID); /* Sync GitLab MR to ZenTao Database. */ $MRList = $this->mr->batchSyncMR($MRList);