Example #1
0
 /**
  * Displays the application output in the canvas.
  *
  * @since    1.0
  * @access    public
  * @param    int        The user id that is currently being viewed.
  */
 public function display($uid = null, $docType = null)
 {
     $event = FD::event($uid);
     // Get the article item
     $news = FD::table('EventNews');
     $news->load($this->input->get('newsId', 0, 'int'));
     // Check if the user is really allowed to view this item
     if (!$event->canViewItem()) {
         return $this->redirect($event->getPermalink(false));
     }
     // Get the author of the article
     $author = FD::user($news->created_by);
     // Get the url for the article
     $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $this->app->getAlias(), 'articleId' => $news->id), false);
     // Apply comments for the article
     $comments = FD::comments($news->id, 'news', 'create', SOCIAL_APPS_GROUP_EVENT, array('url' => $url));
     // Apply likes for the article
     $likes = FD::likes()->get($news->id, 'news', 'create', SOCIAL_APPS_GROUP_EVENT);
     // Set the page title
     FD::page()->title($news->get('title'));
     // Retrieve the params
     $params = $this->app->getParams();
     $this->set('app', $this->app);
     $this->set('params', $params);
     $this->set('event', $event);
     $this->set('likes', $likes);
     $this->set('comments', $comments);
     $this->set('author', $author);
     $this->set('news', $news);
     echo parent::display('canvas/item');
 }
Example #2
0
 /**
  * Displays the gender in the position profileHeaderA
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function profileHeaderA($key, $user, $field)
 {
     $value = $field->data;
     // If user didn't set their gender, don't need to do anything
     if (!$value) {
         return;
     }
     $my = FD::user();
     $privacyLib = FD::privacy($my->id);
     if (!$privacyLib->validate('core.view', $field->id, SOCIAL_TYPE_FIELD, $user->id)) {
         return;
     }
     $theme = FD::themes();
     $theme->set('value', $value);
     $theme->set('params', $field->getParams());
     // linkage to advanced search page.
     if ($field->searchable) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'equal';
         $params['conditions[]'] = $value;
         $advsearchLink = FRoute::search($params);
         $theme->set('advancedsearchlink', $advsearchLink);
     }
     echo $theme->output('fields/user/gender/widgets/display');
 }
Example #3
0
 /**
  * Post processing once a user's access has been revoked
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function revoke()
 {
     FD::info()->set($this->getMessage());
     $url = FRoute::profile(array('layout' => 'edit'), false);
     $this->redirect($url);
     $this->close();
 }
Example #4
0
 /**
  * Retrieves the redirection url for sign in / sign out.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getRedirectionUrl($menuId)
 {
     $menu = JFactory::getApplication()->getMenu();
     $menuItem = $menu->getItem($menuId);
     // Set the default return URL.
     $return = FRoute::dashboard(array(), false);
     if ($menuItem) {
         if ($menuItem->component != 'com_easysocial') {
             if (strpos($menuItem->link, '?') > 0) {
                 $return = JRoute::_($menuItem->link . '&Itemid=' . $menuItem->id, false);
             } else {
                 $return = JRoute::_($menuItem->link . '?Itemid=' . $menuItem->id, false);
             }
             // If the logout return is null, it means the menu item is on the home page.
             if (!$return || isset($menuItem->home) && $menuItem->home) {
                 $return = JURI::root();
             }
         }
         if ($menuItem->component == 'com_easysocial') {
             $view = isset($menuItem->query['view']) ? $menuItem->query['view'] : '';
             if ($view) {
                 $queries = $menuItem->query;
                 unset($queries['option']);
                 unset($queries['view']);
                 $arguments = array($queries, false);
                 $return = call_user_func_array(array('FRoute', $view), $arguments);
             }
         }
     }
     return $return;
 }
Example #5
0
 /**
  * Displays the application output in the canvas.
  *
  * @since	1.0
  * @access	public
  * @param	int		The user id that is currently being viewed.
  */
 public function display($userId = null, $docType = null)
 {
     // Require user to be logged in
     FD::requireLogin();
     $id = JRequest::getVar('schedule_id');
     // Get the user that's being accessed.
     $user = FD::user($userId);
     $calendar = FD::table('Calendar');
     $calendar->load($id);
     if (!$calendar->id || !$id) {
         FD::info()->set(false, JText::_('APP_CALENDAR_CANVAS_INVALID_SCHEDULE_ID'), SOCIAL_MSG_ERROR);
         return $this->redirect(FD::profile(array('id' => $user->getAlias()), false));
     }
     $my = FD::user();
     $privacy = FD::privacy($my->id);
     $result = $privacy->validate('apps.calendar', $calendar->id, 'view', $user->id);
     if (!$result) {
         FD::info()->set(false, JText::_('APP_CALENDAR_NO_ACCESS'), SOCIAL_MSG_ERROR);
         JFactory::getApplication()->redirect(FRoute::dashboard());
     }
     FD::page()->title($calendar->title);
     // Render the comments and likes
     $likes = FD::likes();
     $likes->get($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER);
     // Apply comments on the stream
     $comments = FD::comments($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER, array('url' => FRoute::albums(array('layout' => 'item', 'id' => $id))));
     $params = $this->app->getParams();
     $this->set('params', $params);
     $this->set('likes', $likes);
     $this->set('comments', $comments);
     $this->set('calendar', $calendar);
     $this->set('user', $user);
     echo parent::display('canvas/item/default');
 }
