public function showGroupMiniHeader($groupId) { CMiniHeader::load(); $option = JRequest::getVar('option', '', 'REQUEST'); JFactory::getLanguage()->load('com_community'); CFactory::load('models', 'groups'); $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); $my = CFactory::getUser(); // @rule: Test if the group is unpublished, don't display it at all. if (!$group->published) { return ''; } if (!empty($group->id) && $group->id != 0) { $isMember = $group->isMember($my->id); $config = CFactory::getConfig(); $tmpl = new CTemplate(); $tmpl->set('my', $my); $tmpl->set('group', $group); $tmpl->set('isMember', $isMember); $tmpl->set('config', $config); $showMiniHeader = $option == 'com_community' ? $tmpl->fetch('groups.miniheader') : '<div id="community-wrap" style="min-height:50px;">' . $tmpl->fetch('groups.miniheader') . '</div>'; return $showMiniHeader; } }
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'); }
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; }
public function sendmail() { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_EVENTS_EMAIL_SEND')); $this->addPathway(JText::_('COM_COMMUNITY_EVENTS'), CRoute::_('index.php?option=com_community&view=events')); $this->addPathway(JText::_('COM_COMMUNITY_EVENTS_EMAIL_SEND')); if (!$this->accessAllowed('registered')) { return; } // Display the submenu $this->showSubmenu(); $eventId = $jinput->get('eventid', '', 'INT'); $type = $jinput->get('type', COMMUNITY_EVENT_STATUS_ATTEND, 'INT'); //CFactory::load( 'helpers', 'owner' ); //CFactory::load( 'models' , 'events' ); $event = JTable::getInstance('Event', 'CTable'); $event->load($eventId); if (empty($eventId) || empty($event->title)) { echo JText::_('COM_COMMUNITY_INVALID_ID_PROVIDED'); return; } $my = CFactory::getUser(); $config = CFactory::getConfig(); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; //CFactory::load( 'libraries' , 'editor' ); $editor = new CEditor($config->get('htmleditor')); //CFactory::load( 'helpers' , 'event' ); $handler = CEventHelper::getHandler($event); if (!$handler->manageable()) { $this->noAccess(); return; } $message = JRequest::getVar('message', '', 'post', 'string', JREQUEST_ALLOWRAW); $title = $jinput->get('title', '', 'STRING'); //JRequest::getVar( 'title' , '' ); echo CMiniHeader::showEventMiniHeader($event->id); $tmpl = new CTemplate(); echo $tmpl->set('editor', $editor)->set('type', $type)->set('event', $event)->set('message', $message)->set('title', $title)->fetch('events.sendmail'); }
public function getHeader() { $output = CMiniHeader::showGroupMiniHeader($this->group->id); echo $output; return $output; }
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; }
/** * Show profile miniheader */ public function _getMiniHeader() { CFactory::load('libraries', 'miniheader'); $my = CFactory::getUser(); $mh = new CMiniHeader(); return $mh->showMiniHeader($my->id); }
/** * Show profile miniheader */ public function _getMiniHeader() { $my = CFactory::getUser(); $mh = new CMiniHeader(); return $mh->showMiniHeader($my->id); }
public static function showGroupMiniHeader($groupId) { CMiniHeader::load(); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $option = $jinput->request->get('option', '', 'STRING'); //JRequest::getVar('option', '', 'REQUEST'); JFactory::getLanguage()->load('com_community'); $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); $my = CFactory::getUser(); $isBanned = $group->isBanned($my->id); // @rule: Test if the group is unpublished, don't display it at all. if (!$group->published) { return ''; } if (!empty($group->id) && $group->id != 0) { $fileModel = CFactory::getModel('files'); $params = $group->getParams(); $isMember = $group->isMember($my->id); $config = CFactory::getConfig(); $eventsModel = CFactory::getModel('Events'); $totalEvents = $eventsModel->getTotalGroupEvents($group->id); $discussModel = CFactory::getModel('discussions'); $discussions = $discussModel->getDiscussionTopics($group->id, '10', 0); $totalDiscussion = $discussModel->total; $bulletinModel = CFactory::getModel('bulletins'); $bulletins = $bulletinModel->getBulletins($groupId); $totalBulletin = $bulletinModel->total; $allowManagePhotos = CGroupHelper::allowManagePhoto($group->id); $allowManageVideos = CGroupHelper::allowManageVideo($group->id); $allowCreateEvent = CGroupHelper::allowCreateEvent($my->id, $group->id); $photosModel = CFactory::getModel('photos'); $albums = $photosModel->getGroupAlbums($group->id, true, false, $params->get('grouprecentphotos', GROUP_PHOTO_RECENT_LIMIT)); $totalPhotos = 0; foreach ($albums as $album) { $albumParams = new CParameter($album->params); $totalPhotos = $totalPhotos + $albumParams->get('count'); } $videoModel = CFactory::getModel('videos'); $tmpVideos = $videoModel->getGroupVideos($groupId, '', $params->get('grouprecentvideos', GROUP_VIDEO_RECENT_LIMIT)); $totalVideos = $videoModel->total ? $videoModel->total : 0; // Get like $likes = new CLike(); $isUserLiked = false; if ($isLikeEnabled = $likes->enabled('groups')) { $isUserLiked = $likes->userLiked('groups', $group->id, $my->id); } $totalLikes = $likes->getLikeCount('groups', $group->id); $tmpl = new CTemplate(); $groupModel = CFactory::getModel('groups'); $membersCount = $group->membercount; // If I have tried to join this group, but not yet approved, display a notice $waitingApproval = false; if ($groupModel->isWaitingAuthorization($my->id, $group->id)) { $waitingApproval = true; } $groupsModel = CFactory::getModel('groups'); $bannedMembers = $groupsModel->getBannedMembers($group->id); $tmpl->set('my', $my)->set('isBanned', $isBanned)->set('group', $group)->set('membersCount', $membersCount)->set('showEvents', $config->get('group_events') && $config->get('enableevents') && $params->get('eventpermission', 1) >= 1)->set('totalEvents', $totalEvents)->set('totalDiscussion', $totalDiscussion)->set('totalBulletin', $totalBulletin)->set('showPhotos', $params->get('photopermission') != -1 && $config->get('enablephotos') && $config->get('groupphotos'))->set('showVideos', $params->get('videopermission') != -1 && $config->get('enablevideos') && $config->get('groupvideos'))->set('isSuperAdmin', COwnerHelper::isCommunityAdmin())->set('isMine', $my->id == $group->ownerid)->set('totalVideos', $totalVideos)->set('totalPhotos', $totalPhotos)->set('isAdmin', $groupModel->isAdmin($my->id, $group->id))->set('isFile', $fileModel->isfileAvailable($group->id, 'group'))->set('isLikeEnabled', $isLikeEnabled)->set('totalLikes', $totalLikes)->set('isMember', $isMember)->set('config', $config)->set('totalBannedMembers', count($bannedMembers))->set('isUserLiked', $isUserLiked)->set('allowManagePhotos', $allowManagePhotos)->set('allowManageVideos', $allowManageVideos)->set('allowCreateEvent', $allowCreateEvent)->set('waitingApproval', $waitingApproval); $showMiniHeader = $option == 'com_community' ? $tmpl->fetch('groups/miniheader') : '<div id="community-wrap">' . $tmpl->fetch('groups/miniheader') . '</div>'; return $showMiniHeader; } }
/** * Responsible to output the html codes for the task viewguest. * Outputs html codes for the viewguest page. * * @return none. * */ public function viewguest() { if (!$this->accessAllowed('registered')) { return; } $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $id = JRequest::getInt('eventid', 0); $type = JRequest::getCmd('type'); $approval = JRequest::getCmd('approve'); $event = JTable::getInstance('Event', 'CTable'); $event->load($id); $handler = CEventHelper::getHandler($event); $types = array(COMMUNITY_EVENT_ADMINISTRATOR, COMMUNITY_EVENT_STATUS_INVITED, COMMUNITY_EVENT_STATUS_ATTEND, COMMUNITY_EVENT_STATUS_BLOCKED, COMMUNITY_EVENT_STATUS_REQUESTINVITE); if (!in_array($type, $types)) { JError::raiseError('500', JText::_('Invalid status type')); } // Set the guest type for the title purpose switch ($type) { case COMMUNITY_EVENT_ADMINISTRATOR: $guestType = JText::_('COM_COMMUNITY_ADMINS'); break; case COMMUNITY_EVENT_STATUS_INVITED: $guestType = JText::_('COM_COMMUNITY_EVENTS_PENDING_MEMBER'); break; case COMMUNITY_EVENT_STATUS_ATTEND: $guestType = JText::_('COM_COMMUNITY_EVENTS_CONFIRMED_GUESTS'); break; case COMMUNITY_EVENT_STATUS_BLOCKED: $guestType = JText::_('COM_COMMUNITY_EVENTS_BLOCKED'); break; case COMMUNITY_EVENT_STATUS_REQUESTINVITE: $guestType = JText::_('COM_COMMUNITY_REQUESTED_INVITATION'); break; } // Then we load basic page presentation $this->addPathway(JText::_('COM_COMMUNITY_EVENTS'), CRoute::_('index.php?option=com_community&view=events')); $this->addPathway(JText::sprintf('COM_COMMUNITY_EVENTS_TITLE_LABEL', $event->title), ''); /** * Opengraph */ CHeadHelper::setType('website', JText::sprintf('COM_COMMUNTIY_EVENTS_GUESTLIST', $event->title, $guestType)); $status = $event->getUserStatus($my->id); $allowed = array(COMMUNITY_EVENT_STATUS_INVITED, COMMUNITY_EVENT_STATUS_ATTEND, COMMUNITY_EVENT_STATUS_WONTATTEND, COMMUNITY_EVENT_STATUS_MAYBE); $accessAllowed = in_array($status, $allowed) && $status != COMMUNITY_EVENT_STATUS_BLOCKED ? true : false; if ($handler->hasInvitation() && ($accessAllowed && $event->allowinvite || $event->isAdmin($my->id) || COwnerHelper::isCommunityAdmin())) { $this->addSubmenuItem('javascript:void(0)', JText::_('COM_COMMUNITY_TAB_INVITE'), "joms.invitation.showForm('', 'events,inviteUsers','" . $event->id . "','1','1');", SUBMENU_RIGHT); } $this->showSubmenu(); $isSuperAdmin = COwnerHelper::isCommunityAdmin(); // status = unsure | noreply | accepted | declined | blocked // permission = admin | guest | if ($type == COMMUNITY_EVENT_ADMINISTRATOR) { $guestsIds = $event->getAdmins(0); } else { $guestsIds = $event->getMembers($type, 0, false, $approval); } $guests = array(); // Pre-load multiple users at once $userids = array(); foreach ($guestsIds as $uid) { $userids[] = $uid->id; } CFactory::loadUsers($userids); for ($i = 0; $i < count($guestsIds); $i++) { $guests[$i] = CFactory::getUser($guestsIds[$i]->id); $guests[$i]->friendsCount = $guests[$i]->getFriendCount(); $guests[$i]->isMe = $my->id == $guests[$i]->id ? true : false; $guests[$i]->isAdmin = $event->isAdmin($guests[$i]->id); $guests[$i]->statusType = $guestsIds[$i]->statusCode; } // Featured $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $pagination = $event->getPagination(); // Output to template $tmpl = new CTemplate(); echo CMiniHeader::showEventMiniHeader($event->id); echo $tmpl->set('event', $event)->set('type', $type)->set('handler', $handler)->set('guests', $guests)->set('eventid', $event->id)->set('isMine', $event->isCreator($my->id))->set('isSuperAdmin', $isSuperAdmin)->set('pagination', $pagination)->set('my', $my)->set('config', $config)->set('featuredList', $featuredList)->fetch('events.viewguest'); }