Example #1
0
 function activate($sTemplate)
 {
     $aTemplate = BxDolModuleQuery::getInstance()->getModuleByName($sTemplate);
     if (empty($aTemplate) || !is_array($aTemplate)) {
         return array('code' => 1, 'message' => _t('_adm_err_operation_failed'));
     }
     $aTemplates = array();
     $iTemplates = $this->oDb->getTemplatesBy(array('type' => 'active'), $aTemplates);
     if ($iTemplates == 1 && $aTemplates[0]['name'] == $sTemplate) {
         return array('code' => 1, 'message' => _t('_adm_dsg_err_last_active'));
     }
     $sTemplateDefault = getParam('template');
     if ($aTemplate['uri'] == $sTemplateDefault) {
         return array('code' => 2, 'message' => _t('_adm_dsg_err_deactivate_default'));
     }
     $oInstallerUtils = BxDolStudioInstallerUtils::getInstance();
     $aResult = (int) $aTemplate['enabled'] == 0 ? $oInstallerUtils->perform($aTemplate['path'], 'enable') : $oInstallerUtils->perform($aTemplate['path'], 'disable');
     if ($aResult['code'] != 0) {
         return $aResult;
     }
     $oTemplate = BxDolStudioTemplate::getInstance();
     $aResult = array('code' => 0, 'message' => _t('_adm_scs_operation_done'));
     if ((int) $aTemplate['enabled'] == 0) {
         $aResult['content'] = $oTemplate->parseHtmlByName('page_content_2_col.html', array('page_menu_code' => $this->getPageMenu(), 'page_main_code' => $this->getPageCode()));
     } else {
         $aResult['content'] = "";
     }
     return $aResult;
 }
 function getCode()
 {
     bx_import('BxTemplStudioMenu');
     $aTmplVars = array();
     foreach ($this->aItems as $sPosition => $mixedItems) {
         if (!$this->aVisible[$sPosition]) {
             continue;
         }
         $sContent = "";
         if (is_array($mixedItems)) {
             $oMenu = new BxTemplStudioMenu(array('template' => 'menu_top_toolbar.html', 'menu_items' => $mixedItems));
             $sContent = $oMenu->getCode();
         } else {
             if (is_string($mixedItems) && !empty($mixedItems)) {
                 $sContent = $mixedItems;
             }
         }
         $aTmplVars[] = array('name' => $sPosition, 'content' => $sContent);
     }
     if (empty($aTmplVars)) {
         return '';
     }
     $oTemplate = BxDolStudioTemplate::getInstance();
     $oTemplate->addJs($this->getJs());
     $oTemplate->addCss($this->getCss());
     return $oTemplate->parseHtmlByName('menu_top.html', array('bx_repeat:menus' => $aTmplVars));
 }
 protected function _action($sCache, $sMode = 'clear')
 {
     $sFuncCacheObject = $sMode == 'clear' ? '_clearObject' : '_getSizeObject';
     $sFuncCacheFile = $sMode == 'clear' ? '_clearFile' : '_getSizeFile';
     $mixedResult = false;
     switch ($sCache) {
         case 'db':
             if (getParam('sys_db_cache_enable') != 'on') {
                 break;
             }
             $oCacheDb = BxDolDb::getInstance()->getDbCacheObject();
             $mixedResult = $this->{$sFuncCacheObject}($oCacheDb, 'db_');
             break;
         case 'template':
             if (getParam('sys_template_cache_enable') != 'on') {
                 break;
             }
             $oCacheTemplates = BxDolTemplate::getInstance()->getTemplatesCacheObject();
             $mixedResult = $this->{$sFuncCacheObject}($oCacheTemplates, BxDolStudioTemplate::getInstance()->getCacheFilePrefix($sCache));
             break;
         case 'css':
             if (getParam('sys_template_cache_css_enable') != 'on') {
                 break;
             }
             $mixedResult = $this->{$sFuncCacheFile}(BxDolStudioTemplate::getInstance()->getCacheFilePrefix($sCache), BX_DIRECTORY_PATH_CACHE_PUBLIC);
             break;
         case 'js':
             if (getParam('sys_template_cache_js_enable') != 'on') {
                 break;
             }
             $mixedResult = $this->{$sFuncCacheFile}(BxDolStudioTemplate::getInstance()->getCacheFilePrefix($sCache), BX_DIRECTORY_PATH_CACHE_PUBLIC);
             break;
     }
     return $mixedResult;
 }