Example #6
0
 /**
  * Redirects a notification item to the intended location
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function route()
 {
     // The user needs to be logged in to access notifications
     FD::requireLogin();
     // Get the notification id
     $id = $this->input->get('id', 0, 'int');
     $table = FD::table('Notification');
     $table->load($id);
     // Default redirection URL
     $redirect = FRoute::dashboard(array(), false);
     if (!$id || !$table->id) {
         $this->info->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $this->redirect($redirect);
     }
     // Ensure that the viewer really owns this item
     if ($table->target_id != $this->my->id) {
         $this->info->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_NOT_ALLOWED'), SOCIAL_MSG_ERROR);
         return $this->redirect($redirect);
     }
     // Mark the notification item as read
     $table->markAsRead();
     // Ensure that all & are replaced with &
     $url = str_ireplace('&', '&', $table->url);
     $redirect = FRoute::_($url, false);
     $this->redirect($redirect);
     $this->close();
 }
Example #7
0
 public function display()
 {
     // Get the configuration objects
     $config = FD::config();
     $jConfig = FD::config('joomla');
     // Get the stream library
     $stream = FD::stream();
     $stream->get();
     // Get the result in an array form
     $result = $stream->toArray();
     // Set the document properties
     $doc = JFactory::getDocument();
     $doc->link = FRoute::dashboard();
     FD::page()->title(JText::_('COM_EASYSOCIAL_STREAM_FEED_TITLE'));
     $doc->setDescription(JText::sprintf('COM_EASYSOCIAL_STREAM_FEED_DESC', $jConfig->getValue('sitename')));
     if ($result) {
         $useEmail = $jConfig->getValue('feed_email');
         foreach ($result as $row) {
             $item = new JFeedItem();
             $item->title = $row->title;
             $item->link = FRoute::stream(array('id' => $row->uid));
             $item->description = $row->content;
             $item->date = $row->created->toMySQL();
             $item->author = $row->actor->getName();
             if ($useEmail != 'none') {
                 $item->authorEmail = $jConfig->getValue('mailfrom');
                 if ($useEmail == 'author') {
                     $item->authorEmail = $row->actor->email;
                 }
             }
             $doc->addItem($item);
         }
     }
 }
Example #8
0
 /**
  * Redirects a notification item to the intended location
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function route()
 {
     // The user needs to be logged in to access notifications
     FD::requireLogin();
     // Check for user profile completeness
     FD::checkCompleteProfile();
     $id = JRequest::getInt('id');
     $table = FD::table('Notification');
     $table->load($id);
     if (!$id || !$table->id) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Check if the user is allowed to view this notification item.
     $my = FD::user();
     if ($table->target_id != $my->id) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_NOT_ALLOWED'), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Mark the notification item as read
     $table->markAsRead();
     // Ensure that all & are replaced with &
     $url = str_ireplace('&', '&', $table->url);
     $this->redirect(FRoute::_($url, false));
     $this->close();
 }
Example #9
0
 public function create_report()
 {
     $app = JFactory::getApplication();
     $msg = $app->input->get('message', '', 'STRING');
     $title = $app->input->get('user_title', '', 'STRING');
     $item_id = $app->input->get('itemId', 0, 'INT');
     $log_user = $this->plugin->get('user')->id;
     $data = array();
     $data['message'] = $msg;
     $data['uid'] = $item_id;
     $data['type'] = 'stream';
     $data['title'] = $title;
     $data['extension'] = 'com_easysocial';
     //build share url use for share post through app
     $sharing = FD::get('Sharing', array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item_id, 'external' => true, 'xhtml' => true)), 'display' => 'dialog', 'text' => JText::_('COM_EASYSOCIAL_STREAM_SOCIAL'), 'css' => 'fd-small'));
     $url = $sharing->url;
     $data['url'] = $url;
     // Get the reports model
     $model = FD::model('Reports');
     // Determine if this user has the permissions to submit reports.
     $access = FD::access();
     // Determine if this user has exceeded the number of reports that they can submit
     $total = $model->getCount(array('created_by' => $log_user));
     if ($access->exceeded('reports.limit', $total)) {
         $final_result['message'] = "Limit exceeds";
         $final_result['status'] = true;
         return $final_result;
     }
     // Create the report
     $report = FD::table('Report');
     $report->bind($data);
     // Set the creator id.
     $report->created_by = $log_user;
     // Set the default state of the report to new
     $report->state = 0;
     // Try to store the report.
     $state = $report->store();
     // If there's an error, throw it
     if (!$state) {
         $final_result['message'] = "Can't save report";
         $final_result['status'] = true;
         return $final_result;
     }
     // @badge: reports.create
     // Add badge for the author when a report is created.
     $badge = FD::badges();
     $badge->log('com_easysocial', 'reports.create', $log_user, JText::_('COM_EASYSOCIAL_REPORTS_BADGE_CREATED_REPORT'));
     // @points: reports.create
     // Add points for the author when a report is created.
     $points = FD::points();
     $points->assign('reports.create', 'com_easysocial', $log_user);
     // Determine if we should send an email
     $config = FD::config();
     if ($config->get('reports.notifications.moderators')) {
         $report->notify();
     }
     $final_result['message'] = "Report logged successfully!";
     $final_result['status'] = true;
     return $final_result;
 }
Example #10
0
 /**
  * Responsible to output the html codes that is displayed to
  * a user when their profile is viewed.
  *
  * @since	1.0
  * @access	public
  */
 public function onDisplay($user)
 {
     $value = $this->value;
     if (!$value) {
         return;
     }
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     // If there's no http:// or https:// , automatically append http://
     if (stristr($value, 'http://') === false && stristr($value, 'https://') === false) {
         $value = 'http://' . $value;
     }
     // Push vars to the theme
     $this->set('value', $this->escape($value));
     // linkage to advanced search page.
     $field = $this->field;
     if ($field->searchable) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'contain';
         $params['conditions[]'] = $this->escape($this->value);
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     return $this->display();
 }
