/** * Dialog to confirm a report. * * @since 1.0 * @access public */ public function confirmReport() { $ajax = FD::ajax(); // Determine if the user is a guest $my = FD::user(); $config = FD::config(); if (!$my->id) { if (!$config->get('reports.guests', false)) { return; } } else { // Check if user is really allowed to submit any reports. $access = FD::access(); if (!$access->allowed('reports.submit')) { $this->setMessage(JText::_('COM_EASYSOCIAL_REPORTS_NOT_ALLOWED_TO_SUBMIT_REPORTS'), SOCIAL_MSG_ERROR); return $ajax->reject($this->getMessage()); } } $title = JRequest::getVar('title', JText::_('COM_EASYSOCIAL_REPORTS_DIALOG_TITLE')); $description = JRequest::getVar('description', ''); $theme = FD::themes(); $theme->set('title', $title); $theme->set('description', $description); $html = $theme->output('site/reports/dialog.form'); return $ajax->resolve($html); }
/** * Default method to display the registration page. * * @since 1.0 * @access public * @author Mark Lee <*****@*****.**> */ function item($tpl = null) { // Check for user profile completeness FD::checkCompleteProfile(); $config = FD::config(); if (!$config->get('badges.enabled')) { return $this->redirect(FRoute::dashboard(array(), false)); } // Get id of badge $id = JRequest::getInt('id'); $badge = FD::table('Badge'); $badge->load($id); if (!$id || !$badge->id) { FD::info()->set(JText::_('COM_EASYSOCIAL_BADGES_INVALID_BADGE_ID_PROVIDED'), SOCIAL_MSG_ERROR); $this->redirect(FRoute::badges()); $this->close(); } // Load the badge language $badge->loadLanguage(); // Set the page title FD::page()->title($badge->get('title')); // Set the page breadcrumb FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_BADGES'), FRoute::badges()); FD::page()->breadcrumb($badge->get('title')); // Get the badges model $options = array('start' => 0, 'limit' => FD::themes()->getConfig()->get('achieverslimit', 50)); $achievers = $badge->getAchievers($options); $totalAchievers = $badge->getTotalAchievers(); $this->set('totalAchievers', $totalAchievers); $this->set('achievers', $achievers); $this->set('badge', $badge); parent::display('site/badges/default.item'); }
public function profileHeaderB($key, $user, $field) { // Get the data $data = $field->data; if (!$data) { return; } $my = FD::user(); $privacyLib = FD::privacy($my->id); if (!$privacyLib->validate('core.view', $field->id, SOCIAL_TYPE_FIELD, $user->id)) { return; } $obj = FD::makeObject($data); $theme = FD::themes(); $hide = true; foreach ($obj as $k => &$v) { $v = $theme->html('string.escape', $v); if (!empty($v)) { $hide = false; } } if ($hide) { return true; } $params = $field->getParams(); // Convert country to full text if (!empty($obj->country)) { $obj->country_code = $obj->country; $obj->country = SocialFieldsUserAddressHelper::getCountryName($obj->country, $params->get('data_source')); } $theme->set('value', $obj); $theme->set('params', $field->getParams()); echo $theme->output('fields/user/address/widgets/display'); }
/** * Displays confirmation before deleting an album * * @since 1.0 * @access public * @param string * @return */ public function confirmDelete() { $ajax = FD::ajax(); $theme = FD::themes(); $output = $theme->output('admin/albums/dialog.delete'); return $ajax->resolve($output); }
/** * Displays the markitup html * * @since 1.2 * @access public * @param string * @return */ public function editor($nameAttribute, $value = '', $config = array(), $attributes = array()) { $theme = FD::themes(); $uniqueId = uniqid(); $attr = ''; if (!empty($attributes)) { foreach ($attributes as $key => $val) { $attr .= ' ' . $key . '="' . $val . '"'; } } // Determines if we should display the file browser $files = isset($config['files']) && $config['files'] ? true : false; // Determine the correct uid and type $uid = isset($config['uid']) ? $config['uid'] : FD::user()->id; $type = isset($config['type']) ? $config['type'] : SOCIAL_TYPE_USER; if (isset($config['controllerName'])) { $theme->set('controllerName', $config['controllerName']); } $theme->set('uid', $uid); $theme->set('type', $type); $theme->set('files', $files); $theme->set('value', $value); $theme->set('attr', $attr); $theme->set('nameAttribute', $nameAttribute); $theme->set('uniqueId', $uniqueId); $output = $theme->output('site/bbcode/editor'); return $output; }
/** * Renders a login button. * * @since 1.0 * @access public */ public function getLoginButton($uid, $type, $callback = '', $permissions = array(), $display = 'popup') { $theme = FD::themes(); // Check if the user has already authenticated. $table = FD::table('OAuth'); $exists = $table->load(array('uid' => $uid, 'type' => $type)); if ($exists) { $output = $theme->output('site/login/linkedin.authenticated'); } else { $callback = urlencode($callback); // Ensure that the callback is urlencoded $callback = trim(JURI::root(), '/') . '/administrator/index.php?option=com_easysocial&controller=oauth&task=grant&client=linkedin&uid=' . $uid . '&type=' . $type . '&callback=' . $callback; $this->setCallbackUrl($callback); $requestToken = $this->retrieveTokenRequest(); $_SESSION['oauth']['linkedin']['request'] = $requestToken['linkedin']; $url = LINKEDIN::_URL_AUTH . $requestToken['linkedin']['oauth_token']; $theme->set('url', $url); $theme->set('appId', $this->appId); $theme->set('appSecret', $this->appSecret); $theme->set('callback', $callback); $theme->set('permissions', $permissions); $output = $theme->output('site/login/linkedin'); } return $output; }
public function confirmRestore() { $ajax = FD::ajax(); $theme = FD::themes(); $output = $theme->output('admin/stream/dialog.restore'); return $ajax->resolve($output); }
/** * Retrieves the list of groups * * @since 1.2 * @access public * @param string * @return */ public function getGroups($user, $params) { $model = FD::model('Groups'); $isUserAViewer = FD::user()->id == $user->id ? true : false; $groupOptions = array('uid' => $user->id, 'state' => SOCIAL_CLUSTER_PUBLISHED); // if $user is the current viewer, we will get all the groups if ($isUserAViewer) { $groupOptions['types'] = 'all'; } $groups = $model->getGroups($groupOptions); $limit = $params->get('widget_profile_total', 5); // Get the total groups the user owns $groupCntOptions = array('types' => 'open'); // if $user is the current viewer, we will get all the groups if ($isUserAViewer) { $groupCntOptions = array(); } $total = $user->getTotalGroups($groupCntOptions); $theme = FD::themes(); $theme->set('user', $user); $theme->set('limit', $limit); $theme->set('groups', $groups); $theme->set('total', $total); return $theme->output('themes:/apps/user/groups/widgets/profile/groups'); }
public function sidebarBottom($groupId) { $params = $this->getParams(); if (!$params->get('widget', true)) { return; } $my = FD::user(); $days = $params->get('widgets_days', 14); $total = $params->get('widgets_total', 5); $date = FD::date(); $now = $date->toSql(); $future = FD::date($date->toUnix() + $days * 24 * 60 * 60)->toSql(); $options = array(); $options['start-after'] = $now; $options['start-before'] = $future; $options['limit'] = $total; $options['state'] = SOCIAL_STATE_PUBLISHED; $options['ordering'] = 'start'; $options['group_id'] = $groupId; $events = FD::model('Events')->getEvents($options); if (empty($events)) { return; } $theme = FD::themes(); $theme->set('events', $events); $theme->set('app', $this->app); echo $theme->output('themes:/apps/user/events/widgets/dashboard/upcoming'); }
public function heading() { $theme = FD::themes(); $theme->set('event', $this->event); $output = $theme->output('site/albums/header.event'); return $output; }
/** * Renders the user group tree listing. * * @since 1.0 * @access public * @param object The object to check against. * @param string The controller to be called. * @param string The key for the object. * * @author Mark Lee <*****@*****.**> */ public static function groups($name = 'gid', $selected = '', $exclude = array(), $checkSuperAdmin = false) { static $count; $count++; // If selected value is a string, we assume that it's a json object. if (is_string($selected)) { $json = FD::json(); $selected = $json->decode($selected); } $version = FD::getInstance('Version')->getVersion(); if ($version >= '1.6') { $groups = self::getGroups(); $theme = FD::themes(); $selected = FD::makeArray($selected); $isSuperAdmin = JFactory::getUser()->authorise('core.admin'); $theme->set('name', $name); $theme->set('checkSuperAdmin', $checkSuperAdmin); $theme->set('isSuperAdmin', $isSuperAdmin); $theme->set('selected', $selected); $theme->set('count', $count); $theme->set('groups', $groups); return $theme->output('admin/html/tree.groups'); } return JHTML::_('select.genericlist', JFactory::getAcl()->get_group_children_tree(null, 'USERS', false), 'gid', 'size="10"', 'value', 'text', $selected); }
public function onPrepareStoryPanel($story) { if ($story->clusterType != SOCIAL_TYPE_GROUP) { return; } $params = $this->getParams(); // Determine if we should attach ourselves here. if (!$params->get('story_event', true)) { return; } if (!FD::config()->get('events.enabled')) { return; } // Create plugin object $plugin = $story->createPlugin('event', 'panel'); // Get the theme class $theme = FD::themes(); // Get the available event category $categories = FD::model('EventCategories')->getCreatableCategories(FD::user()->getProfile()->id); $theme->set('categories', $categories); $plugin->button->html = $theme->output('apps/user/events/story/panel.button'); $plugin->content->html = $theme->output('apps/user/events/story/panel.content'); $script = FD::get('Script'); $plugin->script = $script->output('apps:/user/events/story'); return $plugin; }
/** * Displays the registration request * * @since 1.3 * @access public * @param string * @return */ public function request() { $id = $this->input->getInt('id'); $table = JTable::getInstance('Module'); $table->load($id); FD::language()->load('mod_easysocial_registration_requester', JPATH_SITE); $params = FD::registry($table->params); $profileId = $params->get('profile_id'); // If there's no profile id, then we automatically assign the default profile id if (empty($profileId)) { $profileModel = FD::model('profiles'); $defaultProfile = $profileModel->getDefaultProfile(); $profileId = $defaultProfile->id; } $fieldsModel = FD::model('fields'); $options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId); $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); } $theme = FD::themes(); $theme->set('params', $params); $theme->set('config', FD::config()); $theme->set('fields', $fields); $output = $theme->output('site/registration/dialog.request'); return $this->ajax->resolve($output); }
protected function getInput() { // Load the language file. FD::language()->loadAdmin(); // Render the headers FD::page()->start(); $theme = FD::themes(); $label = (string) $this->element['label']; $name = (string) $this->name; $title = JText::_('COM_EASYSOCIAL_JFIELD_SELECT_PROFILE'); if ($this->value) { $profile = FD::table('Profile'); $profile->load($this->value); $title = $profile->get('title'); } $theme->set('name', $name); $theme->set('id', $this->id); $theme->set('value', $this->value); $theme->set('label', $label); $theme->set('title', $title); $output = $theme->output('admin/jfields/profile'); // We do not want to process stylesheets on Joomla 2.5 and below. $options = array(); if (FD::version()->getVersion() < 3) { $options['processStylesheets'] = false; } FD::page()->end($options); return $output; }
/** * Displays the amazon settings form * * @since 1.0 * @access public * @param string * @return */ public function amazon() { $ajax = FD::ajax(); $theme = FD::themes(); $contents = $theme->output('admin/settings/forms/dialog.storage.amazon'); $ajax->resolve($contents); }
public function heading() { $theme = FD::themes(); $theme->set('group', $this->group); $output = $theme->output('site/albums/header.group'); return $output; }
public function getContent() { $source = explode('.', $this->share->element); $element = $source[0]; $group = $source[1]; $message = $this->formatContent($this->share->content); $preview = ""; $content = ""; $title = ""; $stream = FD::stream(); $data = $stream->getItem($this->share->uid); if ($data !== true && !empty($data)) { $title = $data[0]->title; $content = $data[0]->content; if (isset($data[0]->preview) && $data[0]->preview) { $preview = $data[0]->preview; } } $theme = FD::themes(); $theme->set('message', $message); $theme->set('content', $content); $theme->set('preview', $preview); $theme->set('title', $title); $html = $theme->output('apps/user/shares/streams/stream/content'); return $html; }
public function heading() { $theme = FD::themes(); $theme->set('user', $this->user); $output = $theme->output('site/albums/header.user'); return $output; }
/** * Display dialog for confirming deletion * * @since 1.0 * @access public */ public function confirmDelete() { $ajax = FD::ajax(); $theme = FD::themes(); $contents = $theme->output('admin/points/dialog.delete'); return $ajax->resolve($contents); }
protected function getInput() { FD::language()->loadAdmin(); FD::language()->loadSite(); FD::page()->start(); JFactory::getDocument()->addStylesheet(rtrim(JURI::root(), '/') . '/administrator/components/com_easysocial/themes/default/styles/style.css'); $theme = FD::themes(); $label = (string) $this->element['label']; $name = (string) $this->name; $title = JText::_('COM_EASYSOCIAL_JFIELD_SELECT_EVENT'); if ($this->value) { $id = explode(':', $this->value); $id = $id[0]; $group = FD::group($id); $title = $group->getName(); } $theme->set('name', $name); $theme->set('id', $this->id); $theme->set('value', $this->value); $theme->set('label', $label); $theme->set('title', $title); $output = $theme->output('admin/jfields/event'); // We do not want to process stylesheets on Joomla 2.5 and below. $options = array(); if (FD::version()->getVersion() < 3) { $options['processStylesheets'] = false; } FD::page()->end($options); return $output; }
/** * Responsible to output ejs theme files given the namespace. * * @since 1.0 * @access public * @param string The current namespace. */ public function getView($path = '', $type = '', $prefix = '', $config = array()) { $theme = FD::themes(); $theme->extension = 'ejs'; $output = $theme->output($path); return $output; }
/** * Filters the output of members * * @since 1.2 * @access public * @return */ public function filterMembers() { // Check for request forgeriess FD::checkToken(); // Ensure that the user is logged in. FD::requireLogin(); // Load up ajax lib $ajax = FD::ajax(); // Get the group $id = JRequest::getInt('id'); $group = FD::group($id); // @TODO: Check whether the viewer can really view the contents // Get the current filter $filter = JRequest::getWord('filter'); $options = array(); if ($filter == 'admin') { $options['admin'] = true; } if ($filter == 'pending') { $options['state'] = SOCIAL_GROUPS_MEMBER_PENDING; } $model = FD::model('Groups'); $users = $model->getMembers($group->id, $options); $pagination = $model->getPagination(); // Load the contents $theme = FD::themes(); $theme->set('pagination', $pagination); $theme->set('group', $group); $theme->set('users', $users); $contents = $theme->output('apps/group/members/groups/default.list'); return $ajax->resolve($contents); }
public function confirmMigration() { $ajax = FD::ajax(); $theme = FD::themes(); $contents = $theme->output('admin/migrators/dialog.confirm'); return $ajax->resolve($contents); }
/** * 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'); }
/** * Displays the dialog to allow user to crop avatar * * @since 1.2 * @access public * @param string * @return */ public function crop() { // Require the user to be logged in FD::requireLogin(); // Load up the ajax library $ajax = FD::ajax(); // Get the unique object. $uid = JRequest::getInt('uid'); $type = JRequest::getCmd('type'); // Get photo id $id = JRequest::getInt('id'); $table = FD::table('Photo'); $table->load($id); $redirectUrl = JRequest::getVar('redirectUrl', ''); // Load up the library $lib = FD::photo($table->uid, $table->type, $table); if (!$table->id) { return $this->deleted($lib); } // Check if the user is really allowed to upload avatar if (!$lib->canUseAvatar()) { return $ajax->reject(); } $redirect = JRequest::getInt('redirect', 1); $theme = FD::themes(); $theme->set('uid', $uid); $theme->set('type', $type); $theme->set('redirectUrl', $redirectUrl); $theme->set('photo', $lib->data); $theme->set('redirect', $redirect); $output = $theme->output('site/avatar/crop'); return $ajax->resolve($output); }
public function getContent() { $message = $this->formatContent($this->share->content); // Load the photo object $photo = FD::table('Photo'); $photo->load($this->share->uid); // Get user's privacy. $my = FD::user(); $privacy = $my->getPrivacy(); if (!$privacy->validate('photos.view', $photo->id, SOCIAL_TYPE_PHOTO, $photo->uid)) { $theme = FD::themes(); $html = $theme->output('site/stream/restricted.text'); return $html; } // Get the photo app params $app = FD::table('App'); $app->load(array('element' => 'photo', 'group' => 'user')); $params = $app->getParams(); $theme = FD::themes(); $theme->set('params', $params); $theme->set('photo', $photo); $theme->set('message', $message); $html = $theme->output('apps/user/shares/streams/photos/content'); return $html; }
/** * Returns an array of news item in JSON format. * * @since 1.0 * @access public * @param Array A list of news items. * @return SocialAjax * */ public function getNews($news, $appNews = array()) { $ajax = FD::ajax(); // Format the output of the news item since we need the following values // day,month foreach ($news as &$item) { $date = explode('/', $item->date); $item->day = $date[0]; $item->month = $date[1]; } $theme = FD::themes(); $theme->set('items', $news); $content = $theme->output('admin/news/items'); if ($appNews) { foreach ($appNews as &$appItem) { $date = FD::date($appItem->updated); $appItem->lapsed = $date->toLapsed(); $appItem->day = $date->format('d'); $appItem->month = $date->format('M'); } } $theme = FD::themes(); $theme->set('items', $appNews); $apps = $theme->output('admin/news/apps'); return $ajax->resolve($content, $apps); }
/** * 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::themes(); $theme->set('actor', $actor); $theme->set('link', $link); $theme->set('target', $target); $title = $theme->output('apps/event/shares/streams/stream/title'); return $title; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Load the language file. FD::language()->loadAdmin(); // Render the headers FD::page()->start(); // Attach dialog's css file. JFactory::getDocument()->addStylesheet(rtrim(JURI::root(), '/') . '/administrator/components/com_easysocial/themes/default/styles/style.css'); $theme = FD::themes(); $label = (string) $this->element['label']; $name = (string) $this->name; $title = JText::_('COM_EASYSOCIAL_JFIELD_SELECT_BADGE'); if ($this->value) { $badge = FD::table('Badge'); $badge->load($this->value); $title = $badge->get('title'); } $theme->set('name', $name); $theme->set('id', $this->id); $theme->set('value', $this->value); $theme->set('label', $label); $theme->set('title', $title); $output = $theme->output('admin/jfields/badge'); // We do not want to process stylesheets on Joomla 2.5 and below. $options = array(); if (FD::version()->getVersion() < 3) { $options['processStylesheets'] = false; } FD::page()->end($options); return $output; }
public function confirmFilterDelete() { $ajax = FD::ajax(); $theme = FD::themes(); $contents = $theme->output('site/advancedsearch/user/dialog.filter.delete'); return $ajax->resolve($contents); }