Beispiel #1
0
 /**
  * Return friends html block
  * @since 2.2.4
  * @return string
  */
 public function modGetFriendsHTML($userid = null)
 {
     $html = '';
     $tmpl = new CTemplate();
     $friendsModel = CFactory::getModel('friends');
     $my = CFactory::getUser($userid);
     $user = CFactory::getRequestUser();
     $params = $user->getParams();
     // site visitor
     $relation = 10;
     // site members
     if ($my->id != 0) {
         $relation = 20;
     }
     // friends
     if (CFriendsHelper::isConnected($my->id, $user->id)) {
         $relation = 30;
     }
     // mine
     if (COwnerHelper::isMine($my->id, $user->id)) {
         $relation = 40;
     }
     // @todo: respect privacy settings
     if ($relation >= $params->get('privacyFriendsView')) {
         $friends = $friendsModel->getFriends($user->id, 'latest', false, '', PROFILE_MAX_FRIEND_LIMIT + PROFILE_MAX_FRIEND_LIMIT);
         // randomize the friend count
         if ($friends) {
             shuffle($friends);
         }
         $html = $tmpl->setRef('friends', $friends)->set('total', $user->getFriendCount())->setRef('user', $user)->fetch('profile.friends');
     }
     return $html;
 }
Beispiel #2
0
 public function ajaxGetNotification()
 {
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $json = array();
     $my = CFactory::getUser();
     //$inboxModel       = CFactory::getModel( 'inbox' );
     $friendModel = CFactory::getModel('friends');
     $eventModel = CFactory::getModel('events');
     $groupModel = CFactory::getModel('groups');
     $notiTotal = 0;
     //getting pending event request
     $pendingEvent = $eventModel->getPending($my->id);
     $eventHtml = '';
     $event = JTable::getInstance('Event', 'CTable');
     if (!empty($pendingEvent)) {
         $notiTotal += count($pendingEvent);
         for ($i = 0; $i < count($pendingEvent); $i++) {
             $row = $pendingEvent[$i];
             $row->invitor = CFactory::getUser($row->invited_by);
             $event->load($row->eventid);
             // remove the notification if there is no longer seats available
             if (!CEventHelper::seatsAvailable($event)) {
                 unset($pendingEvent[$i]);
                 continue;
             }
             $row->eventAvatar = $event->getThumbAvatar();
             $row->url = CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $row->eventid . false);
             $row->isGroupEvent = $event->contentid ? true : false;
             if ($row->isGroupEvent) {
                 $group = JTable::getInstance('Group', 'CTable');
                 $group->load($event->contentid);
                 $row->groupname = $group->name;
                 $row->grouplink = CUrlHelper::groupLink($group->id);
             }
         }
         $tmpl = new CTemplate();
         $tmpl->set('rows', $pendingEvent);
         $tmpl->setRef('my', $my);
         $eventHtml = $tmpl->fetch('notification.event.invitations');
     }
     //getting pending group request
     $pendingGroup = $groupModel->getGroupInvites($my->id);
     $groupHtml = '';
     $group = JTable::getInstance('Group', 'CTable');
     $groupNotiTotal = 0;
     if (!empty($pendingGroup)) {
         $groupNotiTotal += count($pendingGroup);
         for ($i = 0; $i < count($pendingGroup); $i++) {
             $gRow = $pendingGroup[$i];
             $gRow->invitor = CFactory::getUser($gRow->creator);
             $group->load($gRow->groupid);
             $gRow->name = $group->name;
             $gRow->groupAvatar = $group->getThumbAvatar();
             $gRow->url = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $gRow->groupid . false);
         }
         $tmpl = new CTemplate();
         $tmpl->set('gRows', $pendingGroup);
         $tmpl->setRef('my', $my);
         $groupHtml = $tmpl->fetch('notification.group.invitations');
     }
     //geting pending private group join request
     //Find Users Groups Admin
     $allGroups = $groupModel->getAdminGroups($my->id, COMMUNITY_PRIVATE_GROUP);
     $groupMemberApproveHTML = '';
     //Get unApproved member
     if (!empty($allGroups)) {
         foreach ($allGroups as $groups) {
             $member = $groupModel->getMembers($groups->id, 0, false);
             if (!empty($member)) {
                 for ($i = 0; $i < count($member); $i++) {
                     $oRow = $member[$i];
                     $group->load($groups->id);
                     $oRow->groupId = $groups->id;
                     $oRow->groupName = $groups->name;
                     $oRow->groupAvatar = $group->getThumbAvatar();
                     $oRow->url = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id . false);
                     $members[] = $member[$i];
                 }
             }
         }
     }
     if (!empty($members)) {
         $tmpl = new CTemplate();
         $tmpl->set('oRows', $members);
         $tmpl->set('my', $my);
         $groupMemberApproveHTML = $tmpl->fetch('notification.group.request');
     }
     //non require action notification
     $itemHtml = '';
     $notifCount = 10;
     $notificationModel = CFactory::getModel('notification');
     $myParams = $my->getParams();
     $notifications = $notificationModel->getNotification($my->id, '0', $notifCount, $myParams->get('lastnotificationlist', ''));
     if (!empty($notifications)) {
         for ($i = 0; $i < count($notifications); $i++) {
             $iRow = $notifications[$i];
             $iRow->actorUser = CFactory::getUser($iRow->actor);
             $iRow->actorAvatar = $iRow->actorUser->getThumbAvatar();
             $iRow->actorName = $iRow->actorUser->getDisplayName();
             $iRow->timeDiff = CTimeHelper::timeLapse(CTimeHelper::getDate($iRow->created));
             $iRow->contentHtml = CContentHelper::injectTags($iRow->content, $iRow->params, true);
             $params = new CParameter($iRow->params);
             $iRow->url = $params->get('url', '');
         }
         $tmpl = new CTemplate();
         $tmpl->set('iRows', $notifications);
         $tmpl->setRef('my', $my);
         $itemHtml = $tmpl->fetch('notification.item');
     }
     $notiHtml = $eventHtml . $groupHtml . $groupMemberApproveHTML . $itemHtml;
     if (empty($notiHtml)) {
         $notiHtml .= '<li>';
         $notiHtml .= JText::_('COM_COMMUNITY_NO_NOTIFICATION');
         $notiHtml .= '</li>';
     }
     $date = JFactory::getDate();
     $myParams->set('lastnotificationlist', $date->toSql());
     $my->save('params');
     $url = CRoute::_('index.php?option=com_community&view=profile&task=notifications');
     $notiHtml .= '<div>';
     $notiHtml .= '<a href="' . $url . '" class="joms-button--neutral joms-button--full">' . JText::_('COM_COMMUNITY_VIEW_ALL') . '</a>';
     $notiHtml .= '</div>';
     $json['title'] = JText::_('COM_COMMUNITY_NOTIFICATIONS');
     $json['html'] = $notiHtml;
     die(json_encode($json));
 }
