Esempio n. 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');
    }
Esempio n. 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;
 }
Esempio n. 3
0
 public function getHeader()
 {
     $output = CMiniHeader::showGroupMiniHeader($this->group->id);
     echo $output;
     return $output;
 }
Esempio n. 4
0
 public function pastevents()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $document = JFactory::getDocument();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $groupId = $jinput->get->get('groupid', '', 'INT');
     //JRequest::getVar('groupid','', 'GET');
     if (!empty($groupId)) {
         $group = JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         // Set pathway for group videos
         // Community > Groups > Group Name > Events
         $this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $this->addPathway($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
     } else {
         $this->addPathway(JText::_('COM_COMMUNITY_EVENTS'), CRoute::_('index.php?option=com_community&view=events'));
         $this->addPathway(JText::_('COM_COMMUNITY_EVENTS_PAST_TITLE'), '');
     }
     CHeadHelper::setType('website', JText::_('COM_COMMUNITY_EVENTS_PAST_TITLE'));
     $feedLink = CRoute::_('index.php?option=com_community&view=events&task=pastevents&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_EXPIRED_EVENTS_FEED') . '"  href="' . $feedLink . '"/>';
     $document->addCustomTag($feed);
     // loading neccessary files here.
     //CFactory::load( 'libraries' , 'filterbar' );
     //CFactory::load( 'helpers' , 'event' );
     //CFactory::load( 'helpers' , 'owner' );
     //CFactory::load( 'models' , 'events');
     //$event		= JTable::getInstance( 'Event' , 'CTable' );
     $data = new stdClass();
     $sorted = $jinput->get->get('sort', 'latest', 'STRING');
     $model = CFactory::getModel('events');
     //CFactory::load( 'helpers' , 'event' );
     $event = JTable::getInstance('Event', 'CTable');
     $handler = CEventHelper::getHandler($event);
     // It is safe to pass 0 as the category id as the model itself checks for this value.
     $data->events = $model->getEvents(null, null, $sorted, null, false, true, null, null, $handler->getContentTypes(), $handler->getContentId());
     // Get pagination object
     $data->pagination = $model->getPagination();
     // Get the template for the group lists
     $eventsHTML = $this->_cachedCall('_getEventsHTML', array($data->events, true, $data->pagination), '', array(COMMUNITY_CACHE_TAG_EVENTS));
     $sortItems = array('latest' => JText::_('COM_COMMUNITY_EVENTS_SORT_CREATED'), 'startdate' => JText::_('COM_COMMUNITY_EVENTS_SORT_START_DATE'));
     $title = JText::_('COM_COMMUNITY_EVENTS_PAST_TITLE');
     if ($groupId) {
         $title = JText::_('COM_COMMUNITY_EVENTS_PAST_GROUP_TITLE');
     }
     $config = CFactory::getConfig();
     $canSearch = !$config->get('enableguestsearchevents') && COwnerHelper::isRegisteredUser() || $config->get('enableguestsearchevents') ? true : false;
     $tmpl = new CTemplate();
     $tmpl->set('eventsHTML', $eventsHTML)->set('canSearch', $canSearch)->set('pageTitle', $title)->set('config', $config)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'startdate'))->set('groupMiniHeader', $groupId ? CMiniHeader::showGroupMiniHeader($groupId) : false)->set('my', $my)->set('submenu', $this->showSubmenu(false))->set('createLink', $groupId ? CRoute::_('index.php?option=com_community&view=events&groupid=' . $groupId . '&task=create') : CRoute::_('index.php?option=com_community&view=events&task=create'))->set('ispastevents', true);
     if ($groupId) {
         $tmpl->set('canCreate', $my->authorise('community.create', 'groups.events.' . $groupId));
     } else {
         $tmpl->set('canCreate', $my->authorise('community.create', 'events'));
     }
     echo $tmpl->fetch('events/base');
 }
Esempio n. 5
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;
 }