Example #1
0
 public static function _getArticleHTML($userid, $limit, $limitstart, $row, $app, $total, $cat, $params)
 {
     JPluginHelper::importPlugin('content');
     $dispatcher = JDispatcher::getInstance();
     $html = "";
     if (!empty($row)) {
         $html .= '<div class="joms-app--myarticle">';
         $html .= '<ul class="joms-list">';
         foreach ($row as $data) {
             $text_limit = $params->get('limit', 50);
             $result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, 0));
             if (empty($cat[$data->catid])) {
                 $cat[$data->catid] = "";
             }
             $data->sectionid = empty($data->sectionid) ? 0 : $data->sectionid;
             $link = plgCommunityMyArticles::buildLink($data->id, $data->alias, $data->catid, $cat[$data->catid], $data->sectionid);
             $created = new JDate($data->created);
             $date = CTimeHelper::timeLapse($created);
             $html .= '	<li>';
             $html .= '		<a href="' . $link . '">' . htmlspecialchars($data->title) . '</a>';
             $html .= '<span class="joms-block joms-text--small joms-text--light">' . $date . '</span>';
             $html .= '	</li>';
         }
         $html .= '</ul>';
         $showall = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=myarticles');
         $html .= "<div class='joms-gap'></div><div class='list-articles--button'><small><a class='joms-button--link' href='" . $showall . "'>" . JText::_('PLG_MYARTICLES_SHOWALL') . "</a></small></div>";
         $html .= '</div>';
     } else {
         $html .= "<p>" . JText::_("PLG_MYARTICLES_NO_ARTICLES") . "</p>";
     }
     return $html;
 }
Example #2
0
 /**
  * Displays the viewing profile page.
  * 	 	
  * @access	public
  * @param	array  An associative array to display the fields
  */
 public function profile(&$data)
 {
     $mainframe = JFactory::getApplication();
     $friendsModel = CFactory::getModel('friends');
     $showfriends = JRequest::getVar('showfriends', false);
     $userid = JRequest::getVar('userid', '');
     $user = CFactory::getUser($userid);
     $linkUrl = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
     $document = JFactory::getDocument();
     $document->setTitle(JText::sprintf('COM_COMMUNITY_USERS_FEED_TITLE', $user->getDisplayName()));
     $document->setDescription(JText::sprintf('COM_COMMUNITY_USERS_FEED_DESCRIPTION', $user->getDisplayName(), $user->lastvisitDate));
     $document->setLink($linkUrl);
     include_once JPATH_COMPONENT . '/libraries/activities.php';
     $act = new CActivityStream();
     $friendIds = $friendsModel->getFriendIds($user->id);
     $friendIds = $showfriends ? $friendIds : null;
     $rows = $act->getFEED($user->id, $friendIds, null, $mainframe->getCfg('feed_limit'));
     // add the avatar image
     $rssImage = new JFeedImage();
     $rssImage->url = $user->getThumbAvatar();
     $rssImage->link = $linkUrl;
     $rssImage->width = 64;
     $rssImage->height = 64;
     $document->image = $rssImage;
     //CFactory::load( 'helpers' , 'string' );
     //CFactory::load( 'helpers' , 'time' );
     foreach ($rows->data as $row) {
         if ($row->type != 'title') {
             // Get activities link
             $pattern = '/<a href=\\"(.*?)\\"/';
             preg_match_all($pattern, $row->title, $matches);
             // Use activity owner link when activity link is not available
             if (!empty($matches[1][1])) {
                 $linkUrl = $matches[1][1];
             } else {
                 if (!empty($matches[1][0])) {
                     $linkUrl = $matches[1][0];
                 }
             }
             // load individual item creator class
             $item = new JFeedItem();
             $item->title = $row->title;
             $item->link = $linkUrl;
             $item->description = "<img src=\"{$row->favicon}\" alt=\"\" />&nbsp;" . $row->title;
             $item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
             $item->category = '';
             //$row->category;
             $item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
             // Make sure url is absolute
             $pattern = '/href="(.*?)index.php/';
             $replace = 'href="' . JURI::base() . 'index.php';
             $string = $item->description;
             $item->description = preg_replace($pattern, $replace, $string);
             // loads item info into rss array
             $document->addItem($item);
         }
     }
 }
Example #3
0
 public static function photosWallEdit($userid, $asset, $wall_obj)
 {
     // @rule: We only allow editing of wall in 15 minutes
     $viewer = CFactory::getUser($userid);
     $now = JFactory::getDate();
     $interval = CTimeHelper::timeIntervalDifference($wall_obj->date, $now->toSql());
     $interval = abs($interval);
     // Only owner and site admin can edit
     if (COwnerHelper::isCommunityAdmin() || $viewer->id == $wall_obj->post_by) {
         return true;
     }
     return false;
 }
Example #4
0
 /**
  *
  * @param JDate $date
  *
  */
 public static function timeLapse($date)
 {
     $now = new JDate();
     $dateDiff = CTimeHelper::timeDifference($date->toUnix(), $now->toUnix());
     if ($dateDiff['days'] > 0) {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['days']) ? 'CC LAPSED DAY MANY' : 'CC LAPSED DAY', $dateDiff['days']);
     } elseif ($dateDiff['hours'] > 0) {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['hours']) ? 'CC LAPSED HOUR MANY' : 'CC LAPSED HOUR', $dateDiff['hours']);
     } elseif ($dateDiff['minutes'] > 0) {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['minutes']) ? 'CC LAPSED MINUTE MANY' : 'CC LAPSED MINUTE', $dateDiff['minutes']);
     } else {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['seconds']) ? 'CC LAPSED SECOND MANY' : 'CC LAPSED SECOND', $dateDiff['seconds']);
     }
     return $lapse;
 }
Example #5
0
 public function editPhotoWall($wallId)
 {
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'time');
     $my = CFactory::getUser();
     $wall =& JTable::getInstance('Wall', 'CTable');
     $wall->load($wallId);
     // @rule: We only allow editing of wall in 15 minutes
     $now = JFactory::getDate();
     $interval = CTimeHelper::timeIntervalDifference($wall->date, $now->toMySQL());
     $interval = abs($interval);
     if ((COwnerHelper::isCommunityAdmin() || $my->id == $wall->post_by) && COMMUNITY_WALLS_EDIT_INTERVAL > $interval) {
         return true;
     }
     return false;
 }