Beispiel #3
0
 public function getEmbedCode($videoId, $videoWidth, $videoHeight)
 {
     $video =& JTable::getInstance('Video', 'CTable');
     $video->load($videoId);
     $tmpl = new CTemplate();
     $tmpl->setRef('video', $video);
     $tmpl->set('switch', 'pureObjectTag');
     return $tmpl->fetch('videos.flowplayer');
 }
Beispiel #4
0
 public function showFeaturedGroups($total = 5)
 {
     $tmpl = new CTemplate();
     $config = CFactory::getConfig();
     $showlatestgroups = intval($tmpl->params->get('showlatestgroups'));
     $html = '';
     $data = array();
     if ($showlatestgroups != 0) {
         $groupModel = CFactory::getModel('groups');
         $tmpGroups = $groupModel->getAllGroups(null, null, null, $total);
         $groups = array();
         $data = array();
         $groupView = CFactory::getView('groups');
         $groups = $groupView->getGroupsFeaturedList();
         $tmpl = new CTemplate();
         $html = $tmpl->setRef('groups', $groups)->fetch('frontpage.latestgroup');
     }
     $data['HTML'] = $html;
     return $data;
 }
Beispiel #5
0
 /**
  * Displays the viewing profile page.
  *
  * @access	public
  * @param	array  An associative array to display the fields
  */
 function profile(&$data)
 {
     $mainframe =& JFactory::getApplication();
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $userid = JRequest::getVar('userid', $my->id);
     $user = CFactory::getUser($userid);
     $userId = JRequest::getVar('userid', '', 'GET');
     if ($my->id != 0 && empty($userId)) {
         CFactory::setActiveProfile($my->id);
         $user = $my;
     }
     // Display breadcrumb regardless whether the user is blocked or not
     $pathway =& $mainframe->getPathway();
     $pathway->addItem($user->getDisplayName(), '');
     // Get profile video information
     $params = $user->getParams();
     $videoid = $params->get('profileVideo', 0);
     CFactory::load('helpers', 'owner');
     $blocked = $user->isBlocked();
     if ($blocked && !COwnerHelper::isCommunityAdmin()) {
         $tmpl = new CTemplate();
         echo $tmpl->fetch('profile.blocked');
         return;
     }
     // If the current browser is a site admin, display some notice that user is blocked.
     if ($blocked) {
         $this->addWarning(JText::_('CC USER ACCOUNT BANNED'));
     }
     // access check
     if (!$this->accessAllowed('privacyProfileView')) {
         return;
     }
     require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'userpoints.php';
     $appsLib =& CAppPlugins::getInstance();
     $appsLib->loadApplications();
     CFactory::load('helpers', 'string');
     $document =& JFactory::getDocument();
     $status = $user->getStatus(COMMUNITY_RAW_STATUS);
     $status = empty($status) ? '' : ' : ' . $status;
     $document->setTitle($user->getDisplayName(COMMUNITY_RAW_STATUS) . $status);
     $document->setMetaData('description', JText::sprintf('CC PROFILE META DESCRIPTION', $user->getDisplayName(), $config->get('sitename'), CStringHelper::escape($status)));
     $feedLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id . '&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO USER FEEDS') . '"  href="' . $feedLink . '"/>';
     $mainframe->addCustomHeadTag($feed);
     $feedLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id . '&showfriends=true&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO USER FRIENDS FEEDS') . '"  href="' . $feedLink . '"/>';
     $mainframe->addCustomHeadTag($feed);
     $feedLink = CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $user->id . '&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO USER PHOTO FEEDS') . '"  href="' . $feedLink . '"/>';
     $mainframe->addCustomHeadTag($feed);
     $feedLink = CRoute::_('index.php?option=com_community&view=videos&userid=' . $user->id . '&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO USER VIDEO FEEDS') . '"  href="' . $feedLink . '"/>';
     $mainframe->addCustomHeadTag($feed);
     // Get profile video information
     $params = $user->getParams();
     $data->videoid = $params->get('profileVideo', 0);
     // Show profile header
     $headerHTML = $this->_showHeader($data);
     // Load user application
     $apps = $data->apps;
     // Load community applications plugin
     $app =& CAppPlugins::getInstance();
     $appsModel = CFactory::getModel('apps');
     $tmpAppData = $app->triggerEvent('onProfileDisplay', '', true);
     $appData = array();
     // @rule: Only display necessary apps.
     $count = count($tmpAppData);
     for ($i = 0; $i < $count; $i++) {
         $app =& $tmpAppData[$i];
         $privacy = $appsModel->getPrivacy($user->id, $app->name);
         if ($this->appPrivacyAllowed($privacy)) {
             $appData[] = $app;
         }
     }
     unset($tmpAppData);
     // Split the apps into different list for different positon
     $appsInPositions = array();
     foreach ($appData as &$app) {
         $appsInPositions[$app->position][] = $app;
     }
     $tmpl = new CTemplate();
     $contenHTML = array();
     $contenHTML['content'] = '';
     $contenHTML['sidebar-top'] = '';
     $contenHTML['sidebar-bottom'] = '';
     $jscript = '';
     foreach ($appsInPositions as $position => $appData) {
         ob_start();
         foreach ($appData as $app) {
             // If the apps content is empty, we ignore this app from showing
             // the header in profile page.
             if (JString::trim($app->data) == "") {
                 continue;
             }
             $tmpl->set('app', $app);
             $tmpl->set('isOwner', COwnerHelper::isMine($my->id, $user->id));
             switch ($position) {
                 case 'sidebar-top':
                 case 'sidebar-bottom':
                     echo $tmpl->fetch('application.widget');
                     break;
                 default:
                     echo $tmpl->fetch('application.box');
             }
         }
         $contenHTML[$position] = ob_get_contents();
         ob_end_clean();
     }
     // Get the config
     $config = CFactory::getConfig();
     // get total group
     $groupsModel = CFactory::getModel('groups');
     $totalgroups = $groupsModel->getGroupsCount($user->id);
     // get total friend
     $friendsModel = CFactory::getModel('friends');
     $totalfriends = $user->getFriendCount();
     // get total photos
     $photosModel = CFactory::getModel('photos');
     $totalphotos = $photosModel->getPhotosCount($user->id);
     // get total activities
     $activitiesModel = CFactory::getModel('activities');
     $totalactivities = $activitiesModel->getActivityCount($user->id);
     $isMine = COwnerHelper::isMine($my->id, $user->id);
     $isCommunityAdmin = COwnerHelper::isCommunityAdmin($user->id);
     // Get reporting html
     CFactory::load('libraries', 'reporting');
     $report = new CReportingLibrary();
     $reportHTML = $isMine ? '' : $report->getReportingHTML(JText::_('CC REPORT BAD USER'), 'profile,reportProfile', array($user->id));
     // Check if user is blocked
     $blockUserModel = CFactory::getModel('block');
     $isBlocked = $blockUserModel->getBlockStatus($user->id, $my->id);
     // Get block user html
     CFactory::load('helpers', 'user');
     $blockUserHTML = $isMine || $isCommunityAdmin ? '' : CUserHelper::getBlockUserHTML($user->id, $isBlocked);
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=profile&userid=' . $user->id));
     $bookmarksHTML = $bookmarks->getHTML();
     // Get like
     // cater for buble, blueface template
     $likesHTML = '';
     if ($user->getParams()->get('profileLikes', true)) {
         CFactory::load('libraries', 'like');
         $likes = new CLike();
         $likesHTML = $my->id == 0 ? $likes->getHtmlPublic('profile', $user->id) : $likes->getHTML('profile', $user->id, $my->id);
     }
     $tmpl = new CTemplate();
     $tmpl->set('blockUserHTML', $blockUserHTML);
     $tmpl->set('bookmarksHTML', $bookmarksHTML);
     $tmpl->set('profileOwnerName', $user->getDisplayName());
     $tmpl->set('totalgroups', $totalgroups);
     $tmpl->set('totalfriends', $totalfriends);
     $tmpl->set('totalphotos', $totalphotos);
     $tmpl->set('totalactivities', $totalactivities);
     $tmpl->set('reportsHTML', $reportHTML);
     $tmpl->set('mainframe', $mainframe);
     $tmpl->set('config', $config);
     $tmpl->set('about', $this->_getProfileHTML($data->profile));
     $tmpl->set('friends', $this->_getFriendsHTML());
     $tmpl->set('groups', $this->_getGroupsHTML());
     $tmpl->set('newsfeed', $this->_getNewsfeedHTML());
     $tmpl->set('header', $headerHTML);
     $tmpl->set('adminControlHTML', $this->_getAdminControlHTML($user->id));
     $tmpl->set('content', $contenHTML['content']);
     $tmpl->set('sidebarTop', $contenHTML['sidebar-top']);
     $tmpl->set('sidebarBottom', $contenHTML['sidebar-bottom']);
     $tmpl->set('isMine', $isMine);
     $tmpl->set('jscript', '');
     // maintain for 1.8.0 template compatibility
     $tmpl->setRef('user', $user);
     $tmpl->set('my', $my);
     $tmpl->set('videoid', $data->videoid);
     $tmpl->set('likesHTML', $likesHTML);
     $html = $tmpl->fetch('profile.index');
     echo $html;
 }