Example #11
0
 /**
  * Retrieve the title of the stream
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function getTitle()
 {
     // Get the actors
     $actors = $this->item->actors;
     // Get the source id
     $sourceId = $this->share->uid;
     // Load the stream
     $stream = FD::table('Stream');
     $stream->load($sourceId);
     // If stream cannot be loaded, skip this altogether
     if (!$stream->id) {
         return;
     }
     // Build the permalink to the stream item
     $link = FRoute::stream(array('layout' => 'item', 'id' => $sourceId));
     // Get the target user.
     $target = FD::user($stream->actor_id);
     $actor = $actors[0];
     $theme = FD::get('Themes');
     $theme->set('actor', $actor);
     $theme->set('link', $link);
     $theme->set('target', $target);
     $title = $theme->output('apps/group/shares/streams/stream/title');
     return $title;
 }
Example #12
0
 public function getRegistrationURL()
 {
     $usersConfig = JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration')) {
         return FRoute::registration();
     }
     return null;
 }
Example #13
0
 /**
  * Display user photos on the side bar
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function afterCategory($group)
 {
     $app = $this->getApp();
     $permalink = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'appId' => $app->getAlias()));
     $theme = FD::themes();
     $theme->set('permalink', $permalink);
     $theme->set('group', $group);
     echo $theme->output('themes:/apps/group/members/widgets/header');
 }
Example #14
0
 /**
  * Responsible to display the generic login form via ajax
  *
  * @since	1.0
  * @access	public
  */
 public function form($tpl = null)
 {
     $ajax = FD::ajax();
     $my = FD::user();
     // If user is already logged in, they should not see this page.
     if ($my->id > 0) {
         $this->setMessage(JText::_('COM_EASYSOCIAL_LOGIN_ALREADY_LOGGED_IN'), SOCIAL_MSG_ERROR);
         return $ajax->reject($this->getMessage());
     }
     // Facebook codes.
     $facebook = FD::oauth('Facebook');
     // Get any callback urls.
     $return = FD::getCallback();
     // If return value is empty, always redirect back to the dashboard
     if (!$return) {
         $return = FRoute::dashboard(array(), false);
     }
     // Determine if there's a login redirection
     $config = FD::config();
     $loginMenu = $config->get('general.site.login');
     if ($loginMenu != 'null') {
         $return = FD::get('toolbar')->getRedirectionUrl($loginMenu);
     }
     $return = base64_encode($return);
     $this->set('return', $return);
     $this->set('facebook', $facebook);
     if ($config->get('registrations.enabled')) {
         $profileId = $config->get('registrations.mini.profile', 'default');
         if ($profileId === 'default') {
             $profileId = Foundry::model('profiles')->getDefaultProfile()->id;
         }
         $options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
         $fieldsModel = FD::model('Fields');
         $fields = $fieldsModel->getCustomFields($options);
         if (!empty($fields)) {
             FD::language()->loadAdmin();
             $fieldsLib = FD::fields();
             $session = JFactory::getSession();
             $registration = FD::table('Registration');
             $registration->load($session->getId());
             $data = $registration->getValues();
             $args = array(&$data, &$registration);
             $fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
             $this->set('fields', $fields);
         }
     }
     $contents = parent::display('site/login/dialog.login');
     return $ajax->resolve($contents);
 }
