Exemplo n.º 1
0
 /**
  * Deletes a discussion
  *
  * @since	1.2
  * @access	public
  */
 public function delete()
 {
     // Check for request forgeriess
     FD::checkToken();
     // Ensure that the user is logged in.
     FD::requireLogin();
     // Load up ajax lib
     $ajax = FD::ajax();
     $id = JRequest::getInt('id');
     $groupId = JRequest::getInt('groupId');
     $discussion = FD::table('Discussion');
     $discussion->load($id);
     $my = FD::user();
     $group = FD::group($groupId);
     if (!$group->isAdmin() && $discussion->created_by != $my->id && !$my->isSiteAdmin()) {
         return $this->redirect($group->getPermalink());
     }
     // Delete the discussion
     $discussion->delete();
     // @points: groups.discussion.delete
     // Deduct points from the discussion creator when the discussion is deleted
     $points = FD::points();
     $points->assign('groups.discussion.delete', 'com_easysocial', $discussion->created_by);
     FD::info()->set(JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_DELETED_SUCCESS'));
     // After deleting, we want to redirect to the discussions listing
     $url = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'appId' => $this->getApp()->id), false);
     // Perform a redirection
     $this->redirect($url);
 }
Exemplo n.º 2
0
 /**
  * Display user photos on the side bar
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function afterCategory($group)
 {
     $app = $this->getApp();
     $permalink = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'appId' => $app->getAlias()));
     $theme = FD::themes();
     $theme->set('permalink', $permalink);
     $theme->set('group', $group);
     echo $theme->output('themes:/apps/group/members/widgets/header');
 }
Exemplo n.º 3
0
 public function setBreadcrumbs($layout)
 {
     // Set the link to the groups
     FD::page()->breadcrumb($this->group->getName(), FRoute::groups(array('layout' => 'item', 'id' => $this->group->getAlias())));
     if ($layout == 'item') {
         FD::page()->breadcrumb($this->album->get('title'), $this->album->getPermalink());
     }
     // Set the albums breadcrumb
     FD::page()->breadcrumb($this->getPageTitle($layout, false));
 }
Exemplo n.º 4
0
 /**
  * Renders the sidebar widget for group members
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return	
  */
 public function sidebarBottom($groupId)
 {
     if (!$this->app->getParams()->get('show_members', true)) {
         return;
     }
     $theme = FD::themes();
     $params = $this->app->getParams();
     $limit = (int) $params->get('limit', 10);
     // Load up the group
     $group = FD::group($groupId);
     $options = array('state' => SOCIAL_STATE_PUBLISHED, 'limit' => $limit);
     $model = FD::model('Groups');
     $members = $model->getMembers($group->id, $options);
     $link = FRoute::groups(array('id' => $group->getAlias(), 'appId' => $this->app->getAlias(), 'layout' => 'item'));
     $theme->set('members', $members);
     $theme->set('link', $link);
     echo $theme->output('themes:/apps/group/members/widgets/widget.members');
 }
Exemplo n.º 5
0
		<div class="pull-left widget-title">
			<?php 
echo JText::_('APP_USER_GROUPS_WIDGET_GROUPS_TITLE');
?>
		</div>
		<span class="widget-label">(<?php 
echo $total;
?>
)</span>

		<?php 
if ($user->id == $this->my->id && $this->my->getAccess()->allowed('groups.create')) {
    ?>
			<div class="pull-right fd-small">
				<a href="<?php 
    echo FRoute::groups(array('layout' => 'create'));
    ?>
">
					<i class="icon-es-add"></i><?php 
    echo JText::_('COM_EASYSOCIAL_NEW_GROUP');
    ?>
				</a>
			</div>
		<?php 
}
?>
	</div>
	<div class="es-widget-body">
		<ul class="widget-list fd-nav fd-nav-stacked">
			<?php 
