/**
  * This method store a post by user.
  */
 public function storePost()
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     $content = $this->input->getString('content');
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $content = JString::trim(strip_tags($content));
     $content = JHtmlString::truncate($content, 140);
     if (!$userId) {
         $app->close();
     }
     $userTimeZone = !$user->getParam('timezone') ? null : $user->getParam('timezone');
     try {
         $date = new JDate('now', $userTimeZone);
         $entity = new Socialcommunity\Wall\User\Post(JFactory::getDbo());
         $entity->setUserId($userId);
         $entity->setContent($content);
         $entity->setCreated($date->toSql(true));
         $entity->store();
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM'));
     }
     $params = JComponentHelper::getParams('com_socialcommunity');
     $filesystemHelper = new Prism\Filesystem\Helper($params);
     $mediaFolder = $filesystemHelper->getMediaFolderUri($userId);
     $profile = new Socialcommunity\Profile\Profile(JFactory::getDbo());
     $profile->load(['user_id' => $userId]);
     $displayData = new stdClass();
     $displayData->id = $entity->getId();
     $displayData->profileLink = JRoute::_(SocialCommunityHelperRoute::getProfileRoute($profile->getSlug()), false);
     $displayData->name = htmlentities($profile->getName(), ENT_QUOTES, 'utf-8');
     $displayData->alias = htmlentities($profile->getAlias(), ENT_QUOTES, 'utf-8');
     $displayData->imageSquare = $mediaFolder . '/' . $profile->getImageSquare();
     $displayData->imageAlt = $displayData->name;
     $displayData->content = $entity->getContent();
     $displayData->created = JHtml::_('socialcommunity.created', $entity->getCreated(), $userTimeZone);
     $layout = new JLayoutFile('wall_post');
     echo $layout->render($displayData);
     $app->close();
 }
 /**
  * Get a link to user profile.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  * $userId = 1;
  *
  * $profiles = new ITPrismIntegrateProfilesSocialCommunity();
  * $profiles->load($ids);
  *
  * $link = $profiles->getLink($userId);
  * </code>
  * 
  * @param integer $userId
  *
  * @return string
  */
 public function getLink($userId)
 {
     if (!isset($this->profiles[$userId])) {
         $link = "";
     } else {
         $link = SocialCommunityHelperRoute::getProfileRoute($this->profiles[$userId]->slug);
     }
     return $link;
 }
Esempio n. 3
0
 /**
  * Get a link to user profile.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  * $userId = 1;
  *
  * $profiles = new Prism\Integration\Profiles\SocialCommunity(\JFactory::getDbo());
  * $profiles->load($ids);
  *
  * $link = $profiles->getLink($userId);
  * </code>
  * 
  * @param int $userId
  * @param bool $route Route or not the link.
  *
  * @return string
  */
 public function getLink($userId, $route = true)
 {
     $link = '';
     if (array_key_exists($userId, $this->profiles) and !empty($this->profiles[$userId]->slug)) {
         $link = \SocialCommunityHelperRoute::getProfileRoute($this->profiles[$userId]->slug);
         if ($route) {
             $link = \JRoute::_($link);
         }
     }
     return $link;
 }
 * @copyright    Copyright (C) 2016 Todor Iliev <*****@*****.**>. All rights reserved.
 * @license      http://www.gnu.org/copyleft/gpl.html GNU/GPL
 */
// no direct access
defined('_JEXEC') or die;
if (!$this->item->image) {
    $image = 'media/com_socialcommunity/images/no_profile_200x200.png';
    $imageSquare = 'media/com_socialcommunity/images/no_profile_50x50.png';
    $imageAlt = '';
} else {
    $image = $this->mediaFolder . '/' . $this->item->image;
    $imageSquare = $this->mediaFolder . '/' . $this->item->image_square;
    $imageAlt = 'alt="' . $this->escape($this->item->name) . '"';
}
$layoutData = new stdClass();
$layoutData->profileLink = JRoute::_(SocialCommunityHelperRoute::getProfileRoute($this->item->user_id), false);
$layoutData->imageAlt = $imageAlt;
$layoutData->imageSquare = $imageSquare;
$layoutData->name = $this->escape($this->item->name);
$layoutData->alias = $this->escape($this->item->alias);
?>
<div class="scprofile-wall<?php 
echo $this->params->get('pageclass_sfx');
?>
">
	<?php 
if ($this->item->event->beforeDisplayContent) {
    echo $this->item->event->beforeDisplayContent;
}
?>
echo JText::_('JREGISTER');
?>
</button>
                    <a class="btn btn-default" href="<?php 
echo JRoute::_('');
?>
" title="<?php 
echo JText::_('JCANCEL');
?>
">
                        <?php 
echo JText::_('JCANCEL');
?>
                    </a>
                </div>
                <input type="hidden" name="option" value="com_users" />
                <input type="hidden" name="task" value="registration.register" />
                <input type="hidden" name="return" value="<?php 
echo base64_encode(JRoute::_(SocialCommunityHelperRoute::getProfileRoute()));
?>
" />
                <?php 
echo JHtml::_('form.token');
?>
            </form>
            <?php 
echo $this->formRegistration->getLabel('spacer');
?>
        </div>
    </div>
</div>
Esempio n. 6
0
 /**
  * Get a link to user profile.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  * $userId = 1;
  *
  * $profiles = new Prism\Integration\Profiles\SocialCommunity(\JFactory::getDbo());
  * $profiles->load($ids);
  *
  * $link = $profiles->getLink($userId);
  * </code>
  * 
  * @param int $userId
  * @param bool $route Route or not the link.
  *
  * @return string
  */
 public function getLink($userId, $route = true)
 {
     $link = "";
     if (isset($this->profiles[$userId]) and !empty($this->profiles[$userId]->slug)) {
         $link = \SocialCommunityHelperRoute::getProfileRoute($this->profiles[$userId]->slug);
         if ($route) {
             $link = \JRoute::_($link);
         }
     }
     return $link;
 }
Esempio n. 7
0
 /**
  * Provide a link to social profile.
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\SocialCommunity(\JFactory::getDbo());
  * $profile->load($userId);
  *
  * $link = $profile->getLink();
  * </code>
  *
  * @param bool $route Route or not the link.
  *
  * @return string
  */
 public function getLink($route = true)
 {
     $link = "";
     if (!empty($this->slug)) {
         $link = \SocialCommunityHelperRoute::getProfileRoute($this->slug);
         if ($route) {
             $link = \JRoute::_($link);
         }
     }
     return $link;
 }
Esempio n. 8
0
 /**
  * Provide a link to social profile.
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\SocialCommunity(\JFactory::getDbo());
  * $profile->load($userId);
  *
  * $link = $profile->getLink();
  * </code>
  *
  * @param bool $route Route or not the link.
  *
  * @return string
  */
 public function getLink($route = true)
 {
     $link = '';
     if (\JString::strlen($this->slug) > 0) {
         $link = \SocialCommunityHelperRoute::getProfileRoute($this->slug);
         if ($route) {
             $link = \JRoute::_($link);
         }
     }
     return $link;
 }