Example #15
0
 public function preview()
 {
     $fileid = JRequest::getInt('uid');
     if (empty($fileid)) {
         FD::info()->set((object) array('message' => JText::_('PLG_FIELDS_FILE_ERROR_INVALID_FILE_ID'), 'type' => SOCIAL_MSG_ERROR));
         $this->redirect(FRoute::dashboard(array(), false));
     }
     $file = FD::table('file');
     $state = $file->load($fileid);
     if (!$state || !$file->hasPreview() || !$this->params->get('allow_preview')) {
         FD::info()->set((object) array('message' => JText::_('PLG_FIELDS_FILE_ERROR_PREVIEW_NOT_ALLOWED'), 'type' => SOCIAL_MSG_ERROR));
         $this->redirect(FRoute::dashboard(array(), false));
     }
     $file->preview();
 }
Example #16
0
 public function format(&$notes)
 {
     if (!$notes) {
         return;
     }
     // Since this is the dashboard view, we may freely use the current user.
     $my = FD::user();
     $stream = FD::stream();
     foreach ($notes as &$note) {
         $comments = FD::comments($note->id, 'notes', 'create', SOCIAL_APPS_GROUP_USER, array('url' => FRoute::apps(array('layout' => 'canvas', 'userid' => $my->getAlias(), 'cid' => $note->id))));
         $likes = FD::likes($note->id, 'notes', 'create', SOCIAL_APPS_GROUP_USER);
         $options = array('comments' => $comments, 'likes' => $likes);
         $note->actions = $stream->getActions($options);
     }
 }
Example #17
0
 public function __construct($config = array())
 {
     // We want to allow child classes to easily access theme configurations on the view
     $this->themeConfig = FD::themes()->getConfig();
     parent::__construct($config);
     // Check if there is a method isFeatureEnabled exists. If it does, we should do a check all the time.
     if (method_exists($this, 'isFeatureEnabled')) {
         $this->isFeatureEnabled();
     }
     // // When the user doesn't have community access, ensure that they can only view selected views.
     if (!$this->my->hasCommunityAccess()) {
         // Get the current view
         $view = $this->getName();
         $layout = $this->input->get('layout', '', 'cmd');
         // If this is an ajax call, we need to allow some ajax calls to go through
         $allowedAjaxNamespaces = array('site/views/profile/showFormError');
         if ($this->doc->getType() == 'ajax') {
             $namespace = $this->input->get('namespace', '', 'default');
             // If this is an ajax call, and the namespace is valid, skip checking below
             if (in_array($namespace, $allowedAjaxNamespaces)) {
                 return;
             }
         }
         // Define allowed views and layout
         $allowedViews = array('profile');
         $allowedLayouts = array('edit');
         // views that we should redirect the user to profile edit page.
         $redirectView = array('dashboard', 'profile');
         // User should be allowed to logout from the site
         $isLogout = $this->input->get('controller', '', 'cmd') == 'account' && $this->input->get('task', '', 'cmd') == 'logout' || $this->input->get('view', '', 'cmd') == 'login' && $this->input->get('layout', '', 'cmd') == 'logout';
         // user should be allowed to save their profile details on the site.
         $isProfileSaving = $this->input->get('controller', '', 'cmd') == 'profile' && $this->input->get('task', '', 'cmd') == 'save';
         if (in_array($view, $redirectView) && !$layout && !$isLogout && !$isProfileSaving) {
             // we need to redirect the user to profile edit page.
             $this->redirect(FRoute::profile(array('layout' => 'edit'), false));
             return;
         }
         // Ensure that the restricted user is not able to view other views
         if (!in_array($view, $allowedViews) && !$isLogout && !$isProfileSaving) {
             return JError::raiseError(500, JText::_('COM_EASYSOCIAL_NOT_ALLOWED_TO_VIEW_SECTION'));
         }
         // Ensure that the user is only viewing the allowed layouts
         if (!in_array($layout, $allowedLayouts) && !$isLogout && !$isProfileSaving) {
             return JError::raiseError(500, JText::_('COM_EASYSOCIAL_NOT_ALLOWED_TO_VIEW_SECTION'));
         }
     }
 }
