/** * 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'); }
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 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'); $eventId = $jinput->get('eventid', '', '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('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 = ''; $eventMiniHeader = ''; $targetUserId = $jinput->get('userid', '', 'INT'); // Show miniheader if ($task != 'viewgroup' && $view != 'events') { $groupMiniHeader = CMiniHeader::showGroupMiniHeader($groupId); $eventMiniHeader = CMiniHeader::showEventMiniHeader($eventId); } elseif ($task == 'myevents' && $targetUserId && $targetUserId != $my->id) { //show miniheader if this event list belongs to others $miniheader = CMiniHeader::showMiniHeader($targetUserId); } elseif ($task == 'create' && $view == 'events') { $groupMiniHeader = CMiniHeader::showGroupMiniHeader($groupId); } $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('eventMiniHeader', $eventMiniHeader)->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; }