Beispiel #6
0
 public function getEmbedCode($videoId, $videoWidth, $videoHeight)
 {
     $video = JTable::getInstance('Video', 'CTable');
     $video->load($videoId);
     $tmpl = new CTemplate();
     $tmpl->setRef('video', $video);
     $tmpl->set('switch', 'pureObjectTag');
     $isMp4 = $this->isMp4($video->getFlv());
     if (!$isMp4) {
         return $tmpl->fetch('videos.flowplayer');
     } else {
         return $tmpl->fetch('videos.html5');
     }
 }
Beispiel #7
0
 /**
  * Show listing of most recent photos.
  * @param	$rawData	Retrieves the raw data of recent photos	 
  */
 public function showLatestPhotos($rawData = false)
 {
     $tmpl = new CTemplate();
     $config = CFactory::getConfig();
     $photoModel = CFactory::getModel('photos');
     $showlatestphotos = intval($tmpl->params->get('showlatestphotos'));
     $frontpagePhotos = intval($config->get('frontpagephotos'));
     $latestPhotos = $photoModel->getAllPhotos(null, PHOTOS_USER_TYPE, $frontpagePhotos, 0, COMMUNITY_ORDER_BY_DESC, COMMUNITY_ORDERING_BY_CREATED);
     $data = array();
     if ($showlatestphotos != 0) {
         if ($latestPhotos) {
             shuffle($latestPhotos);
             // Make sure it is all photo object
             foreach ($latestPhotos as &$row) {
                 $photo =& JTable::getInstance('Photo', 'CTable');
                 $photo->bind($row);
                 $row = $photo;
             }
         }
         if (!empty($latestPhotos)) {
             for ($i = 0; $i < count($latestPhotos); $i++) {
                 $row =& $latestPhotos[$i];
                 $row->user = CFactory::getUser($row->creator);
             }
         }
         if ($rawData) {
             return $latestPhotos;
         }
         $tmpl = new CTemplate();
         $data['HTML'] = $tmpl->setRef('latestPhotos', $latestPhotos)->fetch('frontpage.latestphoto');
     } else {
         $data['HTML'] = '';
     }
     return $data;
 }