Example #18
0
 /**
  * Default user listings page.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	null
  */
 public function display($tpl = null)
 {
     // Disallow access
     if (!$this->authorise('easysocial.access.setting')) {
         return $this->app->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
     }
     // Set page heading
     $this->setHeading(JText::_('COM_EASYSOCIAL_TITLE_HEADING_SETTINGS'));
     // Set page icon.
     $this->setIcon('ies-cog-2');
     // Set page description
     $this->setDescription(JText::_('COM_EASYSOCIAL_DESCRIPTION_ACCESS'));
     $this->redirect(FRoute::_('index.php?option=com_easysocial&view=settings&layout=form&page=general'));
     $active = JRequest::getVar('active', 'general');
     $this->set('active', $active);
     return parent::display('admin/settings/default');
 }
Example #19
0
 /**
  * Displays the application output in the canvas.
  *
  * @since    1.0
  * @access    public
  * @param    int        The user id that is currently being viewed.
  */
 public function display($uid = null, $docType = null)
 {
     FD::requireLogin();
     $event = FD::event($uid);
     if (!$event->canViewItem()) {
         return $this->redirect($event->getPermalink(false));
     }
     // Load up the app params
     $params = $this->app->getParams();
     // Get the discussion item
     $id = $this->input->get('discussionId', 0, 'int');
     $discussion = FD::table('Discussion');
     $discussion->load($id);
     // Get the author of the article
     $author = FD::user($discussion->created_by);
     // Get the url for the article
     $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $this->app->getAlias(), 'discussionId' => $discussion->id), false);
     // Set the page title
     FD::page()->title($discussion->get('title'));
     // Increment the hits for this discussion item
     $discussion->addHit();
     // Get a list of other news
     $model = FD::model('Discussions');
     $replies = $model->getReplies($discussion->id, array('ordering' => 'created'));
     $participants = $model->getParticipants($discussion->id);
     // Get the answer
     $answer = false;
     if ($discussion->answer_id) {
         $answer = FD::table('Discussion');
         $answer->load($discussion->answer_id);
         $answer->author = FD::user($answer->created_by);
     }
     // Determines if we should allow file sharing
     $access = $event->getAccess();
     $files = $access->get('files.enabled', true);
     $this->set('app', $this->app);
     $this->set('files', $files);
     $this->set('params', $params);
     $this->set('answer', $answer);
     $this->set('participants', $participants);
     $this->set('discussion', $discussion);
     $this->set('event', $event);
     $this->set('replies', $replies);
     $this->set('author', $author);
     echo parent::display('canvas/item');
 }
Example #20
0
 /**
  * Renders the sidebar widget for group members
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return	
  */
 public function sidebarBottom($groupId)
 {
     if (!$this->app->getParams()->get('show_members', true)) {
         return;
     }
     $theme = FD::themes();
     $params = $this->app->getParams();
     $limit = (int) $params->get('limit', 10);
     // Load up the group
     $group = FD::group($groupId);
     $options = array('state' => SOCIAL_STATE_PUBLISHED, 'limit' => $limit);
     $model = FD::model('Groups');
     $members = $model->getMembers($group->id, $options);
     $link = FRoute::groups(array('id' => $group->getAlias(), 'appId' => $this->app->getAlias(), 'layout' => 'item'));
     $theme->set('members', $members);
     $theme->set('link', $link);
     echo $theme->output('themes:/apps/group/members/widgets/widget.members');
 }
