/** * The construct function. * * 1. global the global vars, refer them by the class member such as $this->app. * 2. set the pathes of current module, and load it's mode class. * 3. auto assign the $lang and $config to the view. * * @access public * @return void */ public function __construct($moduleName = '', $methodName = '', $appName = '') { /* Global the globals, and refer them to the class member. */ global $app, $config, $lang, $dbh, $common; $this->app = $app; $this->config = $config; $this->lang = $lang; $this->dbh = $dbh; $this->viewType = $this->app->getViewType(); $this->appName = $appName ? $appName : $this->app->getAppName(); /* Load the model file auto. */ $this->setModuleName($moduleName); $this->setMethodName($methodName); $this->loadModel($this->moduleName, $appName); $this->setViewPrefix(); /* Init the view vars. */ $this->view = new stdclass(); $this->view->app = $app; $this->view->lang = $lang; $this->view->config = $config; $this->view->common = $common; $this->view->title = ''; /* Set super vars. */ $this->setSuperVars(); }
/** * The construct function. * * 1. global the global vars, refer them by the class member such as $this->app. * 2. set the pathes, config, lang of current module * * @access public * @return void */ public function __construct($appName = '') { global $app, $config, $lang, $dbh; $this->app = $app; $this->config = $config; $this->lang = $lang; $this->dbh = $dbh; $this->appName = empty($appName) ? $this->app->getAppName() : $appName; $moduleName = $this->getModuleName(); $this->app->loadLang($moduleName, $this->appName); $this->app->loadConfig($moduleName, $this->appName, $exitIfNone = false); $this->loadDAO(); $this->setSuperVars(); }