本文整理汇总了PHP中Foundry::user方法的典型用法代码示例。如果您正苦于以下问题:PHP Foundry::user方法的具体用法?PHP Foundry::user怎么用?PHP Foundry::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foundry
的用法示例。
在下文中一共展示了Foundry::user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getJoomlaAvatar
function getJoomlaAvatar($registerType, $profileLink, $user)
{
$html = '';
if ($registerType == 'jomsocial' && file_exists(JPATH_BASE . '/components/com_community/libraries/core.php')) {
$jsUser = CFactory::getUser($user->id);
$avatarURL = $jsUser->getThumbAvatar();
$html = $this->getAvatarHtml($avatarURL, $profileLink, "_self");
} else {
if ($registerType == 'easysocial' && file_exists(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php')) {
$avatarURL = Foundry::user($user->id)->getAvatar();
$html = $this->getAvatarHtml($avatarURL, $profileLink, "_self");
} else {
if ($registerType == "communitybuilder" && file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
$cbUser = CBuser::getInstance($user->id);
$avatar = $cbUser->getField('avatar', null, 'csv', 'none', 'list');
$html = $this->getAvatarHtml($avatar, $profileLink, "_self");
} else {
if ($registerType == 'kunena' && JFolder::exists(JPATH_SITE . '/components/com_kunena')) {
$db = JFactory::getDbo();
$query = "SELECT avatar FROM #__kunena_users WHERE userid = " . $user->id;
$db->setQuery($query);
$avatarURL = $db->loadResult();
if ($avatarURL) {
$avatarURL = JRoute::_('media/kunena/avatars/' . $avatarURL, false);
}
$html = $this->getAvatarHtml($avatarURL, $profileLink, "_self");
}
}
}
}
return $html;
}
示例2: display
/**
* Displays the application output in the canvas.
*
* @param int The user id that is currently being viewed.
* @param string layout path
* @since 1.0
* @access public
*/
public function display($userId = null, $docType = null)
{
// Get the user params
$params = $this->getUserParams($userId);
// Get the app params
$appParams = $this->app->getParams();
// Get the blog model
$total = (int) $params->get('total', $appParams->get('total', 5));
$pin_width = (int) $appParams->get('pin_width', 145);
$pin_padding = (int) $appParams->get('pin_padding', 3);
// Get list of all products created by the user on the site.
$input = JFactory::getApplication()->input;
$storeid = $input->get('storeid', '', 'INT');
$model = $this->getModel('q2cmyproducts');
$products = $model->getItems($userId, $total, $storeid);
$productsCount = $model->getProductsCount($userId, $storeid);
$user = Foundry::user($userId);
// Get store list of user
require_once JPATH_ROOT . '/components/com_quick2cart/helpers/storeHelper.php';
$storeHelper = new storeHelper();
$storelist = $storeHelper->getUserStore($userId);
$this->set('user', $user);
$this->set('userId', $userId);
$this->set('total', $total);
$this->set('pin_width', $pin_width);
$this->set('pin_padding', $pin_padding);
$this->set('products', $products);
$this->set('productsCount', $productsCount);
$this->set('storelists', $storelist);
echo parent::display('profile/default');
}
示例3: getHTML
/**
* Shares a story through 3rd party oauth clients
*
* @param TableBlog $blog A blog table object
* @param string $type The type of oauth client
*
* @return boolean True on success and false otherwise.
**/
public function getHTML($bloggerid = "")
{
$html = '';
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
if ($config->get('main_jomsocial_messaging') && $my->id != $bloggerid) {
$file_core = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
$file_messaging = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'messaging.php';
if (file_exists($file_core) && file_exists($file_messaging)) {
require_once $file_core;
require_once $file_messaging;
CMessaging::load();
$html = '<a href="javascript:void(0);" onclick="' . CMessaging::getPopup($bloggerid) . '" class="author-message" title="' . JText::_('COM_EASYBLOG_MESSAGE_AUTHOR') . '"><span>' . JText::_('COM_EASYBLOG_MESSAGE_AUTHOR') . '</span></a>';
}
}
$easysocial = EasyBlogHelper::getHelper('EasySocial');
if ($config->get('integrations_easysocial_conversations') && $easysocial->exists() && $my->id != $bloggerid) {
$easysocial->init();
$user = Foundry::user($bloggerid);
$theme = new CodeThemes();
$theme->set('user', $user);
$html = $theme->fetch('easysocial.conversation.php');
}
return $html;
}
示例4: onPromoteData
function onPromoteData($id)
{
$db = JFactory::getDBO();
$Itemid = JRequest::getInt('Itemid');
$eschk = $this->_chkextension();
if (!empty($eschk)) {
/*$query = "SELECT cf.id FROM #__community_fields as cf
LEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id
WHERE cf.name like '%About me%' AND cfv.user_id=".$id;
$db->setQuery($query);
$fieldid = $db->loadresult();
*/
$query = "SELECT u.name AS title\n\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\tWHERE u.id =" . $id;
$db->setQuery($query);
$previewdata = $db->loadobjectlist();
//if($fieldid)
//$query .= " AND cfv.field_id=".$fieldid;
require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
$user = Foundry::user($id);
//easysocial data for user
$activitysocialintegrationprofiledata = new activitysocialintegrationprofiledata();
$img_path = $activitysocialintegrationprofiledata->getUserAvatar('EasySocial', JFactory::getUser($id));
$link = $activitysocialintegrationprofiledata->getUserProfileUrl('EasySocial', $id);
$previewdata[0]->image = $img_path;
$previewdata[0]->url = JUri::root() . substr(JRoute::_($link, false), strlen(JUri::base(true)) + 1);
$previewdata[0]->bodytext = '';
return $previewdata;
} else {
return '';
}
}
示例5: getLink
public function getLink()
{
$user = Foundry::user($this->profile->id);
if ($this->komentoprofile) {
return JRoute::_('index.php?option=com_komento&view=profile&id=' . $this->profile->id);
}
return $user->getPermalink();
}
示例6: _getAvatar
function _getAvatar($profile)
{
$easysocial = EasyBlogHelper::getHelper('EasySocial');
$easysocial->init();
$user = Foundry::user($profile->id);
$avatar = new stdClass();
$avatar->link = $user->getAvatar();
return $avatar;
}
示例7: getAvatar
public function getAvatar($profile)
{
$easysocial = EB::easysocial();
if (!$easysocial->exists()) {
return false;
}
// Load the user
$user = Foundry::user($profile->id);
return $user->getAvatar();
}
示例8: isValidNode
public function isValidNode()
{
if (!$this->group->id) {
$this->lib->setError(JText::_('Sorry, but the group id provided is not a valid group id.'));
return false;
}
if (Foundry::user()->id != $this->group->creator_uid) {
if (FD::user()->isBlockedBy($this->group->creator_uid)) {
return JError::raiseError(404, JText::_('COM_EASYSOCIAL_GROUPS_GROUP_NOT_FOUND'));
}
}
return true;
}
示例9: getHTML
public function getHTML($bloggerid = "")
{
$config = EB::config();
$html = '';
$easysocial = EB::easysocial();
if ($config->get('integrations_easysocial_badges') && $easysocial->exists()) {
$easysocial->init();
$user = Foundry::user($bloggerid);
$badges = $user->getBadges();
$theme = EB::template();
$theme->set('badges', $badges);
$html = $theme->output('site/easysocial/achievements');
}
return $html;
}
示例10: getHTML
public function getHTML($bloggerid = "")
{
$config = EasyBlogHelper::getConfig();
$html = '';
$easysocial = EasyBlogHelper::getHelper('EasySocial');
if ($config->get('integrations_easysocial_badges') && $easysocial->exists()) {
$easysocial->init();
$user = Foundry::user($bloggerid);
$badges = $user->getBadges();
$theme = new CodeThemes();
$theme->set('badges', $badges);
$html = $theme->fetch('easysocial.achievements.php');
}
return $html;
}
示例11: getAlbums
/**
* Display the list of photos a user has uploaded
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function getAlbums($user)
{
$params = $this->getUserParams($user->id);
$appParam = $this->app->getParams();
$albums = array();
// Load up albums model
$model = FD::model('Albums');
$sorting = $params->get('ordering', $appParam->get('ordering', 'latest'));
$options = array('order' => 'assigned_date', 'direction' => $sorting == 'latest' ? 'desc' : 'asc');
$options['excludeblocked'] = 1;
// privacy lib
$privacy = Foundry::privacy(Foundry::user()->id);
$results = $model->getAlbums($user->id, SOCIAL_TYPE_USER, $options);
if ($results) {
foreach ($results as $item) {
// we need to check the photo's album privacy to see if user allow to view or not.
if ($privacy->validate('albums.view', $item->id, SOCIAL_TYPE_ALBUM, $item->user_id)) {
$albums[] = $item;
}
}
}
if (empty($albums)) {
return;
}
// If sorting is set to random, then we shuffle the albums
if ($sorting == 'random') {
shuffle($albums);
}
// since we are getting all albums belong to user,
// we do not need to run another query to count the albums.
// just do array count will be fine.
// $total = $model->getTotalAlbums($options);
$total = count($albums);
$limit = $params->get('limit', $appParam->get('limit', 10));
$this->set('total', $total);
$this->set('appParams', $appParam);
$this->set('params', $params);
$this->set('user', $user);
$this->set('albums', $albums);
$this->set('limit', $limit);
$this->set('privacy', $privacy);
return parent::display('widgets/profile/albums');
}
示例12: execute
/**
*
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function execute($item)
{
// Get comment participants
$model = FD::model('Comments');
$users = $model->getParticipants($item->uid, $item->context_type);
// Include the actor of the stream item as the recipient
// Exclude myself from the list of users.
// Ensure that the values are unique
$users[] = $item->actor_id;
$users = array_values(array_unique(array_diff($users, array(Foundry::user()->id))));
// Convert the names to stream-ish
$names = Foundry::string()->namesToNotifications($users);
$plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
// By default content is always empty;
$content = '';
// Only show the content when there is only 1 item
if (count($users) == 1 && !empty($item->content)) {
$content = JString::substr(strip_tags($item->content), 0, 30);
if (JString::strlen($item->content) > 30) {
$content .= JText::_('COM_EASYSOCIAL_ELLIPSES');
}
}
// Load the milestone
$milestone = FD::table('Milestone');
$state = $milestone->load($item->uid);
if (!$state) {
return;
}
// We need to generate the notification message differently for the author of the item and the recipients of the item.
if ($milestone->owner_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$item->title = JText::sprintf('APP_GROUP_TASKS_USER_COMMENTED_ON_YOUR_MILESTONE', $names);
return $item;
}
if ($milestone->owner_id == $item->actor_id && count($users) == 1) {
$item->title = JText::sprintf('APP_GROUP_TASKS_USER_COMMENTED_ON_THEIR_MILESTONE', $names);
return $item;
}
// This is for 3rd party viewers
$item->title = JText::sprintf('APP_GROUP_TASKS_USER_COMMENTED_ON_USERS_MILESTONE', $names, Foundry::user($milestone->owner_id)->getName());
return $item;
}
示例13: getHTML
public function getHTML($bloggerid = "")
{
$html = '';
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
// We don't want to show the link to the same user
if ($my->id == $bloggerid) {
return;
}
if ($config->get('main_jomsocial_friends')) {
$file_core = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
$file_messaging = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'friends.php';
jimport('joomla.filesystem.file');
if (JFile::exists($file_core) && JFile::exists($file_messaging)) {
require_once $file_core;
require_once $file_messaging;
$user = CFactory::getUser();
$model = CFactory::getModel('Friends');
$friends = $model->getFriendIds($bloggerid);
if (!in_array($my->id, $friends)) {
CFriends::load();
$html = '<a href="javascript:void(0);" onclick="' . CFriends::getPopup($bloggerid) . '" class="author-friend"><span>' . JText::_('COM_EASYBLOG_ADD_FRIEND') . '</span></a>';
}
}
}
$easysocial = EasyBlogHelper::getHelper('EasySocial');
if ($config->get('integrations_easysocial_friends') && $easysocial->exists()) {
$user = Foundry::user($bloggerid);
// Check if the user is friends with the current viewer.
if ($user->isFriends($my->id)) {
return;
}
$easysocial->init();
$theme = new CodeThemes();
$theme->set('id', $bloggerid);
$html = $theme->fetch('easysocial.friends.php');
}
return $html;
}
示例14: getHTML
public function getHTML($bloggerid = "")
{
$html = '';
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
// We don't want to show the link to the same user
if ($my->id == $bloggerid) {
return;
}
$easysocial = EasyBlogHelper::getHelper('EasySocial');
if ($config->get('integrations_easysocial_followers') && $easysocial->exists()) {
$user = Foundry::user($bloggerid);
$followed = $user->isFollowed($my->id);
if ($followed) {
return;
}
$easysocial->init();
$theme = new CodeThemes();
$theme->set('id', $bloggerid);
$html = $theme->fetch('easysocial.followers.php');
}
return $html;
}
示例15: getParticipants
/**
* Retrieves a list of participants in this conversation.
*
* @since 1.0
* @access public
* @param Array (Optional) $exclusions An array of user's node id that should be excluded.
*
* @return Array An array of SocialTablePeople objects containing all the participants.
*/
public function getParticipants($exclusions = array())
{
static $_cache = array();
$key = $this->id . '_';
if (is_array($exclusions)) {
$key .= implode('_', $exclusions);
} else {
$key .= $exclusions;
}
if (!isset($_cache[$key])) {
$model = FD::model('Conversations');
$result = $model->getParticipants($this->id, $exclusions);
if (!$result) {
$creator = Foundry::user($this->created_by);
$result = array($creator);
}
$_cache[$key] = $result;
}
return $_cache[$key];
}