if ($groups) {
Exemplo n.º 6
0
 /**
  * Processes mentions in a stream object
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function formatMentions(SocialStreamItem &$stream)
 {
     // Get the current view
     $view = JRequest::getCmd('view', '');
     // Get the stream's content
     $content = $stream->content;
     // Get tags for the stream
     $tags = isset($stream->tags) ? $stream->tags : array();
     // If there is no tags, just skip this and escape the content
     if (!$tags) {
         return FD::string()->escape($content);
     }
     // We need to store the changes in an array and replace it accordingly based on the counter.
     $items = array();
     // We need to merge the mentions and hashtags since we are based on the offset.
     $i = 0;
     foreach ($tags as $tag) {
         if ($tag->type == 'user') {
             $replace = '<a href="' . $tag->user->getPermalink() . '" data-popbox="module://easysocial/profile/popbox" data-popbox-position="top-left" data-user-id="' . $tag->user->id . '" class="mentions-user">' . $tag->user->getName() . '</a>';
         }
         if ($tag->type == 'hashtag') {
             // $alias = JFilterOutput::stringURLSafe($tag->title);
             $alias = $tag->title;
             $url = '';
             if ($view == 'groups') {
                 $clusterReg = FD::registry($stream->params);
                 $object = $clusterReg->get($stream->cluster_type);
                 switch ($stream->cluster_type) {
                     case SOCIAL_TYPE_GROUP:
                         // for now we assume all is group type.
                         $group = new SocialGroup();
                         $group->bind($object);
                         $url = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'tag' => $alias));
                         break;
                     case SOCIAL_TYPE_EVENT:
                         $event = new SocialEvent();
                         $event->bind($object);
                         $url = FRoute::events(array('layout' => 'item', 'id' => $event->getAlias(), 'tag' => $alias));
                         break;
                     default:
                         FRoute::dashboard(array('layout' => 'hashtag', 'tag' => $alias));
                         break;
                 }
             } else {
                 $url = FRoute::dashboard(array('layout' => 'hashtag', 'tag' => $alias));
             }
             $replace = '<a href="' . $url . '" class="mentions-hashtag">#' . $tag->title . '</a>';
         }
         $links[$i] = $replace;
         $replace = '[si:mentions]' . $i . '[/si:mentions]';
         $content = JString::substr_replace($content, $replace, $tag->offset, $tag->length);
         $i++;
     }
     // Once we have the content, escape it
     $content = FD::string()->escape($content);
     if ($links) {
         for ($x = 0; $x < count($links); $x++) {
             $content = str_ireplace('[si:mentions]' . $x . '[/si:mentions]', $links[$x], $content);
         }
     }
     return $content;
 }
Exemplo n.º 7
0
    ?>
" data-es-provide="tooltip" data-placement="bottom">
					<i class="ies-locked"></i> <?php 
    echo JText::_('COM_EASYSOCIAL_GROUPS_CLOSED_GROUP');
    ?>
				</span>
				<?php 
}
?>
			</h4>

			<ul class="stream-apps-meta ml-0 pl-0">
				<li>
					<span>
						<a href="<?php 
echo FRoute::groups(array('layout' => 'category', 'id' => $group->getCategory()->getAlias()));
?>
">
							<i class="ies-database"></i> <?php 
echo $group->getCategory()->get('title');
?>
						</a>
					</span>
				</li>
				<li>
					<span>
						<a href="<?php 
echo FRoute::albums(array('uid' => $group->id, 'type' => SOCIAL_TYPE_GROUP));
?>
">
							<i class="ies-picture"></i> <?php 
Exemplo n.º 8
0
 public function display($groupId = null, $docType = null)
 {
     $group = FD::group($groupId);
     // Check access
     if (!$group->getAccess()->get('events.groupevent', true)) {
         return $this->redirect($group->getPermalink(false));
     }
     // Check if the viewer is allowed here.
     if (!$group->canViewItem()) {
         return $this->redirect($group->getPermalink(false));
     }
     $params = $this->app->getParams();
     // Retrieve event's model
     $model = FD::model('Events');
     // Get the start date
     $start = $this->input->get('start', 0, 'int');
     // Should we include past events?
     $includePast = $this->input->get('includePast', 0, 'int');
     // Ordering of the events
     $ordering = $this->input->get('ordering', 'start', 'string');
     // Get featured events
     $featuredOptions = array('state' => SOCIAL_STATE_PUBLISHED, 'featured' => true, 'ordering' => 'start', 'limit' => 5, 'limitstart' => $start, 'group_id' => $group->id, 'type' => 'all', 'ordering' => $ordering);
     $featuredEvents = $model->getEvents($featuredOptions);
     // Default options
     $options = array('state' => SOCIAL_STATE_PUBLISHED, 'featured' => false, 'ordering' => 'start', 'limit' => 5, 'limitstart' => $start, 'group_id' => $group->id, 'type' => 'all', 'ordering' => $ordering);
     if (empty($includePast)) {
         $options['ongoing'] = true;
         $options['upcoming'] = true;
     }
     // Get the events
     $events = $model->getEvents($options);
     $pagination = $model->getPagination();
     $pagination->setVar('option', 'com_easysocial');
     $pagination->setVar('view', 'groups');
     $pagination->setVar('layout', 'item');
     $pagination->setVar('id', $group->getAlias());
     $pagination->setVar('appId', $this->app->getAlias());
     $hrefs = array();
     $routeOptions = array('layout' => 'item', 'id' => $group->getAlias(), 'appId' => $this->app->getAlias());
     // We use start as key because order is always start by default, and it is the page default link
     $hrefs = array('start' => array('nopast' => FRoute::groups($routeOptions), 'past' => FRoute::groups(array_merge($routeOptions, array('includePast' => 1)))), 'created' => array('nopast' => FRoute::groups(array_merge($routeOptions, array('ordering' => 'created'))), 'past' => FRoute::groups(array_merge($routeOptions, array('ordering' => 'created', 'includePast' => 1)))));
     $this->set('hrefs', $hrefs);
     // Parameters to work with site/event/default.list
     $this->set('featuredEvents', $featuredEvents);
     $this->set('events', $events);
     $this->set('pagination', $pagination);
     $this->set('group', $group);
     $this->set('filter', 'all');
     $this->set('delayed', false);
     $this->set('showSorting', true);
     $this->set('showDistanceSorting', false);
     $this->set('showPastFilter', true);
     $this->set('showDistance', false);
     $this->set('hasLocation', false);
     $this->set('includePast', false);
     $this->set('ordering', $ordering);
     $this->set('includePast', $includePast);
     $this->set('activeCategory', false);
     $this->set('isGroupOwner', true);
     $guestApp = FD::table('App');
     $guestApp->load(array('type' => SOCIAL_TYPE_APPS, 'group' => SOCIAL_TYPE_EVENT, 'element' => 'guests'));
     $this->set('guestApp', $guestApp);
     echo parent::display('groups/default');
 }
Exemplo n.º 9
0
            ?>
    			</a>
    		</li>
    		<?php 
        }
        ?>

    		<?php 
        if ($this->config->get('groups.enabled')) {
            ?>
    		<li class="<?php 
            echo $view == 'groups' ? 'active' : '';
            ?>
">
    			<a href="<?php 
            echo FRoute::groups();
            ?>
">
    				<?php 
            echo JText::_('COM_EASYSOCIAL_TOOLBAR_PROFILE_GROUPS');
            ?>
    			</a>
    		</li>
    		<?php 
        }
        ?>

    		<?php 
        if ($this->config->get('events.enabled')) {
            ?>
    		<li class="<?php 
Exemplo n.º 10
0
 /**
  * Post process after saving group filter
  *
  * @since	1.2
  * @access	public
  * @param	StreamFilter object
  * @return
  */
 public function saveFilter($filter, $groupId)
 {
     // Unauthorized users should not be allowed to access this page.
     FD::requireLogin();
     FD::info()->set($this->getMessage());
     $group = FD::group($groupId);
     $this->redirect(FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias()), false));
 }