Example #21
0
 /**
  * Displays the application output in the canvas.
  *
  * @since    1.0
  * @access    public
  * @param    int        The user id that is currently being viewed.
  */
 public function display($eventId = null, $docType = null)
 {
     // Load up the event
     $event = FD::event($eventId);
     // Get the event params
     $params = $event->getParams();
     // Load up the events model
     $model = FD::model('Events');
     $type = FD::input()->getString('type', 'going');
     $options = array();
     if ($type === 'going') {
         $options['state'] = SOCIAL_EVENT_GUEST_GOING;
     }
     if ($params->get('allowmaybe') && $type === 'maybe') {
         $options['state'] = SOCIAL_EVENT_GUEST_MAYBE;
     }
     if ($params->get('allownotgoingguest') && $type === 'notgoing') {
         $options['state'] = SOCIAL_EVENT_GUEST_NOT_GOING;
     }
     if ($event->isClosed() && $type === 'pending') {
         $options['state'] = SOCIAL_EVENT_GUEST_PENDING;
     }
     if ($type === 'admin') {
         $options['admin'] = 1;
     }
     $this->set('type', $type);
     $guests = $model->getGuests($event->id, $options);
     $pagination = $model->getPagination();
     $this->set('event', $event);
     $this->set('guests', $guests);
     $eventAlias = $event->getAlias();
     $appAlias = $this->app->getAlias();
     $permalinks = array('going' => '', 'notgoing' => '', 'maybe' => '', 'admin' => '', 'pending' => '');
     // Avoid using $filter because it is a FRoute reserved word
     foreach ($permalinks as $key => &$value) {
         $value = FRoute::events(array('layout' => 'item', 'id' => $eventAlias, 'appId' => $appAlias, 'type' => $key));
     }
     $this->set('permalinks', $permalinks);
     $myGuest = $event->getGuest();
     $this->set('myGuest', $myGuest);
     echo parent::display('events/default');
 }
Example #22
0
 public function display($tpl = null)
 {
     $fieldid = JRequest::getInt('id');
     $task = JRequest::getWord('task');
     $field = FD::table('field');
     $state = $field->load($fieldid);
     if (!$state) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_FIELDS_INVALID_ID'), SOCIAL_MSG_ERROR);
         $this->redirect(FRoute::dashboard(array(), false));
         $this->close();
     }
     $app = $field->getApp();
     if (!$app) {
         FD::info()->set(JText::sprintf('COM_EASYSOCIAL_FIELDS_APP_DOES_NOT_EXIST', $app->element), SOCIAL_MSG_ERROR);
         $this->redirect(FRoute::dashboard(array(), false));
         $this->close();
     }
     $base = SOCIAL_FIELDS . '/' . $app->group . '/' . $app->element . '/views';
     $classname = 'SocialFieldView' . ucfirst($app->group) . ucfirst($app->element);
     if (!class_exists($classname)) {
         if (!JFile::exists($base . '/' . $app->element . '.php')) {
             FD::info()->set(JText::sprintf('COM_EASYSOCIAL_FIELDS_VIEW_DOES_NOT_EXIST', $app->element), SOCIAL_MSG_ERROR);
             $this->redirect(FRoute::dashboard(array(), false));
             $this->close();
         }
         require_once $base . '/' . $app->element . '.php';
     }
     if (!class_exists($classname)) {
         FD::info()->set(JText::sprintf('COM_EASYSOCIAL_FIELDS_CLASS_DOES_NOT_EXIST', $classname), SOCIAL_MSG_ERROR);
         $this->redirect(FRoute::dashboard(array(), false));
         $this->close();
     }
     $view = new $classname($app->group, $app->element);
     if (!is_callable(array($view, $task))) {
         FD::info()->set(JText::sprintf('COM_EASYSOCIAL_FIELDS_METHOD_DOES_NOT_EXIST', $task), SOCIAL_MSG_ERROR);
         $this->redirect(FRoute::dashboard(array(), false));
         $this->close();
     }
     $view->init($field);
     return $view->{$task}();
 }