Example #6
0
 public function display($data = null)
 {
     $mainframe = JFactory::getApplication();
     $config = CFactory::getConfig();
     $document = JFactory::getDocument();
     $document->setTitle(JText::sprintf('COM_COMMUNITY_FRONTPAGE_TITLE', $config->get('sitename')));
     $document->setLink(CRoute::_('index.php?option=com_community'));
     $my = CFactory::getUser();
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'string');
     CFactory::load('helpers', 'time');
     $act = new CActivityStream();
     $rows = $act->getFEED('', '', null, $mainframe->getCfg('feed_limit'));
     if ($config->get('showactivitystream') == COMMUNITY_SHOW || $config->get('showactivitystream') == COMMUNITY_MEMBERS_ONLY && $my->id != 0) {
         foreach ($rows->data as $row) {
             if ($row->type != 'title') {
                 // load individual item creator class
                 $item = new JFeedItem();
                 // cannot escape the title. it's already formated. we should
                 // escape it during CActivityStream::add
                 //$item->title 		= CStringHelper::escape($row->title);
                 $item->title = $row->title;
                 $item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->actor);
                 $item->description = "<img src=\"{$row->favicon}\" alt=\"\"/>&nbsp;" . $row->title;
                 $item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
                 $item->category = '';
                 //$row->category;
                 $item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
                 // Make sure url is absolute
                 $item->description = CString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
                 // loads item info into rss array
                 $document->addItem($item);
             }
         }
     }
 }
                    $this->load('activities/videos/like');
                } else {
                    $photo = JTable::getInstance('Photo', 'CTable');
                    $photo->load($act->cid);
                    // if($album->permissions == 30 && !CFriendsHelper::isConnected($my->id,$album->creator)){
                    //     return false;
                    // }
                    $params = $act->params;
                    $users = $params->get('actors');
                    if (!is_array($users)) {
                        $users = array_reverse(explode(',', $users));
                    }
                    $user = CFactory::getUser($users[0]);
                    $date = JFactory::getDate($act->created);
                    if ($config->get('activitydateformat') == "lapse") {
                        $createdTime = CTimeHelper::timeLapse($date);
                    } else {
                        $createdTime = $date->format($config->get('profileDateFormat'));
                    }
                    $isPhotoModal = $config->get('album_mode') == 1;
                    ?>

<div class="joms-stream__header">
    <div class= "joms-avatar--stream <?php 
                    echo CUserHelper::onlineIndicator($user);
                    ?>
">
        <?php 
                    if (count($users) > 1 && false) {
                        // added false for now because we have to show the last user avatar
                        ?>
Example #8
0
        public static function _getArticleHTML($userid, $limit, $limitstart, $row, $app, $total, $cat, $myblogItemId, $introtext, $params)
        {
            JPluginHelper::importPlugin('content');
            $dispatcher = JDispatcher::getInstance();
            $html = "";
            if (!empty($row)) {
                $html .= '<div id="application-myarticles" class="joms-tab__app">';
                $html .= '<ul class="list-articles cResetList">';
                foreach ($row as $data) {
                    $text_limit = $params->get('limit', 50);
                    if (JString::strlen($data->introtext) > $text_limit) {
                        $content = strip_tags(JString::substr($data->introtext, 0, $text_limit));
                        $content .= " .....";
                    } else {
                        $content = $data->introtext;
                    }
                    $data->text = $content;
                    $result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, 0));
                    if (empty($data->permalink)) {
                        $myblog = 0;
                        $permalink = "";
                    } else {
                        $myblog = 1;
                        $permalink = $data->permalink;
                    }
                    if (empty($cat[$data->catid])) {
                        $cat[$data->catid] = "";
                    }
                    $data->sectionid = empty($data->sectionid) ? 0 : $data->sectionid;
                    $link = plgCommunityMyArticles::buildLink($data->id, $data->alias, $data->catid, $cat[$data->catid], $data->sectionid, $myblog, $permalink, $myblogItemId);
                    $created = new JDate($data->created);
                    $date = CTimeHelper::timeLapse($created);
                    $html .= '	<li>';
                    $html .= '		<span class="joms-text--small">' . $date . '</span>';
                    $html .= '		<a href="' . $link . '">' . htmlspecialchars($data->title) . '</a>';
                    if ($introtext == 1) {
                        $html .= '<p>' . $content . '</p>';
                    }
                    $html .= '	</li>';
                }
                $html .= '</ul>';
                if ($app == 1) {
                    jimport('joomla.html.pagination');
                    $pagination = new JPagination($total, $limitstart, $limit);
                    $html .= '
                    <div class="list-articles--button">
						' . $pagination->getPagesLinks() . '
					</div>';
                } else {
                    $showall = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=myarticles');
                    $html .= "<div class='list-articles--button'><a class='joms-button--link' href='" . $showall . "'>" . JText::_('PLG_MYARTICLES_SHOWALL') . "</a></div>";
                }
                $html .= '</div>';
            } else {
                $html .= "<p>" . JText::_("PLG_MYARTICLES_NO_ARTICLES") . "</p>";
            }
            return $html;
        }
Example #9
0
 /**
  * Return true if the event is past
  * A past event, is events that are has passed more than 24 hours from the last date
  */
 public static function isPast($event)
 {
     $endDate = CTimeHelper::getLocaleDate($event->enddate);
     $now = CTimeHelper::getLocaleDate();
     $nowUnix = $now->toUnix();
     $isPast = $endDate->toUnix() < $nowUnix;
     return $isPast;
 }
Example #10
0
    function _getEventsHTML($createEvents, $rows, $user, $config, $totalEvents, $creatable)
    {
        ob_start();
        ?>

        <?php 
        if ($rows) {
            ?>
        <ul class="joms-list--event">
        <?php 
            foreach ($rows as $row) {
                $event = JTable::getInstance('Event', 'CTable');
                $event->load($row->id);
                $creator = CFactory::getUser($event->creator);
                // Get the formated date & time
                $format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_12H') : JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_24H');
                $startdatehtml = CTimeHelper::getFormattedTime($event->startdate, $format);
                $enddatehtml = CTimeHelper::getFormattedTime($event->enddate, $format);
                ?>

            <li class="joms-media--event" title="<?php 
                echo CStringHelper::escape($event->summary);
                ?>
">
                <div class="joms-media__calendar">
                    <span class="month"><?php 
                echo CEventHelper::formatStartDate($event, JText::_('M'));
                ?>
</span>
                    <span class="date"><?php 
                echo CEventHelper::formatStartDate($event, JText::_('d'));
                ?>
</span>
                </div>
                <div class="joms-media__body">
                    <a href="<?php 
                echo CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
                ?>
"><?php 
                echo $event->title;
                ?>
</a>
                    <span class="joms-block"><?php 
                echo $event->location;
                ?>
</span>
                    <a href="<?php 
                echo CRoute::_('index.php?option=com_community&view=events&task=viewguest&eventid=' . $event->id . '&type=' . COMMUNITY_EVENT_STATUS_ATTEND);
                ?>
"><?php 
                echo JText::sprintf(!CStringHelper::isSingular($event->confirmedcount) ? 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT_MANY' : 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT', $event->confirmedcount);
                ?>
</a>
                </div>
            </li>
            <?php 
            }
            ?>
        </ul>
        <?php 
        } else {
            ?>
            <div><?php 
            echo JText::_('PLG_EVENTS_NO_EVENTS_CREATED_BY_THE_USER_YET');
            ?>
</div>
        <?php 
        }
        ?>
        <small>
        <?php 
        if ($creatable) {
            ?>
        <a class="joms-button--link" href="<?php 
            echo CRoute::_('index.php?option=com_community&view=events&task=create');
            ?>
"><?php 
            echo JText::_('COM_COMMUNITY_EVENTS_CREATE');
            ?>
</a>
        <?php 
        }
        ?>
        <a class="joms-button--link" href="<?php 
        echo CRoute::_('index.php?option=com_community&view=events');
        ?>
"><?php 
        echo JText::_('COM_COMMUNITY_EVENTS_ALL_EVENTS') . ' (' . $totalEvents . ')';
        ?>
</a>
        </small>

        <?php 
        $content = ob_get_contents();
        ob_end_clean();
        return $content;
    }