Exemplo n.º 11
0
?>
</div>
                </div>

                <div class="es-widget-body">
                    <ul class="widget-list fd-nav fd-nav-stacked">

                        <?php 
foreach ($apps as $app) {
    ?>
                        <li class="<?php 
    echo $appId == $app->id ? 'active' : '';
    ?>
" data-es-group-filter>
                            <a href="<?php 
    echo FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'appId' => $app->getAlias()));
    ?>
"
                                data-es-group-item-app
                                data-app-id="<?php 
    echo $app->id;
    ?>
"
                                title="<?php 
    echo $this->html('string.escape', $group->getName());
    ?>
 - <?php 
    echo $app->get('title');
    ?>
"
                            >
Exemplo n.º 12
0
							</a>
						</li>

						<!-- Progress -->
						<?php 
$counter = 1;
?>
						<?php 
foreach ($steps as $step) {
    ?>
						<?php 
    $customClass = $step->sequence == $currentStep || $currentStep > $step->sequence || $currentStep == SOCIAL_REGISTER_COMPLETED_STEP ? ' active' : '';
    $customClass .= $step->sequence < $currentStep || $currentStep == SOCIAL_REGISTER_COMPLETED_STEP ? $customClass . ' past' : '';
    if ($stepSession->hasStepAccess($step->sequence)) {
        // $link 		= $step->sequence == $currentStep ? 'javascript:void(0);' : FRoute::registration( array( 'layout' => 'steps' , 'step' => $step->sequence ) );
        $link = $step->sequence == $currentStep ? 'javascript:void(0);' : FRoute::groups(array('layout' => 'steps', 'step' => $counter));
    } else {
        $link = 'javascript:void(0);';
    }
    ?>
						<li class="divider-vertical<?php 
    echo $customClass;
    ?>
"></li>
						<li class="stepItem<?php 
    echo $customClass;
    ?>
"
							data-original-title="<?php 
    echo JText::_($step->title, true);
    ?>
Exemplo n.º 13
0
	>
		<i class="ies-pencil"></i>
	</a>

	<a  href="<?php 
echo FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'filterId' => $filter->getAlias()));
?>
"
		data-es-group-stream
		data-type="custom"
		data-dashboardFeeds-item
		data-id="<?php 