Example #23
0
 /**
  * Suggest a list of friend names for a user.
  *
  * @since	1.0
  * @access	public
  * @param	null
  *
  */
 public function filter()
 {
     // Check for valid tokens.
     FD::checkToken();
     // Check for valid user.
     FD::requireLogin();
     // Load friends model.
     $model = FD::model('Followers');
     $limit = FD::themes()->getConfig()->get('followersLimit', 20);
     // Load the view.
     $view = $this->getCurrentView();
     // Get the filter types.
     $type = JRequest::getVar('type');
     // Get the user id that we should load for.
     $userId = JRequest::getInt('id');
     if (!$userId) {
         $userId = null;
     }
     // Try to load the target user.
     $user = FD::user($userId);
     $users = array();
     if ($type == 'followers') {
         $users = $model->getFollowers($userId, array('limit' => $limit));
     }
     if ($type == 'following') {
         $users = $model->getFollowing($userId, array('limit' => $limit));
     }
     if ($type == 'suggest') {
         $users = $model->getSuggestions($user->id);
     }
     $pagination = $model->getPagination();
     // Define those query strings here
     $pagination->setVar('Itemid', FRoute::getItemId('followers'));
     $pagination->setVar('view', 'followers');
     $pagination->setVar('filter', $type);
     if (FD::user()->id != $userId) {
         $pagination->setVar('userid', $user->getAlias());
     }
     return $view->call(__FUNCTION__, $type, $users, $userId, $pagination);
 }
Example #24
0
 public function load($options = array())
 {
     if (!isset($options['url'])) {
         $options['url'] = FRoute::_(JRequest::getURI());
     }
     $this->url = $options['url'];
     // If display mode is specified, set it accordingly.
     if (isset($options['display'])) {
         $this->display = $options['display'];
     }
     // Set the default text to our own text.
     $this->text = JText::_('COM_EASYSOCIAL_SHARING_SHARE_THIS');
     // If text is provided, allow user to override the default text.
     if (isset($options['text'])) {
         $this->text = $options['text'];
     }
     // Obey settings
     $config = FD::config();
     foreach (self::$availableVendors as $vendor) {
         if ($config->get('sharing.vendors.' . $vendor)) {
             $this->vendors[] = $vendor;
         }
     }
     // Force exclude
     if (isset($options['exclude'])) {
         $this->vendors = array_diff($this->vendors, self::$availableVendors);
         unset($options['exclude']);
     }
     // Force include
     if (isset($options['include'])) {
         $notInList = array_diff($options['include'], $this->vendors);
         $this->vendors = array_merge($this->vendors, $options['include']);
         unset($options['include']);
     }
     if (isset($options['css'])) {
         $this->css = $options['css'];
     }
     $this->options = $options;
 }
Example #25
0
 public function getTitle()
 {
     $actors = $this->item->actors;
     $names = FD::string()->namesToStream($actors, true, 3);
     // Get the source id
     $sourceId = $this->share->uid;
     // Load the stream
     $stream = FD::table('Stream');
     $stream->load($sourceId);
     if (!$stream->id) {
         return '';
     }
     $link = FRoute::stream(array('layout' => 'item', 'id' => $sourceId));
     // Get the target user.
     $target = FD::user($stream->actor_id);
     $actor = $actors[0];
     $theme = FD::get('Themes');
     $theme->set('actor', $actor);
     $theme->set('link', $link);
     $theme->set('target', $target);
     $title = $theme->output('apps/user/shares/streams/stream/title');
     return $title;
 }
Example #26
0
 /**
  * Responsible to output the html codes that is displayed to
  * a user when their profile is viewed.
  *
  * @since	1.0
  * @access	public
  */
 public function onDisplay($user)
 {
     $value = $this->value;
     if ($value == '') {
         return;
     }
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     // linkage to advanced search page.
     $field = $this->field;
     if ($field->searchable) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'equal';
         $params['conditions[]'] = $this->value;
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     // Push variables into theme.
     $this->set('value', $value);
     return $this->display();
 }
