本文整理汇总了PHP中CFriendsHelper类的典型用法代码示例。如果您正苦于以下问题:PHP CFriendsHelper类的具体用法?PHP CFriendsHelper怎么用?PHP CFriendsHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFriendsHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getAccessLevel
public static function getAccessLevel($actorId, $targetId)
{
$actor = CFactory::getUser($actorId);
$target = CFactory::getUser($targetId);
//CFactory::load( 'helpers' , 'owner' );
//CFactory::load( 'helpers' , 'friends' );
// public guest
$access = 0;
// site members
if ($actor->id > 0) {
$access = 20;
}
// they are friends
if ($target->id > 0 && CFriendsHelper::isConnected($actor->id, $target->id)) {
$access = 30;
}
// mine, target and actor is the same person
if ($target->id > 0 && COwnerHelper::isMine($actor->id, $target->id)) {
$access = 40;
}
if (COwnerHelper::isCommunityAdmin()) {
$access = 40;
}
return $access;
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:25,代码来源:privacy.php
示例2: showMiniHeader
function showMiniHeader($userId)
{
CMiniHeader::load();
CFactory::load('helpers', 'friends');
CFactory::load('helpers', 'owner');
$option = JRequest::getVar('option', '', 'REQUEST');
$lang =& JFactory::getLanguage();
$lang->load('com_community');
$my = CFactory::getUser();
$config = CFactory::getConfig();
if (!empty($userId)) {
$user = CFactory::getUser($userId);
CFactory::load('libraries', 'messaging');
$sendMsg = CMessaging::getPopup($user->id);
$tmpl = new CTemplate();
$tmpl->set('my', $my);
$tmpl->set('user', $user);
$tmpl->set('isMine', COwnerHelper::isMine($my->id, $user->id));
$tmpl->set('sendMsg', $sendMsg);
$tmpl->set('config', $config);
$tmpl->set('isFriend', CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id);
$showMiniHeader = $option == 'com_community' ? $tmpl->fetch('profile.miniheader') : '<div id="community-wrap" style="min-height:50px;">' . $tmpl->fetch('profile.miniheader') . '</div>';
return $showMiniHeader;
}
}
开发者ID:bizanto,项目名称:Hooked,代码行数:25,代码来源:miniheader.php
示例3: isAccessAllowed
/**
* Return true if actor have access to target's item
* @param type where the privacy setting should be extracted, {user, group, global, custom}
* Site super admin waill always have access to all area
*/
static function isAccessAllowed($actorId, $targetId, $type, $userPrivacyParam)
{
$actor = CFactory::getUser($actorId);
$target = CFactory::getUser($targetId);
CFactory::load('helpers', 'owner');
CFactory::load('helpers', 'friends');
// Load User params
$params =& $target->getParams();
// guest
$relation = 10;
// site members
if ($actor->id != 0) {
$relation = 20;
}
// friends
if (CFriendsHelper::isConnected($actorId, $targetId)) {
$relation = 30;
}
// mine, target and actor is the same person
if (COwnerHelper::isMine($actor->id, $target->id)) {
$relation = 40;
}
// @todo: respect privacy settings
// If type is 'custom', then $userPrivacyParam will contain the exact
// permission level
$permissionLevel = $type == 'custom' ? $userPrivacyParam : $params->get($userPrivacyParam);
if ($relation < $permissionLevel && !COwnerHelper::isCommunityAdmin($actorId)) {
return false;
}
return true;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:36,代码来源:privacy.php
示例4: _getMutualFriendsHTML
public static function _getMutualFriendsHTML($userid = null)
{
$my = CFactory::getUser();
if ($my->id == $userid) {
return;
}
$friendsModel = CFactory::getModel('Friends');
$friends = $friendsModel->getFriends($userid, 'latest', false, 'mutual');
$html = "<ul class='joms-list--friend single-column'>";
if (sizeof($friends)) {
foreach ($friends as $friend) {
$html .= "<li class='joms-list__item'>";
$html .= "<div class='joms-list__avatar'>";
$html .= '<div class="joms-avatar ' . CUserHelper::onlineIndicator($friend) . '"><a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
$html .= '<img src="' . $friend->getThumbAvatar() . '" data-author="' . $friend->id . '" />';
$html .= "</a></div></div>";
$html .= "<div class='joms-list__body'>";
$html .= CFriendsHelper::getUserCog($friend->id, null, null, true);
$html .= CFriendsHelper::getUserFriendDropdown($friend->id);
$html .= '<a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
$html .= '<h4 class="joms-text--username">' . $friend->getDisplayName() . '</h4></a>';
$html .= '<span class="joms-text--title">' . JText::sprintf('COM_COMMUNITY_TOTAL_MUTUAL_FRIENDS', CFriendsHelper::getTotalMutualFriends($friend->id)) . '</span>';
$html .= "</div></li>";
}
$html .= "</ul>";
} else {
$html .= JText::_('COM_COMMUNITY_NO_MUTUAL_FRIENDS');
}
return $html;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:30,代码来源:mutualfriends.php
示例5: showMiniHeader
public static function showMiniHeader($userId)
{
CMiniHeader::load();
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
JFactory::getLanguage()->load('com_community');
$option = $jinput->get('option', '', 'STRING');
//JRequest::getVar('option', '' , 'REQUEST');
$my = CFactory::getUser();
$config = CFactory::getConfig();
if (!empty($userId)) {
$user = CFactory::getUser($userId);
$params = $user->getParams();
//links information
$photoEnabled = $config->get('enablephotos') ? true : false;
$eventEnabled = $config->get('enableevents') ? true : false;
$groupEnabled = $config->get('enablegroups') ? true : false;
$videoEnabled = $config->get('enablevideos') ? true : false;
//likes
CFactory::load('libraries', 'like');
$like = new Clike();
$isLikeEnabled = $like->enabled('profile') && $params->get('profileLikes', 1) ? 1 : 0;
$isUserLiked = $like->userLiked('profile', $user->id, $my->id);
/* likes count */
$likes = $like->getLikeCount('profile', $user->id);
//profile
$profileModel = CFactory::getModel('profile');
$profile = $profileModel->getViewableProfile($user->id, $user->getProfileType());
$profile = JArrayHelper::toObject($profile);
$profile->largeAvatar = $user->getAvatar();
$profile->defaultAvatar = $user->isDefaultAvatar();
$profile->status = $user->getStatus();
$profile->defaultCover = $user->isDefaultCover();
$profile->cover = $user->getCover();
$profile->coverPostion = $params->get('coverPosition', '');
if (strpos($profile->coverPostion, '%') === false) {
$profile->coverPostion = 0;
}
$groupmodel = CFactory::getModel('groups');
$profile->_groups = $groupmodel->getGroupsCount($profile->id);
$eventmodel = CFactory::getModel('events');
$profile->_events = $eventmodel->getEventsCount($profile->id);
$profile->_friends = $user->_friendcount;
$videoModel = CFactory::getModel('Videos');
$profile->_videos = $videoModel->getVideosCount($profile->id);
$photosModel = CFactory::getModel('photos');
$profile->_photos = $photosModel->getPhotosCount($profile->id);
/* is featured */
$modelFeatured = CFactory::getModel('Featured');
$profile->featured = $modelFeatured->isExists(FEATURED_USERS, $profile->id);
$sendMsg = CMessaging::getPopup($user->id);
$tmpl = new CTemplate();
$tmpl->set('my', $my)->set('user', $user)->set('isBlocked', $user->isBlocked())->set('isMine', COwnerHelper::isMine($my->id, $user->id))->set('sendMsg', $sendMsg)->set('config', $config)->set('isWaitingApproval', CFriendsHelper::isWaitingApproval($my->id, $user->id))->set('isLikeEnabled', $isLikeEnabled)->set('photoEnabled', $photoEnabled)->set('eventEnabled', $eventEnabled)->set('groupEnabled', $groupEnabled)->set('videoEnabled', $videoEnabled)->set('profile', $profile)->set('isUserLiked', $isUserLiked)->set('likes', $likes)->set('isFriend', CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id);
$showMiniHeader = $option == 'com_community' ? $tmpl->fetch('profile.miniheader') : '<div id="community-wrap" style="min-height:50px;">' . $tmpl->fetch('profile.miniheader') . '</div>';
return $showMiniHeader;
}
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:57,代码来源:miniheader.php
示例6: activitiesCommentAdd
public static function activitiesCommentAdd($userId, $assetId, $obj = NULL)
{
//$obj = func_get_arg(2);
$params = func_get_args();
$obj = !isset($params[2]) ? NULL : $params[2];
$model = CFactory::getModel('activities');
$result = false;
$config = CFactory::getConfig();
// Guest can never leave a comment
if ($userId == 0) {
return false;
}
// If global config allow all members to comment, allow it
if ($config->get('allmemberactivitycomment') == '1') {
return true;
}
$allow_comment = false;
// if all activity comment is allowed, return true
$config = CFactory::getConfig();
if ($config->get('allmemberactivitycomment') == '1' && COwnerHelper::isRegisteredUser()) {
$allow_comment = true;
}
if ($obj instanceof CTableEvent || $obj instanceof CTableGroup) {
//event or group activities only
if ($obj->isMember($userId)) {
$allow_comment = true;
}
} else {
if ($config->get('allmemberactivitycomment') == '1' && COwnerHelper::isRegisteredUser()) {
// if all activity comment is allowed, return true
$allow_comment = true;
}
}
if (!isset($obj->params)) {
$params = '{}';
} else {
$params = $obj->params;
}
$params = new CParameter($params);
$commentPermission = $params->get('commentPermission', NULL);
if ($commentPermission == false && !is_null($commentPermission)) {
$allow_comment = false;
}
if ($allow_comment || CFriendsHelper::isConnected($assetId, $userId) || COwnerHelper::isCommunityAdmin()) {
$result = true;
}
return $result;
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:48,代码来源:activities.php
示例7: block
/**
*
* @param type $userId
* @param type $type
* @param type $redirect
*/
public function block($userId, $type, $redirect = false)
{
$my = CFactory::getUser();
$result = false;
/* both of ids must not empty */
if (empty($my->id) || empty($userId)) {
$message = JText::_('COM_COMMUNITY_ERROR_BLOCK_USER');
} else {
/* You can't block yourself */
if ($my->id != $userId) {
/* Get model */
$model = CFactory::getModel('Block');
/* Do block */
if ($model->blockUser($my->id, $userId, $type)) {
$result = true;
/* check if current user is friend with requested user */
$isFriend = CFriendsHelper::isConnected($userId, $my->id);
/* Remove user as friend if user is a friend */
if ($isFriend) {
$this->removeFriend($userId);
}
$message = JText::_('COM_COMMUNITY_USER_BLOCKED');
} else {
$message = JText::_('COM_COMMUNITY_ERROR_BLOCK_USER');
}
} else {
$message = JText::_('COM_COMMUNITY_ERROR_BLOCK_USER');
}
}
if ($redirect) {
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
/* generate redirect url */
$viewName = $jinput->get->get('view', '');
$urlUserId = $viewName == 'friends' ? '' : "&userid=" . $userId;
$url = CRoute::_("index.php?option=com_community&view=" . $viewName . $urlUserId, false);
$mainframe->redirect($url, $message);
}
return $result;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:46,代码来源:block.php
示例8: block
/**
* Block user(Ban)
*/
public function block($userId)
{
$my = CFactory::getUser();
$mainframe =& JFactory::getApplication();
CFactory::load('helpers', 'friends');
$isFriend = CFriendsHelper::isConnected($userId, $my->id);
$viewName = JRequest::getVar('view', '', 'GET');
$urlUserId = $viewName == 'friends' ? '' : "&userid=" . $userId;
$url = CRoute::_("index.php?option=com_community&view=" . $viewName . $urlUserId, false);
$message = empty($my->id) || empty($userId) ? JText::_('COM_COMMUNITY_ERROR_BLOCK_USER') : '';
if (!empty($my->id) && !empty($userId) && $my->id != $userId) {
$model = CFactory::getModel('block');
if ($model->blockUser($my->id, $userId)) {
// Remove user as friend if user is a friend
if ($isFriend) {
$this->removeFriend($userId);
}
$message = JText::_('COM_COMMUNITY_USER_BLOCKED');
} else {
$message = JText::_('COM_COMMUNITY_ERROR_BLOCK_USER');
}
}
$mainframe->redirect($url, $message);
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:27,代码来源:block.php
示例9: activitiesCommentAdd
public static function activitiesCommentAdd($userId, $assetId)
{
$obj = func_get_arg(0);
$model =& CFactory::getModel('activities');
$result = false;
$config = CFactory::getConfig();
// Guest can never leave a comment
if ($userId == 0) {
return false;
}
// If global config allow all members to comment, allow it
if ($config->get('allmemberactivitycomment') == '1') {
return true;
}
$allow_comment = false;
// if all activity comment is allowed, return true
$config = CFactory::getConfig();
if ($config->get('allmemberactivitycomment') == '1' && COwnerHelper::isRegisteredUser()) {
$allow_comment = true;
}
if ($obj instanceof CTableEvent || $obj instanceof CTableGroup) {
//event or group activities only
if ($obj->isMember($userId)) {
$allow_comment = true;
}
} else {
if ($config->get('allmemberactivitycomment') == '1' && COwnerHelper::isRegisteredUser()) {
// if all activity comment is allowed, return true
$allow_comment = true;
}
}
if ($allow_comment || CFriendsHelper::isConnected($assetId, $userId) || COwnerHelper::isCommunityAdmin()) {
$result = true;
}
return $result;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:36,代码来源:activities.php
示例10: defined
/**
* @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
* @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @author iJoomla.com <[email protected]>
* @url https://www.jomsocial.com/license-agreement
* The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
* More info at https://www.jomsocial.com/license-agreement
*/
defined('_JEXEC') or die;
$params = $user->getParams();
$config = CFactory::getConfig();
$my = CFactory::getUser();
$isMine = COwnerHelper::isMine($my->id, $user->id);
$isFriend = CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id;
$isWaitingApproval = CFriendsHelper::isWaitingApproval($my->id, $user->id);
$isWaitingResponse = CFriendsHelper::isWaitingApproval($user->id, $my->id);
$isBlocked = $user->isBlocked();
//links information
$photoEnabled = $config->get('enablephotos') ? true : false;
$eventEnabled = $config->get('enableevents') ? true : false;
$groupEnabled = $config->get('enablegroups') ? true : false;
$videoEnabled = $config->get('enablevideos') ? true : false;
//likes
CFactory::load('libraries', 'like');
$like = new Clike();
$isLikeEnabled = $like->enabled('profile') && $params->get('profileLikes', 1) ? 1 : 0;
$isUserLiked = $like->userLiked('profile', $user->id, $my->id);
/* likes count */
$likes = $like->getLikeCount('profile', $user->id);
$profileFields = '';
$themeModel = CFactory::getModel('theme');
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:hovercard.php
示例11:
<div class="joms-list__body">
<a href="<?php
echo $user->profileLink;
?>
"><h4 class="joms-text--username"><?php
echo $user->getDisplayName();
?>
</h4></a>
<span class="joms-text--title"><?php
echo JText::sprintf('COM_COMMUNITY_TOTAL_MUTUAL_FRIENDS', CFriendsHelper::getTotalMutualFriends($user->id));
?>
</span>
</div>
<div class="joms-list__actions">
<?php
echo CFriendsHelper::getUserCog($user->id, null, null, true);
?>
<?php
echo CFriendsHelper::getUserFriendDropdown($user->id);
?>
</div>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:31,代码来源:friends.invite.php
示例12:
<?php
if ($enableReporting) {
?>
<button class="joms-button--neutral joms-button--small" onclick="joms.api.photoReport('<?php
echo $photo->id;
?>
');"><?php
echo JText::_('COM_COMMUNITY_REPORT');
?>
</button>
<?php
}
?>
<?php
if (COwnerHelper::isMine($my->id, $album->creator) || CFriendsHelper::isConnected($my->id, $album->creator)) {
?>
<button class="joms-button--neutral joms-button--small joms-js--btn-tag"><?php
echo JText::_('COM_COMMUNITY_TAG_THIS_PHOTO');
?>
</button>
<?php
}
?>
<div class="joms-js--photo-tag-ct"></div>
<div class="joms-gap"></div>
<div>
<h5 class="joms-text--title"><?php
echo JText::_('COM_COMMUNITY_PHOTOS_ALBUM_DESC');
开发者ID:Jougito,项目名称:DynWeb,代码行数:31,代码来源:single.php
示例13: isPermitted
/**
* Check if permitted to play the video
*
* @param int $myid The current user's id
* @param int $userid The active profile user's id
* @param int $permission The video's permission
* @return bool True if it's permitted
* @since 1.2
*/
public function isPermitted($myid = 0, $userid = 0, $permissions = 0)
{
if ($permissions == 0) {
return true;
}
// public
if (COwnerHelper::isCommunityAdmin()) {
return true;
}
$relation = 0;
if ($myid != 0) {
$relation = 20;
}
// site members
if (CFriendsHelper::isConnected($myid, $userid)) {
$relation = 30;
}
// friends
if (COwnerHelper::isMine($myid, $userid)) {
$relation = 40;
// mine
}
if ($relation >= $permissions) {
return true;
}
return false;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:36,代码来源:profile.php
示例14: display
public function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$id = $jinput->get('listid', '', 'INT');
//JRequest::getVar( 'listid' , '' );
$list = JTable::getInstance('MemberList', 'CTable');
$list->load($id);
if (empty($list->id) || is_null($list->id)) {
echo JText::_('COM_COMMUNITY_INVALID_ID');
return;
}
/**
* Opengraph
*/
CHeadHelper::setType('website', $list->getTitle());
$tmpCriterias = $list->getCriterias();
$criterias = array();
foreach ($tmpCriterias as $criteria) {
$obj = new stdClass();
$obj->field = $criteria->field;
$obj->condition = $criteria->condition;
$obj->fieldType = $criteria->type;
switch ($criteria->type) {
case 'date':
case 'birthdate':
if ($criteria->condition == 'between') {
$date = explode(',', $criteria->value);
if (isset($date[1])) {
$delimeter = '-';
if (strpos($date[0], '/')) {
$delimeter = '/';
}
$startDate = explode($delimeter, $date[0]);
$endDate = explode($delimeter, $date[1]);
if (isset($startDate[2]) && isset($endDate[2])) {
//date format
$obj->value = array($startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00', $endDate[2] . '-' . intval($endDate[1]) . '-' . $endDate[0] . ' 23:59:59');
} else {
//age format
$obj->value = array($date[0], $date[1]);
}
} else {
//wrong data, set to default
$obj->value = array(0, 0);
}
} else {
$delimeter = '-';
if (strpos($criteria->value, '/')) {
$delimeter = '/';
}
$startDate = explode($delimeter, $criteria->value);
if (isset($startDate[2])) {
//date format
$obj->value = $startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00';
} else {
//age format
$obj->value = $criteria->value;
}
}
break;
case 'checkbox':
default:
$obj->value = $criteria->value;
break;
}
$criterias[] = $obj;
}
//CFactory::load( 'helpers' , 'time');
$created = CTimeHelper::getDate($list->created);
//CFactory::load( 'libraries' , 'advancesearch' );
//CFactory::load( 'libraries' , 'filterbar' );
$sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_LATEST'), 'online' => JText::_('COM_COMMUNITY_SORT_ONLINE'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL'));
$sorting = $jinput->get->get('sort', 'latest', 'STRING');
//JRequest::getVar( 'sort' , 'latest' , 'GET' );
$data = CAdvanceSearch::getResult($criterias, $list->condition, $list->avataronly, $sorting);
$tmpl = new CTemplate();
$html = $tmpl->set('list', $list)->set('created', $created)->set('sorting', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->fetch('memberlist.result');
unset($tmpl);
//CFactory::load( 'libraries' , 'tooltip' );
//CFactory::load( 'helpers' , 'owner' );
//CFactory::load( 'libraries' , 'featured' );
$featured = new CFeatured(FEATURED_USERS);
$featuredList = $featured->getItemIds();
$my = CFactory::getUser();
$resultRows = array();
$friendsModel = CFactory::getModel('friends');
$alreadyfriend = array();
//CFactory::load( 'helpers' , 'friends' );
foreach ($data->result as $user) {
$obj = new stdClass();
$obj->user = $user;
$obj->friendsCount = $user->getFriendCount();
$obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
$isFriend = CFriendsHelper::isConnected($user->id, $my->id);
$obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $user->id ? true : false;
//record friends
if ($obj->addFriend) {
$alreadyfriend[$user->id] = $user->id;
}
//.........这里部分代码省略.........
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:101,代码来源:view.html.php
示例15:
?>
</h4></a>
<span class="joms-text--title"><?php
echo JText::sprintf('COM_COMMUNITY_TOTAL_MUTUAL_FRIENDS', CFriendsHelper::getTotalMutualFriends($row->user->id));
?>
</span>
</div>
<div class="joms-list__actions joms-js--frequest-btn-<?php
echo $connectionId;
?>
">
<?php
echo CFriendsHelper::getUserCog($row->user->id, null, null, true);
?>
<?php
$connectionId = CFriendsHelper::isWaitingApproval($row->user->id, $my->id);
?>
<div class="joms-list__button--dropdown">
<button onclick="joms.api.friendReject('<?php
echo $connectionId;
?>
');" class="joms-button--neutral joms-button--full-small joms-button--smallest"><?php
echo JText::_('COM_COMMUNITY_FRIENDS_PENDING_ACTION_REJECT');
?>
</button>
<button onclick="joms.api.friendApprove('<?php
echo $connectionId;
?>
');" class="joms-button--primary joms-button--full-small joms-button--smallest"><?php
echo JText::_('COM_COMMUNITY_PENDING_ACTION_APPROVE');
?>
开发者ID:Jougito,项目名称:DynWeb,代码行数:31,代码来源:request-received.php
示例16: isPermitted
/**
* Check if permitted to play the video
*
* @param int $myid The current user's id
* @param int $userid The active profile user's id
* @param int $permission The video's permission
* @return bool True if it's permitted
* @since 1.2
*/
public function isPermitted($myid = 0, $userid = 0, $permissions = 0)
{
if ($permissions == 0) {
return true;
}
// public
// Load Libraries
CFactory::load('helpers', 'friends');
CFactory::load('helpers', 'owner');
if (COwnerHelper::isCommunityAdmin()) {
return true;
}
$relation = 0;
if ($myid != 0) {
$relation = 20;
}
// site members
if (CFriendsHelper::isConnected($myid, $userid)) {
$relation = 30;
}
// friends
if (COwnerHelper::isMine($myid, $userid)) {
$relation = 40;
// mine
}
if ($relation >= $permissions) {
return true;
}
return false;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:39,代码来源:view.php
示例17:
?>
');">
<button class="joms-button--neutral joms-button--smallest joms-button--full-small"><?php
echo JText::_('COM_COMMUNITY_FRIENDS_PENDING_ACTION_REJECT');
?>
</button>
</a>
</div>
<?php
}
?>
</div>
<div class="joms-list__actions">
<?php
echo CFriendsHelper::getUserCog($member->id, $groupid, null, true);
?>
<?php
//echo CFriendsHelper::getUserFriendDropdown($member->id);
?>
</div>
</li>
<?php
}
?>
</ul>
<?php
}
?>
<?php
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:groups.viewmembers.php
示例18:
</b>
<div class="small">
<a href="<?php
echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
?>
">
<?php
echo JText::_('COM_COMMUNITY_GO_TO_PROFILE');
?>
</a>
</div>
</div>
<div class="span8">
<ul class="cToolBox-Options unstyled">
<?php
if (!$isFriend && !$isMine && !CFriendsHelper::isWaitingApproval($my->id, $user->id)) {
?>
<li>
<a href="javascript:void(0)" onclick="joms.api.friendAdd('<?php
echo $user->id;
?>
')">
<i class="com-icon-user-plus"></i>
<span><?php
echo JText::_('COM_COMMUNITY_PROFILE_ADD_AS_FRIEND');
?>
</span>
</a>
</li>
<?php
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:31,代码来源:profile.miniheader.php
示例19: getUserFriendDropdown
public static function getUserFriendDropdown($targetId)
{
$my = CFactory::getUser();
//current user
$user = CFactory::getUser($targetId);
//if user is not logged in, nothing should be displayed at all
if (!$my->id || $my->id == $targetId) {
return false;
}
$display = new stdClass();
$display->canAddFriend = false;
$display->canUnfriend = false;
$display->canRemoveFriendRequest = false;
$display->dropdown = false;
$display->dropdownTrigger = false;
$display->button = "COM_COMMUNITY_PROFILE_ADD_AS_FRIEND";
//by default
$display->buttonTrigger = "joms.api.friendAdd('" . $user->id . "')";
//is friend
if (CFriendsHelper::isConnected($my->id, $targetId)) {
$display->button = "COM_COMMUNITY_FRIENDS_COUNT";
//friend
$display->dropdown = 'COM_COMMUNITY_FRIENDS_REMOVE';
$display->dropdownTrigger = "joms.api.friendRemove('" . $user->id . "');";
$display->buttonTrigger = false;
} else {
if (CFriendsHelper::isWaitingApproval($my->id, $user->id)) {
$display->button = "COM_COMMUNITY_PROFILE_CONNECT_REQUEST_SENT";
$display->buttonTrigger = false;
$display->dropdown = "COM_COMMUNITY_CANCEL_FRIEND_REQUEST";
$display->dropdownTrigger = "joms.api.friendAddCancel('" . $user->id . "');";
} else {
if ($connectionId = CFriendsHelper::isWaitingApproval($user->id, $my->id)) {
$display->button = "COM_COMMUNITY_PENDING_APPROVAL";
$display->buttonTrigger = false;
$display->dropdown[] = "COM_COMMUNITY_FRIEND_ACCEPT_REQUEST";
$display->dropdownTrigger[] = "joms.api.friendApprove('" . $connectionId . "');";
$display->dropdown[] = "COM_COMMUNITY_FRIEND_REJECT_REQUEST";
$display->dropdownTrigger[] = "joms.api.friendReject('" . $connectionId . "');";
}
}
}
$tmpl = new CTemplate();
return $tmpl->set('options', $display)->fetch('general/friend-dropdown');
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:45,代码来源:friends.php
示例20: array
} else {
$users = array($this->act->actor);
$user = CFactory::getUser($this->act->actor);
}
$truncateVal = 60;
$date = JFactory::getDate($act->created);
if ($config->get('activitydateformat') == "lapse") {
$createdTime = CTimeHelper::timeLapse($date);
} else {
$createdTime = $date->format($config->get('profileDateFormat'));
}
// Setup album table
$album = JTable::getInstance('Album', 'CTable');
$album->load($act->cid);
$this->set('album', $album);
if ($album->permissions == 30 && !CFriendsHelper::isConnected($my->id, $album->creator)) {
return false;
}
$albumUrl = CRoute::_($album->getURI());
$isPhotoModal = $config->get('album_mode') == 1;
if ($isPhotoModal) {
$albumUrl = 'javascript:" onclick="joms.api.photoOpen(\'' . $album->id . '\', \'\');';
}
?>
<div class="joms-stream__header">
<div class= "joms-avatar--stream">
<a href="<?php
echo CUrlHelper::userLink($user->id);
?>
">
开发者ID:Jougito,项目名称:DynWeb,代码行数:31,代码来源:like.php
注:本文中的CFriendsHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论