echo $filter->id;
?>
"
		data-url="<?php 
echo FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'filterId' => $filter->getAlias()));
?>
"
		data-title="<?php 
echo $this->html('string.escape', $filter->title);
?>
"
		class="data-dashboardfeeds-item"
	>
		<i class="ies-list mr-5"></i> <?php 
echo $filter->title;
?>
	</a>
</li>
" />
		</div>
		<div class="media-body">
			<h3 class="h3 es-title-font mt-10"><?php 
    echo $activeCategory->get('title');
    ?>
</h3>
		</div>
	</div>

	<p class="fd-small">
		<?php 
    echo $activeCategory->get('description');
    ?>
	</p>

	<div class="mt-15">
		<a href="<?php 
    echo FRoute::groups(array('layout' => 'category', 'id' => $activeCategory->getAlias()));
    ?>
" class="btn btn-es-primary btn-sm"><?php 
    echo JText::_('COM_EASYSOCIAL_GROUPS_MORE_INFO_CATEGORY');
    ?>
 &rarr;</a>
	</div>

</div>

<hr />
<?php 
}
Exemplo n.º 15
0
    ?>
				<ul class="widget-list widget-list-with-count fd-nav fd-nav-stacked" data-es-groups-categories>
					<?php 
    foreach ($categories as $category) {
        ?>
					<li data-es-groups-category data-es-groups-category-id="<?php 
        echo $category->id;
        ?>
"
						class="<?php 
        echo $activeCategory && $activeCategory->id == $category->id ? 'active' : '';
        ?>
"
					>
						<a href="<?php 
        echo FRoute::groups(array('categoryid' => $category->getAlias()));
        ?>
" title="<?php 
        echo $this->html('string.escape', $category->get('title'));
        ?>
"><?php 
        echo $category->get('title');
        ?>
</a>
						<span data-total-groups="<?php 
        echo $category->getTotalGroups(true);
        ?>
" class="es-count-no pull-right"><?php 
        echo $category->getTotalGroups(true);
        ?>
</span>
Exemplo n.º 16
0
 /**
  * Retrieves the new article form
  *
  * @since	1.2
  * @access	public
  * @return
  */
 public function save()
 {
     // Check for request forgeriess
     FD::checkToken();
     // Ensure that the user is logged in.
     FD::requireLogin();
     // Get the posted data
     $post = JRequest::get('post');
     // Determines if this is an edited news.
     $id = JRequest::getInt('newsId');
     // Load up the news obj
     $news = FD::table('GroupNews');
     $news->load($id);
     $message = !$news->id ? JText::_('APP_GROUP_NEWS_CREATED_SUCCESSFULLY') : JText::_('APP_GROUP_NEWS_UPDATED_SUCCESSFULLY');
     // Get the group
     $groupId = JRequest::getInt('cluster_id');
     $group = FD::group($groupId);
     $my = FD::user();
     // Get the app id
     $app = $this->getApp();
     if (!$group->isAdmin()) {
         $url = FRoute::groups($group->getPermalink(false));
         return $this->redirect($url);
     }
     $options = array();
     $options['title'] = JRequest::getVar('title');
     $options['content'] = JRequest::getVar('news_content', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $options['comments'] = JRequest::getBool('comments');
     $options['state'] = SOCIAL_STATE_PUBLISHED;
     // Only bind this if it's a new item
     if (!$news->id) {
         $options['cluster_id'] = $groupId;
         $options['created_by'] = $my->id;
         $options['hits'] = 0;
     }
     // Bind the data
     $news->bind($options);
     // Check if there are any errors
     if (!$news->check()) {
         FD::info()->set($news->getError(), SOCIAL_MSG_ERROR);
         $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'form', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias()), false);
         return $this->redirect($url);
     }
     // If everything is okay, bind the data.
     $news->store();
     // Redirect to the appropriate page now
     $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias(), 'newsId' => $news->id), false);
     // If it is a new item, we want to run some other stuffs here.
     if (!$id) {
         // @points: groups.news.create
         // Add points to the user that updated the group
         $points = FD::points();
         $points->assign('groups.news.create', 'com_easysocial', $my->id);
         $app = $this->getApp();
         $permalink = $app->getPermalink('canvas', array('customView' => 'item', 'groupId' => $group->id, 'newsId' => $news->id));
         // Notify users about the news.
         $options = array('userId' => $my->id, 'permalink' => $permalink, 'newsId' => $news->id, 'newsTitle' => $news->title, 'newsContent' => strip_tags($news->content));
         $group->notifyMembers('news.create', $options);
     }
     FD::info()->set($message, SOCIAL_MSG_SUCCESS);
     // Perform a redirection
     $this->redirect($url);
 }
