示例#1
0
文件: views.php 项目: bizanto/Hooked
    function showToolbar($data = null)
    {
        $mySQLVer = 0;
        if (JFile::exists(JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php')) {
            require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php';
            $mySQLVer = CAdvanceSearch::getMySQLVersion();
        }
        require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'toolbar.php';
        require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'miniheader.php';
        $format = JRequest::getVar('format', 'html', 'get');
        if ($format == 'json') {
            return;
        }
        $mainframe =& JFactory::getApplication();
        $document =& JFactory::getDocument();
        $my = CFactory::getUser();
        $userid = JRequest::getInt('userid', '');
        $user = CFactory::getUser($userid);
        // Get the configuration object.
        $config = CFactory::getConfig();
        //JHTML::_('behavior.tooltip');
        $js = 'assets/window-1.0';
        $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
        CAssets::attach($js, 'js');
        $js = 'assets/script-1.2';
        $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
        CAssets::attach($js, 'js');
        $js = '<script type=\'text/javascript\'>';
        $js .= '/*<![CDATA[*/';
        $js .= 'var js_viewerId  = ' . $my->id . '; ';
        $js .= 'var js_profileId = ' . $user->id . ';';
        $js .= '/*]]>*/';
        $js .= '</script>';
        $mainframe->addCustomHeadTag($js);
        CFactory::load('libraries', 'template');
        CTemplate::addStylesheet('style');
        // Load rtl stylesheet
        if ($document->direction == 'rtl') {
            CTemplate::addStylesheet('style.rtl');
        }
        // FOr iPhone, we need to add the stylesheet AFTER the main stylesheet has been loaded
        // if(JRequest::getVar('screen')=='mobile')
        // {
        // 	$document->addStylesheet( JURI::root() . 'components/com_community/templates/default/css/style.mobile.css' );
        // }
        // This need to be loaded in main messaging library
        CFactory::load('libraries', 'window');
        CWindow::load();
        $template = new CTemplateHelper();
        $styleIE7 = $template->getTemplateAsset('styleIE7', 'css');
        $styleIE6 = $template->getTemplateAsset('styleIE6', 'css');
        $css = '<!-- Jom Social -->
				<!--[if IE 7.0]>
				<link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" />
				<![endif]-->
				<!--[if lte IE 6]>
				<link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" />
				<![endif]-->';
        $mainframe->addCustomHeadTag($css);
        $css = 'assets/autocomplete.css';
        CAssets::attach($css, 'css');
        // Load joms.ajax
        CTemplate::addScript('joms.ajax');
        $task = JRequest::getVar('task', '', 'GET');
        $groupId = JRequest::getInt('groupid', '', 'GET');
        // Hide the toolbar from unregistered user
        // but still show the mini header
        if (empty($my->id)) {
            if (!empty($groupId) && $task != 'viewgroup') {
                CFactory::load('libraries', 'miniheader');
                echo CMiniHeader::showGroupMiniHeader($groupId);
                return;
            }
            echo CMiniHeader::showMiniHeader($this->_showMiniHeaderUser);
            return;
        }
        /**
         * Inbox unread count
         */
        $inboxUnread = 0;
        if (!empty($data['inbox'])) {
            $inboxUnread = $data['inbox'];
        }
        /**
         * Notification alert
         */
        $notiAlert = 0;
        $notiAlert = $this->_newNotification();
        if (!empty($notiAlert) && $notiAlert > 0) {
            CFactory::load('libraries', 'window');
            CWindow::load();
        }
        $config = CFactory::getConfig();
        $logoutLink = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_logout'), false);
        $logoutLink = base64_encode($logoutLink);
        $isFacebookUser = false;
        if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) {
            CFactory::load('libraries', 'facebook');
            CFactory::load('models', 'connect');
            // Once they reach here, we assume that they are already logged into facebook.
            // Since CFacebook library handles the security we don't need to worry about any intercepts here.
            $facebook = new CFacebook();
            $connectTable =& JTable::getInstance('Connect', 'CTable');
            $fbUser = $facebook->getUser();
            $connectTable->load($fbUser);
            $isFacebookUser = $connectTable->userid == $my->id;
        }
        $groupMiniHeader = '';
        // Show miniheader
        if ($task != 'viewgroup') {
            CFactory::load('libraries', 'miniheader');
            $groupMiniHeader = CMiniHeader::showGroupMiniHeader($groupId);
        }
        $tmpl = new CTemplate();
        $tmpl->set('my', $my);
        $tmpl->set('isMine', COwnerHelper::isMine($my->id, $user->id));
        $tmpl->set('config', $config);
        $tmpl->set('inboxUnread', $inboxUnread);
        $tmpl->set('notiAlert', $notiAlert);
        $tmpl->set('miniheader', CMiniHeader::showMiniHeader($this->_showMiniHeaderUser));
        $tmpl->set('groupMiniHeader', $groupMiniHeader);
        $tmpl->set('showAdvanceSearch', $mySQLVer > 4.1 ? 1 : 0);
        $tmpl->set('logoutLink', $logoutLink);
        $tmpl->set('isFacebookUser', $isFacebookUser);
        $toolbar = CFactory::getToolbar();
        $tmpl->set('customToolbar', $toolbar);
        echo $tmpl->fetch('toolbar.index');
    }
