Exemple #1
0
    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');
    }
Exemple #2
0
 public function getHTML($userId = '')
 {
     static $html = false;
     if (!$html) {
         $my = CFactory::getUser();
         // @rule: Do not display toolbar for non logged in users.
         if (empty($my->id)) {
             CFactory::load('libraries', 'miniheader');
             $task = JRequest::getVar('task', '', 'GET');
             $groupId = JRequest::getVar('groupid', '', 'GET');
             if (!empty($groupId) && $task != 'viewgroup') {
                 CFactory::load('libraries', 'miniheader');
                 return CMiniHeader::showGroupMiniHeader($groupId);
             }
             return CMiniHeader::showMiniHeader($userId);
         }
         $format = JRequest::getVar('format', 'html', 'get');
         // @rule: For json formatted output, we do not want to display the output as well.
         if ($format == 'json') {
             return;
         }
         // Compatibility with other pages, we need to include necessary javascripts and css libraries.
         $this->attachHeaders();
         CFactory::load('libraries', 'window');
         CWindow::load();
         CFactory::load('libraries', 'miniheader');
         $config = CFactory::getConfig();
         $logoutLink = base64_encode(CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_logout'), false));
         $tmpl = new CTemplate();
         $miniheader = CMiniHeader::showMiniHeader($userId);
         $groupMiniHeader = '';
         $task = JRequest::getVar('task', '');
         $groupId = JRequest::getVar('groupid', '');
         // Show miniheader
         if ($task != 'viewgroup') {
             $groupMiniHeader = CMiniHeader::showGroupMiniHeader($groupId);
         }
         $menus = $this->getItems();
         $this->addLegacyToolbars($menus);
         $model = CFactory::getModel('Toolbar');
         $newMessageCount = $this->getTotalNotifications('inbox');
         $newEventInviteCount = $this->getTotalNotifications('events');
         $newFriendInviteCount = $this->getTotalNotifications('friends');
         $newGroupInviteCount = $this->getTotalNotifications('groups');
         //add Event notification count with group notification count
         //$newEventInviteCount += $newGroupInviteCount;
         $totalNotifications = $newMessageCount + $newEventInviteCount + $newFriendInviteCount;
         $html = $tmpl->set('miniheader', $miniheader)->set('groupMiniHeader', $groupMiniHeader)->set('menus', $menus)->set('showToolbar', $config->get('show_toolbar'))->set('newMessageCount', $newMessageCount)->set('newFriendInviteCount', $newFriendInviteCount)->set('newEventInviteCount', $newEventInviteCount + $newGroupInviteCount)->set('logoutLink', $logoutLink)->set('active', $model->getActiveId(CToolbarLibrary::getActiveLink()))->set('notiAlert', $newMessageCount + $newEventInviteCount + $newFriendInviteCount)->fetch('toolbar.index');
     }
     return $html;
 }
Exemple #3
0
 /**
  * Show profile miniheader
  */
 public function _getMiniHeader()
 {
     CFactory::load('libraries', 'miniheader');
     $my = CFactory::getUser();
     $mh = new CMiniHeader();
     return $mh->showMiniHeader($my->id);
 }
Exemple #4
0
 public function getHTML($userId = '')
 {
     static $html = false;
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     if (!$html) {
         $my = CFactory::getUser();
         $view = $jinput->get('view', '');
         $task = $jinput->get('task', '');
         $groupId = $jinput->get('groupid', '', 'INT');
         // @rule: Do not display toolbar for non logged in users.
         if (empty($my->id)) {
             if (!empty($groupId) && ($task != 'viewgroup' && $view != 'events')) {
                 return CMiniHeader::showGroupMiniHeader($groupId);
             }
             return CMiniHeader::showMiniHeader($userId);
         }
         $format = $jinput->get->get('format', 'html', 'STRING');
         // @rule: For json formatted output, we do not want to display the output as well.
         if ($format == 'json') {
             return;
         }
         // Compatibility with other pages, we need to include necessary javascripts and css libraries.
         $this->attachHeaders();
         CWindow::load();
         $config = CFactory::getConfig();
         $logoutLink = base64_encode(CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_logout'), false));
         $tmpl = new CTemplate();
         $miniheader = CMiniHeader::showMiniHeader($userId);
         $groupMiniHeader = '';
         $targetUserId = $jinput->get('userid', '', 'INT');
         // Show miniheader
         if ($task != 'viewgroup' && $view != 'events') {
             $groupMiniHeader = CMiniHeader::showGroupMiniHeader($groupId);
         } elseif ($task == 'myevents' && $targetUserId && $targetUserId != $my->id) {
             //show miniheader if this event list belongs to others
             $miniheader = CMiniHeader::showMiniHeader($targetUserId);
         }
         $menus = $this->getItems();
         $this->addLegacyToolbars($menus);
         $model = CFactory::getModel('Toolbar');
         $notifModel = CFactory::getModel('notification');
         $newMessageCount = $this->getTotalNotifications('inbox');
         $newEventInviteCount = $this->getTotalNotifications('events');
         $newFriendInviteCount = $this->getTotalNotifications('friends');
         $newGroupInviteCount = $this->getTotalNotifications('groups');
         $myParams = $my->getParams();
         $newNotificationCount = $notifModel->getNotificationCount($my->id, '0', $myParams->get('lastnotificationlist', ''));
         $menuParams = '';
         if (isset($menus[$model->getActiveId(CToolbarLibrary::getActiveLink())])) {
             $menuParams = new CParameter($menus[$model->getActiveId(CToolbarLibrary::getActiveLink())]->item->params);
         }
         //add Event notification count with group notification count
         //$newEventInviteCount += $newGroupInviteCount;
         $totalNotifications = $newMessageCount + $newEventInviteCount + $newFriendInviteCount;
         $html = $tmpl->set('miniheader', $miniheader)->set('groupMiniHeader', $groupMiniHeader)->set('menus', $menus)->set('showToolbar', $config->get('show_toolbar'))->set('newMessageCount', $newMessageCount)->set('newFriendInviteCount', $newFriendInviteCount)->set('newEventInviteCount', $newEventInviteCount + $newGroupInviteCount + $newNotificationCount)->set('logoutLink', $logoutLink)->set('active', $model->getActiveId(CToolbarLibrary::getActiveLink()))->set('notiAlert', $newMessageCount + $newEventInviteCount + $newFriendInviteCount + $newNotificationCount)->set('menuParams', $menuParams)->set('isMessageEnable', $config->get('enablepm'))->fetch('toolbar/base');
     }
     return $html;
 }
Exemple #5
0
 /**
  * Show profile miniheader
  */
 public function _getMiniHeader()
 {
     $my = CFactory::getUser();
     $mh = new CMiniHeader();
     return $mh->showMiniHeader($my->id);
 }