Beispiel #1
0
 public function ajaxGetTotalNotifications()
 {
     $my = CFactory::getUser();
     $myParams = $my->getParams();
     $config = CFactory::getConfig();
     $toolbar = CToolbarLibrary::getInstance();
     $notifModel = CFactory::getModel('notification');
     $response = array('newEventInviteCount' => $toolbar->getTotalNotifications('events'), 'newFriendInviteCount' => $toolbar->getTotalNotifications('friends'), 'newGroupInviteCount' => $toolbar->getTotalNotifications('groups'), 'newNotificationCount' => $notifModel->getNotificationCount($my->id, '0', $myParams->get('lastnotificationlist', '')), 'newMessageCount' => $toolbar->getTotalNotifications('inbox'));
     $response['newNotificationCount'] += $response['newGroupInviteCount'];
     $response['newNotificationCount'] += $response['newEventInviteCount'];
     $response['nextPingDelay'] = 0;
     if ($my->id && $config->get('notifications_ajax_enable_refresh')) {
         $response['nextPingDelay'] = $config->get('notifications_ajax_refresh_interval');
     }
     die(json_encode($response));
 }
Beispiel #2
0
	techjoomla.jQuery('#'+rId+pre +"  .clerfix").remove();
	techjoomla.jQuery('#'+rId+pre).append(removeButton);
	techjoomla.jQuery('#'+rId+pre).after(newElem);

}

       function removeClone(rId,rClass){
               jQuery('#'+rId).remove();
       }
</script>
<?php 
//newly added for JS toolbar inclusion
if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_community') and $socialads_config['show_js_toolbar'] == 1) {
    require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'toolbar.php';
    $toolbar = CFactory::getToolbar();
    $tool = CToolbarLibrary::getInstance();
    ?>
<style>
   <!--
      div#proimport-wrap #community-wrap { margin: 0;padding: 0; }
      div#proimport-wrap #community-wrap { min-height: 45px !important; }
      -->
</style>
<script src="<?php 
    echo JUri::root() . 'components/com_community/assets/bootstrap/bootstrap.min.js';
    ?>
" type="text/javascript"></script>
<div id="proimport-wrap">
   <div id="community-wrap">
      <?php 
    echo $tool->getHTML();
Beispiel #3
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;
 }
Beispiel #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;
 }