Beispiel #8
0
 public function ajaxGetNotification()
 {
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     $inboxModel = CFactory::getModel('inbox');
     $friendModel = CFactory::getModel('friends');
     $eventModel = CFactory::getModel('events');
     $inboxHtml = '';
     $frenHtml = '';
     $rowHeight = 50;
     $menuHeight = 35;
     $extraMenuHeight = 0;
     $notiTotal = 0;
     // getting inbox
     $unreadInbox = $inboxModel->getUnReadInbox();
     if (!empty($unreadInbox)) {
         $extraMenuHeight += 25;
         $notiTotal += count($unreadInbox);
         for ($i = 0; $i < count($unreadInbox); $i++) {
             $row =& $unreadInbox[$i];
             $user = CFactory::getUser($row->from);
             $row->avatar = $user->getThumbAvatar();
             $row->isUnread = true;
             $row->from_name = $user->getDisplayName();
             $row->profileLink = CUrlHelper::userLink($user->id);
         }
         $tmpl = new CTemplate();
         $tmpl->set('messages', $unreadInbox);
         $inboxHtml = $tmpl->fetch('notification.unread.inbox');
         $inboxHtml .= '<br />';
     }
     // getting pending fren request
     $pendingFren = $friendModel->getPending($my->id);
     if (!empty($pendingFren)) {
         $extraMenuHeight += 25;
         $notiTotal += count($pendingFren);
         for ($i = 0; $i < count($pendingFren); $i++) {
             $row =& $pendingFren[$i];
             $row->user = CFactory::getUser($row->id);
             $row->user->friendsCount = $row->user->getFriendCount();
             $row->user->profileLink = CUrlHelper::userLink($row->id);
         }
         $tmplF = new CTemplate();
         $tmplF->set('rows', $pendingFren);
         $tmplF->setRef('my', $my);
         $frenHtml = $tmplF->fetch('notification.friend.request');
         $frenHtml .= "<br />";
     }
     //getting pending event request
     $pendingEvent = $eventModel->getPending($my->id);
     $eventHtml = '';
     $event =& JTable::getInstance('Event', 'CTable');
     if (!empty($pendingEvent)) {
         $extraMenuHeight += 25;
         $notiTotal += count($pendingEvent);
         for ($i = 0; $i < count($pendingEvent); $i++) {
             $row =& $pendingEvent[$i];
             $row->invitor = CFactory::getUser($row->invited_by);
             $event->load($row->eventid);
             $row->eventAvatar = $event->getThumbAvatar();
             $row->url = CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $row->eventid . false);
         }
         $tmpl = new CTemplate();
         $tmpl->set('rows', $pendingEvent);
         $tmpl->setRef('my', $my);
         $eventHtml = $tmpl->fetch('notification.event.invitations');
     }
     $notiHtml = $inboxHtml . $frenHtml . $eventHtml;
     $objResponse->addAssign('cWindowContent', 'innerHTML', $notiHtml);
     $totalHeight = $menuHeight + $extraMenuHeight + $notiTotal * $rowHeight;
     if ($totalHeight > 450) {
         $totalHeight = 450;
     }
     /* Max height 450 */
     $objResponse->addAssign('cwin_logo', 'innerHTML', JText::_('CC NOTIFICATIONS'));
     $objResponse->addScriptCall('cWindowResize', $totalHeight);
     $objResponse->sendResponse();
 }