Example #11
0
 /**
  * View method to display specific discussion from a group
  * @since 2.4
  * @access	public
  * @param	Object	Data object passed from controller
  */
 public function viewdiscussion()
 {
     $mainframe =& JFactory::getApplication();
     $document = JFactory::getDocument();
     $jconfig = JFactory::getConfig();
     $config = CFactory::getConfig();
     // Load window library
     CFactory::load('libraries', 'window');
     // Load necessary window css / javascript headers.
     CWindow::load();
     // Get necessary variables
     CFactory::load('models', 'groups');
     CFactory::load('models', 'discussions');
     $my = CFactory::getUser();
     $groupId = JRequest::getInt('groupid', '', 'GET');
     $topicId = JRequest::getInt('topicid', '', 'GET');
     // Load necessary library and objects
     $groupModel = CFactory::getModel('groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $discussion =& JTable::getInstance('Discussion', 'CTable');
     $group->load($groupId);
     $discussion->load($topicId);
     $isBanned = $group->isBanned($my->id);
     $document->addCustomTag('<link rel="image_src" href="' . $group->getThumbAvatar() . '" />');
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$group->published) {
         $this->_redirectUnpublishGroup();
         return;
     }
     $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussion&topicid=' . $topicId . '&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_GROUPS_LATEST_FEED') . '"  href="' . $feedLink . '"/>';
     $document->addCustomTag($feed);
     CFactory::load('helpers', 'owner');
     if ($group->approvals == 1 && !$group->isMember($my->id) && !COwnerHelper::isCommunityAdmin()) {
         $this->noAccess(JText::_('COM_COMMUNITY_GROUPS_PRIVATE_NOTICE'));
         return;
     }
     // Execute discussion onDisplay filter
     $appsLib =& CAppPlugins::getInstance();
     $appsLib->loadApplications();
     $args = array();
     $args[] =& $discussion;
     $appsLib->triggerEvent('onDiscussionDisplay', $args);
     // Get the discussion creator info
     $creator = CFactory::getUser($discussion->creator);
     // Format the date accordingly.
     //$discussion->created	= CTimeHelper::getDate( $discussion->created );
     $dayinterval = ACTIVITY_INTERVAL_DAY;
     $timeFormat = $config->get('activitiestimeformat');
     $dayFormat = $config->get('activitiesdayformat');
     if ($config->get('activitydateformat') == COMMUNITY_DATE_FIXED) {
         $discussion->created = CTimeHelper::getDate($discussion->created)->toFormat(JText::_('DATE_FORMAT_LC2'), true);
     } else {
         $discussion->created = CTimeHelper::timeLapse(CTimeHelper::getDate($discussion->created));
     }
     // Set page title
     $document->setTitle(JText::sprintf('COM_COMMUNITY_GROUPS_DISCUSSION_TITTLE', $discussion->title));
     // Add pathways
     $this->_addGroupInPathway($group->id);
     $this->addPathway(JText::_('COM_COMMUNITY_GROUPS_DISCUSSION'), CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussions&groupid=' . $group->id));
     $this->addPathway(JText::sprintf('COM_COMMUNITY_GROUPS_DISCUSSION_TITTLE', $discussion->title));
     CFactory::load('helpers', 'owner');
     $isGroupAdmin = $groupModel->isAdmin($my->id, $group->id);
     if ($my->id == $creator->id || $isGroupAdmin || COwnerHelper::isCommunityAdmin()) {
         $title = JText::_('COM_COMMUNITY_DELETE_DISCUSSION');
         $titleLock = $discussion->lock ? JText::_('COM_COMMUNITY_UNLOCK_DISCUSSION') : JText::_('COM_COMMUNITY_LOCK_DISCUSSION');
         $actionLock = $discussion->lock ? JText::_('COM_COMMUNITY_UNLOCK') : JText::_('COM_COMMUNITY_LOCK');
         $this->addSubmenuItem('', $actionLock, "joms.groups.lockTopic('" . $titleLock . "','" . $group->id . "','" . $discussion->id . "');", SUBMENU_RIGHT);
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), "joms.groups.removeTopic('" . $title . "','" . $group->id . "','" . $discussion->id . "');", SUBMENU_RIGHT);
         $this->addSubmenuItem('index.php?option=com_community&view=groups&task=editdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id, JText::_('COM_COMMUNITY_EDIT'), '', SUBMENU_RIGHT);
     }
     $this->showSubmenu();
     CFactory::load('libraries', 'wall');
     $wallContent = CWallLibrary::getWallContents('discussions', $discussion->id, $isGroupAdmin, $jconfig->get('list_limit'), 0, 'wall.content', 'groups,discussion');
     $wallCount = CWallLibrary::getWallCount('discussions', $discussion->id);
     $viewAllLink = CRoute::_('index.php?option=com_community&view=groups&task=discussapp&topicid=' . $discussion->id . '&app=walls');
     $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     // Test if the current browser is a member of the group
     $isMember = $group->isMember($my->id);
     $waitingApproval = false;
     // If I have tried to join this group, but not yet approved, display a notice
     if ($groupModel->isWaitingAuthorization($my->id, $group->id)) {
         $waitingApproval = true;
     }
     $wallForm = '';
     $config = CFactory::getConfig();
     // Only get the wall form if user is really allowed to see it.
     if (!$config->get('lockgroupwalls') || $config->get('lockgroupwalls') && $isMember && !$isBanned && !$waitingApproval || COwnerHelper::isCommunityAdmin()) {
         $outputLock = '<div class="warning">' . JText::_('COM_COMMUNITY_DISCUSSION_LOCKED_NOTICE') . '</div>';
         $outputUnLock = CWallLibrary::getWallInputForm($discussion->id, 'groups,ajaxSaveDiscussionWall', 'groups,ajaxRemoveReply');
         $wallForm = '<div class="wall-tittle">' . JText::_('COM_COMMUNITY_REPLIES') . '</div>';
         $wallForm .= $discussion->lock ? $outputLock : $outputUnLock;
     }
     if (empty($wallForm)) {
         //user must join in order to see this page
         $tmpl = new CTemplate();
         $wallForm = $tmpl->set('groupid', $groupId)->fetch('groups.joingroup');
         $outputLock = '<div class="warning">' . JText::_('COM_COMMUNITY_DISCUSSION_LOCKED_NOTICE') . '</div>';
         $outputUnLock = CWallLibrary::getWallInputForm($discussion->id, 'groups,ajaxSaveDiscussionWall', 'groups,ajaxRemoveReply');
         $wallForm2 = '<div class="wall-tittle">' . JText::_('COM_COMMUNITY_REPLIES') . '</div>';
         $wallForm2 .= $discussion->lock ? $outputLock : $outputUnLock;
         $wallForm = $wallForm . '<div style="display:none" class="reply-form">' . $wallForm2 . '</div>';
     }
     $config = CFactory::getConfig();
     // Get creator link
     $creatorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $creator->id);
     // Get reporting html
     CFactory::load('libraries', 'reporting');
     $report = new CReportingLibrary();
     $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_GROUPS_DISCUSSION_REPORT'), 'groups,reportDiscussion', array($discussion->id));
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id));
     $bookmarksHTML = $bookmarks->getHTML();
     $tmpl = new CTemplate();
     echo $tmpl->set('bookmarksHTML', $bookmarksHTML)->set('discussion', $discussion)->set('creator', $creator)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('creatorLink', $creatorLink)->set('reportHTML', $reportHTML)->set('groupid', $groupId)->fetch('groups.viewdiscussion');
 }
Example #12
0
 /**
  * Method to get the last update
  *
  * @return type
  */
 public function getLastUpdate()
 {
     // If new albums that has just been created and
     // does not contain any images, the lastupdated will always be 0000-00-00 00:00:00:00
     // Try to use the albums creation date instead.
     if ($this->lastupdated == '0000-00-00 00:00:00' || $this->lastupdated == '') {
         $lastupdated = $this->created;
         if ($this->lastupdated == '' || $this->lastupdated == '0000-00-00 00:00:00') {
             $lastupdated = JText::_('COM_COMMUNITY_PHOTOS_NO_ACTIVITY');
         } else {
             $lastUpdated = new JDate($this->lastupdated);
             $lastupdated = CTimeHelper::timeLapse($lastUpdated, false);
         }
     } else {
         $lastUpdated = new JDate($this->lastupdated);
         $lastupdated = CTimeHelper::timeLapse($lastUpdated, false);
     }
     return $lastupdated;
 }
