本文整理汇总了PHP中FD::group方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::group方法的具体用法?PHP FD::group怎么用?PHP FD::group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FD
的用法示例。
在下文中一共展示了FD::group方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.2
*/
protected function getInput()
{
// Load the language file.
FD::language()->loadAdmin();
FD::language()->loadSite();
// 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_GROUP');
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/group');
// 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;
}
示例2: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($uid = null, $docType = null)
{
$group = FD::group($uid);
$editor = JFactory::getEditor();
// Only allow group admin to create or edit news
if (!$group->isAdmin() && !$this->my->isSiteAdmin()) {
FD::info()->set(false, JText::_('COM_EASYSOCIAL_GROUPS_ONLY_MEMBER_ARE_ALLOWED'), SOCIAL_MSG_ERROR);
return $this->redirect($group->getPermalink(false));
}
$id = JRequest::getInt('newsId');
$news = FD::table('GroupNews');
$news->load($id);
FD::page()->title(JText::_('APP_GROUP_NEWS_FORM_UPDATE_PAGE_TITLE'));
// Determine if this is a new record or not
if (!$id) {
$news->comments = true;
FD::page()->title(JText::_('APP_GROUP_NEWS_FORM_CREATE_PAGE_TITLE'));
}
// Get app params
$params = $this->app->getParams();
$this->set('params', $params);
$this->set('news', $news);
$this->set('editor', $editor);
$this->set('group', $group);
echo parent::display('canvas/form');
}
示例3: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($groupId = null, $docType = null)
{
$group = FD::group($groupId);
// Render the rss model
$model = FD::model('RSS');
$result = $model->getItems($group->id, SOCIAL_TYPE_GROUP);
// If there are tasks, we need to bind them with the table.
$feeds = array();
if ($result) {
foreach ($result as $row) {
// Bind the result back to the note object.
$rss = FD::table('Rss');
$rss->bind($row);
// Initialize the parser.
$parser = @JFactory::getFeedParser($rss->url);
$rss->parser = $parser;
$rss->total = @$parser->get_item_quantity();
$rss->items = @$parser->get_items();
$feeds[] = $rss;
}
}
// Get the app params
$params = $this->app->getParams();
$limit = $params->get('total', 5);
$this->set('totalDisplayed', $limit);
$this->set('appId', $this->app->id);
$this->set('group', $group);
$this->set('feeds', $feeds);
echo parent::display('views/default');
}
示例4: display
/**
* Displays the application output in the canvas.
*
* @since 1.2
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($groupId = null, $docType = null)
{
$group = FD::group($groupId);
// Check if the viewer is allowed here.
if (!$group->canViewItem()) {
return $this->redirect($group->getPermalink(false));
}
// Get app params
$params = $this->app->getParams();
// Load the milestone
$id = JRequest::getInt('milestoneId');
$milestone = FD::table('Milestone');
$milestone->load($id);
FD::page()->title(JText::_('APP_GROUP_TASKS_TITLE_CREATE_MILESTONE'));
if ($id && $milestone->id) {
FD::page()->title(JText::_('APP_GROUP_TASKS_TITLE_EDITING_MILESTONE'));
}
// Get a list of members from the group
$groupModel = FD::model('Groups');
$members = $groupModel->getMembers($group->id);
$this->set('members', $members);
$this->set('milestone', $milestone);
$this->set('params', $params);
$this->set('group', $group);
echo parent::display('views/form');
}
示例5: createStream
public function createStream($verb)
{
// Create a new stream item for this discussion
$stream = FD::stream();
// Get the stream template
$tpl = $stream->getTemplate();
// Someone just joined the group
$tpl->setActor($this->created_by, SOCIAL_TYPE_USER);
// Set the params to cache the group data
$registry = FD::registry();
$registry->set('news', $this);
// Set the context
$tpl->setContext($this->id, 'news');
$group = FD::group($this->cluster_id);
// Set the cluster
$tpl->setCluster($this->cluster_id, SOCIAL_TYPE_GROUP, $group->type);
// Set the verb
$tpl->setVerb($verb);
// Set the params
$tpl->setParams($registry);
if ($this->_stream_date) {
$tpl->setDate($this->_stream_date);
}
$tpl->setAccess('core.view');
// Add the stream
$stream->add($tpl);
}
示例6: sidebarBottom
public function sidebarBottom($groupId)
{
$params = $this->getParams();
if (!$params->get('widget', true)) {
return;
}
$group = FD::group($groupId);
if (!$group->getAccess()->get('events.groupevent', true)) {
return;
}
$my = FD::user();
$days = $params->get('widget_days', 14);
$total = $params->get('widget_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');
}
示例7: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($uid = null, $docType = null)
{
$group = FD::group($uid);
// Get the article item
$news = FD::table('GroupNews');
$news->load(JRequest::getInt('newsId'));
// Check if the user is really allowed to view this item
if (!$group->canViewItem()) {
return $this->redirect($group->getPermalink(false));
}
// Get the author of the article
$author = FD::user($news->created_by);
// Get the url for the article
$url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $this->app->getAlias(), 'articleId' => $news->id), false);
// Apply comments for the article
$comments = FD::comments($news->id, 'news', 'create', SOCIAL_APPS_GROUP_GROUP, array('url' => $url));
// Apply likes for the article
$likes = FD::likes()->get($news->id, 'news', 'create', SOCIAL_APPS_GROUP_GROUP);
// Set the page title
FD::page()->title($news->get('title'));
// Get a list of other news
$model = FD::model('Groups');
// Retrieve the params
$params = $this->app->getParams();
$this->set('params', $params);
$this->set('group', $group);
$this->set('likes', $likes);
$this->set('comments', $comments);
$this->set('author', $author);
$this->set('news', $news);
echo parent::display('canvas/item');
}
示例8: getSearch
function getSearch()
{
//init variable
$app = JFactory::getApplication();
$log_user = JFactory::getUser($this->plugin->get('user')->id);
$nxt_lim = 20;
$search = $app->input->get('search', '', 'STRING');
$nxt_lim = $app->input->get('next_limit', 0, 'INT');
$mapp = new EasySocialApiMappingHelper();
$res = new stdClass();
if (empty($search)) {
$res->status = 0;
$res->message = 'Empty searchtext';
return $res;
}
$userid = $log_user->id;
$serch_obj = new EasySocialModelSearch();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$frnd_obj = new EasySocialModelFriends();
$query->select($db->quoteName(array('su.user_id')));
$query->from($db->quoteName('#__social_users', 'su'));
$query->join('LEFT', $db->quoteName('#__users', 'u') . ' ON (' . $db->quoteName('su.user_id') . ' = ' . $db->quoteName('u.id') . ')');
//->where(($db->quoteName('u.username') . ' LIKE '. $db->quote('\'% '.$search.'%\'') ).'OR' .( $db->quoteName('u.name') . ' LIKE '. $db->quote('\'%'.$search.'%\'') ).'OR'.( $db->quoteName('u.email') . ' LIKE '. $db->quote('\'%'.$search.'%\'')))
if (!empty($search)) {
$query->where("(u.username LIKE '%" . $search . "%' ) OR ( u.name LIKE '%" . $search . "%') OR ( u.email LIKE '%" . $search . "%')");
}
$query->order($db->quoteName('u.id') . 'ASC');
$db->setQuery($query);
$tdata = $db->loadObjectList();
$susers = array();
foreach ($tdata as $ky => $val) {
$susers[] = FD::user($val->user_id);
}
$base_obj = $mapp->mapItem($susers, 'user', $log_user->id);
$list['user'] = $this->createSearchObj($base_obj);
//for group
$query1 = $db->getQuery(true);
$query1->select($db->quoteName(array('cl.id')));
$query1->from($db->quoteName('#__social_clusters', 'cl'));
if (!empty($search)) {
$query1->where("(cl.title LIKE '%" . $search . "%' )");
}
$query1->order($db->quoteName('cl.id') . 'ASC');
$db->setQuery($query1);
$gdata = $db->loadObjectList();
$grp_model = FD::model('Groups');
$group = array();
foreach ($gdata as $grp) {
$group[] = FD::group($grp->id);
}
$list['group'] = $mapp->mapItem($group, 'group', $log_user->id);
if (empty($list['group'])) {
$ret_arr = new stdClass();
$ret_arr->status = false;
$ret_arr->message = "No group found in search";
$list['group'] = $ret_arr;
}
return $list;
}
示例9: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($uid = null, $docType = null)
{
$group = FD::group($uid);
$editor = JFactory::getEditor();
$this->set('editor', $editor);
$this->set('group', $group);
echo parent::display('canvas/form');
}
示例10: __construct
public function __construct($id)
{
parent::__construct($id, 'group');
if (!EB::easysocial()->exists()) {
return;
}
$this->group = FD::group($id);
}
示例11: update
/**
* Allows caller to update a stream
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function update()
{
// Check for request forgeries
FD::checkToken();
// Check for valid users
FD::requireLogin();
// Get the current view
$view = $this->getCurrentView();
// Get the stream id
$id = JRequest::getInt('id');
$stream = FD::table('Stream');
$stream->load($id);
// Check for valid stream id's.
if (!$id || !$stream->id) {
$view->setMessage(JText::_('COM_EASYSOCIAL_STREAM_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
// @TODO: Check for permissions
$my = FD::user();
if ($stream->cluster_id) {
$group = FD::group($stream->cluster_id);
if (!$my->isSiteAdmin() && $stream->actor_id != $my->id && !$group->isAdmin()) {
$view->setMessage(JText::_('COM_EASYSOCIAL_STREAM_NO_PERMISSIONS_TO_EDIT'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
} else {
if (!$my->isSiteAdmin() && $stream->actor_id != $my->id) {
$view->setMessage(JText::_('COM_EASYSOCIAL_STREAM_NO_PERMISSIONS_TO_EDIT'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
}
$content = JRequest::getVar('content', '', 'post', 'string', JREQUEST_ALLOWRAW);
$mentions = JRequest::getVar('mentions');
// Format the json string to array
if (!empty($mentions)) {
foreach ($mentions as &$mention) {
$mention = FD::json()->decode($mention);
}
}
// Process the content
$stream->content = $content;
// Set the last edited date
$stream->edited = FD::date()->toSql();
// Get the stream model and remove mentions
$model = FD::model('Stream');
$model->removeMentions($stream->id);
// Now we need to add new mentions
if ($mentions) {
$model->addMentions($stream->id, $mentions);
}
// Save the stream
$stream->store();
// Because we know that story posts only has 1 item, we may safely assume that the first index.
$items = $stream->getItems();
$item = $items[0];
return $view->call(__FUNCTION__, $item);
}
示例12: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($groupId = null, $docType = null)
{
$group = FD::group($groupId);
$model = FD::model('Groups');
$users = $model->getMembers($group->id);
$pagination = $model->getPagination();
$this->set('group', $group);
$this->set('users', $users);
echo parent::display('groups/default');
}
示例13: sidebarBottom
/**
* Display user photos on the side bar
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function sidebarBottom($groupId)
{
// Get the group
$group = FD::group($groupId);
$params = $this->app->getParams();
if ($params->get('show_online', true)) {
echo $this->getOnlineUsers($group);
}
if ($params->get('show_friends', true)) {
echo $this->getFriends($group);
}
}
示例14: getGroupAlias
function getGroupAlias($id)
{
static $groups = array();
// Ensure that the id is purely an integer
if (!isset($groups[$id])) {
$group = FD::group($id);
// We need to replace : with - since SH404 correctly processes it.
$alias = $group->getAlias();
$alias = str_ireplace(':', '-', $alias);
$groups[$id] = $alias;
}
return $groups[$id];
}
示例15: sidebarBottom
/**
* Display user photos on the side bar
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function sidebarBottom($groupId)
{
// Get the group
$group = FD::group($groupId);
$params = $this->app->getParams();
// Determines if we should display the online group members
if ($params->get('show_online')) {
echo $this->getOnlineUsers($group);
}
// Determines if we should display friends in this group
if ($params->get('show_friends')) {
echo $this->getFriends($group);
}
}