/** * getContent() method manages all data in Back Office * * @return string */ public function getContent() { require_once _FPC_PATH_CONF . 'admin.conf.php'; require_once _FPC_PATH_LIB_ADMIN . 'admin-ctrl_class.php'; // set $aUpdateModule = array(); try { // update new module keys BT_FPCModuleTools::updateConfiguration(); // get configuration options BT_FPCModuleTools::getConfiguration(); // set js msg translation BT_FPCModuleTools::translateJsMsg(); // instantiate admin controller object $oAdmin = new BT_AdminCtrl(); // defines type to execute // use case : no key sAction sent in POST mode (no form has been posted => first page is displayed with admin-display.class.php) // use case : key sAction sent in POST mode (form or ajax query posted ). $sAction = !Tools::getIsset('sAction') || Tools::getIsset('sAction') && 'display' == Tools::getValue('sAction') ? Tools::getIsset('sAction') ? Tools::getValue('sAction') : 'display' : Tools::getValue('sAction'); // make module update only in case of display general admin page if ($sAction == 'display' && !Tools::getIsset('sType')) { // update module if necessary $aUpdateModule = $this->_updateModule(); } //execute good action in admin // only displayed with key : tpl and assign in order to display good smarty template $aDisplay = $oAdmin->run($sAction, array_merge($_GET, $_POST)); // free memory unset($oAdmin); if (!empty($aDisplay)) { $aDisplay['assign'] = array_merge($aDisplay['assign'], array('aUpdateErrors' => $aUpdateModule, 'oJsTranslatedMsg' => BT_FPCModuleTools::jsonEncode($GLOBALS[_FPC_MODULE_NAME . '_JS_MSG']), 'bAddJsCss' => true)); // get content $sContent = $this->displayModule($aDisplay['tpl'], $aDisplay['assign']); if (!empty(self::$sQueryMode)) { echo $sContent; } else { return $sContent; } } else { throw new Exception('action returns empty content', 110); } } catch (Exception $e) { $this->aErrors[] = array('msg' => $e->getMessage(), 'code' => $e->getCode()); // get content $sContent = $this->displayErrorModule(); if (!empty(self::$sQueryMode)) { echo $sContent; } else { return $sContent; } } // exit clean with XHR mode if (!empty(self::$sQueryMode)) { exit(0); } }