Exemplo n.º 17
0
 /**
  * Approves a user's registration application
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function approve($email = true)
 {
     // Upda the group's state first.
     $this->state = SOCIAL_CLUSTER_PUBLISHED;
     $state = $this->save();
     // Activity logging.
     // Announce to the world when a new user registered on the site.
     $config = FD::config();
     // If we need to send email to the user, we need to process this here.
     if ($email) {
         FD::language()->loadSite();
         // Push arguments to template variables so users can use these arguments
         $params = array('title' => $this->getName(), 'name' => $this->getCreator()->getName(), 'avatar' => $this->getAvatar(SOCIAL_AVATAR_LARGE), 'groupUrl' => $this->getPermalink(false, true), 'editUrl' => FRoute::groups(array('external' => true, 'layout' => 'edit', 'id' => $this->getAlias()), false));
         // Get the email title.
         $title = JText::sprintf('COM_EASYSOCIAL_EMAILS_GROUP_APPLICATION_APPROVED', $this->getName());
         // Immediately send out emails
         $mailer = FD::mailer();
         // Get the email template.
         $mailTemplate = $mailer->getTemplate();
         // Set recipient
         $mailTemplate->setRecipient($this->getCreator()->getName(), $this->getCreator()->email);
         // Set title
         $mailTemplate->setTitle($title);
         // Set the contents
         $mailTemplate->setTemplate('site/group/approved', $params);
         // Set the priority. We need it to be sent out immediately since this is user registrations.
         $mailTemplate->setPriority(SOCIAL_MAILER_PRIORITY_IMMEDIATE);
         // Try to send out email now.
         $mailer->create($mailTemplate);
     }
     // Once a group is approved, generate a stream item for it.
     // Add activity logging when a user creates a new group.
     if ($config->get('groups.stream.create')) {
         $stream = FD::stream();
         $streamTemplate = $stream->getTemplate();
         // Set the actor
         $streamTemplate->setActor($this->creator_uid, SOCIAL_TYPE_USER);
         // Set the context
         $streamTemplate->setContext($this->id, SOCIAL_TYPE_GROUPS);
         $streamTemplate->setVerb('create');
         $streamTemplate->setSiteWide();
         $streamTemplate->setAccess('core.view');
         // Set the params to cache the group data
         $registry = FD::registry();
         $registry->set('group', $this);
         // Set the params to cache the group data
         $streamTemplate->setParams($registry);
         $streamTemplate->setCluster($this->id, SOCIAL_TYPE_GROUP, $this->type);
         // Add stream template.
         $stream->add($streamTemplate);
     }
     return true;
 }
Exemplo n.º 18
0
        <p><?php 
echo JText::_('COM_EASYSOCIAL_GROUPS_SELECT_CATEGORY_INFO');
?>
</p>
    </div>

    <hr />

    <div class="es-create-category-select">
        <div class="btn-group" data-bs-toggle="radio-buttons">
            <?php 
foreach ($categories as $category) {
    ?>
            <div class="btn-wrap">
                <a href="<?php 
    echo FRoute::groups(array('controller' => 'groups', 'task' => 'selectCategory', 'category_id' => $category->id));
    ?>
" class="btn btn-es">
                    <img src="<?php 
    echo $category->getAvatar(SOCIAL_AVATAR_SQUARE);
    ?>
" class="avatar" />
                    <span><?php 
    echo $category->get('title');
    ?>
</span>
                    <div class="es-description fd-small es-muted mt-5"><?php 
    echo $category->get('description');
    ?>
</div>
                </a>
Exemplo n.º 19
0
</a>

			<h3 class="pull-left">
				<a href="<?php 
    echo FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'tag' => $hashtagAlias));
    ?>
">#<?php 
    echo $hashtag;
    ?>
</a>
			</h3>
		</div>
	</div>
	<p class="fd-small">
		<?php 
    echo JText::sprintf('COM_EASYSOCIAL_STREAM_HASHTAG_CURRENTLY_FILTERING', '<a href="' . FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'tag' => $hashtagAlias)) . '">#' . $hashtag . '</a>');
    ?>
	</p>
</div>
<hr />
<?php 
}
?>

<?php 
echo $stream->html();
?>

<?php 
if ($this->my->guest) {
    ?>
Exemplo n.º 20
0
 public function setBreadcrumbs($layout)
 {
     // Set the link to the groups
     FD::page()->breadcrumb($this->group->getName(), FRoute::groups(array('layout' => 'item', 'id' => $this->group->getAlias())));
     if ($layout == 'form') {
         FD::page()->breadcrumb($this->getPageTitle('default', false));
     }
     if ($layout == 'item') {
         FD::page()->breadcrumb($this->getPageTitle('default', false), FRoute::albums(array('uid' => $this->group->id, 'type' => SOCIAL_TYPE_GROUP)));
     }
     // Set the albums breadcrumb
     FD::page()->breadcrumb($this->getPageTitle($layout, false));
 }
Exemplo n.º 21
0
 /**
  * post processing after group filter get deleted.
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function deleteFilter($groupId)
 {
     $ajax = FD::ajax();
     FD::requireLogin();
     FD::info()->set($this->getMessage());
     $group = FD::group($groupId);
     $url = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias()), false);
     return $ajax->redirect($url);
 }
Exemplo n.º 22
0
 public function initInfo()
 {
     FD::checkToken();
     $view = $this->getCurrentView();
     $groupId = JRequest::getInt('groupId');
     $group = FD::group($groupId);
     if (empty($group) || empty($group->id)) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_INVALID_GROUP_ID'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     $my = FD::user();
     if (!$my->isSiteAdmin() && !$group->isOpen() && !$group->isMember()) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_NO_ACCESS'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     FD::language()->loadAdmin();
     $steps = FD::model('Steps')->getSteps($group->category_id, SOCIAL_TYPE_CLUSTERS, SOCIAL_GROUPS_VIEW_DISPLAY);
     $fieldsLib = FD::fields();
     $fieldsLib->init(array('privacy' => false));
     $fieldsModel = FD::model('Fields');
     $index = 1;
     foreach ($steps as $step) {
         $step->fields = $fieldsModel->getCustomFields(array('step_id' => $step->id, 'data' => true, 'dataId' => $group->id, 'dataType' => SOCIAL_TYPE_GROUP, 'visible' => SOCIAL_GROUPS_VIEW_DISPLAY));
         if (!empty($step->fields)) {
             $args = array($group);
             $fieldsLib->trigger('onDisplay', SOCIAL_FIELDS_GROUP_GROUP, $step->fields, $args);
         }
         $step->hide = true;
         foreach ($step->fields as $field) {
             // As long as one of the field in the step has an output, then this step shouldn't be hidden
             // If step has been marked false, then no point marking it as false again
             // We don't break from the loop here because there is other checking going on
             if (!empty($field->output) && $step->hide === true) {
                 $step->hide = false;
             }
         }
         if ($index === 1) {
             $step->url = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'type' => 'info'), false);
         } else {
             $step->url = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'type' => 'info', 'infostep' => $index), false);
         }
         $step->title = $step->get('title');
         $step->active = !$step->hide && $index == 1;
         if ($step->active) {
             $theme = FD::themes();
             $theme->set('fields', $step->fields);
             $step->html = $theme->output('site/groups/item.info');
         }
         $step->index = $index;
         $index++;
     }
     return $view->call(__FUNCTION__, $steps);
 }