Example #4
0
 function __construct($iTimeStart)
 {
     parent::__construct();
     $this->oConfig = new BxProfilerConfig($GLOBALS['bx_profiler_module']);
     $this->oTemplate = new BxProfilerTemplate($this->oConfig);
     $this->oTemplateAdmin = BxDolStudioTemplate::getInstance();
     $aCss = array('profiler.css', BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'jush/|jush.css');
     $aJs = array('jquery.tablesorter.min.js', 'profiler.js', 'jush/jush.js');
     foreach ($aCss as $sCssUrl) {
         $this->oTemplate->addCss($sCssUrl);
         $this->oTemplateAdmin->addCss($sCssUrl);
     }
     foreach ($aJs as $sJsUrl) {
         $this->oTemplate->addJs($sJsUrl);
         $this->oTemplateAdmin->addJs($sJsUrl);
     }
     if (getParam('bx_profiler_long_sql_queries_log')) {
         $this->aConf['long_query'] = getParam('bx_profiler_long_sql_queries_time');
     }
     if (getParam('bx_profiler_long_module_query_log')) {
         $this->aConf['long_module'] = getParam('bx_profiler_long_module_query_time');
     }
     if (getParam('bx_profiler_long_page_log')) {
         $this->aConf['long_page'] = getParam('bx_profiler_long_page_time');
     }
     $this->_iTimeStart = $iTimeStart;
 }
Example #5
0
 protected function getSettings()
 {
     $oTemplate = BxDolStudioTemplate::getInstance();
     bx_import('BxTemplStudioSettings');
     $oPage = new BxTemplStudioSettings($this->sModule);
     $aTmplVars = array('bx_repeat:blocks' => $oPage->getPageCode());
     return $oTemplate->parseHtmlByName('module.html', $aTmplVars);
 }
 protected function getGrid($sObjectName)
 {
     $oGrid = BxDolGrid::getObjectInstance($sObjectName);
     if (!$oGrid) {
         return '';
     }
     return BxDolStudioTemplate::getInstance()->parseHtmlByName('polyglot.html', array('content' => $this->getBlockCode(array('items' => $oGrid->getCode()))));
 }
 protected function getGrid($sObjectName)
 {
     $oGrid = BxDolGrid::getObjectInstance($sObjectName);
     if (!$oGrid) {
         return '';
     }
     $aTmplVars = array('js_object' => $this->getPageJsObject(), 'bx_repeat:blocks' => array(array('caption' => '', 'panel_top' => '', 'items' => $oGrid->getCode(), 'panel_bottom' => '')));
     return BxDolStudioTemplate::getInstance()->parseHtmlByName('permissions.html', $aTmplVars);
 }
Example #8
0
 function __construct()
 {
     parent::__construct();
     $oTemplate = BxDolStudioTemplate::getInstance();
     $this->aVisible[BX_DOL_STUDIO_MT_LEFT] = true;
     $this->aVisible[BX_DOL_STUDIO_MT_RIGHT] = true;
     $this->aItems[BX_DOL_STUDIO_MT_LEFT] = $oTemplate->parseHtmlByName('splash_logo.html', array());
     $this->aItems[BX_DOL_STUDIO_MT_RIGHT] = array('site' => array('name' => 'profile', 'icon' => 'user', 'link' => BxDolPermalinks::getInstance()->permalink('page.php?i=create-account'), 'title' => ''));
 }
Example #9
0
 protected function getIcon(&$aWidget)
 {
     $oTemplate = BxDolStudioTemplate::getInstance();
     $sUrl = $oTemplate->getIconUrl($aWidget['icon']);
     if (empty($sUrl)) {
         $aModule = BxDolModuleQuery::getInstance()->getModuleByName($aWidget['module']);
         $sUrl = BxDolStudioUtils::getIconDefault($aModule['type']);
     }
     return $sUrl;
 }
 protected function getGrid($sObjectName)
 {
     $oTemplate = BxDolStudioTemplate::getInstance();
     bx_import('BxDolGrid');
     $oGrid = BxDolGrid::getObjectInstance($sObjectName);
     if (!$oGrid) {
         return '';
     }
     $aTmplVars = array('bx_repeat:blocks' => array(array('caption' => '', 'panel_top' => '', 'items' => $oGrid->getCode(), 'panel_bottom' => '')));
     return $oTemplate->parseHtmlByName('polyglot.html', $aTmplVars);
 }
