public function browse($data = null) { //require_once (JPATH_COMPONENT . '/libraries/template.php'); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $this->addPathway(JText::_('COM_COMMUNITY_GROUPS_MEMBERS'), ''); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_GROUPS_MEMBERS')); $my = CFactory::getUser(); $view = CFactory::getView('search'); $searchModel = CFactory::getModel('search'); $userModel = CFactory::getModel('user'); $avatar = CFactory::getModel('avatar'); $friends = CFactory::getModel('friends'); $tmpl = new CTemplate(); $sorted = $jinput->get->get('sort', 'latest', 'STRING'); //JRequest::getVar( 'sort' , 'latest' , 'GET' ); $filter = JRequest::getWord('filter', 'all', 'GET'); $profiletype = $jinput->get('profiletype', 0, 'INT'); $rows = $searchModel->getPeople($sorted, $filter, $profiletype); $sortItems = array('online' => JText::_('COM_COMMUNITY_SORT_ONLINE'), 'latest' => JText::_('COM_COMMUNITY_SORT_LATEST'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL')); $filterItems = array(); $config = CFactory::getConfig(); if ($config->get('alphabetfiltering')) { $filterItems = array('all' => JText::_('COM_COMMUNITY_JUMP_ALL'), 'abc' => JText::_('COM_COMMUNITY_JUMP_ABC'), 'def' => JText::_('COM_COMMUNITY_JUMP_DEF'), 'ghi' => JText::_('COM_COMMUNITY_JUMP_GHI'), 'jkl' => JText::_('COM_COMMUNITY_JUMP_JKL'), 'mno' => JText::_('COM_COMMUNITY_JUMP_MNO'), 'pqr' => JText::_('COM_COMMUNITY_JUMP_PQR'), 'stu' => JText::_('COM_COMMUNITY_JUMP_STU'), 'vwx' => JText::_('COM_COMMUNITY_JUMP_VWX'), 'yz' => JText::_('COM_COMMUNITY_JUMP_YZ'), 'others' => JText::_('COM_COMMUNITY_JUMP_OTHERS')); } $html = ''; $totalUser = $userModel->getMembersCount(); $resultRows = array(); $alreadyfriend = array(); // No need to pre-load multiple users at once since $searchModel->getPeople // already did for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; $obj = clone $row; $user = CFactory::getUser($row->id); $obj->friendsCount = $user->getFriendCount(); $obj->user = $user; $obj->profileLink = CUrl::build('profile', '', array('userid' => $row->id)); $isFriend = CFriendsHelper::isConnected($row->id, $my->id); $connection = $friends->getFriendConnection($my->id, $row->id); $obj->isMyFriend = false; if (!empty($connection)) { if ($connection[0]->connect_from == $my->id) { $obj->isMyFriend = true; } } $obj->addFriend = !$isFriend && $my->id != $row->id ? true : false; if ($obj->addFriend) { $alreadyfriend[$row->id] = $row->id; } $resultRows[] = $obj; } $featuredList = $this->_cachedCall('getFeaturedMember', array(), '', array(COMMUNITY_CACHE_TAG_FEATURED)); $config = CFactory::getConfig(); if ($config->get('alphabetfiltering')) { $sortingsHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'); $alphabetHTML = CFilterBar::getHTML(CRoute::getURI(), '', '', $filterItems, 'all'); } else { $sortingsHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'); } $multiprofileArr = array(); $hasMultiprofile = false; //let see if we have any multiprofile enabled if ($config->get('profile_multiprofile')) { $hasMultiprofile = true; //lets get the available profile $profileModel = CFactory::getModel('Profile'); $profiles = $profileModel->getProfileTypes(); if ($profiles) { $multiprofileArr[] = array('url' => CRoute::_('index.php?option=com_community&view=search&task=browse&filter=' . $filter . '&sort=' . $sorted), 'name' => JText::_('COM_COMMUNITY_ALL_PROFILE'), 'selected' => !$profiletype ? 1 : 0); foreach ($profiles as $profile) { $multiprofileArr[] = array('url' => CRoute::_('index.php?option=com_community&view=search&task=browse&filter=' . $filter . '&sort=' . $sorted . '&profiletype=' . $profile->id), 'name' => $profile->name, 'selected' => $profile->id == $profiletype ? 1 : 0); } } } echo $tmpl->set('featuredList', $featuredList)->set('hasMultiprofile', $hasMultiprofile)->set('multiprofileArr', $multiprofileArr)->set('alreadyfriend', $alreadyfriend)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->set('data', $resultRows)->set('sortings', $sortingsHTML)->set('alphabet', $alphabetHTML)->set('my', $my)->set('submenu', $this->showSubmenu(false))->set('totalUser', $totalUser)->set('showFeaturedList', $config->get('show_featured'))->set('pagination', $searchModel->getPagination())->fetch('people.browse'); }
public function display($tpl = null) { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $id = $jinput->get('listid', '', 'INT'); //JRequest::getVar( 'listid' , '' ); $list = JTable::getInstance('MemberList', 'CTable'); $list->load($id); if (empty($list->id) || is_null($list->id)) { echo JText::_('COM_COMMUNITY_INVALID_ID'); return; } /** * Opengraph */ CHeadHelper::setType('website', $list->getTitle()); $tmpCriterias = $list->getCriterias(); $criterias = array(); foreach ($tmpCriterias as $criteria) { $obj = new stdClass(); $obj->field = $criteria->field; $obj->condition = $criteria->condition; $obj->fieldType = $criteria->type; switch ($criteria->type) { case 'date': case 'birthdate': if ($criteria->condition == 'between') { $date = explode(',', $criteria->value); if (isset($date[1])) { $delimeter = '-'; if (strpos($date[0], '/')) { $delimeter = '/'; } $startDate = explode($delimeter, $date[0]); $endDate = explode($delimeter, $date[1]); if (isset($startDate[2]) && isset($endDate[2])) { //date format $obj->value = array($startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00', $endDate[2] . '-' . intval($endDate[1]) . '-' . $endDate[0] . ' 23:59:59'); } else { //age format $obj->value = array($date[0], $date[1]); } } else { //wrong data, set to default $obj->value = array(0, 0); } } else { $delimeter = '-'; if (strpos($criteria->value, '/')) { $delimeter = '/'; } $startDate = explode($delimeter, $criteria->value); if (isset($startDate[2])) { //date format $obj->value = $startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00'; } else { //age format $obj->value = $criteria->value; } } break; case 'checkbox': default: $obj->value = $criteria->value; break; } $criterias[] = $obj; } //CFactory::load( 'helpers' , 'time'); $created = CTimeHelper::getDate($list->created); //CFactory::load( 'libraries' , 'advancesearch' ); //CFactory::load( 'libraries' , 'filterbar' ); $sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_LATEST'), 'online' => JText::_('COM_COMMUNITY_SORT_ONLINE'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL')); $sorting = $jinput->get->get('sort', 'latest', 'STRING'); //JRequest::getVar( 'sort' , 'latest' , 'GET' ); $data = CAdvanceSearch::getResult($criterias, $list->condition, $list->avataronly, $sorting); $tmpl = new CTemplate(); $html = $tmpl->set('list', $list)->set('created', $created)->set('sorting', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->fetch('memberlist.result'); unset($tmpl); //CFactory::load( 'libraries' , 'tooltip' ); //CFactory::load( 'helpers' , 'owner' ); //CFactory::load( 'libraries' , 'featured' ); $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $my = CFactory::getUser(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); $alreadyfriend = array(); //CFactory::load( 'helpers' , 'friends' ); foreach ($data->result as $user) { $obj = new stdClass(); $obj->user = $user; $obj->friendsCount = $user->getFriendCount(); $obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id); $isFriend = CFriendsHelper::isConnected($user->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $user->id ? true : false; //record friends if ($obj->addFriend) { $alreadyfriend[$user->id] = $user->id; } $resultRows[] = $obj; } $tmpl = new CTemplate(); echo $tmpl->set('data', $resultRows)->set('alreadyfriend', $alreadyfriend)->set('sortings', '')->set('pagination', $data->pagination)->set('filter', '')->set('featuredList', $featuredList)->set('my', $my)->set('showFeaturedList', false)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->fetch('people.browse'); }
function myinvites() { if (!$this->accessAllowed('registered')) { return; } $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); $config =& CFactory::getConfig(); $my = CFactory::getUser(); $userid = JRequest::getCmd('userid', null); $this->addPathway(JText::_('CC EVENTS'), CRoute::_('index.php?option=com_community&view=events')); $this->addPathway(JText::_('CC EVENT PENDING INVITATIONS'), ''); $document->setTitle(JText::_('CC EVENT PENDING INVITATIONS')); $this->showSubmenu(); $feedLink = CRoute::_('index.php?option=com_community&view=events&userid=' . $userid . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO PENDING INVITATIONS FEED') . '" href="' . $feedLink . '"/>'; $mainframe->addCustomHeadTag($feed); CFactory::load('libraries', 'filterbar'); CFactory::load('helpers', 'event'); CFactory::load('helpers', 'owner'); CFactory::load('models', 'events'); $sorted = JRequest::getVar('sort', 'startdate', 'GET'); $model = CFactory::getModel('events'); $pending = COMMUNITY_EVENT_STATUS_INVITED; // It is safe to pass 0 as the category id as the model itself checks for this value. $rows = $model->getEvents(null, $my->id, $sorted, null, true, false, $pending); $pagination = $model->getPagination(); $count = count($rows); $tmpl = new CTemplate(); $sortItems = array('latest' => JText::_('CC SORT EVENT CREATED'), 'startdate' => JText::_('CC SORT EVENT STARTDATE')); $events = array(); if ($rows) { foreach ($rows as $row) { $event =& JTable::getInstance('Event', 'CTable'); $event->bind($row); $events[] = $event; } unset($eventObjs); } $tmpl = new CTemplate(); $tmpl->set('events', $events); $tmpl->set('pagination', $pagination); $tmpl->set('config', $config); $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'startdate')); $tmpl->set('my', $my); $tmpl->set('count', $count); echo $tmpl->fetch('events.myinvites'); }
public function myvideos($id = null) { $document = JFactory::getDocument(); $my = CFactory::getUser(); $userid = JRequest::getInt('userid', ''); $user = CFactory::getUser($userid); // Set document title CFactory::load('helpers', 'owner'); $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } if ($my->id == $user->id) { $title = JText::_('COM_COMMUNITY_VIDEOS_MY'); } else { $title = JText::sprintf('COM_COMMUNITY_VIDEOS_USERS_VIDEO_TITLE', $user->getDisplayName()); } $document->setTitle($title); // Set pathway $mainframe =& JFactory::getApplication(); $this->addPathway(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos')); $this->addPathway($title); // Show the mini header when viewing other's photos if ($my->id != $user->id) { $this->attachMiniHeaderUser($user->id); } // Display submenu $this->_addSubmenu(); $this->showSubmenu(); // Get data from DB $model = CFactory::getModel('videos'); $filters = array('creator' => $user->id, 'status' => 'ready', 'groupid' => 0, 'sorting' => JRequest::getVar('sort', 'latest')); $videos = $model->getVideos($filters); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); $sortItems = array('latest' => JText::_('COM_COMMUNITY_VIDEOS_SORT_LATEST'), 'mostwalls' => JText::_('COM_COMMUNITY_VIDEOS_SORT_MOST_WALL_POST'), 'mostviews' => JText::_('COM_COMMUNITY_VIDEOS_SORT_POPULAR'), 'title' => JText::_('COM_COMMUNITY_VIDEOS_SORT_TITLE')); //pagination $pagination = $model->getPagination(); $videosHTML = $this->_getVideosHTML($videos); $tmpl = new CTemplate(); $tmpl->set('user', $user); $tmpl->set('sort', JRequest::getVar('sort', 'latest')); $tmpl->set('currentTask', JRequest::getCmd('task', '')); $tmpl->set('videosHTML', $videosHTML); $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest')); $tmpl->set('pagination', $pagination); echo $tmpl->fetch('videos.myvideos'); }
public function myinvites() { $mainframe =& JFactory::getApplication(); $userId = JRequest::getVar('userid', ''); $config = CFactory::getConfig(); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); $document = JFactory::getDocument(); $this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $this->addPathway(JText::_('COM_COMMUNITY_GROUPS_PENDING_INVITES'), ''); $document->setTitle(JText::_('COM_COMMUNITY_GROUPS_PENDING_INVITES')); $this->showSubmenu(); $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $userId . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_PENDING_INVITATIONS_FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); $my = CFactory::getUser(); $model = CFactory::getModel('groups'); $discussionModel = CFactory::getModel('discussions'); $sorted = JRequest::getVar('sort', 'latest', 'GET'); $rows = $model->getGroupInvites($my->id); $pagination = $model->getPagination(count($rows)); $groups = array(); $ids = ''; if ($rows) { foreach ($rows as $row) { $table =& JTable::getInstance('Group', 'CTable'); $table->load($row->groupid); $table->description = CStringHelper::clean(CStringHelper::truncate($table->description, $config->get('tips_desc_length'))); $groups[] = $table; $ids = empty($ids) ? $table->id : $ids . ',' . $table->id; } } $sortItems = array('latest' => JText::_('COM_COMMUNITY_GROUPS_SORT_LATEST'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL'), 'mostactive' => JText::_('COM_COMMUNITY_GROUPS_SORT_MOST_ACTIVE')); $tmpl = new CTemplate(); echo $tmpl->set('groups', $groups)->set('pagination', $pagination)->set('count', $pagination->total)->set('my', $my)->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->fetch('groups.myinvites'); }
/** * DIsplay list of friends * * if no $_GET['id'] is set, we're viewing our own friends */ public function friends($data = null, $onlineFriendsOnly = false) { // Load necessary window css / javascript headers. CWindow::load(); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $my = CFactory::getUser(); $userid = $jinput->get('userid', 0, 'INT'); $search = $jinput->get('search', false, 'STRING'); $searchQuery = $jinput->get('q', '', 'STRING'); $id = $userid ? $userid : $my->id; // Display mini header if user is viewing other user's friend if ($id != $my->id) { $this->attachMiniHeaderUser($id); } $feedLink = CRoute::_('index.php?option=com_community&view=friends&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_FRIENDS_FEEDS') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); $user = CFactory::getUser($id); $params = $user->getParams(); $people = CFactory::getModel('search'); $userModel = CFactory::getModel('user'); $avatar = CFactory::getModel('avatar'); $friends = CFactory::getModel('friends'); $sorted = $jinput->get->get('sort', 'latest', 'STRING'); $filter = JRequest::getWord('filter', 'all', 'GET'); if ($searchQuery == '') { $rows = $friends->getFriends($id, $sorted, true, $filter); } else { $rows = $friends->getFriends($id, $sorted, true, 'friends', 0, $searchQuery); } $isMine = $id == $my->id && $my->id != 0; $document = JFactory::getDocument(); $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS'), CRoute::_('index.php?option=com_community&view=friends')); if ($my->id == $id) { $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS')); } else { $this->addPathway(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName())); } $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); // Hide submenu if we are viewing other's friends if ($isMine) { $submenu = $this->showSubmenu(false); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS')); } else { $this->addSubmenuItem('index.php?option=com_community&view=profile&userid=' . $user->id, JText::_('COM_COMMUNITY_PROFILE_BACK_TO_PROFILE')); //$this->addSubmenuItem('index.php?option=com_community&view=friends&userid=' . $user->id, JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL')); //$this->addSubmenuItem('index.php?option=com_community&view=friends&task=mutualFriends&userid=' . $user->id . '&filter=mutual', JText::_('COM_COMMUNITY_MUTUAL_FRIENDS')); //$tmpl = new CTemplate(); //$tmpl->set('view', "friends"); //$tmpl->set('url', CRoute::_('index.php?option=com_community&view=friends&task=viewfriends')); //$html = $tmpl->fetch('friendsearch.submenu'); //$this->addSubmenuItem('index.php?option=com_community&view=friends&task=viewfriends', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html); $submenu = parent::showSubmenu(false); /** * Opengraph */ CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName())); } $sortItems = array(); $config = CFactory::getConfig(); $filterItems = array(); if ($config->get('alphabetfiltering')) { $filterItems = array('all' => JText::_('COM_COMMUNITY_JUMP_ALL'), 'abc' => JText::_('COM_COMMUNITY_JUMP_ABC'), 'def' => JText::_('COM_COMMUNITY_JUMP_DEF'), 'ghi' => JText::_('COM_COMMUNITY_JUMP_GHI'), 'jkl' => JText::_('COM_COMMUNITY_JUMP_JKL'), 'mno' => JText::_('COM_COMMUNITY_JUMP_MNO'), 'pqr' => JText::_('COM_COMMUNITY_JUMP_PQR'), 'stu' => JText::_('COM_COMMUNITY_JUMP_STU'), 'vwx' => JText::_('COM_COMMUNITY_JUMP_VWX'), 'yz' => JText::_('COM_COMMUNITY_JUMP_YZ'), 'others' => JText::_('COM_COMMUNITY_JUMP_OTHERS')); } // Check if friend is banned $blockModel = CFactory::getModel('block'); $resultRows = array(); // @todo: preload all friends foreach ($rows as $row) { $user = CFactory::getUser($row->id); $obj = clone $row; $obj->friendsCount = $user->getFriendCount(); $obj->profileLink = CUrlHelper::userLink($row->id); $obj->isFriend = true; $obj->isBlocked = $blockModel->getBlockStatus($user->id, $my->id); //display online friends only. if ($onlineFriendsOnly && !$user->isOnline()) { continue; } //if this is a search, only apply to those with subset of search name if ($search) { // if( trim($searchQuery) != '' && strpos(strtolower($user->getDisplayName()), strtolower($searchQuery)) === false){ // continue; // } } $resultRows[] = $obj; } unset($rows); // Should not show recently added filter to otehr people $sortingHTML = ''; if ($isMine) { $sortingHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest', $filterItems, 'all'); } $pagination = $friends->getPagination(); $tmpl = new CTemplate(); $html = $tmpl->set('isMine', $isMine)->set('userid', $userid)->setRef('my', $my)->set('search', $search)->set('searchQuery', $searchQuery)->setRef('friends', $resultRows)->set('sortings', $sortingHTML)->set('config', CFactory::getConfig())->set('submenu', $submenu)->set('featuredList', $featuredList)->set('pagination', $pagination)->fetch('friends/list'); echo $html; }
/** * Display Upload video form for user **/ function linkVideo() { if (!$this->accessAllowed('registered')) { echo JText::_('CC MEMBERS AREA'); return; } CFactory::load('libraries', 'filterbar'); CFactory::load('libraries', 'videos'); CFactory::load('helpers', 'videos'); $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $videoModel = CFactory::getModel('videos'); $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $pathway->addItem(JText::_('CC EDIT PROFILE VIDEO'), ''); // Load the toolbar $this->showSubmenu(); $document->setTitle(JText::_('CC EDIT PROFILE VIDEO')); $video = $this->_getCurrentProfileVideo(); $filters = array('creator' => $my->id, 'status' => 'ready', 'sorting' => JRequest::getVar('sort', 'latest')); $videos = $videoModel->getVideos($filters, true); $sortItems = array('latest' => JText::_('CC VIDEO SORT LATEST'), 'mostwalls' => JText::_('CC VIDEO SORT MOST WALL POST'), 'mostviews' => JText::_('CC VIDEO SORT POPULAR'), 'title' => JText::_('CC VIDEO SORT TITLE')); // Pagination $pagination = $videoModel->getPagination(); $redirectUrl = CRoute::getURI(false); $tmpl = new CTemplate(); $tmpl->set('my', $my); $tmpl->set('video', $video); $tmpl->set('sort', JRequest::getVar('sort', 'latest')); $tmpl->set('videos', $videos); $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest')); $tmpl->set('pagination', $pagination); $tmpl->set('videoThumbWidth', CVideoLibrary::thumbSize('width')); $tmpl->set('videoThumbHeight', CVideoLibrary::thumbSize('height')); $tmpl->set('redirectUrl', $redirectUrl); echo $tmpl->fetch('profile.linkvideo'); }
/** * Display Upload video form for user * */ public function linkVideo() { if (!$this->accessAllowed('registered')) { echo JText::_('COM_COMMUNITY_MEMBERS_AREA'); return; } $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $videoModel = CFactory::getModel('videos'); $pathway = $mainframe->getPathway(); $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS_EDIT_PROFILE_VIDEO'), ''); // Load the toolbar //$this->showSubmenu(); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_VIDEOS_EDIT_PROFILE_VIDEO')); $video = $this->_getCurrentProfileVideo(); $filters = array('creator' => $my->id, 'status' => 'ready', 'sorting' => $jinput->get('sort', 'latest', 'STRING')); $videos = $videoModel->getVideos($filters, true); $sortItems = array('latest' => JText::_('COM_COMMUNITY_VIDEOS_SORT_LATEST'), 'mostwalls' => JText::_('COM_COMMUNITY_VIDEOS_SORT_MOST_WALL_POST'), 'mostviews' => JText::_('COM_COMMUNITY_VIDEOS_SORT_POPULAR'), 'title' => JText::_('COM_COMMUNITY_VIDEOS_SORT_TITLE')); // Pagination $pagination = $videoModel->getPagination(); $redirectUrl = CRoute::getURI(false); $tmpl = new CTemplate(); echo $tmpl->set('my', $my)->set('video', $video)->set('sort', $jinput->get('sort', 'latest', 'STRING'))->set('videos', $videos)->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->set('pagination', $pagination)->set('videoThumbWidth', CVideoLibrary::thumbSize('width'))->set('videoThumbHeight', CVideoLibrary::thumbSize('height'))->set('redirectUrl', $redirectUrl)->set('submenu', $this->showSubmenu(false))->fetch('profile.linkvideo'); }
public function myvideos($id = null) { $document = JFactory::getDocument(); $my = CFactory::getUser(); $userid = JRequest::getInt('userid', $my->id); $user = CFactory::getUser($userid); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $categoryId = $jinput->get('catid', 0, 'INT'); $categoryId = $jinput->get('catid', 0, 'INT'); $category = JTable::getInstance('VideosCategory', 'CTable'); $category->load($categoryId); // Set document title $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } if ($my->id == $user->id) { $title = JText::_('COM_COMMUNITY_VIDEOS_MY'); } else { $title = JText::sprintf('COM_COMMUNITY_VIDEOS_USERS_VIDEO_TITLE', $user->getDisplayName()); } /** * Opengraph */ CHeadHelper::setType('website', $title); // Set pathway $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $this->addPathway(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos')); $this->addPathway($title); $feedLink = CRoute::_('index.php?option=com_community&view=videos&userid=' . $user->id . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_MY_VIDEOS_FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); // Show the mini header when viewing other's photos if ($my->id != $user->id) { $this->attachMiniHeaderUser($user->id); } // Display submenu $this->_addSubmenu(); // Get data from DB $model = CFactory::getModel('videos'); //CFactory::load( 'helpers' , 'friends' ); if ($my->id == $user->id || COwnerHelper::isCommunityAdmin()) { $permission = 40; } elseif (CFriendsHelper::isConnected($my->id, $user->id)) { $permission = 30; } elseif ($my->id != 0) { $permission = 20; } else { $permission = 10; } // Get in category and it's children. $categories = $model->getAllCategories(); $categoryIds = CCategoryHelper::getCategoryChilds($categories, $category->id); $categoryIds[] = $categoryId; $filters = array('creator' => $user->id, 'category_id' => $categoryIds, 'status' => 'ready', 'sorting' => $jinput->get('sort', 'latest', 'STRING'), 'permissions' => $permission); $videos = $model->getVideos($filters); $sortItems = $this->_getSortOptions(); //pagination $pagination = $model->getPagination(); $videosHTML = $this->_getVideosHTML($videos, $pagination); //This is local file $categories = $this->getFullVideoCategories(); $sortItems = $this->_getSortOptions(); $allVideosUrl = 'index.php?option=com_community&view=videos'; $catVideoUrl = 'index.php?option=com_community&view=videos&task=myvideos&userid=' . $userid . '&catid='; $pendingVideos = $this->model->hasPendingVideos($my->id, VIDEO_USER_TYPE); $tmpl = new CTemplate(); $tmpl->set('user', $user)->set('sort', $jinput->get('sort', 'latest', 'STRING'))->set('currentTask', JRequest::getCmd('task', ''))->set('isMyVideo', true)->set('videosHTML', $videosHTML)->set('$category', $category)->set('categories', $categories)->set('currentUrl', CRoute::getURI())->set('allVideosUrl', $allVideosUrl)->set('catVideoUrl', $catVideoUrl)->set('categories', $this->getFullVideoCategories())->set('category', $category)->set('categoryId', $categoryId)->set('pendingVideos', $pendingVideos)->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->set('submenu', $this->showSubmenu(false))->set('pagination', $pagination); if ($userid == $my->id) { $tmpl->set('canCreate', $my->authorise('community.create', 'videos')); } else { $tmpl->set('canCreate', 0); } echo $tmpl->fetch('videos/base'); }
function myinvites() { $mainframe =& JFactory::getApplication(); $userId = JRequest::getVar('userid', ''); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); $document =& JFactory::getDocument(); $this->addPathway(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $this->addPathway(JText::_('CC GROUP PENDING INVITATIONS'), ''); $document->setTitle(JText::_('CC GROUP PENDING INVITATIONS')); $this->showSubmenu(); $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $userId . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO PENDING INVITATIONS FEED') . '" href="' . $feedLink . '"/>'; $mainframe->addCustomHeadTag($feed); $my = CFactory::getUser(); $model = CFactory::getModel('groups'); $discussionModel = CFactory::getModel('discussions'); $sorted = JRequest::getVar('sort', 'latest', 'GET'); $rows = $model->getGroupInvites($my->id); $pagination = $model->getPagination(count($rows)); $groups = array(); $ids = ''; if ($rows) { foreach ($rows as $row) { $table =& JTable::getInstance('Group', 'CTable'); $table->load($row->groupid); $groups[] = $table; $ids = empty($ids) ? $table->id : $ids . ',' . $table->id; } } $sortItems = array('latest' => JText::_('CC GROUP SORT LATEST'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL'), 'mostdiscussed' => JText::_('CC GROUP SORT MOST DISCUSSED'), 'mostwall' => JText::_('CC GROUP SORT MOST WALL POST'), 'mostmembers' => JText::_('CC GROUP SORT MOST MEMBERS'), 'mostactive' => JText::_('CC GROUP SORT MOST ACTIVE')); $tmpl = new CTemplate(); $tmpl->set('groups', $groups); $tmpl->set('pagination', $pagination); $tmpl->set('count', $pagination->total); $tmpl->set('my', $my); $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest')); //echo $tmpl->fetch('groups.mygroups'); echo $tmpl->fetch('groups.myinvites'); }
/** * DIsplay list of friends * * if no $_GET['id'] is set, we're viewing our own friends */ public function friends($data = null) { // Load window library CFactory::load('libraries', 'window'); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); // Load necessary window css / javascript headers. CWindow::load(); $mainframe =& JFactory::getApplication(); $document = JFactory::getDocument(); $my = CFactory::getUser(); $id = JRequest::getInt('userid', null); if ($id == null) { $id = $my->id; } // Display mini header if user is viewing other user's friend if ($id != $my->id) { $this->attachMiniHeaderUser($id); } $feedLink = CRoute::_('index.php?option=com_community&view=friends&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_FRIENDS_FEEDS') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); $friendsModel = CFactory::getModel('friends'); $user = CFactory::getUser($id); $params = $user->getParams(); CFactory::load('helpers', 'friends'); $people = CFactory::getModel('search'); $userModel = CFactory::getModel('user'); $avatar = CFactory::getModel('avatar'); $friends = CFactory::getModel('friends'); $sorted = JRequest::getVar('sort', 'latest', 'GET'); $filter = JRequest::getWord('filter', 'all', 'GET'); CFactory::load('helpers', 'friends'); $rows = $friends->getFriends($id, $sorted, true, $filter); $isMine = $id == $my->id && $my->id != 0; $document = JFactory::getDocument(); $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS'), CRoute::_('index.php?option=com_community&view=friends')); if ($my->id == $id) { $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS')); } else { $this->addPathway(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName())); } // Hide submenu if we are viewing other's friends if ($isMine) { $this->showSubmenu(); $document->setTitle(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS')); } else { $this->addSubmenuItem('index.php?option=com_community&view=profile&userid=' . $user->id, JText::_('COM_COMMUNITY_PROFILE_BACK_TO_PROFILE')); $this->addSubmenuItem('index.php?option=com_community&view=friends&userid=' . $user->id, JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL')); $this->addSubmenuItem('index.php?option=com_community&view=friends&task=mutualFriends&userid=' . $user->id . '&filter=mutual', JText::_('COM_COMMUNITY_MUTUAL_FRIENDS')); $tmpl = new CTemplate(); $tmpl->set('view', "friends"); $tmpl->set('url', CRoute::_('index.php?option=com_community&view=friends&task=viewfriends')); $html = $tmpl->fetch('friendsearch.submenu'); $this->addSubmenuItem('index.php?option=com_community&view=friends&task=viewfriends', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html); parent::showSubmenu(); $document->setTitle(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName())); } $sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_RECENT_FRIENDS'), 'online' => JText::_('COM_COMMUNITY_ONLINE'), 'name' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL')); $config = CFactory::getConfig(); $filterItems = array(); if ($config->get('alphabetfiltering')) { $filterItems = array('all' => JText::_('COM_COMMUNITY_JUMP_ALL'), 'abc' => JText::_('COM_COMMUNITY_JUMP_ABC'), 'def' => JText::_('COM_COMMUNITY_JUMP_DEF'), 'ghi' => JText::_('COM_COMMUNITY_JUMP_GHI'), 'jkl' => JText::_('COM_COMMUNITY_JUMP_JKL'), 'mno' => JText::_('COM_COMMUNITY_JUMP_MNO'), 'pqr' => JText::_('COM_COMMUNITY_JUMP_PQR'), 'stu' => JText::_('COM_COMMUNITY_JUMP_STU'), 'vwx' => JText::_('COM_COMMUNITY_JUMP_VWX'), 'yz' => JText::_('COM_COMMUNITY_JUMP_YZ'), 'others' => JText::_('COM_COMMUNITY_JUMP_OTHERS')); } // Check if friend is banned $blockModel = CFactory::getModel('block'); $resultRows = array(); // @todo: preload all friends foreach ($rows as $row) { $user = CFactory::getUser($row->id); $obj = clone $row; $obj->friendsCount = $user->getFriendCount(); $obj->profileLink = CUrlHelper::userLink($row->id); $obj->isFriend = true; $obj->isBlocked = $blockModel->getBlockStatus($user->id, $my->id); $resultRows[] = $obj; } unset($rows); // Should not show recently added filter to otehr people $sortingHTML = ''; if ($isMine) { $sortingHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest', $filterItems, 'all'); } $tmpl = new CTemplate(); $html = $tmpl->set('isMine', $isMine)->setRef('my', $my)->setRef('friends', $resultRows)->set('sortings', $sortingHTML)->set('config', CFactory::getConfig())->fetch('friends.list'); $html .= '<div class="pagination-container">'; $pagination = $friends->getPagination(); $html .= $pagination->getPagesLinks(); $html .= '</div>'; echo $html; }
public function display() { $id = JRequest::getVar('listid', ''); $list =& JTable::getInstance('MemberList', 'CTable'); $list->load($id); if (empty($list->id) || is_null($list->id)) { echo JText::_('CC INVALID ID'); return; } $document =& JFactory::getDocument(); $document->setTitle($list->getTitle()); $tmpCriterias = $list->getCriterias(); $criterias = array(); foreach ($list->getCriterias() as $criteria) { $obj = new stdClass(); $obj->field = $criteria->field; $obj->condition = $criteria->condition; $obj->fieldType = $criteria->type; switch ($criteria->type) { case 'date': if ($criteria->condition == 'between') { $date = explode(',', $criteria->value); $startDate = explode('/', $date[0]); $endDate = explode('/', $date[1]); $obj->value = array($startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00', $endDate[2] . '-' . intval($endDate[1]) . '-' . $endDate[0] . ' 23:59:59'); } else { $startDate = explode('/', $criteria->value); $obj->value = $startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00'; } break; case 'checkbox': default: $obj->value = $criteria->value; break; } $criterias[] = $obj; } CFactory::load('helpers', 'time'); $created = CTimeHelper::getDate($list->created); CFactory::load('libraries', 'advancesearch'); CFactory::load('libraries', 'filterbar'); $sortItems = array('latest' => JText::_('CC SORT LATEST'), 'online' => JText::_('CC SORT ONLINE'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL')); $sorting = JRequest::getVar('sort', 'latest', 'GET'); $data = CAdvanceSearch::getResult($criterias, $list->condition, $list->avataronly, $sorting); $tmpl = new CTemplate(); $tmpl->set('list', $list); $tmpl->set('created', $created); $tmpl->set('sorting', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest')); $html = $tmpl->fetch('memberlist.result'); unset($tmpl); CFactory::load('libraries', 'tooltip'); CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'featured'); $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $my = CFactory::getUser(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); CFactory::load('helpers', 'friends'); foreach ($data->result as $user) { $obj = new stdClass(); $obj->user = $user; $obj->friendsCount = $user->getFriendCount(); $obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id); $isFriend = CFriendsHelper::isConnected($user->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $user->id ? true : false; $resultRows[] = $obj; } $tmpl = new CTemplate(); $tmpl->set('data', $resultRows); $tmpl->set('sortings', ''); $tmpl->set('pagination', $data->pagination); $tmpl->set('filter', ''); $tmpl->set('featuredList', $featuredList); $tmpl->set('my', $my); $tmpl->set('showFeaturedList', false); $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $html .= $tmpl->fetch('people.browse'); echo $html; }
public function myvideos($id = null) { $document = JFactory::getDocument(); $my = CFactory::getUser(); $userid = JRequest::getInt('userid', $my->id); $user = CFactory::getUser($userid); // Set document title CFactory::load('helpers', 'owner'); $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } if ($my->id == $user->id) { $title = JText::_('COM_COMMUNITY_VIDEOS_MY'); } else { $title = JText::sprintf('COM_COMMUNITY_VIDEOS_USERS_VIDEO_TITLE', $user->getDisplayName()); } $document->setTitle($title); // Set pathway $mainframe =& JFactory::getApplication(); $this->addPathway(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos')); $this->addPathway($title); $feedLink = CRoute::_('index.php?option=com_community&view=videos&userid=' . $user->id . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_MY_VIDEOS_FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); // Show the mini header when viewing other's photos if ($my->id != $user->id) { $this->attachMiniHeaderUser($user->id); } // Display submenu $this->_addSubmenu(); $this->showSubmenu(); // Get data from DB $model = CFactory::getModel('videos'); $filters = array('creator' => $user->id, 'status' => 'ready', 'sorting' => JRequest::getVar('sort', 'latest')); $videos = $model->getVideos($filters); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); $sortItems = $this->_getSortOptions(); //pagination $pagination = $model->getPagination(); $videosHTML = $this->_getVideosHTML($videos, $pagination); $tmpl = new CTemplate(); echo $tmpl->set('user', $user)->set('sort', JRequest::getVar('sort', 'latest'))->set('currentTask', JRequest::getCmd('task', ''))->set('videosHTML', $videosHTML)->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->set('pagination', $pagination)->fetch('videos.myvideos'); }
function browse($data = null) { require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'template.php'; $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); $this->addPathway(JText::_('CC MEMBERS'), ''); $document->setTitle(JText::_('CC MEMBERS')); CFactory::load('helpers', 'friends'); CFactory::load('libraries', 'template'); CFactory::load('libraries', 'tooltip'); CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'featured'); $my = CFactory::getUser(); $view = CFactory::getView('search'); $searchModel = CFactory::getModel('search'); $userModel = CFactory::getModel('user'); $avatar = CFactory::getModel('avatar'); $friends = CFactory::getModel('friends'); $tmpl = new CTemplate(); $sorted = JRequest::getVar('sort', 'latest', 'GET'); $filter = JRequest::getWord('filter', 'all', 'GET'); $rows = $searchModel->getPeople($sorted, $filter); $sortItems = array('latest' => JText::_('CC SORT LATEST'), 'online' => JText::_('CC SORT ONLINE'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL')); $filterItems = array(); $config = CFactory::getConfig(); if ($config->get('alphabetfiltering')) { $filterItems = array('all' => JText::_('CC ALL'), 'abc' => JText::_('CC ABC'), 'def' => JText::_('CC DEF'), 'ghi' => JText::_('CC GHI'), 'jkl' => JText::_('CC JKL'), 'mno' => JText::_('CC MNO'), 'pqr' => JText::_('CC PQR'), 'stu' => JText::_('CC STU'), 'vwx' => JText::_('CC VWX'), 'yz' => JText::_('CC YZ'), 'others' => JText::_('CC OTHERS')); } $html = ''; $totalUser = $userModel->getMembersCount(); $resultRows = array(); // No need to pre-load multiple users at once since $searchModel->getPeople // already did for ($i = 0; $i < count($rows); $i++) { $row =& $rows[$i]; $obj = clone $row; $user = CFactory::getUser($row->id); $obj->friendsCount = $user->getFriendCount(); $obj->user = $user; $obj->profileLink = CUrl::build('profile', '', array('userid' => $row->id)); $isFriend = CFriendsHelper::isConnected($row->id, $my->id); $obj->addFriend = !$isFriend && $my->id != $row->id ? true : false; $resultRows[] = $obj; } $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $config = CFactory::getConfig(); if ($config->get('alphabetfiltering')) { $sortingsHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest', $filterItems, 'all'); } else { $sortingsHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'); } $tmpl->set('featuredList', $featuredList); $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $tmpl->set('featuredList', $featuredList); $tmpl->set('data', $resultRows); $tmpl->set('sortings', $sortingsHTML); $tmpl->set('my', $my); $tmpl->set('totalUser', $totalUser); $tmpl->set('showFeaturedList', true); $tmpl->set('pagination', $searchModel->getPagination()); echo $tmpl->fetch('people.browse'); }