Example #13
0
 /**
  * return array of notification items
  */
 public function getNotification($userid, $type = '0', $limit = 10, $since = '')
 {
     $db = $this->getDBO();
     $limit = $limit === 0 ? $this->getState('limit') : $limit;
     $limitstart = $this->getState('limitstart');
     $sinceWhere = '';
     if (empty($limitstart)) {
         $limitstart = 0;
     }
     if (!empty($since)) {
         $sinceWhere = ' AND ' . $db->quoteName('created') . ' >= ' . $db->Quote($since);
         //rule: if no new notification, load the first 5th latest notification
         $query = 'SELECT COUNT(*)  FROM ' . $db->quoteName('#__community_notifications') . ' AS a ' . 'WHERE a.' . $db->quoteName('target') . '=' . $db->Quote($userid) . $sinceWhere . ' AND a.' . $db->quoteName('type') . '=' . $db->Quote($type);
         $db->setQuery($query);
         $total = $db->loadResult();
         if ($total == 0) {
             $sinceWhere = '';
             //$limit = 5;
         }
     }
     if (!CFactory::getConfig()->get('enablepm')) {
         $sinceWhere .= ' AND a.' . $db->quoteName('cmd_type') . 'NOT LIKE ' . $db->quote('%inbox%');
     }
     $date = CTimeHelper::getDate();
     //we need to compare where both date with offset so that the day diff correctly.
     $query = 'SELECT *,' . ' TO_DAYS(' . $db->Quote($date->format('Y-m-d H:i:s', true, false)) . ') -  TO_DAYS( DATE_ADD(a.' . $db->quoteName('created') . ', INTERVAL ' . $date->getOffset() . ' HOUR ) ) as _daydiff' . ' FROM ' . $db->quoteName('#__community_notifications') . ' AS a ' . 'WHERE a.' . $db->quoteName('target') . '=' . $db->Quote($userid) . ' AND a.' . $db->quoteName('type') . '=' . $db->Quote($type) . $sinceWhere . ' ORDER BY a.' . $db->quoteName('created') . ' DESC';
     if (!is_null($limit)) {
         $query .= ' LIMIT ' . $limitstart . ',' . $limit;
     }
     $db->setQuery($query);
     $result = $db->loadObjectList();
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     //Pagination
     $query = 'SELECT COUNT(*)  FROM ' . $db->quoteName('#__community_notifications') . ' AS a ' . 'WHERE a.' . $db->quoteName('target') . '=' . $db->Quote($userid) . $sinceWhere . ' AND a.' . $db->quoteName('type') . '=' . $db->Quote($type);
     $db->setQuery($query);
     $total = $db->loadResult();
     $this->total = $total;
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     if (empty($this->_pagination)) {
         jimport('joomla.html.pagination');
         $this->_pagination = new JPagination($total, $limitstart, $limit);
     }
     return $result;
 }
Example #14
0
<?php

/**
* @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 <*****@*****.**>
* @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('Restricted access');
$usersModel = CFactory::getModel('user');
$now = new JDate();
$date = CTimeHelper::getDate();
$users = $usersModel->getLatestMember(10);
$totalRegistered = count($users);
$title = JText::sprintf('COM_COMMUNITY_TOTAL_USERS_REGISTERED_THIS_MONTH_ACTIVITY_TITLE', $totalRegistered, $date->monthToString($now->format('%m')));
?>

<div class="joms-stream__body joms-stream-box">

    <h4><?php 
echo JText::_('COM_COMMUNITY_LAST_10_USERS_REGISTERED');
?>
</h4>

        <?php 
if ($totalRegistered > 0) {
    ?>

            <div class="joms-list--block">
Example #15
0
 public function getTotalMessageSent($userId)
 {
     //CFactory::load( 'helpers' , 'time' );
     $date = CTimeHelper::getDate();
     $db = $this->getDBO();
     //Joomla 1.6 JDate::getOffset returns in second while in J1.5 it's in hours
     $query = 'SELECT COUNT(*) FROM ' . $db->quoteName('#__community_msg') . ' AS a ' . 'WHERE a.' . $db->quoteName('from') . '=' . $db->Quote($userId) . ' AND TO_DAYS(' . $db->Quote($date->toSql(true)) . ') - TO_DAYS( DATE_ADD( a.' . $db->quoteName('posted_on') . ' , INTERVAL ' . $date->getOffset() / 3600 . ' HOUR ) ) = ' . $db->Quote('0') . ' AND a.' . $db->quoteName('parent') . '=a.' . $db->quoteName('id');
     $db->setQuery($query);
     $count = $db->loadResult();
     return $count;
 }
Example #16
0
                            <span><?php 
        echo JText::_('COM_COMMUNITY_EVENTS_START_TIME');
        ?>
</span>
                            <?php 
        echo CTimeHelper::getFormattedUTC($event->getStartDate(), $offsetValue);
        ?>
                        </div>

                        <div class="joms-form__group">
                            <span><?php 
        echo JText::_('COM_COMMUNITY_EVENTS_END_TIME');
        ?>
</span>
                            <?php 
        echo CTimeHelper::getFormattedUTC($event->getEndDate(), $offsetValue);
        ?>
                        </div>

                        <div class="joms-form__group">
                            <span><?php 
        echo JText::_('COM_COMMUNITY_TIMEZONE');
        ?>
</span>
                            <?php 
        $time = new DateTime('now', new DateTimeZone($offset));
        $time = (int) $time->format('P');
        ?>

                            <input class="joms-input" name="event-<?php 
        echo $i;
Example #17
0
    /**
     * Get event child count
     *
     * @param int    $parent
     * @return int total
     *
     * */
    public function getEventChildsCount($parent)
    {
        $db = $this->getDBO();
        $pastDate = CTimeHelper::getLocaleDate();
        $query = 'SELECT COUNT(*)
			      FROM ' . $db->quoteName('#__community_events') . '
				  WHERE ' . $db->quoteName('parent') . '=' . $db->Quote($parent) . '
				  AND ' . $db->quoteName('enddate') . ' > ' . $db->Quote($pastDate->toSql(true)) . '
				  AND ' . $db->quoteName('published') . '=' . $db->Quote(1);
        $db->setQuery($query);
        if ($db->getErrorNum()) {
            JError::raiseError(500, $db->stderr());
        }
        return $db->loadResult();
    }
Example #18
0
<?php

/**
 * @package		JomSocial
 * @subpackage 	Template 
 * @copyright (C) 2008 by Slashes & Dots Sdn Bhd - All rights reserved!
 * @license		GNU/GPL, see LICENSE.php
 * 
 * @param	friends		array or CUser (all user)
 * @param	total		integer total number of friends  
 */
defined('_JEXEC') or die;
$jnow = CTimeHelper::getDate();
?>

<div id="writeMessageContainer">
	<form name="jsform-inbox-ajaxcompose" method="post" action="" name="writeMessageForm" id="writeMessageForm">
		<table class="cWindowForm">
			<tr>
				<td class="cWindowFormKey"><label class="label"><?php 
echo JText::_('CC COMPOSE TO');
?>
</td>
				<td class="cWindowFormVal">
				    <table cellpadding="0" cellspacing="0" border="0" width="100%" class="receiverContainer">
						<tr>
						    <td style="padding: 0; width: 40px;">
						    	<div>
									<img src="<?php 
echo $user->getThumbAvatar();
?>
Example #19
0
 private function getPhotoInfoHeader($photo)
 {
     $date = CTimeHelper::getDate($photo->created);
     $config = CFactory::getConfig();
     $creator = CFactory::getUser($photo->creator);
     if ($config->get('activitydateformat') == 'lapse') {
         $created = CTimeHelper::timeLapse($date);
     } else {
         $created = $date->Format(JText::_('DATE_FORMAT_LC2'));
     }
     $userThumb = CUserHelper::getThumb($creator->id, 'avatar');
     $caption = $photo->caption;
     $template = new CTemplate();
     return $template->set('creator', $creator)->set('permission', $photo->permissions)->set('created', $created)->set('userThumb', $userThumb)->set('caption', $caption)->fetch('wall/info');
 }