Example #27
0
 /**
  * Displays the gender in the position profileHeaderA
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function profileHeaderA($key, $user, $field)
 {
     $dateString = '';
     $theme = FD::themes();
     if ($user->lastvisitDate == '' || $user->lastvisitDate == '0000-00-00 00:00:00') {
         $dateString = JText::_('PLG_FIELDS_JOOMLA_LASTLOGIN_WIDGETS_NEVER_LOGGED_IN');
     } else {
         $llDate = FD::date($user->lastvisitDate);
         // linkage to advanced search page.
         if ($field->searchable) {
             $date = $llDate->toFormat('Y-m-d');
             $params = array('layout' => 'advanced');
             $params['criterias[]'] = $field->unique_key . '|' . $field->element;
             $params['operators[]'] = 'between';
             $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
             $advsearchLink = FRoute::search($params);
             $theme->set('advancedsearchlink', $advsearchLink);
         }
         $dateString = $llDate->toLapsed();
         $dateString = JText::sprintf('PLG_FIELDS_JOOMLA_LASTLOGIN_WIDGETS_LAST_LOGGED_IN', $dateString);
     }
     $theme->set('value', $dateString);
     echo $theme->output('fields/user/joomla_lastlogin/widgets/display');
 }
Example #28
0
 /**
  * Displays the gender in the position profileHeaderA
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function profileHeaderA($key, $user, $field)
 {
     $dateString = '';
     $theme = FD::themes();
     $regDate = FD::date($user->registerDate);
     // linkage to advanced search page.
     if ($field->searchable) {
         $date = $regDate->toFormat('Y-m-d');
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'between';
         $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
         $advsearchLink = FRoute::search($params);
         $theme->set('advancedsearchlink', $advsearchLink);
     }
     $fieldParams = $field->getParams();
     $format = 'd M Y';
     switch ($fieldParams->get('date_format')) {
         case 2:
         case '2':
             $format = 'M d Y';
             break;
         case 3:
         case '3':
             $format = 'Y d M';
             break;
         case 4:
         case '4':
             $format = 'Y M d';
             break;
     }
     $dateString = $regDate->toFormat($format);
     $dateString = JText::sprintf('PLG_FIELDS_JOOMLA_JOINDATE_WIDGETS_MEMBER_SINCE', $dateString);
     $theme->set('value', $dateString);
     echo $theme->output('fields/user/joomla_joindate/widgets/display');
 }
Example #29
0
			<?php 
if ($search) {
    ?>
			<div class="fd-navbar-search pull-right" data-nav-search>
				<form action="<?php 
    echo JRoute::_('index.php');
    ?>
" method="post">
					<i class="ies-search"></i>
					<input type="text" name="q" class="search-query" autocomplete="off" data-nav-search-input placeholder="<?php 
    echo JText::_('COM_EASYSOCIAL_TOOLBAR_SEARCH', true);
    ?>
" />

					<?php 
    echo $this->html('form.itemid', FRoute::getItemId('search'));
    ?>
					<input type="hidden" name="view" value="search" />
					<input type="hidden" name="option" value="com_easysocial" />
				</form>
			</div>
			<?php 
}
?>

			<ul class="fd-nav pull-right">
				<?php 
if ($this->my->guest && $login) {
    ?>
				<li class="dropdown_">
					<?php 
Example #30
0
 /**
  * Displays the age in the position profileHeaderA
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function profileHeaderA($key, $user, $field)
 {
     $my = FD::user();
     $privacyLib = FD::privacy($my->id);
     if (!$privacyLib->validate('core.view', $field->id, SOCIAL_TYPE_FIELD, $user->id)) {
         return;
     }
     $params = $field->getParams();
     if ($params->get('show_age') && !$privacyLib->validate('field.birthday', $field->id, 'year', $user->id)) {
         return;
     }
     // Get the current stored value.
     $value = $field->data;
     if (empty($value)) {
         return false;
     }
     if (is_array($value) && isset($value['date']) && !$value['date']) {
         // empty value. just return empty string.
         return false;
     }
     $data = new SocialFieldsUserDateTimeObject($value);
     $date = null;
     if (!empty($data->year) && !empty($data->month) && !empty($data->day)) {
         $date = $data->year . '-' . $data->month . '-' . $data->day;
     }
     if (!$date) {
         return;
     }
     $allowYear = true;
     $theme = FD::themes();
     if ($params->get('show_age')) {
         // Compute the age now.
         $age = $this->getAge($date);
         $theme->set('value', $age);
     } else {
         $allowYear = $privacyLib->validate('field.birthday', $field->id, 'year', $user->id);
         $format = $allowYear ? 'j F Y' : 'j F';
         $birthday = FD::date($date, false)->format($format);
         $theme->set('value', $birthday);
     }
     // linkage to advanced search page.
     if ($allowYear && $field->searchable) {
         $date = $data->format('Y-m-d');
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'between';
         $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
         $advsearchLink = FRoute::search($params);
         $theme->set('advancedsearchlink', $advsearchLink);
     }
     $theme->set('params', $params);
     echo $theme->output('fields/user/birthday/widgets/display');
 }