Пример #1
0
 public function _addSubmenu()
 {
     $mySQLVer = 0;
     if (JFile::exists(JPATH_COMPONENT . '/libraries/advancesearch.php')) {
         require_once JPATH_COMPONENT . '/libraries/advancesearch.php';
         $mySQLVer = CAdvanceSearch::getMySQLVersion();
     }
     // Only display related links for guests
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     if ($my->id == 0) {
         //                $tmpl = new CTemplate();
         //                $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search'));
         //                $html = $tmpl->fetch('search.submenu');
         //                $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html);
         if ($mySQLVer >= 4.1 && $config->get('guestsearch')) {
             $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH'));
         }
     } else {
         $this->addSubmenuItem('index.php?option=com_community&view=search&task=browse', JText::_('COM_COMMUNITY_ALL_MEMBERS'));
         // $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('COM_COMMUNITY_SEARCH'));
         $tmpl = new CTemplate();
         $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search'));
         if ($mySQLVer >= 4.1) {
             $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH'));
         }
     }
 }
Пример #2
0
 function _addSubmenu()
 {
     $mySQLVer = 0;
     if (JFile::exists(JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php')) {
         require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php';
         $mySQLVer = CAdvanceSearch::getMySQLVersion();
     }
     // Only display related links for guests
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     if ($my->id == 0) {
         $tmpl = new CTemplate();
         $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search'));
         $html = $tmpl->fetch('search.submenu');
         $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('CC SEARCH FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html);
         if ($mySQLVer >= 4.1 && $config->get('guestsearch')) {
             $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('CC CUSTOM SEARCH'));
         }
     } else {
         $this->addSubmenuItem('index.php?option=com_community&view=friends', JText::_('CC SHOW ALL FRIENDS'));
         $tmpl = new CTemplate();
         $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search'));
         $html = $tmpl->fetch('search.submenu');
         $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('CC SEARCH FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html);
         if ($mySQLVer >= 4.1) {
             $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('CC CUSTOM SEARCH'));
         }
         $this->addSubmenuItem('index.php?option=com_community&view=friends&task=invite', JText::_('CC INVITE FRIENDS'));
         $this->addSubmenuItem('index.php?option=com_community&view=friends&task=sent', JText::_('CC REQUEST SENT'));
         $this->addSubmenuItem('index.php?option=com_community&view=friends&task=pending', JText::_('CC PENDING APPROVAL'));
     }
 }
Пример #3
0
 public function _addSubmenu()
 {
     $mySQLVer = 0;
     if (JFile::exists(JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php')) {
         require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php';
         $mySQLVer = CAdvanceSearch::getMySQLVersion();
     }
     $this->addSubmenuItem('index.php?option=com_community&view=friends', JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL'));
     $tmpl = new CTemplate();
     $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search'));
     $html = $tmpl->fetch('search.submenu');
     $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html);
     if ($mySQLVer >= 4.1) {
         $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH'));
     }
     $this->addSubmenuItem('index.php?option=com_community&view=friends&task=invite', JText::_('COM_COMMUNITY_INVITE_FRIENDS'));
     $this->addSubmenuItem('index.php?option=com_community&view=friends&task=sent', JText::_('COM_COMMUNITY_FRIENDS_REQUEST_SENT'));
     $this->addSubmenuItem('index.php?option=com_community&view=friends&task=pending', JText::_('COM_COMMUNITY_FRIENDS_PENDING_APPROVAL'));
 }
Пример #4
0
 public function _addSubmenu()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $task = $jinput->get('task', '');
     if (JFile::exists(JPATH_COMPONENT . '/libraries/advancesearch.php')) {
         require_once JPATH_COMPONENT . '/libraries/advancesearch.php';
         $mySQLVer = CAdvanceSearch::getMySQLVersion();
     }
     if ($task != 'sent' && $task != 'pending') {
         $this->addSubmenuItem('index.php?option=com_community&view=friends', JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL'));
         //$this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH'));
         //$this->addSubmenuItem('index.php?option=com_community&view=friends&task=invite', JText::_('COM_COMMUNITY_INVITE_FRIENDS'));
     }
     $tmpl = new CTemplate();
     $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search'));
     $html = $tmpl->fetch('search.submenu');
     $this->addSubmenuItem('index.php?option=com_community&view=friends&task=sent', JText::_('COM_COMMUNITY_FRIENDS_REQUEST_SENT'));
     $this->addSubmenuItem('index.php?option=com_community&view=friends&task=pending', JText::_('COM_COMMUNITY_FRIENDS_PENDING_APPROVAL'));
 }
Пример #5
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');
    }
Пример #6
0
 function CToolbar()
 {
     $this->_toolbar = array(TOOLBAR_HOME => null, TOOLBAR_PROFILE => null, TOOLBAR_FRIEND => null, TOOLBAR_APP => null, TOOLBAR_INBOX => null);
     $my =& JFactory::getUser();
     $config = CFactory::getConfig();
     $mySQLVer = 0;
     if (JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'advancesearch.php')) {
         $mySQLVer = CAdvanceSearch::getMySQLVersion();
     }
     foreach ($this->_toolbar as $key => &$row) {
         $defaultCoreMenuArray = array();
         $default = new stdClass();
         switch ($key) {
             case TOOLBAR_HOME:
                 $default->caption = JText::_('CC HOME');
                 $default->link = CRoute::_('index.php?option=com_community&view=frontpage');
                 $default->view = array('frontpage');
                 break;
             case TOOLBAR_PROFILE:
                 $default->caption = JText::_('CC PROFILE');
                 $default->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id);
                 $default->view = array('profile');
                 $defaultCoreMenuArray['PROFILE_AVATAR'] = $this->_addDefaultItem(JText::_('CC EDIT AVATAR'), CRoute::_('index.php?option=com_community&view=profile&task=uploadAvatar'));
                 if ($config->get('enablevideos')) {
                     if ($config->get('enableprofilevideo')) {
                         $defaultCoreMenuArray['PROFILE_EDIT_PROFILE_VIDEO'] = $this->_addDefaultItem(JText::_('CC EDIT PROFILE VIDEO'), CRoute::_('index.php?option=com_community&view=profile&task=linkVideo'));
                     }
                 }
                 $defaultCoreMenuArray['PROFILE_EDIT_PROFILE'] = $this->_addDefaultItem(JText::_('CC EDIT PROFILE'), CRoute::_('index.php?option=com_community&view=profile&task=edit'));
                 $defaultCoreMenuArray['PROFILE_EDIT_DETAILS'] = $this->_addDefaultItem(JText::_('CC EDIT DETAILS'), CRoute::_('index.php?option=com_community&view=profile&task=editDetails'));
                 $defaultCoreMenuArray['PROFILE_EDIT_PRIVACY'] = $this->_addDefaultItem(JText::_('CC EDIT PRIVACY'), CRoute::_('index.php?option=com_community&view=profile&task=privacy'));
                 $defaultCoreMenuArray['PROFILE_EDIT_PREFERENCES'] = $this->_addDefaultItem(JText::_('CC EDIT PREFERENCES'), CRoute::_('index.php?option=com_community&view=profile&task=preferences'));
                 break;
             case TOOLBAR_FRIEND:
                 $default->caption = JText::_('CC FRIENDS');
                 $default->link = CRoute::_('index.php?option=com_community&view=friends&userid=' . $my->id);
                 $default->view = array('friends', 'search');
                 $defaultCoreMenuArray['FRIEND_SHOW_ALL_FRIENDS'] = $this->_addDefaultItem(JText::_('CC SHOW ALL FRIENDS'), CRoute::_('index.php?option=com_community&view=friends'), false, true);
                 $defaultCoreMenuArray['FRIEND_SEARCH_FRIENDS'] = $this->_addDefaultItem(JText::_('CC SEARCH FRIENDS'), CRoute::_('index.php?option=com_community&view=search'));
                 if ($mySQLVer > 4.1) {
                     $defaultCoreMenuArray['FRIEND_ADVANCE_SEARCH_FRIENDS'] = $this->_addDefaultItem(JText::_('CC CUSTOME SEARCH FRIENDS'), CRoute::_('index.php?option=com_community&view=search&task=advancesearch'));
                 }
                 $defaultCoreMenuArray['FRIEND_INVITE_FRIENDS'] = $this->_addDefaultItem(JText::_('CC INVITE FRIENDS'), CRoute::_('index.php?option=com_community&view=friends&task=invite'));
                 $defaultCoreMenuArray['FRIEND_REQUEST_SENT'] = $this->_addDefaultItem(JText::_('CC REQUEST SENT'), CRoute::_('index.php?option=com_community&view=friends&task=sent'));
                 $defaultCoreMenuArray['FRIEND_PENDING_APPROVAL'] = $this->_addDefaultItem(JText::_('CC PENDING APPROVAL'), CRoute::_('index.php?option=com_community&view=friends&task=pending'));
                 break;
             case TOOLBAR_APP:
                 $default->caption = JText::_('CC APPLICATIONS');
                 $default->link = CRoute::_('index.php?option=com_community&view=apps');
                 $default->view = array('apps', 'groups', 'photos', 'videos', 'events');
                 $defaultCoreMenuArray['APP_EDIT_APPS'] = $this->_addDefaultItem(JText::_('CC EDIT APPS'), CRoute::_('index.php?option=com_community&view=apps'));
                 if ($config->get('enablegroups')) {
                     $defaultCoreMenuArray['APP_GROUP'] = $this->_addDefaultItem(JText::_('CC GROUP'), CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $my->id));
                 }
                 if ($config->get('enablephotos')) {
                     $defaultCoreMenuArray['APP_PHOTOS'] = $this->_addDefaultItem(JText::_('CC PHOTOS'), CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $my->id));
                 }
                 if ($config->get('enablevideos')) {
                     $defaultCoreMenuArray['APP_VIDEOS'] = $this->_addDefaultItem(JText::_('CC VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&task=myvideos&userid=' . $my->id));
                 }
                 if ($config->get('enableevents')) {
                     $defaultCoreMenuArray['APP_EVENTS'] = $this->_addDefaultItem(JText::_('CC EVENTS'), CRoute::_('index.php?option=com_community&view=events&task=myevents&userid=' . $my->id));
                 }
                 break;
             case TOOLBAR_INBOX:
                 $default->caption = JText::_('CC INBOX');
                 $default->link = CRoute::_('index.php?option=com_community&view=inbox');
                 $default->view = array('inbox');
                 $defaultCoreMenuArray['INBOX_INBOX'] = $this->_addDefaultItem(JText::_('CC INBOX'), CRoute::_('index.php?option=com_community&view=inbox'));
                 $defaultCoreMenuArray['INBOX_SENT'] = $this->_addDefaultItem(JText::_('CC SENT'), CRoute::_('index.php?option=com_community&view=inbox&task=sent'));
                 $defaultCoreMenuArray['INBOX_WRITE'] = $this->_addDefaultItem(JText::_('CC WRITE'), CRoute::_('index.php?option=com_community&view=inbox&task=write'));
             default:
                 break;
         }
         $default->child = array('prepend' => array(), 'append' => $defaultCoreMenuArray);
         $row = $default;
     }
 }