本文整理汇总了PHP中FD::checkCompleteProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::checkCompleteProfile方法的具体用法?PHP FD::checkCompleteProfile怎么用?PHP FD::checkCompleteProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FD
的用法示例。
在下文中一共展示了FD::checkCompleteProfile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: route
/**
* 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();
}
示例2: display
/**
* Responsible to output the single stream layout.
*
* @access public
* @return null
*
*/
public function display()
{
// Unauthorized users should not be allowed to access this page.
FD::requireLogin();
// Check for user profile completeness
FD::checkCompleteProfile();
// Get the current logged in user.
$user = FD::user();
// Get user's privacy
$privacy = FD::get('Privacy')->getUserPrivacy($user->id);
$this->set('user', $user);
$this->set('privacy', $privacy);
echo parent::display('site/privacy/default');
}
示例3: canvas
/**
* Displays the application in a main canvas layout which is the full width of the component.
* Example:
* index.php?option=com_easysocial&view=apps&layout=canvas&id=[id]&appView=[appView]
*
* @since 1.0
* @access public
* @param null
* @return null
*
*/
public function canvas()
{
// Check for user profile completeness
FD::checkCompleteProfile();
// Get the unique id of the item that is being viewed
$uid = $this->input->get('uid', null, 'int');
$type = $this->input->get('type', SOCIAL_TYPE_USER, 'word');
// Determines if the type is accessible
if (!$this->allowed($uid, $type)) {
return;
}
// Get the current app id.
$id = $this->input->get('id', 0, 'int');
// Get the current app.
$app = FD::table('App');
$state = $app->load($id);
// Default redirection url
$redirect = FRoute::dashboard(array(), false);
// Check if the user has access to this app
if (!$app->accessible($uid, $type) && $type == SOCIAL_TYPE_USER) {
$this->info->set(null, JText::_('COM_EASYSOCIAL_APPS_CANVAS_APP_IS_NOT_INSTALLED'), SOCIAL_MSG_ERROR);
return $this->redirect($redirect);
}
// If id is not provided, we need to throw some errors here.
if (!$id || !$state) {
$this->setMessage(JText::_('COM_EASYSOCIAL_APPS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
$info->set($this->getMessage());
return $this->redirect($redirect);
}
// Try to load the app's css.
$app->loadCss();
// Check if the app provides any custom view
$appView = $this->input->get('customView', 'canvas', 'default');
// We need to set the breadcrumb for the cluster type
if ($type == 'group') {
$group = FD::group($uid);
$this->page->breadcrumb($group->getName());
}
// Set the breadcrumbs with the app's title
$this->page->breadcrumb($app->get('title'));
// Load the library.
$lib = FD::apps();
$contents = $lib->renderView(SOCIAL_APPS_VIEW_TYPE_CANVAS, $appView, $app, array('uid' => $uid));
$this->set('uid', $uid);
$this->set('contents', $contents);
$template = 'site/apps/default.canvas.' . strtolower($type);
echo parent::display($template);
}
示例4: display
/**
* Default display method for leader board
*
* @since 1.0
* @access public
* @param string
* @return
*/
function display($tpl = null)
{
// Check for user profile completeness
FD::checkCompleteProfile();
$config = FD::config();
$limit = $config->get('layout.leaderboard.limit');
$model = FD::model('Leaderboard');
// Should we exclude admin here
$excludeAdmin = !$config->get('leaderboard.listings.admin');
$options = array('ordering' => 'points', 'limit' => $limit, 'excludeAdmin' => $excludeAdmin);
$users = $model->getLadder($options, false);
// Set the page title
FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_LEADERBOARD'));
$this->set('users', $users);
echo parent::display('site/leaderboard/default');
}
示例5: canvas
/**
* Displays the application in a main canvas layout which is the full width of the component.
* Example:
* index.php?option=com_easysocial&view=apps&layout=canvas&id=[id]&appView=[appView]
*
* @since 1.0
* @access public
* @param null
* @return null
*
*/
public function canvas()
{
// Check for user profile completeness
FD::checkCompleteProfile();
// Get the current logged in user.
$my = FD::user();
// Get the unique id of the item that is being viewed
$uid = JRequest::getInt('uid', null);
$type = JRequest::getWord('type', SOCIAL_TYPE_USER);
// Determines if the type is accessible
if (!$this->allowed($uid, $type)) {
return;
}
// Get config object.
$config = FD::config();
// Get the current app id.
$id = JRequest::getInt('id');
// Get the current app.
$app = FD::table('App');
$state = $app->load($id);
// Check if the user has access to this app
if (!$app->accessible($uid, $type) && $type == SOCIAL_TYPE_USER) {
FD::info()->set(null, JText::_('COM_EASYSOCIAL_APPS_CANVAS_APP_IS_NOT_INSTALLED'), SOCIAL_MSG_ERROR);
return $this->redirect(FRoute::dashboard(array(), false));
}
// Load info
$info = FD::info();
// If id is not provided, we need to throw some errors here.
if (!$id || !$state) {
$this->setMessage(JText::_('COM_EASYSOCIAL_APPS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
$info->set($this->getMessage());
return $this->redirect(FRoute::dashboard(array(), false));
}
// Try to load the app's css.
$app->loadCss();
// Check if the app provides any custom view
$appView = JRequest::getVar('customView', 'canvas');
// Load the library.
$lib = FD::apps();
$contents = $lib->renderView(SOCIAL_APPS_VIEW_TYPE_CANVAS, $appView, $app, array('uid' => $uid));
$this->set('uid', $uid);
$this->set('contents', $contents);
$template = 'site/apps/default.canvas.' . strtolower($type);
echo parent::display($template);
}
示例6: advanced
/**
* Displays the advanced search form
*
* @since 1.0
* @access public
*/
public function advanced($tpl = null)
{
// Check for user profile completeness
FD::checkCompleteProfile();
// Set the page title
FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_ADVANCED_SEARCH'));
// Set the page breadcrumb
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_ADVANCED_SEARCH'));
// Get current logged in user.
$my = FD::user();
$config = FD::config();
// What is this? - this is advanced search filter id.
$fid = JRequest::getInt('fid', 0);
// Get filters
$model = FD::model('Search');
$filters = $model->getFilters($my->id);
// Load up advanced search library
$library = FD::get('AdvancedSearch');
// default values
// Get values from posted data
$match = JRequest::getVar('matchType', 'all');
$avatarOnly = JRequest::getInt('avatarOnly', 0);
$sort = JRequest::getVar('sort', $config->get('users.advancedsearch.sorting', 'default'));
// Get values from posted data
$values = array();
$values['criterias'] = JRequest::getVar('criterias');
$values['datakeys'] = JRequest::getVar('datakeys');
$values['operators'] = JRequest::getVar('operators');
$values['conditions'] = JRequest::getVar('conditions');
$values['match'] = $match;
$values['avatarOnly'] = $avatarOnly;
$values['sort'] = $sort;
// echo '<pre>';print_r( $values );echo '</pre>';exit;
// Default values
$results = null;
$total = 0;
$nextlimit = null;
$criteriaHTML = '';
if ($fid && empty($values['criterias'])) {
// we need to load the data from db and do the search based on the saved filter.
$filter = FD::table('SearchFilter');
$filter->load($fid);
// data saved as json format. so we need to decode it.
$dataFilter = FD::json()->decode($filter->filter);
// override with the one from db.
$values['criterias'] = isset($dataFilter->{'criterias[]'}) ? $dataFilter->{'criterias[]'} : '';
$values['datakeys'] = isset($dataFilter->{'datakeys[]'}) ? $dataFilter->{'datakeys[]'} : '';
$values['operators'] = isset($dataFilter->{'operators[]'}) ? $dataFilter->{'operators[]'} : '';
$values['conditions'] = isset($dataFilter->{'conditions[]'}) ? $dataFilter->{'conditions[]'} : '';
// we need check if the item passed in is array or not. if not, make it an array.
if (!is_array($values['criterias'])) {
$values['criterias'] = array($values['criterias']);
}
if (!is_array($values['datakeys'])) {
$values['datakeys'] = array($values['datakeys']);
}
if (!is_array($values['operators'])) {
$values['operators'] = array($values['operators']);
}
if (!is_array($values['conditions'])) {
$values['conditions'] = array($values['conditions']);
}
$values['match'] = isset($dataFilter->matchType) ? $dataFilter->matchType : 'all';
$values['avatarOnly'] = isset($dataFilter->avatarOnly) ? true : false;
$values['sort'] = isset($dataFilter->sort) ? $dataFilter->sort : $config->get('users.advancedsearch.sorting', 'default');
$match = $values['match'];
$avatarOnly = $values['avatarOnly'];
$sort = $values['sort'];
}
$displayOptions = array();
// If there are criterias, we know the user is making a post request to search
if ($values['criterias']) {
$results = $library->search($values);
$displayOptions = $library->getDisplayOptions();
$total = $library->getTotal();
$nextlimit = $library->getNextLimit();
}
// Get search criteria output
$criteriaHTML = $library->getCriteriaHTML(array(), $values);
if (!$criteriaHTML) {
$criteriaHTML = $library->getCriteriaHTML(array());
}
$this->set('criteriaHTML', $criteriaHTML);
$this->set('match', $match);
$this->set('avatarOnly', $avatarOnly);
$this->set('sort', $sort);
$this->set('results', $results);
$this->set('total', $total);
$this->set('nextlimit', $nextlimit);
$this->set('filters', $filters);
$this->set('fid', $fid);
$this->set('displayOptions', $displayOptions);
echo parent::display('site/advancedsearch/user/default');
}
示例7: achievements
/**
* Displays a list of badges the user has achieved
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function achievements()
{
// Check for user profile completeness
FD::checkCompleteProfile();
$config = FD::config();
if (!$config->get('badges.enabled')) {
return $this->redirect(FRoute::dashboard(array(), false));
}
// Get the current user id that should be displayed
$userId = JRequest::getInt('userid', null);
$user = FD::user($userId);
// If user is not found, we need to redirect back to the dashboard page
if (!$user->id) {
return $this->redirect(FRoute::dashboard(array(), false));
}
$title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS');
if (!$user->isViewer()) {
$title = JText::sprintf('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS_USER', $user->getName());
// Let's test if the current viewer is allowed to view this user's achievements.
$my = FD::user();
$privacy = $my->getPrivacy();
$allowed = $privacy->validate('achievements.view', $user->id, SOCIAL_TYPE_USER);
if (!$allowed) {
$this->set('user', $user);
parent::display('site/badges/restricted');
return;
}
}
// Set the page title
FD::page()->title($title);
// Set the page breadcrumb
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS'), FRoute::badges(array('userid' => $userId, 'layout' => 'achievements')));
// Load admin translations
FD::language()->loadAdmin();
// @TODO: Check for privacy
$model = FD::model('badges');
$badges = $model->getBadges($user->id);
$totalBadges = count($badges);
$this->set('totalBadges', $totalBadges);
$this->set('badges', $badges);
$this->set('user', $user);
parent::display('site/badges/achievements');
}
示例8: category
/**
* Displays the category item page.
*
* @author Jason Rey <jasonrey@stackideas.com>
* @since 1.3
* @access public
*/
public function category()
{
// Check if events is enabled.
$this->checkFeature();
FD::checkCompleteProfile();
// Get the current category
$id = $this->input->get('id', 0, 'int');
// Pagination for the stream
$startlimit = $this->input->get('limitstart', 0, 'int');
$category = FD::table('EventCategory');
$state = $category->load($id);
if (!$state) {
FD::info()->set(false, JText::_('COM_EASYSOCIAL_EVENTS_INVALID_CATEGORY_ID'), SOCIAL_MSG_ERROR);
return $this->redirect(FRoute::events());
}
FD::language()->loadAdmin();
FD::page()->title($category->get('title'));
// Add breadcrumbs
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_EVENTS'), FRoute::events());
FD::page()->breadcrumb($category->get('title'));
$model = FD::model('Events');
$categoryModel = FD::model('EventCategories');
$events = $model->getEvents(array('state' => SOCIAL_STATE_PUBLISHED, 'sort' => 'random', 'category' => $category->id, 'featured' => false, 'limit' => 5, 'limitstart' => 0, 'type' => array(SOCIAL_EVENT_TYPE_PUBLIC, SOCIAL_EVENT_TYPE_PRIVATE)));
$featuredEvents = $model->getEvents(array('state' => SOCIAL_STATE_PUBLISHED, 'sort' => 'random', 'category' => $category->id, 'featured' => true, 'limit' => 5, 'limitstart' => 0, 'type' => array(SOCIAL_EVENT_TYPE_PUBLIC, SOCIAL_EVENT_TYPE_PRIVATE)));
$randomGuests = $categoryModel->getRandomCategoryGuests($category->id);
$randomAlbums = $categoryModel->getRandomCategoryAlbums($category->id);
$stats = $categoryModel->getCreationStats($category->id);
$totalEvents = $model->getTotalEvents(array('state' => SOCIAL_STATE_PUBLISHED, 'category' => $category->id, 'type' => array(SOCIAL_EVENT_TYPE_PUBLIC, SOCIAL_EVENT_TYPE_PRIVATE)));
$totalAlbums = $categoryModel->getTotalAlbums($category->id);
$stream = FD::stream();
$stream->get(array('clusterCategory' => $category->id, 'clusterType' => SOCIAL_TYPE_EVENT, 'startlimit' => $startlimit));
$this->set('events', $events);
$this->set('featuredEvents', $featuredEvents);
$this->set('randomGuests', $randomGuests);
$this->set('randomAlbums', $randomAlbums);
$this->set('totalEvents', $totalEvents);
$this->set('totalAlbums', $totalAlbums);
$this->set('stats', $stats);
$this->set('stream', $stream);
$this->set('category', $category);
return parent::display('site/events/category');
}
示例9: editPrivacy
/**
* Edit privacy form
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function editPrivacy()
{
// User needs to be logged in
FD::requireLogin();
// Check for user profile completeness
FD::checkCompleteProfile();
// Get the current logged in user.
$my = FD::user();
// Get user's privacy
$privacyLib = FD::privacy($my->id);
$result = $privacyLib->getData();
// Set page title
FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_PRIVACY_SETTINGS'));
// Set the page breadcrumb
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_PROFILE'), FRoute::profile());
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_PRIVACY_SETTINGS'));
$privacy = array();
// Update the privacy data with proper properties.
foreach ($result as $group => $items) {
// We do not want to show field privacy rules here because it does not make sense for user to set a default value
// Most of the fields only have 1 and it is set in Edit Profile page
if ($group === 'field') {
continue;
}
foreach ($items as &$item) {
$rule = strtoupper(JString::str_ireplace('.', '_', $item->rule));
$groupKey = strtoupper($group);
$item->groupKey = $groupKey;
$item->label = JText::_('COM_EASYSOCIAL_PRIVACY_LABEL_' . $groupKey . '_' . $rule);
$item->tips = JText::_('COM_EASYSOCIAL_PRIVACY_TIPS_' . $groupKey . '_' . $rule);
}
$privacy[$group] = $items;
}
// Get a list of blocked users for this user
$model = FD::model('Blocks');
$blocked = $model->getBlockedUsers($this->my->id);
$this->set('blocked', $blocked);
$this->set('privacy', $privacy);
parent::display('site/profile/default.edit.privacy');
}
示例10: category
/**
* Displays information from groups within a particular category
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function category()
{
// Check if this feature is enabled.
$this->checkFeature();
// Check for user profile completeness
FD::checkCompleteProfile();
// Get the category id from the query
$id = JRequest::getInt('id');
$category = FD::table('GroupCategory');
$category->load($id);
// Check if the category is valid
if (!$id || !$category->id) {
return JError::raise(E_ERROR, 404, JText::_('COM_EASYSOCIAL_GROUPS_INVALID_GROUP_ID'));
}
// Load backend language file
FD::language()->loadAdmin();
// Set the page title to this category
FD::page()->title($category->get('title'));
// Set the breadcrumbs
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_GROUPS'), FRoute::groups());
FD::page()->breadcrumb($category->get('title'));
// Get recent 10 groups from this category
$options = array('sort' => 'random', 'category' => $category->id);
$model = FD::model('Groups');
$groups = $model->getGroups($options);
// Get random members from this category
$randomMembers = $model->getRandomCategoryMembers($category->id, SOCIAL_CLUSTER_CATEGORY_MEMBERS_LIMIT);
// Get group creation stats for this category
$stats = $model->getCreationStats($category->id);
// Get total groups within a category
$totalGroups = $model->getTotalGroups(array('category_id' => $category->id));
// Get total albums within a category
$totalAlbums = $model->getTotalAlbums(array('category_id' => $category->id));
// Get the stream for this group
$stream = FD::stream();
$stream->get(array('clusterCategory' => $category->id, 'clusterType' => SOCIAL_TYPE_GROUP));
// Get random albums for groups in this category
$randomAlbums = $model->getRandomAlbums(array('category_id' => $category->id, 'core' => false));
$this->set('randomAlbums', $randomAlbums);
$this->set('stream', $stream);
$this->set('totalGroups', $totalGroups);
$this->set('stats', $stats);
$this->set('randomMembers', $randomMembers);
$this->set('groups', $groups);
$this->set('category', $category);
$this->set('totalAlbums', $totalAlbums);
parent::display('site/groups/category.item');
}
示例11: read
/**
* When a conversation is marked as read.
*
* @since 1.0
* @access public
* @param null
*/
public function read()
{
// Prevent unauthorized access.
FD::requireLogin();
// Check for user profile completeness
FD::checkCompleteProfile();
// Get the conversation id
$id = $this->input->get('id', 0, 'int');
$conversation = FD::table('Conversation');
$loaded = $conversation->load($id);
// Check if the conversation id provided is valid.
if (!$id || !$loaded) {
$this->info->set(JText::_('COM_EASYSOCIAL_CONVERSATIONS_ERROR_INVALID_ID'), SOCIAL_MSG_ERROR);
$url = FRoute::conversations(array(), false);
return $this->redirect($url);
}
// Check if the user has access to read this discussion.
if (!$conversation->isReadable($this->my->id)) {
$this->info->set(JText::_('COM_EASYSOCIAL_CONVERSATIONS_NOT_ALLOWED_TO_READ'), SOCIAL_MSG_ERROR);
$url = FRoute::conversations(array(), false);
return $this->redirect($url);
}
// Retrieve conversations model.
$model = FD::model('Conversations');
// Always reset the limistart to 0 so that when the page refresh, system will not get the 'previous' saved limitstart.
$model->setState('limitstart', 0);
// Get list of files in this conversation
$filesModel = FD::model('Files');
// Get a list of all the message ids from this conversation.
$files = $filesModel->getFiles($model->getMessageIds($conversation->id), SOCIAL_TYPE_CONVERSATIONS);
// Get a list of participants for this particular conversation except myself.
$participants = $model->getParticipants($conversation->id);
// this flag is to indicate if there is only one participant and the participant is a ESAD.
$isESADuser = false;
if (count($participants) == 2) {
foreach ($participants as $pUser) {
if ($pUser->id != $this->my->id && !$pUser->hasCommunityAccess()) {
$isESADuser = true;
}
}
}
// Fetch a list of messages for this particular conversation
$messages = $model->setLimit($this->themeConfig->get('messages_limit'))->getMessages($conversation->id, $this->my->id);
// Beautify the names
$participantNames = FD::string()->namesToStream($participants, false, 3, false);
$title = JText::sprintf('COM_EASYSOCIAL_PAGE_TITLE_CONVERSATIONS_READ', $participantNames);
// Set title
FD::page()->title($title);
// Set breadcrumbs
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_CONVERSATIONS_INBOX'), FRoute::conversations());
FD::page()->breadcrumb($title);
// @trigger: onPrepareConversations
$dispatcher = FD::dispatcher();
$args = array(&$messages);
$dispatcher->trigger(SOCIAL_TYPE_USER, 'onPrepareConversations', $args);
// Get pagination
$pagination = $model->getPagination();
// Determine if load previous messages should appear.
$loadPrevious = $pagination->total > $pagination->limit;
// Mark conversation as read because the viewer is already reading the conversation.
$conversation->markAsRead($this->my->id);
// Get total number of messages sent today
$totalSentDaily = $model->getTotalSentDaily($this->my->id);
// @points: conversation.read
// Assign points when user reads a conversation
$points = FD::points();
$points->assign('conversation.read', 'com_easysocial', $this->my->id);
$this->set('files', $files);
$this->set('totalSentDaily', $totalSentDaily);
$this->set('loadPrevious', $loadPrevious);
$this->set('conversation', $conversation);
$this->set('participants', $participants);
$this->set('messages', $messages);
$this->set('pagination', $pagination);
$this->set('isESADuser', $isESADuser);
echo parent::display('site/conversations/read');
}
示例12: item
/**
* Default method to display the registration page.
*
* @since 1.0
* @access public
* @author Mark Lee <mark@stackideas.com>
*/
function item($tpl = null)
{
$this->checkFeature();
// Check for user profile completeness
FD::checkCompleteProfile();
$id = JRequest::getInt('id');
$point = FD::table('Points');
$point->load($id);
if (!$id || !$point->id) {
FD::info()->set(null, JText::_('The points id provided is not a valid id.'), SOCIAL_MSG_ERROR);
return $this->redirect(FRoute::dashboard(array(), false));
}
$point->loadLanguage();
// Load language file.
JFactory::getLanguage()->load('com_easysocial', JPATH_ROOT . '/administrator');
// Set the page title
FD::page()->title($point->get('title'));
// Set the page breadcrumb
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_POINTS'), FRoute::points());
FD::page()->breadcrumb($point->get('title'));
// Get list of point achievers.
$achievers = $point->getAchievers();
$this->set('achievers', $achievers);
$this->set('point', $point);
parent::display('site/points/default.item');
}
示例13: form
/**
* Displays the photo form
*
* @since 1.0
* @access public
*/
public function form()
{
// Only logged in users are allowed to modify photos.
FD::requireLogin();
// Check for user profile completeness
FD::checkCompleteProfile();
// Check if photos is enabled
$this->checkFeature();
// Get current user
$my = FD::user();
// Get photo
$id = JRequest::getInt('id', null);
// Load the photo table
$table = FD::table('Photo');
$table->load($id);
// If id is not given or photo does not exist
if (!$id || !$table->id) {
return $this->deleted($lib);
}
// Load up the library photo library
$lib = FD::photo($table->uid, $table->type, $table);
// Check if the person is allowed to edit the photo
if (!$lib->editable()) {
return $this->restricted($lib);
}
// Set the page title.
$title = $lib->getPageTitle($this->getLayout());
FD::page()->title($title);
// Set the breadcrumbs
$lib->setBreadcrumbs($this->getLayout());
// Render options
$options = array('size' => 'large', 'showForm' => true, 'layout' => 'form');
// Render item
$output = $lib->renderItem($options);
return $this->output($lib, $output);
}
示例14: search
/**
* Displays a list of users on the site from dating search module
*
* @access public
* @param string The name of the template file to parse; automatically searches through the template paths.
* @return null
*/
public function search($tpl = null)
{
// Check for user profile completeness
FD::checkCompleteProfile();
// Retrieve the users model
$model = FD::model('Users');
$my = FD::user();
$config = FD::config();
$admin = $config->get('users.listings.admin') ? true : false;
$options = array('includeAdmin' => $admin);
$limit = FD::themes()->getConfig()->get('userslimit');
$options['limit'] = $limit;
// Default title
$title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_USERS');
$post = JRequest::get('POSTS');
// echo '<pre>';print_r( $post );echo '</pre>';
// Get values from posted data
$values = array();
$values['criterias'] = JRequest::getVar('criterias');
$values['datakeys'] = JRequest::getVar('datakeys');
$values['operators'] = JRequest::getVar('operators');
$values['conditions'] = JRequest::getVar('conditions');
// echo '<pre>';print_r( $values );echo '</pre>';
$searchOptions = array();
// lets do some clean up here.
for ($i = 0; $i < count($values['criterias']); $i++) {
$criteria = $values['criterias'][$i];
$condition = $values['conditions'][$i];
$datakey = $values['datakeys'][$i];
$operator = $values['operators'][$i];
if (trim($condition)) {
$searchOptions['criterias'][] = $criteria;
$searchOptions['datakeys'][] = $datakey;
$searchOptions['operators'][] = $operator;
$field = explode('|', $criteria);
$fieldCode = $field[0];
$fieldType = $field[1];
if ($fieldType == 'birthday') {
// currently the value from form is in age format. we need to convert it into date time.
$ages = explode('|', $condition);
if (!isset($ages[1])) {
// this happen when start has value and end has no value
$ages[1] = $ages[0];
}
if ($ages[1] && !$ages[0]) {
//this happen when start is empty and end has value
$ages[0] = $ages[1];
}
$startdate = '';
$enddate = '';
$currentTimeStamp = FD::date()->toUnix();
if ($ages[0] == $ages[1]) {
$start = strtotime('-' . $ages[0] . ' years', $currentTimeStamp);
$year = FD::date($start)->toFormat('Y');
$startdate = $year . '-01-01 00:00:01';
$enddate = FD::date($start)->toFormat('Y-m-d') . ' 23:59:59';
} else {
if ($ages[0]) {
$start = strtotime('-' . $ages[0] . ' years', $currentTimeStamp);
$year = FD::date($start)->toFormat('Y');
$enddate = $year . '-12-31 23:59:59';
}
if ($ages[1]) {
$end = strtotime('-' . $ages[1] . ' years', $currentTimeStamp);
$year = FD::date($end)->toFormat('Y');
$startdate = $year . '-01-01 00:00:01';
}
}
$condition = $startdate . '|' . $enddate;
}
$searchOptions['conditions'][] = $condition;
}
}
$pagination = null;
$result = null;
$users = array();
if ($searchOptions) {
$searchOptions['match'] = 'all';
$searchOptions['avatarOnly'] = false;
// Retrieve the users
$result = $model->getUsersByFilter('0', $options, $searchOptions);
// $result = array();
$pagination = $model->getPagination();
$pagination->setVar('Itemid', FRoute::getItemId('users'));
$pagination->setVar('view', 'users');
$pagination->setVar('layout', 'search');
$pagination->setVar('filter', 'search');
for ($i = 0; $i < count($values['criterias']); $i++) {
$criteria = $values['criterias'][$i];
$condition = $values['conditions'][$i];
$datakey = $values['datakeys'][$i];
$operator = $values['operators'][$i];
$field = explode('|', $criteria);
//.........这里部分代码省略.........
示例15: editPrivacy
/**
* Edit privacy form
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function editPrivacy()
{
// User needs to be logged in
FD::requireLogin();
// Check for user profile completeness
FD::checkCompleteProfile();
// Get user's privacy
$privacyLib = FD::privacy($this->my->id);
$result = $privacyLib->getData();
// Set page title
$this->page->title('COM_EASYSOCIAL_PAGE_TITLE_PRIVACY_SETTINGS');
// Set the page breadcrumb
$this->page->breadcrumb('COM_EASYSOCIAL_PAGE_TITLE_PROFILE', FRoute::profile());
$this->page->breadcrumb('COM_EASYSOCIAL_PAGE_TITLE_PRIVACY_SETTINGS');
$privacy = array();
// Update the privacy data with proper properties.
foreach ($result as $group => $items) {
// We do not want to show field privacy rules here because it does not make sense for user to set a default value
// Most of the fields only have 1 and it is set in Edit Profile page
if ($group === 'field') {
continue;
}
// Only display such privacy rules if photos is enabled
if (($group == 'albums' || $group == 'photos') && !$this->config->get('photos.enabled')) {
continue;
}
// Do not display badges / achievements in privacy if badges is disabled
if ($group == 'achievements' && !$this->config->get('badges.enabled')) {
continue;
}
// Do not display followers privacy item
if ($group == 'followers' && !$this->config->get('followers.enabled')) {
continue;
}
foreach ($items as &$item) {
// Conversations rule should only appear if it is enabled.
if ($group == 'profiles' && $item->rule == 'post.message' && !$this->config->get('conversations.enabled')) {
unset($item);
}
$rule = JString::str_ireplace('.', '_', $item->rule);
$rule = strtoupper($rule);
$groupKey = strtoupper($group);
// Determines if this has custom
$item->hasCustom = $item->custom ? true : false;
// If the rule is a custom rule, we need to set the ids
$item->customIds = array();
$item->customUsers = array();
if ($item->hasCustom) {
foreach ($item->custom as $friend) {
$item->customIds[] = $friend->user_id;
$user = FD::user($friend->user_id);
$item->customUsers[] = $user;
}
}
// Try to find an app element that is related to the privacy type
$app = ES::table('App');
$appExists = $app->load(array('element' => $item->type));
if ($appExists) {
$app->loadLanguage();
}
// Go through each options to get the selected item
$item->selected = '';
foreach ($item->options as $option => $value) {
if ($value) {
$item->selected = $option;
}
// We need to remove "Everyone" if the site lockdown is enabled
if ($this->config->get('general.site.lockdown.enabled') && $option == SOCIAL_PRIVACY_0) {
unset($item->options[$option]);
}
}
$item->groupKey = $groupKey;
$item->label = JText::_('COM_EASYSOCIAL_PRIVACY_LABEL_' . $groupKey . '_' . $rule);
$item->tips = JText::_('COM_EASYSOCIAL_PRIVACY_TIPS_' . $groupKey . '_' . $rule);
}
$privacy[$group] = $items;
}
// Get a list of blocked users for this user
$blockModel = FD::model('Blocks');
$blocked = $blockModel->getBlockedUsers($this->my->id);
$this->set('blocked', $blocked);
$this->set('privacy', $privacy);
parent::display('site/profile/default.edit.privacy');
}