Пример #1
0
defined('_JEXEC') or die('Restricted access');
define('REAL_NAME', 0);
define('USERNAME', 1);
$Itemid=AwdwallHelperUser::getComItemId();
$userids=$this->userids;
$privacy=$this->privacy;
$useridstr=$this->useridstr;
$app = JFactory::getApplication('site');
$config =  & $app->getParams('com_awdwall');
$listingperpage 		= $config->get('listingperpage', 5);
$imagelimit 		= $config->get('imagelimit',4);

$wallversion=checkversionwall();
$db		=& JFactory :: getDBO();
$user =& JFactory::getUser();
$pendingFriends = JsLib::getPendingFriends($user->id);
$groupsUrl=JRoute::_('index.php?option=com_awdwall&task=groups&Itemid=' . $Itemid, false);
if($wallversion=='cb')
{
	$friendJsUrl = JRoute::_('index.php?option=com_awdwall&task=friends&Itemid=' . $Itemid, false);
	$accountUrl=JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='******'&Itemid=' . $Itemid, false);
}
elseif($wallversion=='js')
{
	$friendJsUrl = JRoute::_('index.php?option=com_community&view=friends&userid=' . $user->id . '&Itemid=' . $Itemid,false);
	$accountUrl=JRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id . '&Itemid=' . $Itemid, false);
}
else
{
	$friendJsUrl = JRoute::_('index.php?option=com_awdwall&task=friends&Itemid=' . $Itemid, false);
	$accountUrl=JRoute::_('index.php?option=com_awdwall&task=uploadavatar&Itemid=' . $Itemid, false);
Пример #2
0
	public function viewFriends($tpl = null)

	{

		$mainframe	=& JFactory::getApplication();

		$itemId = AwdwallHelperUser::getComItemId();

		$task 			= JRequest::getCmd('task', '');

		$page 			= JRequest::getCmd('awd_page', 0);



		// get configuration from database

		//$config = &JComponentHelper::getParams('com_awdwall');
		$app = JFactory::getApplication('site');
		$config =  & $app->getParams('com_awdwall');
		$displayName 	= $config->get('display_name', 1);
		$postLimit 		= $config->get('nof_post', 15);
		$fields			= $config->get('fieldids', '');
		$privacy 		= $config->get('privacy', 0); 

		$displayPm = $config->get('display_pm', 1);
		
		$display_group = $config->get('display_group', 1);
		
		$display_group_for_moderators = $config->get('display_group_for_moderators', 1);
		
		$moderator_users = $config->get('moderator_users', '');
		
		$moderator_users=explode(',',$moderator_users);

		$user = &JFactory::getUser();		

		// get all msg from databases

		$wallModel = & $this->getModel('wall');
		$this->assignRef('wallModel', $wallModel);
		// build where clause	

		$where = array();

		$where[] = 'connect_from  = ' . (int)$user->id;

		$where = count($where) ? ' WHERE ' . implode( ' AND ', $where ) : '';

		$offset = $page*$postLimit;

		

		//color

		$db		=& JFactory::getDBO();

//		$query = "SELECT params FROM #__components WHERE `name`='Colors' AND `admin_menu_link`='option=com_awdwall&controller=colors'";
		$link='index.php?option=com_awdwall&controller=colors';
		$db->setQuery("SELECT params FROM #__menu WHERE `link`='".$link."'");
		$params = json_decode( $db->loadResult(), true );
		for($i=1; $i<=14; $i++)
		{
			$str_color = 'color'.$i;			
			$color[$i]= $params[$str_color];
		}

		

		$this->assignRef('color', $color);

		

		//$friends = $wallModel->getAllFriends($postLimit, $where, $offset);
		$query 	= 'SELECT * FROM #__awd_connection  inner join #__users ON #__awd_connection.connect_to=#__users.id '				
				.$where . ' '
				.'ORDER BY connection_id DESC ';
				// echo $query ;
		$db->setQuery($query);
		$friends =$db->loadObjectList();
		$nofFriends = $wallModel->countFriends($where);

		require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'jslib.php');

		$basicInfo 		= JsLib::getUserBasicInfo($user->id, $fields);

		$totalFriends 	= JsLib::countFriends($user->id);

		$friendLimit 	= (int)$config->get('nof_friends', 4);

		if($friendLimit > 6)

			$friendLimit = 6;

		$leftFriends 	= JsLib::getAllFriends($user->id, $friendLimit);

		
		// get 4 first groups to display

		require_once (JPATH_COMPONENT . DS . 'models' . DS . 'group.php');

		$whr = array();

		$whr[] = 'ag.creator = ' . $user->id . ' OR agm.user_id =' . $user->id;
		$whr[] =' status="1"';
		$whr = count($whr) ? ' WHERE ' . implode( ' AND ', $whr ) : '';

		$groups = AwdwallModelGroup::getAllGrps($whr, 4, 0);


		//Total pending friend requests
		$pendingFriends = JsLib::getPendingFriends($user->id);
		
		//Userinfo of login user
		$userinfo = AwdwallHelperUser::getUserInfo($user->id);		
		$this->assignRef('userinfo', $userinfo);  
		
		//Total private message of user
		require_once (JPATH_COMPONENT . DS . 'models' . DS . 'wall.php');
		$modelWall = new AwdwallModelWall();	
		//print_r($modelWall);
		$totalpm = $modelWall->countpm($user->id);
		
		$pendingGroups = JsLib::getPendingGroups($user->id);

		$this->assignRef('pendingGroups', $pendingGroups);
		$this->assignRef('totalpm', $totalpm);
		$this->assignRef('totalmygroup', $totalmygroup);
		$this->assignRef('groups', $groups);

		$this->assignRef('totalFriends', $totalFriends);

		$this->assignRef('leftFriends', $leftFriends);

		$this->assignRef('basicInfo', $basicInfo);

		$this->assignRef('nofFriends', $nofFriends);

		$this->assignRef('friends', $friends);

		$this->assignRef('page', $page);

		$this->assignRef('postLimit', $postLimit);		

		$this->assignRef('privacy', $privacy);
		$this->assignRef('displayName', $displayName);
		$this->assignRef('displayPm', $displayPm);
		$this->assignRef('display_group', $display_group);
		$this->assignRef('display_group_for_moderators', $display_group_for_moderators);
		$this->assignRef('moderator_users', $moderator_users);
		$this->assignRef('pendingFriends', $pendingFriends);

		$display_profile_link = $config->get('display_profile_link', 1);
		$this->assignRef('display_profile_link', $display_profile_link);
		
		
		$wallalbumfile = JPATH_SITE . '/components/com_awdjomalbum/awdjomalbum.php';
		if (file_exists($wallalbumfile)) // if com_awdjomalbum install then only
		{
			$query="Select * from #__awd_jomalbum_userinfo where userid=".$user->id; 
			$db->setQuery($query);
			$rows=$db->loadObjectList();
			$this->assignRef('albumuserinfo', $rows[0]);
		}
		
		parent::display($tpl);

	}