Example #11
0
 public function serviceGetCacheUpdater()
 {
     check_logged();
     if (!isAdmin()) {
         return '';
     }
     $oTemplate = BxDolStudioTemplate::getInstance();
     $sContent = $oTemplate->addJs('launcher.js', true);
     $sContent .= $oTemplate->parseHtmlByName('launcher_cache_updater.html', array('js_object' => $this->getPageJsObject()));
     return $sContent;
 }
 function getLanguagesInfo($bIdAsKey = false, $bActiveOnly = false)
 {
     $aLanguages = array();
     $this->oDb->getLanguagesBy(array('type' => 'all'), $aLanguages, false);
     if (!is_array($aLanguages) || empty($aLanguages)) {
         return $aLanguages;
     }
     $oTemplate = BxDolStudioTemplate::getInstance();
     foreach ($aLanguages as $iKey => $aLanguage) {
         $aLanguages[$iKey]['icon'] = $oTemplate->getIconUrl('sys_fl_' . $aLanguage['flag'] . '.gif');
     }
     return $aLanguages;
 }
 function getLanguagesInfo($bIdAsKey = false, $bActiveOnly = false)
 {
     $aLanguages = array();
     $this->oDb->getLanguagesBy(array('type' => 'all'), $aLanguages, false);
     if (!is_array($aLanguages) || empty($aLanguages)) {
         return $aLanguages;
     }
     $oTemplate = BxDolStudioTemplate::getInstance();
     foreach ($aLanguages as $iKey => $aLanguage) {
         $aLanguages[$iKey]['icon'] = genFlag($aLanguage['name'], $oTemplate);
     }
     return $aLanguages;
 }
 function getLoginForm()
 {
     $oTemplate = BxDolStudioTemplate::getInstance();
     $sUrlRelocate = bx_get('relocate');
     if (empty($sUrlRelocate) || basename($sUrlRelocate) == 'index.php') {
         $sUrlRelocate = '';
     }
     $oTemplate->addJsTranslation(array('_adm_txt_login_username', '_adm_txt_login_password'));
     $sHtml = $oTemplate->parseHtmlByName('login_form.html', array('role' => BX_DOL_ROLE_ADMIN, 'csrf_token' => BxDolForm::genCsrfToken(true), 'relocate_url' => bx_html_attribute($sUrlRelocate), 'action_url' => BX_DOL_URL_ROOT . 'member.php', 'forgot_password_url' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=forgot-password')));
     $sHtml = $oTemplate->parseHtmlByName('login.html', array('form' => $this->transBox('bx-std-login-form-box', $sHtml, true)));
     $oTemplate->setPageNameIndex(BX_PAGE_CLEAR);
     $oTemplate->setPageParams(array('css_name' => array('forms.css', 'login.css'), 'js_name' => array('jquery-ui/jquery.ui.position.min.js', 'jquery.form.min.js', 'jquery.dolPopup.js', 'login.js'), 'header' => _t('_adm_page_cpt_login')));
     $oTemplate->setPageContent('page_main_code', $sHtml);
     $oTemplate->getPageCode();
 }
Example #15
0
 function __construct($iTimeStart)
 {
     parent::__construct();
     $this->oConfig = new BxProfilerConfig($GLOBALS['bx_profiler_module']);
     $this->oTemplate = new BxProfilerTemplate($this->oConfig);
     $this->oTemplateAdmin = BxDolStudioTemplate::getInstance();
     if (getParam('bx_profiler_long_sql_queries_log')) {
         $this->aConf['long_query'] = getParam('bx_profiler_long_sql_queries_time');
     }
     if (getParam('bx_profiler_long_module_query_log')) {
         $this->aConf['long_module'] = getParam('bx_profiler_long_module_query_time');
     }
     if (getParam('bx_profiler_long_page_log')) {
         $this->aConf['long_page'] = getParam('bx_profiler_long_page_time');
     }
     $this->_iTimeStart = $iTimeStart;
 }
 public function getUpdates()
 {
     $aUpdates = array();
     bx_import('BxDolStudioTemplate');
     $oTemplate = BxDolStudioTemplate::getInstance();
     $aInstalledPathes = $aInstalledInfo = array();
     $this->getInstalledInfo($aInstalledPathes, $aInstalledInfo);
     $sPath = BX_DIRECTORY_PATH_MODULES;
     if (($rHandleVendor = opendir($sPath)) !== false) {
         while (($sVendor = readdir($rHandleVendor)) !== false) {
             if (substr($sVendor, 0, 1) == '.' || !is_dir($sPath . $sVendor)) {
                 continue;
             }
             if (($rHandleModule = opendir($sPath . $sVendor . '/')) !== false) {
                 while (($sModule = readdir($rHandleModule)) !== false) {
                     if (!is_dir($sPath . $sVendor . '/' . $sModule) || substr($sModule, 0, 1) == '.') {
                         continue;
                     }
                     if (($rHandleUpdate = @opendir($sPath . $sVendor . '/' . $sModule . '/updates/')) !== false) {
                         while (($sUpdate = readdir($rHandleUpdate)) !== false) {
                             if (!is_dir($sPath . $sVendor . '/' . $sModule . '/updates/' . $sUpdate) || substr($sUpdate, 0, 1) == '.') {
                                 continue;
                             }
                             $sConfigPathModule = $sPath . $sVendor . '/' . $sModule . '/install/config.php';
                             $sConfigPathUpdate = $sPath . $sVendor . '/' . $sModule . '/updates/' . $sUpdate . '/install/config.php';
                             $aUpdate = $this->getConfigUpdate($sConfigPathModule, $sConfigPathUpdate, $aInstalledPathes, $aInstalledInfo);
                             if (empty($aUpdate) || !is_array($aUpdate) || version_compare($aUpdate['module_version'], $aUpdate['version_from']) != 0) {
                                 continue;
                             }
                             $aUpdates[$aUpdate['title']] = $aUpdate;
                         }
                         closedir($rHandleUpdate);
                     }
                 }
                 closedir($rHandleModule);
             }
         }
         closedir($rHandleVendor);
     }
     ksort($aUpdates);
     return $aUpdates;
 }
 public function performActionEdit()
 {
     $oTemplate = BxDolStudioTemplate::getInstance();
     $aIds = bx_get('ids');
     if (!$aIds || !is_array($aIds)) {
         $iId = (int) bx_get('id');
         if (!$iId) {
             $this->_echoResultJson(array());
             exit;
         }
         $aIds = array($iId);
     }
     $iId = $aIds[0];
     $sAction = 'edit';
     $aLanguages = array();
     $iLanguages = $this->oDb->getLanguagesBy(array('type' => 'all_key_id'), $aLanguages);
     $aKey = $this->oDb->getKeyFullInfo($iId);
     $aForm = array('form_attrs' => array('id' => 'adm-lang-edit-key-form', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_localization_keys', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('id' => array('type' => 'hidden', 'name' => 'id', 'value' => $iId, 'db' => array('pass' => 'Int'))));
     foreach ($aLanguages as $aLanguage) {
         $sName = 'language_' . $aLanguage['id'];
         $aForm['inputs'][$sName] = array('type' => 'textarea', 'name' => $sName, 'caption' => $aLanguage['title'], 'value' => isset($aKey['strings'][$aLanguage['name']]) ? $aKey['strings'][$aLanguage['name']]['string'] : '', 'db' => array('pass' => 'XssHtml'));
     }
     $aForm['inputs'] = array_merge($aForm['inputs'], array('languages' => array('type' => 'hidden', 'name' => 'languages', 'value' => implode(',', array_keys($aLanguages)), 'db' => array('pass' => 'Xss')), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_pgt_btn_nkp_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_pgt_btn_nkp_close'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
     bx_import('BxTemplStudioFormView');
     $oForm = new BxTemplStudioFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $mixedResult = $this->edit($oForm);
         if (is_int($mixedResult)) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $mixedResult);
         } else {
             $aRes = array('msg' => $mixedResult);
         }
         $this->_echoResultJson($aRes, true);
     } else {
         bx_import('BxTemplStudioFunctions');
         $sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-lang-edit-key-popup', _t('_adm_pgt_txt_nkp_edit_popup', $aKey['key']), $this->_oTemplate->parseHtmlByName('pgt_new_key.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
Example #18
0
 public static function getModuleIcon($mixedModule, $sType = 'menu', $bReturnAsUrl = true)
 {
     $aType2Prefix = array('menu' => 'mi', 'page' => 'pi', 'store' => 'si');
     if (!is_array($mixedModule)) {
         $aModule = BxDolModuleQuery::getInstance()->getModuleByName($mixedModule);
     } else {
         $aModule = $mixedModule;
     }
     $sDefaultIcon = self::getIconDefault(isset($aModule['type']) ? $aModule['type'] : '');
     if (empty($aModule)) {
         return $sDefaultIcon;
     }
     $sModuleIcon = '';
     if (isset($aModule['path'])) {
         $sModuleIcon = $aModule['name'] . '@modules/' . $aModule['path'] . '|std-' . $aType2Prefix[$sType] . '.png';
     } else {
         if (isset($aModule['dir'])) {
             $sModuleIcon = $aModule['name'] . '@modules/' . $aModule['dir'] . '|std-' . $aType2Prefix[$sType] . '.png';
         }
     }
     $sModuleIconUrl = BxDolStudioTemplate::getInstance()->getIconUrl($sModuleIcon);
     return !empty($sModuleIcon) && !empty($sModuleIconUrl) ? $bReturnAsUrl ? $sModuleIconUrl : $sModuleIcon : $sDefaultIcon;
 }
 public function serviceGetBlockCache()
 {
     $sJsObject = $this->getPageJsObject();
     $sChartData = $this->getCacheChartData();
     $bChartData = $sChartData !== false;
     $aMenu = array();
     if ($bChartData) {
         foreach ($this->aItemsCache as $aItem) {
             $aMenu[] = array('name' => $aItem['name'], 'title' => _t('_adm_dbd_txt_c_clear_' . $aItem['name']), 'link' => 'javascript:void(0)', 'onclick' => $sJsObject . ".clearCache('" . $aItem['name'] . "')");
         }
     }
     $sContent = BxDolStudioTemplate::getInstance()->parseHtmlByName('dbd_cache.html', array('bx_if:show_chart' => array('condition' => $bChartData, 'content' => array('js_object' => $sJsObject, 'chart_data' => $sChartData)), 'bx_if:show_empty' => array('condition' => !$bChartData, 'content' => array('message' => MsgBox(_t('_adm_dbd_msg_c_all_disabled'))))));
     return array('content' => $sContent, 'menu' => $aMenu);
 }
Example #20
0
 protected function getPageCaptionHelp()
 {
     $oTemplate = BxDolStudioTemplate::getInstance();
     $sContent = '<a href="' . BX_DOL_URL_STUDIO . 'module.php?name=bx_smtp&page=help">' . _t('_bx_smtp_help') . "</a>";
     return $oTemplate->parseHtmlByName('page_caption_help.html', array('content' => $sContent));
 }
Example #21
0
 protected function getJsResult($sMessage, $bTranslate = true, $bRedirect = false, $sRedirect = '', $sOnResult = '')
 {
     $aResult = array();
     $aResult['message'] = $bTranslate ? _t($sMessage) : $sMessage;
     if ($bRedirect) {
         $aResult['redirect'] = $sRedirect != '' ? $sRedirect : BX_DOL_URL_STUDIO;
     }
     if (!empty($sOnResult)) {
         $aResult['on_result'] = $sOnResult;
     }
     $sResult = "window.parent." . BX_DOL_STUDIO_PAGE_JS_OBJECT . ".showMessage(" . json_encode($aResult) . ");";
     return BxDolStudioTemplate::getInstance()->_wrapInTagJsCode($sResult);
 }
Example #22
0
 public function __construct($aObject, $oTemplate)
 {
     parent::__construct($aObject, $oTemplate !== false ? $oTemplate : BxDolStudioTemplate::getInstance());
 }
Example #23
0
 protected function _displayResult($sAction, $bResult, $sResult = '', $bHtmlResponse = true)
 {
     if ($bResult && !in_array($sAction, array('show_introduction', 'show_conclusion')) && !$this->_bShowOnSuccess) {
         return '';
     }
     $sTitle = $this->_aActions[$sAction]['title'] . ' ';
     if (!empty($sResult)) {
         $sResult = substr($sResult, 0, 1) == '_' ? _t($sResult) : $sResult;
     }
     $sContent = !empty($sResult) ? $sResult : _t($bResult ? '_adm_txt_modules_process_action_success' : '_adm_err_modules_process_action_failed');
     if (!$bHtmlResponse) {
         return $sTitle . $sContent;
     }
     return BxDolStudioTemplate::getInstance()->parseHtmlByName('mod_action_result_step.html', array('color' => $bResult ? 'green' : 'red', 'title' => $sTitle, 'content' => $sContent));
 }
 protected function getBlockList($sModule)
 {
     if (empty($sModule)) {
         return '';
     }
     $sJsObject = $this->getPageJsObject();
     $oTemplate = BxDolStudioTemplate::getInstance();
     $oForm = new BxTemplStudioFormView(array());
     $aInputCheckbox = array('type' => 'checkbox', 'name' => 'blocks[]', 'attrs' => array('onChange' => 'javascript:' . $sJsObject . '.onSelectBlock(this);'), 'value' => '');
     $aTmplParams = array('html_block_list_id' => $this->aHtmlIds['block_list_id'] . $sModule, 'bx_repeat:blocks' => array());
     $aBlocks = $this->getBlocks($sModule);
     foreach ($aBlocks as $aBlock) {
         list($sIcon, $sIconUrl) = $this->getBlockIcon($aBlock);
         $aInputCheckbox['value'] = $aBlock['id'];
         $aTmplParams['bx_repeat:blocks'][] = array('js_object' => $sJsObject, 'html_id' => $this->aHtmlIds['block_id'] . $aBlock['id'], 'bx_if:is_inactive' => array('condition' => false, 'content' => array()), 'bx_if:show_link' => array('condition' => false, 'content' => array()), 'bx_if:show_text' => array('condition' => true, 'content' => array('title' => _t($aBlock['title']))), 'bx_if:image' => array('condition' => (bool) $sIconUrl, 'content' => array('icon_url' => $sIconUrl)), 'bx_if:icon' => array('condition' => (bool) $sIcon, 'content' => array('icon' => $sIcon)), 'module' => $this->getModuleTitle($aBlock['module']), 'visible_for' => _t('_adm_bp_txt_visible_for', BxDolStudioUtils::getVisibilityTitle($aBlock['visible_for_levels'])), 'bx_if:show_checkbox' => array('condition' => true, 'content' => array('content' => $oForm->genRow($aInputCheckbox))), 'bx_if:show_drag_handle' => array('condition' => false, 'content' => array()));
     }
     return $oTemplate->parseHtmlByName('bp_blocks_list.html', $aTmplParams);
 }
Example #25
0
 protected function displayUpdates($aItems, $aParams = array())
 {
     if (!is_array($aItems)) {
         return $aItems;
     }
     if (empty($aItems)) {
         return MsgBox(_t('_Empty'));
     }
     $sJsObject = $this->getPageJsObject();
     $oTemplate = BxDolStudioTemplate::getInstance();
     $sResult = '';
     foreach ($aItems as $aItem) {
         $bDownloadable = (int) $aItem['is_file'] == 1;
         $sIcon = !empty($aItem['thumbnail']['big']) ? $aItem['thumbnail']['big'] : BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_MODULE);
         $bIcon = strpos($sIcon, '.') === false;
         $sResult .= $oTemplate->parseHtmlByName('str_update_v2.html', array('js_object' => $sJsObject, 'id' => $aItem['id'], 'name' => $aItem['name'], 'url' => $aItem['url'], 'bx_if:icon' => array('condition' => $bIcon, 'content' => array('icon' => $sIcon)), 'bx_if:image' => array('condition' => !$bIcon, 'content' => array('icon_url' => $sIcon)), 'title' => $aItem['title'], 'vendor' => $aItem['author'], 'versions' => _t('_adm_str_txt_update_from_to', $aItem['file_version'], $aItem['file_version_to']), 'bx_if:show_download' => array('condition' => $bDownloadable, 'content' => array('caption' => _t($this->bAuthAccessUpdates ? '_adm_btn_download_submit' : '_adm_btn_install_submit'), 'on_click' => $sJsObject . "." . ($this->bAuthAccessUpdates ? "getFile(" . $aItem['file_id'] . ", this)" : "getUpdateAndInstall('" . $aItem['name'] . "', this)")))));
     }
     return $sResult;
 }
Example #26
0
 protected function getSettings()
 {
     $oPage = new BxTemplStudioSettings(BX_DOL_STUDIO_STG_TYPE_SYSTEM, BX_DOL_STUDIO_STG_CATEGORY_TEMPLATES);
     $aTmplVars = array('js_object' => $this->getPageJsObject(), 'bx_repeat:blocks' => $oPage->getPageCode());
     return BxDolStudioTemplate::getInstance()->parseHtmlByName('designer.html', $aTmplVars);
 }
Example #27
0
<?php

/**
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 *
 * @defgroup    TridentEndAdmin Trident Studio End Admin Pages
 * @ingroup     TridentStudio
 * @{
 */
require_once './../inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
bx_import('BxDolLanguages');
bx_require_authentication(true);
$sPage = bx_get('page');
$sPage = $sPage !== false ? bx_process_input($sPage) : '';
$oPage = new BxTemplStudioPolyglot($sPage);
$oPage->init();
$oTemplate = BxDolStudioTemplate::getInstance();
$oTemplate->setPageNameIndex($oPage->getPageIndex());
$oTemplate->setPageHeader($oPage->getPageHeader());
$oTemplate->setPageContent('page_caption_code', $oPage->getPageCaption());
$oTemplate->setPageContent('page_attributes', $oPage->getPageAttributes());
$oTemplate->setPageContent('page_menu_code', $oPage->getPageMenu());
$oTemplate->setPageContent('page_main_code', $oPage->getPageJsCode() . $oPage->getPageCode());
$oTemplate->addCss($oPage->getPageCss());
$oTemplate->addJs($oPage->getPageJs());
$oTemplate->getPageCode();
/** @} */
Example #28
0
 public function activate($sModule)
 {
     $aModule = $this->oDb->getModuleByName($sModule);
     if (empty($aModule) || !is_array($aModule)) {
         return array('code' => 1, 'message' => _t('_adm_err_operation_failed'));
     }
     bx_import('BxDolStudioInstallerUtils');
     $aResult = BxDolStudioInstallerUtils::getInstance()->perform($aModule['path'], (int) $aModule['enabled'] == 0 ? 'enable' : 'disable', array('html_response' => true));
     if ($aResult['code'] != 0) {
         return $aResult;
     }
     bx_import('BxDolStudioTemplate');
     $oTemplate = BxDolStudioTemplate::getInstance();
     $aResult = array('code' => 0, 'message' => _t('_adm_scs_operation_done'));
     if ((int) $aModule['enabled'] == 0) {
         $aResult['content'] = $oTemplate->parseHtmlByName('page_content_2_col.html', array('page_menu_code' => $this->getPageMenu(), 'page_main_code' => $this->getPageCode()));
     } else {
         $aResult['content'] = "";
     }
     return $aResult;
 }
Example #29
0
 function addStudioInjection($sKey, $sType, $sData, $iReplace = 0)
 {
     BxDolStudioTemplate::getInstance()->aPage['injections']['page_0'][$sKey][] = array('page_index' => 0, 'key' => $sKey, 'type' => $sType, 'data' => $sData, 'replace' => $iReplace);
 }
 public function getUpdates()
 {
     $aUpdates = array();
     bx_import('BxDolStudioTemplate');
     $oTemplate = BxDolStudioTemplate::getInstance();
     $aInstalledInfo = $this->getInstalledInfo();
     $sPath = BX_DIRECTORY_PATH_MODULES;
     if (($rHandleVendor = opendir($sPath)) !== false) {
         while (($sVendor = readdir($rHandleVendor)) !== false) {
             if (substr($sVendor, 0, 1) == '.' || !is_dir($sPath . $sVendor)) {
                 continue;
             }
             if (($rHandleModule = opendir($sPath . $sVendor . '/')) !== false) {
                 while (($sModule = readdir($rHandleModule)) !== false) {
                     if (!is_dir($sPath . $sVendor . '/' . $sModule) || substr($sModule, 0, 1) == '.') {
                         continue;
                     }
                     $sModulePath = $sVendor . '/' . $sModule . '/';
                     if (empty($aInstalledInfo[$sModulePath])) {
                         continue;
                     }
                     $aUpdate = $this->getUpdate($aInstalledInfo[$sModulePath]);
                     if (!empty($aUpdate)) {
                         $aUpdates[$aUpdate['title']] = $aUpdate;
                     }
                 }
                 closedir($rHandleModule);
             }
         }
         closedir($rHandleVendor);
     }
     ksort($aUpdates);
     return $aUpdates;
 }