diff --git a/module/screen/control.php b/module/screen/control.php index 84d6da7694..d139136838 100644 --- a/module/screen/control.php +++ b/module/screen/control.php @@ -20,30 +20,48 @@ class screen extends control */ public function browse($dimensionID = 0) { - $this->app->loadLang('admin'); - $this->loadModel('setting'); - $dimensionID = $this->loadModel('dimension')->setSwitcherMenu($dimensionID); + $this->checkShowGuide(); - /* BI guide. */ - $lang = (strpos($this->app->getClientLang(), 'zh') !== false) ? 'zh' : 'en'; - $version = ($this->config->edition == 'biz' or $this->config->edition == 'max') ? 'biz' : 'pms'; - $imageURL = "static/images/bi_guide_{$version}_{$lang}.png"; - - $currentUser = $this->app->user->account; - $moduleKey = $version . 'firstGuide'; - $firstGuide = $this->setting->getItem("owner={$currentUser}&module=bi&key={$moduleKey}"); - if(empty($firstGuide)) $this->setting->setItem("{$currentUser}.bi.{$moduleKey}", 1); - - $this->view->firstGuide = !empty($firstGuide); - $this->view->imageURL = $imageURL; - $this->view->version = $version; $this->view->title = $this->lang->screen->common; $this->view->screens = $this->screen->getList($dimensionID); $this->view->dimension = $dimensionID; $this->display(); } + /** + * Check whether show guide. + * + * @access public + * @return void + */ + public function checkShowGuide() + { + $this->app->loadLang('admin'); + $this->loadModel('setting'); + + $isUpdate = $this->setting->getItem("owner=system&module=bi&key=update2BI"); + if(empty($isUpdate)) + { + $this->view->showGuide = false; + return; + } + + $lang = (strpos($this->app->getClientLang(), 'zh') !== false) ? 'zh' : 'en'; + $version = ($this->config->edition == 'biz' or $this->config->edition == 'max') ? 'biz' : 'pms'; + $imageURL = "static/images/bi_guide_{$version}_{$lang}.png"; + + $moduleKey = $version . 'Guide'; + $guides = $this->setting->getItem("owner=system&module=bi&key={$moduleKey}"); + $haveSeen = explode(',', $guides); + $afterSeen = array_merge($haveSeen, array($this->app->user->account)); + $this->setting->setItem("system.bi.{$moduleKey}", implode(',', array_unique($afterSeen))); + + $this->view->showGuide = in_array($this->app->user->account, $haveSeen) ? false : true; + $this->view->imageURL = $imageURL; + $this->view->version = $version; + } + /** * View screen. * diff --git a/module/screen/js/browse.js b/module/screen/js/browse.js index 21cacb7888..771e500b8a 100644 --- a/module/screen/js/browse.js +++ b/module/screen/js/browse.js @@ -1,5 +1,5 @@ $(function() { - if(!firstGuide) $('#firstGuide').modal(); + if(showGuide) $('#firstGuide').modal(); }); diff --git a/module/screen/view/browse.html.php b/module/screen/view/browse.html.php index 5da35f5202..046e1c5bc5 100644 --- a/module/screen/view/browse.html.php +++ b/module/screen/view/browse.html.php @@ -1,5 +1,5 @@ getModuleRoot() . 'common/view/header.html.php';?> - +