示例#2
0
 public function executeMobile($task = '')
 {
     CFactory::load('libraries', 'mobile');
     $view =& $this->getView(JRequest::getCmd('view', 'frontpage'));
     // Fetch content
     ob_start();
     if (!empty($task) && method_exists($this, $task)) {
         $this->{$task}();
     } else {
         $this->display();
     }
     $content = ob_get_contents();
     ob_end_clean();
     // Swap joomla document with
     // CDocumentMobile or CDocumentMobileAjax
     $document =& JFactory::getDocument();
     if (JRequest::getCmd('section') == 'content') {
         $document = new CDocumentMobileAjax($document);
         echo $content;
     } else {
         $document = new CDocumentMobile($document);
         // Add our scripts & stylesheets
         CTemplate::addScript('script.mobile-1.0');
         CTemplate::addScript('joms.ajax');
         CTemplate::addStylesheet('style.mobile');
         // Fetch toolbar
         ob_start();
         $view->showToolbarMobile();
         $toolbar = ob_get_contents();
         ob_end_clean();
         // Fetch switcher
         ob_start();
         CMobile::showSwitcher();
         $switcher = ob_get_contents();
         ob_end_clean();
         $tmpl = new CTemplate();
         $tmpl->set('toolbar', $toolbar);
         $tmpl->set('content', $content);
         $tmpl->set('switcher', $switcher);
         echo $tmpl->fetch('mobile.index');
     }
 }
示例#3
0
    /**
     * Attach necessary scripts and stylesheets for the toolbar to operate correctly on 3rd party
     * environments.
     **/
    private function attachHeaders()
    {
        $document =& JFactory::getDocument();
        $config = CFactory::getConfig();
        if ($document->getType() != 'html') {
            return;
        }
        $js = 'assets/window-1.0';
        $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
        CAssets::attach($js, 'js');
        $js = 'assets/script-1.2';
        $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
        CAssets::attach($js, 'js');
        CFactory::load('libraries', 'template');
        CTemplate::addStylesheet('style');
        $templateParams = CTemplate::getTemplateParams();
        CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme'));
        // Load rtl stylesheet
        if ($document->direction == 'rtl') {
            CTemplate::addStylesheet('style.rtl');
        }
        // This need to be loaded so the popups will work correctly in notification window
        CFactory::load('libraries', 'window');
        CWindow::load();
        $template = new CTemplateHelper();
        $styleIE7 = $template->getTemplateAsset('styleIE7', 'css');
        $styleIE6 = $template->getTemplateAsset('styleIE6', 'css');
        $css = '<!-- Jom Social -->
				<!--[if IE 7.0]>
				<link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" />
				<![endif]-->
				<!--[if lte IE 6]>
				<link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" />
				<![endif]-->';
        $document->addCustomTag($css);
        $css = 'assets/autocomplete.css';
        CAssets::attach($css, 'css');
        // Load joms.ajax
        CTemplate::addScript('joms.ajax');
    }
示例#4
0
    public function attachHeaders()
    {
        $document = JFactory::getDocument();
        $config = CFactory::getConfig();
        $my = CFactory::getUser();
        $userid = JRequest::getVar('userid', '');
        $user = CFactory::getUser($userid);
        if ($document->getType() != 'html') {
            return;
        }
        $document = JFactory::getDocument();
        $js = '<script type=\'text/javascript\'>';
        $js .= '/*<![CDATA[*/';
        $js .= 'var js_viewerId  = ' . $my->id . '; ';
        $js .= 'var js_profileId = ' . $user->id . ';';
        $js .= '/*]]>*/';
        $js .= '</script>';
        $document->addCustomTag($js);
        // This need to be loaded so the popups will work correctly in notification window
        CFactory::load('libraries', 'window');
        CWindow::load();
        CFactory::load('libraries', 'minitip');
        CMinitip::load();
        CFactory::load('libraries', 'template');
        CTemplate::addStylesheet('style');
        $templateParams = CTemplate::getTemplateParams();
        CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme'));
        // Load rtl stylesheet
        if ($document->direction == 'rtl') {
            CTemplate::addStylesheet('style.rtl');
        }
        $template = new CTemplateHelper();
        $styleIE7 = $template->getTemplateAsset('styleIE7', 'css');
        $styleIE6 = $template->getTemplateAsset('styleIE6', 'css');
        $css = '<!-- Jom Social -->
				<!--[if IE 7.0]>
				<link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" />
				<![endif]-->
				<!--[if lte IE 6]>
				<link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" />
				<![endif]-->';
        $document->addCustomTag($css);
        $css = 'assets/autocomplete.css';
        CAssets::attach($css, 'css');
        // Required, but added in default template
        //$css = 'assets/tipsy-0.1.7/src/stylesheets/tipsy.css';
        //CAssets::attach($css, 'css');
        // Load joms.ajax
        CTemplate::addScript('joms.ajax');
    }