Example #20
0
 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;
         }
         $resultRows[] = $obj;
     }
     $tmpl = new CTemplate();
     echo $tmpl->set('data', $resultRows)->set('alreadyfriend', $alreadyfriend)->set('sortings', '')->set('pagination', $data->pagination)->set('filter', '')->set('featuredList', $featuredList)->set('my', $my)->set('showFeaturedList', false)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->fetch('people.browse');
 }
    <article>
      <a href="<?php 
echo $this->event->getLink();
?>
"> <i class="joms-icon-calendar-empty portrait-phone-only"></i> <?php 
echo JHTML::_('string.truncate', $this->event->title, $truncateVal, true, false);
?>
</a>
      <div class="separator"></div>
      <p><?php 
echo JHTML::_('string.truncate', $this->event->description, $truncateVal, true, false);
?>
</p>
      <ul class="list-unstyled content-details">
          <li><i class="joms-icon-calendar"></i><?php 
echo CTimeHelper::getFormattedTime($this->event->startdate, $format);
?>
</li>
          <li><i class="joms-icon-map-marker"></i><?php 
echo CActivities::format($activity->get('location'));
?>
</li>
      </ul>
    </article>
</div>

    <?php 
$this->load('activities.actions');
?>
</div>
Example #22
0
 /**
  * AJAX method to add predefined activity
  **/
 public function ajaxAddPredefined($key, $message = '')
 {
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     $filter = JFilterInput::getInstance();
     $key = $filter->clean($key, 'string');
     $message = $filter->clean($message, 'string');
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'owner');
     if (!COwnerHelper::isCommunityAdmin()) {
         return;
     }
     // Predefined system custom activity.
     $system = array('system.registered', 'system.populargroup', 'system.totalphotos', 'system.popularprofiles', 'system.popularphotos', 'system.popularvideos');
     $act = new stdClass();
     $act->actor = $my->id;
     $act->target = 0;
     $act->app = 'system';
     $act->access = PRIVACY_FORCE_PUBLIC;
     $params = new CParameter('');
     if (in_array($key, $system)) {
         switch ($key) {
             case 'system.registered':
                 CFactory::load('helpers', 'time');
                 $usersModel = CFactory::getModel('user');
                 $now = new JDate();
                 $date = CTimeHelper::getDate();
                 $title = JText::sprintf('COM_COMMUNITY_TOTAL_USERS_REGISTERED_THIS_MONTH_ACTIVITY_TITLE', $usersModel->getTotalRegisteredByMonth($now->toFormat('%Y-%m')), $date->_monthToString($now->toFormat('%m')));
                 $act->cmd = 'system.registered';
                 $act->title = $title;
                 $act->content = '';
                 break;
             case 'system.populargroup':
                 $groupsModel = CFactory::getModel('groups');
                 $activeGroup = $groupsModel->getMostActiveGroup();
                 $title = JText::sprintf('COM_COMMUNITY_MOST_POPULAR_GROUP_ACTIVITY_TITLE', $activeGroup->name);
                 $params->set('action', 'groups.join');
                 $params->set('group_url', CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $activeGroup->id));
                 $act->cmd = 'groups.popular';
                 $act->cid = $activeGroup->id;
                 $act->title = $title;
                 break;
             case 'system.totalphotos':
                 $photosModel = CFactory::getModel('photos');
                 $total = $photosModel->getTotalSitePhotos();
                 $params->set('photos_url', CRoute::_('index.php?option=com_community&view=photos'));
                 $act->cmd = 'photos.total';
                 $act->title = JText::sprintf('COM_COMMUNITY_TOTAL_PHOTOS_ACTIVITY_TITLE', $total);
                 break;
             case 'system.popularprofiles':
                 CFactory::load('libraries', 'tooltip');
                 $act->cmd = 'members.popular';
                 $act->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_PROFILES', 5);
                 $params->set('action', 'top_users');
                 $params->set('count', 5);
                 break;
             case 'system.popularphotos':
                 $act->cmd = 'photos.popular';
                 $act->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_PHOTOS', 5);
                 $params->set('action', 'top_photos');
                 $params->set('count', 5);
                 break;
             case 'system.popularvideos':
                 $act->cmd = 'videos.popular';
                 $act->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_VIDEOS', 5);
                 $params->set('action', 'top_videos');
                 $params->set('count', 5);
                 break;
         }
     } else {
         // For additional custom activities, we only take the content passed by them.
         if (!empty($message)) {
             CFactory::load('helpers', 'string');
             $message = CStringHelper::escape($message);
             $app = explode('.', $key);
             $app = isset($app[0]) ? $app[0] : 'system';
             $act->title = JText::_($message);
             $act->app = $app;
         }
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
     // Allow comments on all these
     $act->comment_id = CActivities::COMMENT_SELF;
     $act->comment_type = $key;
     // Allow like for all admin activities
     $act->like_id = CActivities::LIKE_SELF;
     $act->like_type = $key;
     // Add activity logging
     CActivityStream::add($act, $params->toString());
     $objResponse->addAssign('activity-stream-container', 'innerHTML', $this->_getActivityStream());
     $objResponse->addScriptCall("joms.jQuery('.jomTipsJax').addClass('jomTips');");
     $objResponse->addScriptCall('joms.tooltip.setup();');
     return $objResponse->sendResponse();
 }
Example #23
0
        echo JText::_('COM_COMMUNITY_INBOX_REMOVE');
        ?>
</span>
                    </a>
                </div>
                <div class="joms-list--message__checkbox js-mail-checkbox">
                    <span>
                        <input type="checkbox" class="joms-checkbox" name="message[]" value="<?php 
        echo $message->id;
        ?>
" onclick="checkSelected();">
                    </span>
                </div>
                <small class="joms-list--message__time">
                    <?php 
        $postdate = CTimeHelper::timeLapse(CTimeHelper::getDate($message->posted_on));
        echo $postdate;
        ?>
                   <svg class="joms-icon" viewBox="0 0 16 16">
                        <use xlink:href="<?php 
        echo CRoute::getURI();
        ?>
#joms-icon-clock"/>
                    </svg>
                </small>
            </div>
        <?php 
    }
    ?>
    </div>
Example #24
0
 function _getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile)
 {
     CFactory::load('helpers', 'url');
     CFactory::load('helpers', 'user');
     CFactory::load('helpers', 'videos');
     CFactory::load('libraries', 'comment');
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'time');
     $user = CFactory::getUser($wall->post_by);
     $date = CTimeHelper::getDate($wall->date);
     $config = CFactory::getConfig();
     // @rule: for site super administrators we want to allow them to view the remove link
     $isOwner = COwnerHelper::isCommunityAdmin() ? true : $isOwner;
     $isEditable = CWall::isEditable($processFunc, $wall->id);
     // Apply any post processing on the content
     $wall->comment = CWallLibrary::_processWallContent($wall->comment);
     $commentsHTML = '';
     $comment = new CComment();
     // If the wall post is a user wall post (in profile pages), we
     // add wall comment feature
     if ($appType == 'user' || $appType == 'groups' || $appType == 'events') {
         $commentsHTML = $comment->getHTML($wallComments, 'wall-cmt-' . $wall->id, CWall::canComment($wall->type, $wall->contentid));
     }
     $avatarHTML = CUserHelper::getThumb($wall->post_by, 'avatar');
     //var_dump($avatarHTML);exit;
     // @rule: We only allow editing of wall in 15 minutes
     $now = JFactory::getDate();
     $interval = CTimeHelper::timeIntervalDifference($wall->date, $now->toMySQL());
     $interval = COMMUNITY_WALLS_EDIT_INTERVAL - abs($interval);
     $editInterval = round($interval / 60);
     // Create new instance of the template
     $tmpl = new CTemplate();
     $tmpl->set('id', $wall->id);
     $tmpl->set('author', $user->getDisplayName());
     $tmpl->set('avatarHTML', $avatarHTML);
     $tmpl->set('authorLink', CUrlHelper::userLink($user->id));
     $tmpl->set('created', $date->toFormat(JText::_('DATE_FORMAT_LC2')));
     $tmpl->set('content', $wall->comment);
     $tmpl->set('commentsHTML', $commentsHTML);
     $tmpl->set('avatar', $user->getThumbAvatar());
     $tmpl->set('isMine', $isOwner);
     $tmpl->set('isEditable', $isEditable);
     $tmpl->set('editInterval', $editInterval);
     $tmpl->set('processFunc', $processFunc);
     $tmpl->set('config', $config);
     return $tmpl->fetch($templateFile);
 }