Beispiel #5
0
	function jomsocialtoolbar($template)

	{

		//Load Language file.
		
		$toolbarstyling = 'components/com_community/templates/'.$template.'/css/style.css';

		$lang =& JFactory::getLanguage();

		$lang->load( 'com_community' );

		require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php');
		$my 	= CFactory::getUser();
		// initiate toolbar

		$customToolbar	=& CFactory::getToolbar();

		// get Jomsocial configuration

		$config	=& CFactory::getConfig();

		// Include CAppPlugins library

		require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'apps.php');

		$appsLib	=& CAppPlugins::getInstance();

		$appsLib->loadApplications();

		// Only trigger applications and set active URI when needed

		$args = array();

		$appsLib->triggerEvent( 'onSystemStart' , $args );

		// Set active URI

		CFactory::setCurrentURI();

		// Include templates

		require_once (JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries'.DS.'template.php');

		// Include templates

		require_once (JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries'.DS.'miniheader.php');

		require_once(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'tooltip.php');

		require_once(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'toolbar.php');

		// Script needs to be here if they are 

		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 );

		$logoutLink	= CRoute::_( 'index.php?option=com_community&view=frontpage' , false );

		$logoutLink	= base64_encode( $logoutLink );



		$document	= & JFactory::getDocument();

		if($toolbarstyling !== ""){$document->addStyleSheet( JURI::base() . $toolbarstyling );}			
		$document->addStyleSheet( JURI::base() . 'components/com_community/assets/autocomplete.css' );
		$document->addStyleSheet( JURI::base() . 'components/com_community/assets/window.css' );
		$document->addStyleSheet( JURI::base() . 'components/com_community/templates/default/css/style.green.css' );
		//$document->addScript( JURI::base() . 'components/com_community/assets/jquery-1.3.2.pack.js' );
		$document->addScript( JURI::base() . 'components/com_community/assets/joms.jquery.js' );
		$document->addScript( JURI::base() . 'components/com_community/assets/joms.ajax.js' );

		$document->addScript( JURI::base() . 'components/com_community/assets/window-1.0.pack.js' );	

		$document->addScript( JURI::base() . 'components/com_community/assets/script-1.2.pack.js' );

		//$document->addScript( JURI::base() . 'components/com_community/assets/jquery.qtip-1.0.0-rc3.min.js' );			


?>

		<div id="community-wrap" style="display:inline"> 

		<?php 
		$db =& JFactory::getDBO();
		$query	= 'SELECT  ' . $db->nameQuote( 'params' ) . ' FROM ' . $db->nameQuote( '#__community_config' ) . ' WHERE ' . $db->nameQuote( 'name' ) . ' = ' . $db->quote('config');
		$db->setQuery( $query );
		$row = $db->loadResult();		
		$params	= new JParameter( $row );
		$showToolbar = $params->get('showToolbar', '1');

		$xml=simplexml_load_file(JPATH_SITE . '/administrator/components/com_community/community.xml');
		$version=$xml->version;
		$version=str_replace('.','',$version);
 
 		if($version >= 224)
		{
			CFactory::load( 'libraries' , 'toolbar' );
			$toolbar_lib = CToolbarLibrary::getInstance();
			echo $toolbar_lib->getHTML(  );
		}
		else
		{
			CFactory::load( 'libraries' , 'toolbar' );
			echo CToolbarLibrary::getHTML(  );
		}
		
		$menus	= CToolbarLibrary::getItems();
		CToolbarLibrary::addLegacyToolbars( $menus );
		//$showToolbar=1;
		//print_r($menus);
		if(file_exists(JPATH_SITE . '/components/com_community/templates/'.$template.'/toolbar.index.php'))

		{

			require_once (JPATH_ROOT .'/components/com_community/templates/'.$template.'/toolbar.index.php');

		}

		else

		{

			require_once (JPATH_ROOT .'/components/com_community/templates/default/toolbar.index.php');

		}

		?>

		 </div>

	<?php }
Beispiel #6
0
 /**
  * Deprecated since 2.2
  * Should use CToolbarLibrary::getHTML instead
  **/
 public function showToolbar($data = null)
 {
     CFactory::load('libraries', 'toolbar');
     $toolbar_lib = CToolbarLibrary::getInstance();
     echo $toolbar_lib->getHTML($this->_showMiniHeaderUser);
 }
Beispiel #7
0
 /**
  * Deprecated since 2.2
  * Should use CToolbarLibrary::getHTML instead
  * */
 public function showToolbar($data = null)
 {
     $toolbar_lib = CToolbarLibrary::getInstance();
     echo $toolbar_lib->getHTML($this->_showMiniHeaderUser);
 }
Beispiel #8
0
 /**
  * Displays the toolbar of JomSocial
  *
  * @since   5.0
  * @access  public
  * @param   string
  * @return
  */
 public function getToolbar()
 {
     if (!$this->config->get('integrations_jomsocial_toolbar')) {
         return;
     }
     // Allow third party to control the toolbar
     $displayToolbar = $this->input->get('showJomsocialToolbar', true);
     $format = $this->input->get('format', '', 'word');
     $tmpl = $this->input->get('tmpl', '', 'word');
     if ($format == 'pdf' || $format == 'phocapdf' || $tmpl == 'component' || !$displayToolbar) {
         return;
     }
     // Ensure that JomSocial exists
     if (!$this->exists()) {
         return;
     }
     // Ensure the library really exists on the site.
     if (!class_exists('CToolbarLibrary') || !method_exists('CToolbarLibrary', 'getInstance')) {
         return;
     }
     $svg = '';
     if (method_exists('CFactory', 'getPath')) {
         $svg = CFactory::getPath('template://assets/icon/joms-icon.svg');
     }
     // Load up the apps
     $appsLib = CAppPlugins::getInstance();
     $appsLib->loadApplications();
     $appsLib->triggerEvent('onSystemStart', array());
     // Get the toolbar library
     $toolbar = CToolbarLibrary::getInstance();
     $theme = EB::template();
     $theme->set('svg', $svg);
     $theme->set('toolbar', $toolbar);
     $contents = $theme->output('site/toolbar/toolbar.jomsocial');
     return $contents;
 }