BxDolMobileTemplate.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. bx_import('BxDolModuleTemplate');
  22. class BxDolMobileTemplate extends BxDolModuleTemplate {
  23. var $_aMobileJs = array ('jquery.js');
  24. var $_aMobileCss = array ('mobile.css');
  25. /*
  26. * Constructor.
  27. */
  28. function BxDolMobileTemplate(&$oConfig, &$oDb, $sRootPath = BX_DIRECTORY_PATH_ROOT, $sRootUrl = BX_DOL_URL_ROOT) {
  29. parent::BxDolModuleTemplate($oConfig, $oDb, $sRootPath, $sRootUrl);
  30. }
  31. function addMobileCss($mixedFiles) {
  32. if (is_array($mixedFiles))
  33. $this->_aMobileJs = array_merge($this->_aMobileJs, $mixedFiles);
  34. else
  35. $this->_aMobileJs[] = $mixedFiles;
  36. }
  37. function addMobileJs($mixedFiles) {
  38. if (is_array($mixedFiles))
  39. $this->_aMobileCss = array_merge($this->_aMobileCss, $mixedFiles);
  40. else
  41. $this->_aMobileCss[] = $mixedFiles;
  42. }
  43. function pageCode ($sTitle, $isDesignBox = true, $isWrap = true) {
  44. global $_page;
  45. global $_page_cont;
  46. $GLOBALS['BxDolTemplateJs'] = array ();
  47. $GLOBALS['BxDolTemplateCss'] = array ();
  48. $this->addCss($this->_aMobileCss);
  49. $this->addJs($this->_aMobileJs);
  50. $sOutput = $this->pageEnd();
  51. if ($isDesignBox) {
  52. $aVars = array ('content' => $sOutput);
  53. $sOutput = $this->parseHtmlByName('mobile_box.html', $aVars);
  54. }
  55. if ($isWrap) {
  56. $aVars = array ('content' => $sOutput);
  57. $sOutput = $this->parseHtmlByName('mobile_page_padding.html', $aVars);
  58. }
  59. $iNameIndex = 11;
  60. $_page['name_index'] = $iNameIndex;
  61. $_page['header'] = $sTitle ? $sTitle : $GLOBALS['site']['title'];
  62. $_page_cont[$iNameIndex]['page_main_code'] = $sOutput;
  63. PageCode($this);
  64. }
  65. function displayNoData($sCaption = false) {
  66. $this->displayMsg(_t('_Empty'), $sCaption);
  67. }
  68. function displayAccessDenied($sCaption = false) {
  69. $this->displayMsg(_t('_Access denied'), $sCaption);
  70. }
  71. function displayPageNotFound() {
  72. header("HTTP/1.0 404 Not Found");
  73. $this->displayMsg(_t('_sys_request_page_not_found_cpt'));
  74. }
  75. function displayMsg($sMsg, $bTranslateMsg = false, $sTitle = false, $bTranslateMsg = false) {
  76. $sMsg = $bTranslateMsg ? _t($sMsg) : $sMsg;
  77. $sTitle = $bTranslateMsg ? _t($sTitle) : $sTitle;
  78. echo $sMsg;
  79. $this->pageCode($sTitle ? $sTitle : $sMsg);
  80. }
  81. }