Example #25
0
 /**
  * Return formatted comment given the wall item
  */
 public static function formatComment($wall)
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $actModel = CFactory::getModel('activities');
     $like = new CLike();
     $likeCount = $like->getLikeCount('comment', $wall->id);
     $isLiked = $like->userLiked('comment', $wall->id, $my->id);
     $user = CFactory::getUser($wall->post_by);
     // Censor if the user is banned
     if ($user->block) {
         $wall->comment = $origComment = JText::_('COM_COMMUNITY_CENSORED');
     } else {
         // strip out the comment data
         $CComment = new CComment();
         $wall->comment = $CComment->stripCommentData($wall->comment);
         // Need to perform basic formatting here
         // 1. support nl to br,
         // 2. auto-link text
         $CTemplate = new CTemplate();
         $wall->comment = $origComment = $CTemplate->escape($wall->comment);
         $wall->comment = CStringHelper::autoLink($wall->comment);
     }
     $commentsHTML = '';
     $commentsHTML .= '<div class="cComment wall-coc-item" id="wall-' . $wall->id . '"><a href="' . CUrlHelper::userLink($user->id) . '"><img src="' . $user->getThumbAvatar() . '" alt="" class="wall-coc-avatar" /></a>';
     $date = new JDate($wall->date);
     $commentsHTML .= '<a class="wall-coc-author" href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> ';
     $commentsHTML .= $wall->comment;
     $commentsHTML .= '<span class="wall-coc-time">' . CTimeHelper::timeLapse($date);
     $cid = isset($wall->contentid) ? $wall->contentid : null;
     $activity = $actModel->getActivity($cid);
     $ownPost = $my->id == $wall->post_by;
     $allowRemove = $my->authorise('community.delete', 'walls', $wall);
     $canEdit = $config->get('wallediting') && $my->id == $wall->post_by || COwnerHelper::isCommunityAdmin();
     // only poster can edit
     if ($allowRemove) {
         $commentsHTML .= ' <span class="wall-coc-remove-link">&#x2022; <a href="#removeComment">' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</a></span>';
     }
     $commentsHTML .= '</span>';
     $commentsHTML .= '</div>';
     $editHTML = '';
     if ($config->get('wallediting') && $ownPost || COwnerHelper::isCommunityAdmin()) {
         $editHTML .= '<a href="javascript:" class="joms-button--edit">';
         $editHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-pencil"></use></svg>';
         $editHTML .= '<span>' . JText::_('COM_COMMUNITY_EDIT') . '</span>';
         $editHTML .= '</a>';
     }
     $removeHTML = '';
     if ($allowRemove) {
         $removeHTML .= '<a href="javascript:" class="joms-button--remove">';
         $removeHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-remove"></use></svg>';
         $removeHTML .= '<span>' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</span>';
         $removeHTML .= '</a>';
     }
     $removeTagHTML = '';
     if (CActivitiesHelper::hasTag($my->id, $wall->comment)) {
         $removeTagHTML = '<span><a data-action="remove-tag" data-id="' . $wall->id . '" href="javascript:">' . JText::_('COM_COMMUNITY_WALL_REMOVE_TAG') . '</a></span>';
     }
     /* user deleted */
     if ($user->guest == 1) {
         $userLink = '<span class="cStream-Author">' . $user->getDisplayName() . '</span> ';
     } else {
         $userLink = '<a class="cStream-Avatar cStream-Author cFloat-L" href="' . CUrlHelper::userLink($user->id) . '"> <img class="cAvatar" src="' . $user->getThumbAvatar() . '"> </a> ';
     }
     $params = $wall->params;
     $paramsHTML = '';
     $image = (array) $params->get('image');
     $photoThumbnail = false;
     if ($params->get('attached_photo_id') > 0) {
         $photo = JTable::getInstance('Photo', 'CTable');
         $photo->load($params->get('attached_photo_id'));
         $photoThumbnail = $photo->getThumbURI();
         $paramsHTML .= '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . $photoThumbnail . '" /></div>';
     } else {
         if ($params->get('title')) {
             $video = self::detectVideo($params->get('url'));
             if (is_object($video)) {
                 $paramsHTML .= '<div class="joms-media--video joms-js--video"';
                 $paramsHTML .= ' data-type="' . $video->type . '"';
                 $paramsHTML .= ' data-id="' . $video->id . '"';
                 $paramsHTML .= ' data-path="' . ($video->type === 'file' ? JURI::root(true) . '/' : '') . $video->path . '"';
                 $paramsHTML .= ' style="margin-top:10px;">';
                 $paramsHTML .= '<div class="joms-media__thumbnail">';
                 $paramsHTML .= '<img src="' . $video->getThumbnail() . '">';
                 $paramsHTML .= '<a href="javascript:" class="mejs-overlay mejs-layer mejs-overlay-play joms-js--video-play joms-js--video-play-' . $wall->id . '">';
                 $paramsHTML .= '<div class="mejs-overlay-button"></div>';
                 $paramsHTML .= '</a>';
                 $paramsHTML .= '</div>';
                 $paramsHTML .= '<div class="joms-media__body">';
                 $paramsHTML .= '<h4 class="joms-media__title">' . JHTML::_('string.truncate', $video->title, 50, true, false) . '</h4>';
                 $paramsHTML .= '<p class="joms-media__desc">' . JHTML::_('string.truncate', $video->description, $config->getInt('streamcontentlength'), true, false) . '</p>';
                 $paramsHTML .= '</div>';
                 $paramsHTML .= '</div>';
             } else {
                 $paramsHTML .= '<div class="joms-gap"></div>';
                 $paramsHTML .= '<div class="joms-media--album joms-relative joms-js--comment-preview">';
                 if ($user->id == $my->id || COwnerHelper::isCommunityAdmin()) {
                     $paramsHTML .= '<span class="joms-media__remove" data-action="remove-preview" onClick="joms.api.commentRemovePreview(\'' . $wall->id . '\');"><svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="#joms-icon-remove"></use></svg></span>';
                 }
                 if ($params->get('image')) {
                     $paramsHTML .= $params->get('link');
                     $paramsHTML .= '<div class="joms-media__thumbnail">';
                     $paramsHTML .= '<a href="' . $params->get('link') ? $params->get('link') : '#' . '">';
                     $paramsHTML .= '<img src="' . array_shift($image) . '" />';
                     $paramsHTML .= '</a>';
                     $paramsHTML .= '</div>';
                 }
                 $url = $params->get('url') ? $params->get('url') : '#';
                 $paramsHTML .= '<div class="joms-media__body">';
                 $paramsHTML .= '<a href="' . $url . '">';
                 $paramsHTML .= '<h4 class="joms-media__title">' . $params->get('title') . '</h4>';
                 $paramsHTML .= '<p class="joms-media__desc reset-gap">' . CStringHelper::trim_words($params->get('description')) . '</p>';
                 if ($params->get('link')) {
                     $paramsHTML .= '<span class="joms-text--light"><small>' . preg_replace('#^https?://#', '', $params->get('link')) . '</small></span>';
                 }
                 $paramsHTML .= '</a></div></div>';
             }
         }
     }
     if (!$params->get('title') && $params->get('url')) {
         $paramsHTML .= '<div class="joms-gap"></div>';
         $paramsHTML .= '<div class="joms-media--album">';
         $paramsHTML .= '<a href="' . $params->get('url') . '">';
         $paramsHTML .= '<img class="joms-stream-thumb" src="' . $params->get('url') . '" />';
         $paramsHTML .= '</a>';
         $paramsHTML .= '</div>';
     }
     $wall->comment = nl2br($wall->comment);
     $wall->comment = CUserHelper::replaceAliasURL($wall->comment);
     $wall->comment = CStringHelper::getEmoticon($wall->comment);
     $wall->comment = CStringHelper::converttagtolink($wall->comment);
     // convert to hashtag
     $template = new CTemplate();
     $template->set('wall', $wall)->set('originalComment', $origComment)->set('date', $date)->set('isLiked', $isLiked)->set('likeCount', $likeCount)->set('canRemove', $allowRemove)->set('canEdit', $canEdit)->set('canRemove', $allowRemove)->set('user', $user)->set('photoThumbnail', $photoThumbnail)->set('paramsHTML', $paramsHTML);
     $commentsHTML = $template->fetch('stream/single-comment');
     return $commentsHTML;
 }
