示例#1
0
 /**
  *
  * @param string $templateSource if $fetchType is FETCH_FILE,
  *                                  then $templateSource is template file name
  *                               if $fetchType is FETCH_TEXT,
  *                                  then $templateSource is template source as a string
  * @param string $panelName optional
  * @param string $fetchType FETCH_FILE (default) or FETCH_TEXT
  */
 public function __construct($templateSource, $panelName = '', $fetchType = self::FETCH_FILE, $theme = '')
 {
     if ($theme == '') {
         $this->theme = Gpf_Session::getAuthUser()->getTheme();
         $this->paths = Gpf_Paths::getInstance();
     } else {
         $this->theme = $theme;
         $this->paths = Gpf_Paths::getInstance()->clonePaths($theme);
     }
     if ($panelName == '') {
         $this->panel = Gpf_Session::getModule()->getPanelName();
     } else {
         $this->panel = $panelName;
     }
     $this->basePath = $this->paths->getTopPath();
     if ($fetchType == self::FETCH_FILE) {
         $this->initFetchFromFile($templateSource);
     } else {
         $this->initFetchFromText($templateSource);
     }
     $this->addPluginsDirectories();
     $this->setAndCheckCompileDir();
     $this->smarty->register_prefilter(array(&$this, 'preProcess'));
     $this->assign('basePath', $this->paths->getBaseServerUrl());
     $this->assign('imgPath', $this->getImgUrl());
     $this->assign('logoutUrl', $this->getLogoutUrl());
     Gpf_Session::getModule()->assignModuleAttributes($this);
 }