Beispiel #9
0
 public function ajaxGetNotification()
 {
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     $inboxModel = CFactory::getModel('inbox');
     $friendModel = CFactory::getModel('friends');
     $eventModel = CFactory::getModel('events');
     $groupModel = CFactory::getModel('groups');
     $inboxHtml = '';
     $frenHtml = '';
     $notiTotal = 0;
     //getting pending event request
     $pendingEvent = $eventModel->getPending($my->id);
     $eventHtml = '';
     $event =& JTable::getInstance('Event', 'CTable');
     if (!empty($pendingEvent)) {
         $notiTotal += count($pendingEvent);
         for ($i = 0; $i < count($pendingEvent); $i++) {
             $row =& $pendingEvent[$i];
             $row->invitor = CFactory::getUser($row->invited_by);
             $event->load($row->eventid);
             $row->eventAvatar = $event->getThumbAvatar();
             $row->url = CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $row->eventid . false);
         }
         $tmpl = new CTemplate();
         $tmpl->set('rows', $pendingEvent);
         $tmpl->setRef('my', $my);
         $eventHtml = $tmpl->fetch('notification.event.invitations');
     }
     //getting pending group request
     $pendingGroup = $groupModel->getGroupInvites($my->id);
     $groupHtml = '';
     $group =& JTable::getInstance('Group', 'CTable');
     $groupNotiTotal = 0;
     if (!empty($pendingGroup)) {
         $groupNotiTotal += count($pendingGroup);
         for ($i = 0; $i < count($pendingGroup); $i++) {
             $gRow =& $pendingGroup[$i];
             $gRow->invitor = CFactory::getUser($gRow->creator);
             $group->load($gRow->groupid);
             $gRow->name = $group->name;
             $gRow->groupAvatar = $group->getThumbAvatar();
             $gRow->url = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $gRow->groupid . false);
         }
         $tmpl = new CTemplate();
         $tmpl->set('gRows', $pendingGroup);
         $tmpl->setRef('my', $my);
         $groupHtml = $tmpl->fetch('notification.group.invitations');
     }
     //geting pending private group join request
     //Find Users Groups Admin
     $allGroups = $groupModel->getAdminGroups($my->id, COMMUNITY_PRIVATE_GROUP);
     $groupMemberApproveHTML = '';
     //Get unApproved member
     if (!empty($allGroups)) {
         foreach ($allGroups as $groups) {
             $member = $groupModel->getMembers($groups->id, 0, false);
             if (!empty($member)) {
                 for ($i = 0; $i < count($member); $i++) {
                     $oRow =& $member[$i];
                     $group->load($groups->id);
                     $oRow->groupId = $groups->id;
                     $oRow->groupName = $groups->name;
                     $oRow->groupAvatar = $group->getThumbAvatar();
                     $oRow->url = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id . false);
                     $members[] = $member[$i];
                 }
             }
         }
     }
     if (!empty($members)) {
         $tmpl = new CTemplate();
         $tmpl->set('oRows', $members);
         $tmpl->set('my', $my);
         $groupMemberApproveHTML = $tmpl->fetch('notification.group.request');
     }
     $notiHtml = $inboxHtml . $frenHtml . $eventHtml . $groupHtml . $groupMemberApproveHTML;
     if (empty($notiHtml)) {
         $notiHtml = '<div class="jsNotificationContent jsNotificationEmpty">';
         $notiHtml .= '<div class="jsNotificationActor">';
         $notiHtml .= JText::_('COM_COMMUNITY_NO_NOTIFICATION');
         $notiHtml .= '</div>';
         $notiHtml .= '</div>';
     }
     $objResponse->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_NOTIFICATIONS'));
     $objResponse->addScriptCall('cWindowAddContent', $notiHtml);
     $objResponse->sendResponse();
 }