Example #26
0
 public function getLastUpdated($raw = false)
 {
     $this->_lastupdated = $this->created;
     if ($raw) {
         return $this->_lastupdated;
     }
     if ($this->_lastupdated == '0000-00-00 00:00:00' || $this->_lastupdated == '') {
         $this->_lastupdated = $this->created;
         if ($this->_lastupdated == '' || $this->_lastupdated == '0000-00-00 00:00:00') {
             $this->_lastupdated = JText::_('COM_COMMUNITY_NO_LAST_ACTIVITY');
         } else {
             $lastUpdated = new JDate($this->_lastupdated);
             //$this->_lastupdated = CActivityStream::_createdLapse( $lastUpdated, false );
             $this->_lastupdated = CTimeHelper::timeLapse($lastUpdated);
         }
     } else {
         $lastUpdated = new JDate($this->_lastupdated);
         //$this->_lastupdated = CActivityStream::_createdLapse( $lastUpdated, false );
         $this->_lastupdated = CTimeHelper::timeLapse($lastUpdated);
     }
     return $this->_lastupdated;
 }
Example #27
0
 public static function getFormattedTime($time, $format, $offset = 0)
 {
     $time = strtotime($time);
     // Manually modify the month and day strings in the format.
     if (strpos($format, '%a') !== false) {
         $format = str_replace('%a', CTimeHelper::dayToString(date('w', $time), true), $format);
     }
     if (strpos($format, '%A') !== false) {
         $format = str_replace('%A', CTimeHelper::dayToString(date('w', $time)), $format);
     }
     if (strpos($format, '%b') !== false) {
         $format = str_replace('%b', CTimeHelper::monthToString(date('n', $time), true), $format);
     }
     if (strpos($format, '%B') !== false) {
         $format = str_replace('%B', CTimeHelper::monthToString(date('n', $time)), $format);
     }
     return strftime($format, $time);
 }
Example #28
0
 * @copyright (C) 2008 by Slashes & Dots Sdn Bhd - All rights reserved!
 * @license		GNU/GPL, see LICENSE.php
 *
 * @params	isMine		boolean is this group belong to me
 * @params	categories	Array	An array of categories object
 * @params	members		Array	An array of members object
 * @params	event		Event	A group object that has the property of a group
 * @params	wallForm	string A html data that will output the walls form.
 * @params	wallContent string A html data that will output the walls data.
 **/
defined('_JEXEC') or die;
$accessAllowed = ($memberStatus == COMMUNITY_EVENT_STATUS_INVITED || $memberStatus == COMMUNITY_EVENT_STATUS_ATTEND || $memberStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $memberStatus == COMMUNITY_EVENT_STATUS_MAYBE || !$event->permission) && $memberStatus != COMMUNITY_EVENT_STATUS_BLOCKED || $isCommunityAdmin;
$hasResponded = $memberStatus == COMMUNITY_EVENT_STATUS_ATTEND || $memberStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $memberStatus == COMMUNITY_EVENT_STATUS_MAYBE;
$creator = CFactory::getUser($event->creator);
$creatorUtcOffset = $creator->getUtcOffset();
$creatorUtcOffsetStr = CTimeHelper::getTimezone($creator->getTimezone());
?>

<div class="event">
<div class="page-actions">
		<?php 
echo $reportHTML;
?>
		<?php 
echo $bookmarksHTML;
?>
	</div>

<!-- begin: .cLayout -->
<div class="cLayout clrfix">
Example #29
0
"><strong><?php 
echo $this->escape($event->title);
?>
</strong></a>
			</h3>
			<div class="cIndex-Status">
				<div class="cIndex-Date"><b><?php 
echo CEventHelper::formatStartDate($event, $config->get('eventdateformat'));
?>
</b></div>
				<i class="cIndex-Location"><?php 
echo $this->escape($event->location);
?>
</i>
				<div class="cIndex-Time"><?php 
echo JText::sprintf('COM_COMMUNITY_EVENTS_DURATION', CTimeHelper::getFormattedTime($event->startdate, $timeFormat), CTimeHelper::getFormattedTime($event->enddate, $timeFormat));
?>
</div>
			</div>
			<div class="cIndex-Actions">
				<div class="action">
					<?php 
