Skip to content

Instantly share code, notes, and snippets.

@z3cka
Forked from hottraffic/gist:6690884
Created September 24, 2013 20:39

Revisions

  1. @hottraffic hottraffic created this gist Sep 24, 2013.
    268 changes: 268 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,268 @@
    <?php
    /**
    * @package Jtouch for Joomla 1.5
    * @copyright Copyright (C) 2011 - 2012 MobileMeWs.com. All rights reserved.
    * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
    * @license GNU/GPL, see LICENSE.php
    * Joomla! is free software. This version may have been modified pursuant
    * to the GNU General Public License, and as distributed it includes or
    * is derivative of works licensed under the GNU General Public License or
    * other free or open source software licenses.
    * See COPYRIGHT.php for copyright notices and details.
    */

    defined('_JEXEC') or die('Restricted access');

    $document = & JFactory::getDocument();

    $thisTplUrl = $this->baseurl. '/templates/' . $this->template;
    $thisTplPath =JPATH_ROOT.DS.'templates'.DS.$this->template;
    $jqmPath = $thisTplUrl.'/client-libs/jquerymobile/11';
    $pageId = JRequest::getInt('Itemid', 0);
    $jqmVer = '1.1.0';
    $pageId = JRequest::getInt('Itemid', 0);
    $debug = ($this->params->get('jtouch-debug', 1) == 1)? true:false;
    $minfile = $debug? '' : '.min';

    // Load Jtouch libs
    require_once ($thisTplPath .DS .'utils' .DS .'jtouch25.utils.php');

    // Menu builder
    require($thisTplPath.DS. 'utils'.DS.'jtouch_menu.php');

    // For Kunena Only
    if( (int)$this->params->get('jtouch-kunena-load', 0) == 1) {
    Jtouch25Utils::kunenaLoadJsFiles($minfile);
    }

    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <?php if( (int)$this->params->get('jtouch-load-jhead') == 1 ):?>
    <jdoc:include type="head" />
    <?php else:?>

    <title><?php echo $document->getTitle();?></title>
    <link href="<?php echo $thisTplUrl;?>/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <?php endif;?>

    <?php
    $iOSIcon = $this->params->get('jtouch-ios-favicon') ;
    if($iOSIcon!=''):
    ?>
    <link rel="apple-touch-icon" href="<?php echo $thisTplUrl;?>/jtouch.png" />
    <?php endif;?>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="generator" content="Joomla 1.5, mobilized by Jtouch template (c) 2012 mobilemews.com" />

    <link rel="stylesheet" href="<?php echo $jqmPath;?>/resources/jquery.mobile-<?php echo $jqmVer.$minfile;?>.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $jqmPath;?>/resources/jtouch-custom.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $thisTplUrl;?>/client-libs/simpledialog2/jquery.mobile.simpledialog.min.css" type="text/css" />

    <link rel="stylesheet" href="<?php echo $thisTplUrl;?>/css/template<?php echo $minfile;?>.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $thisTplUrl;?>/css/template-overwrite<?php echo $minfile;?>.css" type="text/css" />

    <?php Jtouch25Utils::writeCss(); ?>

    <script type="text/javascript">
    //pageID = Itemid
    var jtouchPageId = <?php echo $pageId;?>;
    </script>

    <script src="<?php echo $jqmPath;?>/jquery.min.js" type="text/javascript"></script>
    <script src="<?php echo $jqmPath;?>/jqm.init<?php echo $minfile;?>.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).bind("mobileinit", function() {
    $.mobile.defaultPageTransition = '<?php echo $this->params->get('jtouch-page-transition', 'slide');?>';
    });
    </script>
    <script src="<?php echo $jqmPath;?>/jquery.mobile-<?php echo $jqmVer.$minfile;?>.js" type="text/javascript"></script>
    <script src="<?php echo $jqmPath;?>/jtouch.core<?php echo $minfile;?>.js" type="text/javascript"></script>
    <script src="<?php echo $jqmPath;?>/jqm.domready<?php echo $minfile;?>.js" type="text/javascript"></script>

    <script src="<?php echo $jqmPath;?>/jquery.validate.190.min.js" type="text/javascript"></script>
    <script src="<?php echo $thisTplUrl;?>/client-libs/simpledialog2/jquery.mobile.simpledialog2.min.js" type="text/javascript"></script>

    <?php if( (int)$this->params->get('jtouch-ios-add-app', 0) == 1 ): ?>
    <script type="text/javascript">
    var addToHomeConfig = {
    animationIn: 'bubble',
    animationOut: 'drop',
    lifespan:10000,
    expire:2,
    touchIcon:true,
    returningVisitor: true,
    message:'<?php echo JText::_('TPL_JTOUCH_ADD_2_HOME_TEXT');?></a>'
    };
    </script>
    <link rel="stylesheet" href="<?php echo $thisTplUrl; ?>/client-libs/add2home/add2home.min.css" />
    <script type="text/javascript" src="<?php echo $thisTplUrl; ?>/client-libs/add2home/add2home.min.js"></script>
    <?php endif;?>

    <?php
    $extraTopCls = '';
    if($this->params->get('jtouch-banner', '') != ''){
    $extraTopCls = 'jtouch-extratop';
    }
    ?>

    <?php if( (int)$this->params->get('jtouch-google-analytics', 0) == 1): ?>
    <script type="text/javascript">
    var _gaq = _gaq || [];
    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
    </script>
    <?php endif; ?>

    </head>
    <body class="<?php echo $extraTopCls;?>">
    <!-- MAIN PAGE -->
    <?php
    $pageTheme = $this->params->get('jtouch-theme');
    $headerTheme = $this->params->get('jtouch-header-theme');

    $fixedHeader = '';
    if( (int)$this->params->get('jtouch-fixed-header') == 1 ){
    $fixedHeader = ' data-position="fixed" ';
    }

    $fixedFooter = '';
    if( (int)$this->params->get('jtouch-fixed-footer') == 1 ){
    $fixedFooter = ' data-position="fixed" ';
    }
    ?>

    <?php if($this->params->get('jtouch-banner', '') != ''): ?>
    <div id="jtouch-logo"><a href="index.php"><img src="<?php echo $this->params->get('jtouch-banner', ''); ?>"/></a></div>
    <?php endif;?>
    <a href="" id="hidden_link" style="display:none;"></a>
    <a name="topofpage" style="display:none;"></a>

    <div data-role="page" id="page-<?php echo $pageId;?>" data-add-back-btn="true" data-back-btn-text="<?php echo JText::_('TPL_JTOUCH_BACK_BUTTON_TEXT');?>" data-theme="<?php echo $pageTheme;?>">
    <div data-role="header" <?php echo $fixedHeader;?> data-theme="<?php echo $headerTheme;?>">
    <a href="#page-menu" data-icon="gear" class="ui-btn-right">Menu</a>
    <h1><?php echo $document->getTitle();?></h1>
    </div>

    <div data-role="content">
    <?php if ($this->countModules('jtouch-top')): ?>
    <div id="jtouch-top">
    <jdoc:include type="modules" name="jtouch-top" />
    </div>
    <?php endif; ?>

    <?php if ($this->countModules('jtouch-user1')): ?>
    <div id="jtouch-user1">
    <jdoc:include type="modules" name="jtouch-user1" style="xhtml" />
    </div>
    <?php endif; ?>

    <?php if ($this->countModules('jtouch-menu-2')): ?>
    <div id="jtouch-menu-2">
    <?php
    $systemMenu = $this->params->get('jtouch-menu') ;
    if($systemMenu == null || $systemMenu == ''){
    $systemMenu = 'mainmenu';
    }
    jtouchShowMainMenu($systemMenu);
    ?>
    </div>
    <?php endif; ?>


    <jdoc:include type="message" />

    <?php
    $turnoffIds = $this->params->get('jtouch-turnoff-ids', -1);
    $turnedOff = false;
    if($turnoffIds != -1){
    $turnoffIds = explode(',', $turnoffIds);
    $currentID = JRequest::getInt('Itemid', 0);
    if(in_array($currentID, $turnoffIds)){
    $turnedOff = true;
    }
    }
    if(!$turnedOff) :
    ?>
    <div id="jdoc-componnet">
    <jdoc:include type="component" />
    </div>

    <?php endif;?>

    <?php if ($this->countModules('jtouch-user2')): ?>
    <div id="jtouch-user2">
    <jdoc:include type="modules" name="jtouch-user2" style="xhtml" />
    </div>
    <?php endif; ?>

    <?php if ($this->countModules('jtouch-breadcrumb')): ?>
    <div id="page-pathway">
    <jdoc:include type="modules" name="jtouch-breadcrumb" />
    </div>
    <?php endif; ?>

    <?php if ($this->countModules('jtouch-bottom')): ?>
    <div id="jtouch-bottom">
    <jdoc:include type="modules" name="jtouch-bottom" style="xhtml" />
    </div>
    <?php endif; ?>
    </div>

    <div data-role="footer" <?php echo $fixedFooter;?> data-theme="<?php echo $pageTheme;?>">
    <?php if ($this->countModules('jtouch-footer') || $this->params->get('jtouch-show-powerby', 1) == 1): ?>
    <div id="page-footer">
    <jdoc:include type="modules" name="jtouch-footer" />

    <?php if($this->params->get('jtouch-show-powerby', 1) == 1): ?>
    <div class="jtouch-copyright"><a href="http://www.mobilemews.com" target="_blank" title="Jtouch - mobile template for Joomla, VirtuMart and Kunena">mobilized by mobilemews.com</a></div>
    <?php endif;?>
    </div>
    <?php endif; ?>
    </div>
    </div>

    <!-- MENU PAGE -->
    <div data-role="page" id="page-menu" data-add-back-btn="true" data-back-btn-text="<?php echo JText::_('TPL_JTOUCH_BACK_BUTTON_TEXT');?>" data-theme="<?php echo $pageTheme;?>">
    <div data-role="header" data-theme="<?php echo $headerTheme;?>">
    <h1><?php echo JText::_('TPL_JTOUCH_MENU_MENU');?></h1>
    </div>
    <div data-role="content">
    <?php
    $jtouchDesktopTpl = $this->params->get('jtouch-desktop-template', '-1');
    $url = clone JFactory::getURI();
    //$params = array( 'jtouchTemplateSelector' => $jtouchDesktopTpl); /old
    $params = array( 'jtouchTemplateSelector' => $jtouchDesktopTpl, 'jtpl' => $jtouchDesktopTpl); //new
    $params = array_merge( $url->getQuery( true ), $params );
    $query = $url->buildQuery( $params );
    $url->setQuery( $query );

    if( $jtouchDesktopTpl != '-1' ):
    ?>
    <a href="<?php echo $url->toString();?>" data-icon="gear" data-role="button" target="_self" data-mini="true"><?php echo JText::_('TPL_JTOUCH_SWITCH_TO_DESKTOP');?></a>
    <?php endif;?>

    <?php
    $systemMenu = $this->params->get('jtouch-menu') ;
    if($systemMenu == null || $systemMenu == ''){
    $systemMenu = 'mainmenu';
    }
    jtouchShowMainMenu($systemMenu);
    ?>
    </div>
    </div>

    <!-- EX JS SCRIPTS FOR JTOUCH -->
    <?php Jtouch25Utils::writeJs($this->params);?>

    <?php if( (int)$this->params->get('jtouch-google-analytics', 0) == 1){
    require_once 'page-elements/ga.php';
    } ?>
    <!-- EX JS SCRIPTS FOR JTOUCH: END -->

    </body>
    </html>