本文整理汇总了PHP中Foundry::group方法的典型用法代码示例。如果您正苦于以下问题:PHP Foundry::group方法的具体用法?PHP Foundry::group怎么用?PHP Foundry::group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foundry
的用法示例。
在下文中一共展示了Foundry::group方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explorer
/**
* Service Hook for explorer
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function explorer()
{
// Check for request forgeries
Foundry::checkToken();
// Require the user to be logged in
Foundry::requireLogin();
// Get the current view
$view = $this->getCurrentView();
// Get the group object
$groupId = JRequest::getInt('uid');
$group = Foundry::group($groupId);
// Determine if the viewer can really view items
if (!$group->canViewItem()) {
return $view->call(__FUNCTION__);
}
// Load up the explorer library
$explorer = Foundry::explorer($group->id, SOCIAL_TYPE_GROUP);
$hook = JRequest::getCmd('hook');
$result = $explorer->hook($hook);
$exception = Foundry::exception('Folder retrieval successful', SOCIAL_MSG_SUCCESS);
return $view->call(__FUNCTION__, $exception, $result);
}
示例2: getAlbums
/**
* Retrieves list of albums
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function getAlbums($uid = '', $type = '', $options = array())
{
$config = FD::config();
$db = FD::db();
// Get the query object
$sql = $db->sql();
$sql->select('#__social_albums', 'a');
$sql->column('a.*');
$excludeblocked = isset($options['excludeblocked']) ? $options['excludeblocked'] : 0;
if ($config->get('users.blocking.enabled') && $excludeblocked && !JFactory::getUser()->guest) {
$sql->leftjoin('#__social_block_users', 'bus');
$sql->on('a.user_id', 'bus.user_id');
$sql->on('bus.target_id', JFactory::getUser()->id);
$sql->isnull('bus.id');
}
if ($uid) {
$sql->where('uid', $uid);
}
if ($type) {
$sql->where('type', $type);
}
$exclusion = isset($options['exclusion']) ? $options['exclusion'] : '';
$privacy = isset($options['privacy']) ? $options['privacy'] : false;
if ($exclusion) {
$exclusion = FD::makeArray($exclusion);
foreach ($exclusion as $excludeAlbumId) {
$sql->where('id', $excludeAlbumId, '!=');
}
}
// Determine if we should include the core albums
$coreAlbums = isset($options['core']) ? $options['core'] : true;
if (!$coreAlbums) {
$sql->where('core', 0);
}
$coreAlbumsOnly = isset($options['coreAlbumsOnly']) ? $options['coreAlbumsOnly'] : '';
if ($coreAlbumsOnly) {
$sql->where('core', 0, '>');
}
$withCoversOnly = isset($options['withCovers']) ? $options['withCovers'] : '';
if ($withCoversOnly) {
$sql->join('#__social_photos', 'b', 'INNER');
$sql->on('cover_id', 'b.id');
}
$ordering = isset($options['order']) ? $options['order'] : '';
if ($ordering) {
$direction = isset($options['direction']) ? $options['direction'] : 'desc';
$sql->order($ordering, $direction);
}
$pagination = isset($options['pagination']) ? $options['pagination'] : false;
$result = array();
if ($pagination) {
// Set the total number of items.
$totalSql = $sql->getSql();
$this->setTotal($totalSql, true);
$result = $this->getData($sql->getSql());
} else {
$limit = isset($options['limit']) ? $options['limit'] : '';
if ($limit) {
$sql->limit($limit);
}
$db->setQuery($sql);
$result = $db->loadObjectList();
}
if (!$result) {
return $result;
}
$albums = array();
$privacyLib = FD::privacy(FD::user()->id);
foreach ($result as $row) {
$album = FD::table('Album');
$album->bind($row);
$add = true;
if ($privacy) {
if ($album->type == SOCIAL_TYPE_USER) {
$add = $privacyLib->validate('albums.view', $album->id, SOCIAL_TYPE_ALBUM, $album->user_id);
} else {
if ($album->type == SOCIAL_TYPE_GROUP) {
$group = Foundry::group($album->uid);
if ($group->isOpen()) {
$add = true;
} else {
$add = $group->isMember() || FD::user()->isSiteAdmin();
}
}
}
}
if ($add) {
$albums[] = $album;
}
}
return $albums;
}
示例3: prepareGroupUpdateCoverStream
/**
* Prepares the upload avatar stream
*
* @since 1.0
* @access public
* @param SocialStream
* @return
*/
public function prepareGroupUpdateCoverStream(&$item, $privacy, $includePrivacy = true)
{
// Load the photo
$photo = $this->getPhotoFromParams($item);
// Load the group
$group = Foundry::group($item->cluster_id);
// Get the cover object for the group
$cover = $group->getCoverData();
$this->set('cover', $cover);
$this->set('photo', $photo);
$this->set('actor', $item->actor);
$this->set('group', $group);
$item->title = parent::display('streams/group/upload.cover.title');
$item->content = parent::display('streams/group/upload.cover.content');
if ($includePrivacy) {
$element = $item->context;
$uid = $item->contextId;
$item->privacy = $privacy->form($uid, $element, $item->actor->id, 'core.view', false, $item->uid);
}
}