if ($isExpired || CEventHelper::isPast($event)) {
    ?>
					<a href="<?php 
    echo $event->getGuestLink(COMMUNITY_EVENT_STATUS_ATTEND);
    ?>
"><?php 
    echo JText::sprintf(CStringHelper::isPlural($event->confirmedcount) ? 'COM_COMMUNITY_EVENTS_COUNT_MANY_PAST' : 'COM_COMMUNITY_EVENTS_COUNT_PAST', $event->confirmedcount);
    ?>
</a>
Example #30
0
 /**
  * Responsible for displaying the event page.
  **/
 function viewevent()
 {
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     CFactory::load('libraries', 'tooltip');
     CFactory::load('libraries', 'wall');
     CFactory::load('libraries', 'window');
     CWindow::load();
     $eventid = JRequest::getInt('eventid', 0);
     $eventModel =& CFactory::getModel('events');
     $event =& JTable::getInstance('Event', 'CTable');
     CFactory::load('helpers', 'event');
     $handler = CEventHelper::getHandler($event);
     $event->load($eventid);
     if (!$handler->exists()) {
         $mainframe->enqueueMessage(JText::_('CC EVENTS NOT AVAILABLE'), 'error');
         return;
     }
     if (!$handler->browsable()) {
         echo JText::_('CC NOT ALLOWED TO ACCESS SECTION');
         return;
     }
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$event->published) {
         echo JText::_('CC EVENTS UNDER MODERATION');
         return;
     }
     $this->showSubmenu();
     $event->hit();
     // Basic page presentation
     if ($event->type == 'group') {
         $groupId = $event->contentid;
         $group =& JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         // Set pathway for group videos
         // Community > Groups > Group Name > Events
         $this->addPathway(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $this->addPathway($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
     }
     $this->addPathway(JText::_('CC EVENTS'), CRoute::_('index.php?option=com_community&view=events'));
     $this->addPathway(JText::sprintf('CC VIEW EVENTS TITLE', $event->title), '');
     // Permissions and privacies
     CFactory::load('helpers', 'owner');
     $isEventGuest = $event->isMember($my->id);
     $isMine = $my->id == $event->creator;
     $isAdmin = $event->isAdmin($my->id);
     $isCommunityAdmin = COwnerHelper::isCommunityAdmin();
     // Get Event Admins
     $eventAdmins = $event->getAdmins(12, CC_RANDOMIZE);
     $eventAdminsCount = $event->getAdminsCount();
     // Attach avatar of the admin
     for ($i = 0; $i < count($eventAdmins); $i++) {
         $row =& $eventAdmins[$i];
         $eventAdmins[$i] = CFactory::getUser($row->id);
     }
     // Get Attending Event Guests
     $eventMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_ATTEND, 12, CC_RANDOMIZE);
     $eventMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_ATTEND);
     // Get pending event guests
     $pendingMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_INVITED, 12, CC_RANDOMIZE);
     $pendingMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_INVITED);
     // Get blocked Event Guests
     $blockedMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_BLOCKED, 12, CC_RANDOMIZE);
     $blockedMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_BLOCKED);
     // Attach avatar of the admin
     // Pre-load multiple users at once
     $userids = array();
     foreach ($eventMembers as $uid) {
         $userids[] = $uid->id;
     }
     CFactory::loadUsers($userids);
     for ($i = 0; $i < count($eventMembers); $i++) {
         $row =& $eventMembers[$i];
         $eventMembers[$i] = CFactory::getUser($row->id);
     }
     // Pre-load multiple users at once
     $userids = array();
     foreach ($pendingMembers as $uid) {
         $userids[] = $uid->id;
     }
     CFactory::loadUsers($userids);
     for ($i = 0; $i < count($pendingMembers); $i++) {
         $row =& $pendingMembers[$i];
         $pendingMembers[$i] = CFactory::getUser($row->id);
     }
     // Pre-load multiple users at once
     $userids = array();
     foreach ($blockedMembers as $uid) {
         $userids[] = $uid->id;
     }
     CFactory::loadUsers($userids);
     for ($i = 0; $i < count($blockedMembers); $i++) {
         $row =& $blockedMembers[$i];
         $blockedMembers[$i] = CFactory::getUser($row->id);
     }
     $waitingApproval = $event->isPendingApproval($my->id);
     $waitingRespond = false;
     $myStatus = $event->getUserStatus($my->id);
     $hasResponded = $myStatus == COMMUNITY_EVENT_STATUS_ATTEND || $myStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $myStatus == COMMUNITY_EVENT_STATUS_MAYBE;
     // Get Bookmark HTML
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id));
     $bookmarksHTML = $bookmarks->getHTML();
     // Get Reporting HTML
     CFactory::load('libraries', 'reporting');
     $report = new CReportingLibrary();
     $reportHTML = $report->getReportingHTML(JText::_('CC REPORT EVENT'), 'events,reportEvent', array($event->id));
     // Get the Wall
     CFactory::load('libraries', 'wall');
     $wallContent = CWallLibrary::getWallContents('events', $event->id, $isAdmin, 10, 0, 'wall.content', 'events,events');
     $wallCount = CWallLibrary::getWallCount('events', $event->id);
     $viewAllLink = false;
     if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
         $viewAllLink = CRoute::_('index.php?option=com_community&view=events&task=app&eventid=' . $event->id . '&app=walls');
     }
     $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     $wallForm = '';
     if (!$config->get('lockeventwalls') || $config->get('lockeventwalls') && $isEventGuest && !$waitingApproval && $hasResponded || $isCommunityAdmin) {
         $wallForm = CWallLibrary::getWallInputForm($event->id, 'events,ajaxSaveWall', 'events,ajaxRemoveWall');
     }
     // Construct the RVSP radio list
     $arr = array(JHTML::_('select.option', COMMUNITY_EVENT_STATUS_ATTEND, JText::_('CC EVENT ACTION ATTEND')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_WONTATTEND, JText::_('CC EVENT ACTION DECLINE')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_MAYBE, JText::_('CC EVENT ACTION UNSURE')));
     $status = $event->getMemberStatus($my->id);
     $radioList = JHTML::_('select.radiolist', $arr, 'status', '', 'value', 'text', $status, false);
     $unapprovedCount = $event->inviteRequestCount();
     //...
     $editEvent = JRequest::getVar('edit', false, 'GET');
     $editEvent = $editEvent == 1 ? true : false;
     // Am I invited in this event?
     $isInvited = false;
     $join = '';
     $friendsCount = 0;
     $isInvited = $eventModel->isInvitedMe(0, $my->id, $event->id);
     // If I was invited, I want to know my invitation informations
     if ($isInvited) {
         $invitor = CFactory::getUser($isInvited[0]->invited_by);
         $join = '<a href="' . CUrlHelper::userLink($invitor->id) . '">' . $invitor->getDisplayName() . '</a>';
         // Get users friends in this group
         $friendsCount = $eventModel->getFriendsCount($my->id, $event->id);
     }
     $friendsModel = CFactory::getModel('Friends');
     $tmpFriends = $friendsModel->getFriends($my->id, 'name', false);
     $friends = array();
     for ($i = 0; $i < count($tmpFriends); $i++) {
         $friend =& $tmpFriends[$i];
         if (!$event->isMember($friend->id)) {
             $friends[] = $friend;
         }
     }
     unset($tmpFriends);
     // Get like
     CFactory::load('libraries', 'like');
     $likes = new CLike();
     $likesHTML = $likes->getHTML('events', $event->id, $my->id);
     // Is this event is a past event?
     $now = new JDate();
     $isPastEvent = $event->getEndDate(false)->toMySQL() < $now->toMySQL(true) ? true : false;
     // Output to template
     $tmpl = new CTemplate();
     CFactory::load('libraries', 'invitation');
     $inviteHTML = CInvitation::getHTML($friends, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::HIDE_EMAIL);
     $tmpl->setMetaTags('event', $event);
     $tmpl->set('timezone', CTimeHelper::getTimezone($event->offset));
     $tmpl->set('handler', $handler);
     $tmpl->set('likesHTML', $likesHTML);
     $tmpl->set('inviteHTML', $inviteHTML);
     $tmpl->set('guestStatus', $event->getUserStatus($my->id));
     $tmpl->set('event', $event);
     $tmpl->set('radioList', $radioList);
     $tmpl->set('bookmarksHTML', $bookmarksHTML);
     $tmpl->set('reportHTML', $reportHTML);
     $tmpl->set('isEventGuest', $isEventGuest);
     $tmpl->set('isMine', $isMine);
     $tmpl->set('isAdmin', $isAdmin);
     $tmpl->set('isCommunityAdmin', $isCommunityAdmin);
     $tmpl->set('unapproved', $unapprovedCount);
     $tmpl->set('waitingApproval', $waitingApproval);
     $tmpl->set('wallForm', $wallForm);
     $tmpl->set('wallContent', $wallContent);
     $tmpl->set('eventAdmins', $eventAdmins);
     $tmpl->set('eventAdminsCount', $eventAdminsCount);
     $tmpl->set('eventMembers', $eventMembers);
     $tmpl->set('eventMembersCount', $eventMembersCount);
     $tmpl->set('blockedMembers', $blockedMembers);
     $tmpl->set('blockedMembersCount', $blockedMembersCount);
     $tmpl->set('pendingMembers', $pendingMembers);
     $tmpl->set('pendingMembersCount', $pendingMembersCount);
     $tmpl->set('editEvent', $editEvent);
     $tmpl->set('my', $my);
     $tmpl->set('memberStatus', $myStatus);
     $tmpl->set('waitingRespond', $waitingRespond);
     $tmpl->set('isInvited', $isInvited);
     $tmpl->set('join', $join);
     $tmpl->set('friendsCount', $friendsCount);
     $tmpl->set('isPastEvent', $isPastEvent);
     echo $tmpl->fetch('events.viewevent');
 }