| 1 | <?php
|
|---|
| 2 | /***************************************************************************
|
|---|
| 3 | * Dolphin Smart Community Builder
|
|---|
| 4 | * -------------------
|
|---|
| 5 | * begin : Mon Mar 23 2006
|
|---|
| 6 | * copyright : (C) 2007 BoonEx Group
|
|---|
| 7 | * website : http://www.boonex.com
|
|---|
| 8 | * This file is part of Dolphin - Smart Community Builder
|
|---|
| 9 | *
|
|---|
| 10 | * Dolphin is free software; you can redistribute it and/or modify it under
|
|---|
| 11 | * the terms of the GNU General Public License as published by the
|
|---|
| 12 | * Free Software Foundation; either version 2 of the
|
|---|
| 13 | * License, or any later version.
|
|---|
| 14 | *
|
|---|
| 15 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|---|
| 16 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 17 | * See the GNU General Public License for more details.
|
|---|
| 18 | * You should have received a copy of the GNU General Public License along with Dolphin,
|
|---|
| 19 | * see license.txt file; if not, write to marketing@boonex.com
|
|---|
| 20 | ***************************************************************************/
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 | require_once( '../inc/header.inc.php' );
|
|---|
| 24 | require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
|
|---|
| 25 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
|
|---|
| 26 | require_once( BX_DIRECTORY_PATH_INC . 'admin_design.inc.php' );
|
|---|
| 27 | require_once( BX_DIRECTORY_PATH_INC . 'db.inc.php' );
|
|---|
| 28 | require_once( BX_DIRECTORY_PATH_INC . 'admin.inc.php' );
|
|---|
| 29 | require_once( BX_DIRECTORY_PATH_INC . 'images.inc.php' );
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | $logged['admin'] = member_auth( 1, true, true );
|
|---|
| 33 |
|
|---|
| 34 | bx_import('BxDolAdminBuilder');
|
|---|
| 35 | class BxDolAdminMobileBuilder extends BxDolAdminBuilder {
|
|---|
| 36 |
|
|---|
| 37 | var $_sPage;
|
|---|
| 38 |
|
|---|
| 39 | function BxDolAdminMobileBuilder ($sPage) {
|
|---|
| 40 | parent::BxDolAdminBuilder(
|
|---|
| 41 | '`sys_menu_mobile`',
|
|---|
| 42 | BX_DOL_URL_ADMIN . 'mobileBuilder.php',
|
|---|
| 43 | array (
|
|---|
| 44 | '1' => _t('_adm_mobile_builder_cont_active'),
|
|---|
| 45 | '0' => _t('_adm_mobile_builder_cont_inactive'),
|
|---|
| 46 | ));
|
|---|
| 47 | $this->_sPage = process_db_input($sPage);
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | function getItemsForContainer ($sKey) {
|
|---|
| 51 | global $MySQL;
|
|---|
| 52 | return $MySQL->getAll("SELECT * FROM `sys_menu_mobile` WHERE `page` = '" . $this->_sPage . "' AND `active` = '" . $MySQL->escape($sKey) . "' ORDER BY `order`");
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | function getItem ($aItem) {
|
|---|
| 56 | $a = array (
|
|---|
| 57 | 'content' => _t($aItem['title']),
|
|---|
| 58 | );
|
|---|
| 59 | return $GLOBALS['oSysTemplate']->parseHtmlByName('mobile_box.html', $a);
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | function addExternalResources () {
|
|---|
| 63 | parent::addExternalResources ();
|
|---|
| 64 | $GLOBALS['oAdmTemplate']->addCss(array(
|
|---|
| 65 | 'pageBuilder.css',
|
|---|
| 66 | 'forms_adv.css',
|
|---|
| 67 | ));
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | function getBuilderPage () {
|
|---|
| 71 |
|
|---|
| 72 | $aPagesForTemplate = array (
|
|---|
| 73 | array(
|
|---|
| 74 | 'value' => '',
|
|---|
| 75 | 'title' => _t('_adm_txt_pb_select_page'),
|
|---|
| 76 | 'selected' => empty($this->_sPage) ? 'selected="selected"' : ''
|
|---|
| 77 | )
|
|---|
| 78 | );
|
|---|
| 79 |
|
|---|
| 80 | $aPages = $this->_getPages();
|
|---|
| 81 | foreach ($aPages as $r)
|
|---|
| 82 | $aPagesForTemplate[] = array(
|
|---|
| 83 | 'value' => $r['page'],
|
|---|
| 84 | 'title' => htmlspecialchars_adv(_t($r['title'])),
|
|---|
| 85 | 'selected' => $r['page'] == $this->_sPage ? 'selected="selected"' : '',
|
|---|
| 86 | );
|
|---|
| 87 |
|
|---|
| 88 | $sPagesSelector = $GLOBALS['oAdmTemplate']->parseHtmlByName('mobile_builder_pages_selector.html', array(
|
|---|
| 89 | 'bx_repeat:pages' => $aPagesForTemplate,
|
|---|
| 90 | 'url' => bx_html_attribute(BX_DOL_URL_ADMIN . 'mobileBuilder.php'),
|
|---|
| 91 | ));
|
|---|
| 92 |
|
|---|
| 93 | if (empty($this->_sPage))
|
|---|
| 94 | $this->addExternalResources ();
|
|---|
| 95 | return $sPagesSelector . (!empty($this->_sPage) ? parent::getBuilderPage () : '');
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | function _getPages() {
|
|---|
| 99 | global $MySQL;
|
|---|
| 100 | return $MySQL->getAll("SELECT * FROM `sys_menu_mobile_pages` ORDER BY `order`");
|
|---|
| 101 | }
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | $oAdminMobileBuilder = new BxDolAdminMobileBuilder (bx_get('page'));
|
|---|
| 105 |
|
|---|
| 106 | if (0 == strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
|
|---|
| 107 | $oAdminMobileBuilder->handlePostActions($_POST);
|
|---|
| 108 | exit;
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 | $sPageContent = $oAdminMobileBuilder->getBuilderPage();
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 | $iNameIndex = 0;
|
|---|
| 116 | $_page = array(
|
|---|
| 117 | 'name_index' => $iNameIndex,
|
|---|
| 118 | 'header' => _t('_adm_mobile_builder_title'),
|
|---|
| 119 | 'header_text' => _t('_adm_mobile_builder_title'),
|
|---|
| 120 | );
|
|---|
| 121 | $_page_cont[$iNameIndex]['page_main_code'] = $sPageContent;
|
|---|
| 122 |
|
|---|
| 123 | PageCodeAdmin();
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|