Beispiel #10
0
 /**
  * Show the invite window
  */
 function invite()
 {
     $mainframe =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     $config = CFactory::getConfig();
     $document->setTitle(JText::sprintf('CC INVITE FRIENDS TITLE', $config->get('sitename')));
     $my = CFactory::getUser();
     $this->showSubmenu();
     $post = JRequest::getVar('action', '', 'POST') == 'invite' ? JRequest::get('POST') : array('message' => '', 'emails' => '');
     $pathway =& $mainframe->getPathway();
     $this->addPathway(JText::_('CC FRIENDS'), CRoute::_('index.php?option=com_community&view=friends'));
     $this->addPathway(JText::_('CC INVITE FRIENDS'), '');
     // Process the Suggest Friends
     // Load required filterbar library that will be used to display the filtering and sorting.
     CFactory::load('libraries', 'filterbar');
     $id = JRequest::getCmd('userid', $my->id);
     $user = CFactory::getUser($id);
     $sorted = JRequest::getVar('sort', 'suggestion', 'GET');
     $filter = JRequest::getVar('filter', 'suggestion', 'GET');
     $friends = CFactory::getModel('friends');
     $rows = $friends->getFriends($id, $sorted, true, $filter);
     $resultRows = array();
     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;
         $resultRows[] = $obj;
     }
     unset($rows);
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-friends-invite'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     $tmpl->set('beforeFormDisplay', $beforeFormDisplay);
     $tmpl->set('afterFormDisplay', $afterFormDisplay);
     $tmpl->set('my', $my);
     $tmpl->set('post', $post);
     $tmpl->setRef('friends', $resultRows);
     $tmpl->set('config', CFactory::getConfig());
     echo $tmpl->fetch('friends.invite');
 }