function display($tpl = null) { $jconfig = new JConfig(); jimport('joomla.html.pagination'); include_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'string.php'; $this->addPathway(JText::_('NAVIGATOR_LABEL_FILE'), JRoute::_('index.php?option=com_stream&view=groups')); $title = JText::_("COM_STREAM_LABEL_LINK_LISTING"); $this->_attachScripts(); // Reset the stream view count every time we visit this page $user = JXFactory::getUser(); $filter = array(); // Filter by user_id (cannot be used along with 'by' filter) if ($user_id = JRequest::getVar('user_id', '')) { $filter['user_id'] = $user_id; $user = JXFactory::getUser($user_id); $title = JText::sprintf("%1s's links", $user->name); } $usrLinks = $user->getParam('links', ''); $linkModel = StreamFactory::getModel('links'); $links = $linkModel->getLinks(array('id' => $usrLinks, '!link' => ''), $jconfig->list_limit, JRequest::getVar('limitstart', 0)); $total = $linkModel->getTotal(array('id' => $usrLinks, '!link' => '')); $doc = JFactory::getDocument(); $doc->setTitle($title); // Pagination $pagination = new JPagination($total, JRequest::getVar('limitstart', 0), $jconfig->list_limit); $html = ''; $tmpl = new StreamTemplate(); $tmpl->set('links', $links)->set('pagination', $pagination); $html .= $tmpl->fetch('links.list'); return $html; }
public function getItemHTML($format = null) { // If were not in 'article' view, just show short summary /* $view = JRequest::getVar('view'); $task = JRequest::getVar('task'); if( ($view != 'message' || $task != 'show') && $format != 'full'){ $date = new JDate($this->data->start_date); $html = '<li class="message-item compact-item"><span class="label-compact label-event">Event</span> <div class="message-content-compact"> <a href="'. $this->data->getUri().'"> '.StreamMessage::format($this->data->message).' </a> <span class="small hint">'.JXDate::formatLapse( $date ).'</span> </div> <div class="clear"></div> </li>'; return $html; } */ $tmpl = new StreamTemplate(); $tmpl->set('stream', $this->data)->set('comment', StreamComment::getCommentSummaryHTML($this->data)); return $tmpl->fetch('stream.item.event'); }
public function compose() { $tmpl = new StreamTemplate(); $html = $tmpl->fetch('stream.post.direct'); echo $html; exit; }
/** * */ public static function getCommentsHTML($stream_id) { $tmpl = new StreamTemplate(); $model = StreamFactory::getModel('stream'); $data = $model->getComments(array('message_id' => $stream_id)); $last_comment = count($data) > 0 ? $data[0] : null; $tmpl->set('comments', $data)->set('stream_id', $stream_id); return $tmpl->fetch('comment.list'); }
public function create() { $my = JXFactory::getUser(); $customList = JTable::getInstance('Customlist', 'StreamTable'); $customList->load(JRequest::getVar('customlist_id')); $tmpl = new StreamTemplate(); $tmpl->set('customList', $customList); $data = $tmpl->fetch('customlist.edit'); header('Content-Type: text/html; charset=UTF-8'); echo $data; exit; }
public function modTagsTrendingHTML($group = null) { $tags = new StreamTag(); $trendingTags = $tags->getTrending($group); $tmpl = new StreamTemplate(); $tmpl->set('title', JText::_('COM_STREAM_LABEL_TRENDING_TAGS')); $tmpl->set('trendingTags', $trendingTags); if (!is_null($group)) { // Filter tags in viewed group $tmpl->set('groupId', $group->id); } $html = $tmpl->fetch('stream.tag.trending'); return $html; }
public function getItemHTML($format = null) { $tmpl = new StreamTemplate(); // If were not in 'direct' view, just show short summary $view = JRequest::getVar('view'); $task = JRequest::getVar('task'); if ($view == 'direct' || $task == 'show') { $tmpl->set('stream', $this->data)->set('comment', StreamComment::getCommentSummaryHTML($this->data)); return $tmpl->fetch('stream.item.direct'); } else { $tmpl->set('stream', $this->data); return $tmpl->fetch('stream.compact.direct'); } }
public function updateFile() { $my = JXFactory::getUser(); $file_id = JRequest::getInt('file_id'); $file_name = JRequest::getVar('new_name', ''); $result = new stdClass(); $result->result = false; if (intval($file_id) > 0 && preg_match("/^[^\\/?*:;{}\\\\]+\$/", $file_name)) { $file = JTable::getInstance('File', 'StreamTable'); if ($file->load($file_id)) { if ($my->authorise('stream.file.edit', $file)) { $originalName = explode('.', $file->filename); $extension = array_pop($originalName); $file->filename = $file_name . '.' . $extension; $file->store(); $result->result = true; $result->fileid = $file_id; $result->filename = StreamTemplate::escape(JHtmlString::truncate($file->filename, 32)); $result->full_filename = StreamTemplate::escape(preg_replace('/\\.[a-z]+$/i', '', $file->filename)); } else { $result->error = JText::_('Not authorized to edit file!'); } } else { $result->error = $file->getError(); } } else { $result->error = JText::_('Invalid filename!'); } echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); exit; }
/** * Open, parse, and return the template file. * * @param $file string the template file name */ public function fetch($file = null) { $tmpFile = $file; if (empty($file)) { $file = $this->file; } $file = JPATH_ROOT . DS . 'components' . DS . 'com_stream' . DS . 'templates' . DS . 'default' . DS . $file . '.php'; // Template variable: $my; $my = JXFactory::getUser(); $this->setRef('my', $my); // Template variable: the rest. if ($this->vars) { extract($this->vars, EXTR_REFS); } if (!JFile::exists($file)) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::sprintf('COM_STREAM_TEMPLATE_FILE_NOT_FOUND', $tmpFile . '.php'), 'error'); return; } ob_start(); // Start output buffering require $file; // Include the file $contents = ob_get_contents(); // Get the contents of the buffer ob_end_clean(); // End buffering and discard // Replace all _QQQ_ to " // Language file now uses new _QQQ_ to maintain Joomla 1.6 compatibility $contents = StreamTemplate::quote($contents); return $contents; // Return the contents }
/** * Add message */ public function add() { $user = JXFactory::getUser(); // Store stream $comment = JTable::getInstance('Comment', 'StreamTable'); $message = JTable::getInstance('Stream', 'StreamTable'); $message->load(JRequest::getVar('stream_id')); $user_id = JRequest::getVar('anon', false) ? JUserHelper::getUserId('anon') : $user->id; // People need to be able to read the message to add comment if (!$user->authorise('stream.message.read', $message)) { // No reason this code would ever get here! exit; } $comment->bind(JRequest::get('POST', JREQUEST_ALLOWRAW)); $comment->raw = json_encode(JRequest::get('POST', JREQUEST_ALLOWRAW)); $comment->user_id = $user_id; $comment->group_id = $message->group_id; $comment->store(); // Update group stats, if it is a group message if (!empty($comment->group_id)) { $group = JTable::getInstance('Group', 'StreamTable'); $group->load($comment->group_id); $group->setParam('last_comment', $comment->id); $group->store(); } // Trigger Notification StreamNotification::trigger('profile_post_comment', $comment); // If the updated date is set further than the current date, it is a pinned stream item and shouldn't be updated $now = new JDate(); $updated = new JDate($message->updated); $preventUpdate = $updated->toUnix() > $now->toUnix(); // Check pinned item status too? For now... naa // Update stream stats. Recalculate the count $this->_recalculateCommentCount($comment->stream_id, $preventUpdate); // Get the HTML code to append $tmpl = new StreamTemplate(); header('Content-Type: text/html; charset=UTF-8'); echo $tmpl->set('comment', $comment)->fetch('comment.item'); exit; }
public function getInput() { $this->_multiFieldsId = 'multiTexts_' . $this->id; $values = json_decode($this->value, true); // decode data from db $totalRows = 1; $html = $jsInputHtml = array(); $html[] = '<div id="' . $this->_multiFieldsId . '" class="' . $this->type . '">'; if ($values !== null) { $totalRows = count($values); } for ($i = 0; $i < $totalRows; $i++) { $html[] = '<p class="' . $this->type . '">'; foreach ($this->element->children() as $element) { // if the javascript modify the input field by ADD/REMOVE field, it will break the iteration index. // skipping unexistent field as a sanity check //if (empty($values[$i])) continue; $fieldValue = StreamTemplate::escape($values[$i][(string) $element['name']]); // bind values from json decoded array $elementName = $this->name . "[{$i}][" . $element['name'] . "]"; // name for POST $showRemove = false; // hide remove button if ($i > 0) { $showRemove = true; } if ($element['type'] == 'list') { // create a new select list $html[] = $this->_getSelectList($element, $elementName, $fieldValue); if ($i == 0) { // only need one as the rest will dynamically added with js $jsInputHtml[] = $this->_getSelectList($element, $elementName); } } elseif ($element['type'] == 'text') { // create a new input field $html[] = $this->_getInputField($element, $elementName, $fieldValue, $showRemove); if ($i == 0) { // only need one as the rest will dynamically added with js $jsInputHtml[] = $this->_getInputField($element, $elementName, '', true); } } } if ($i == 0) { $html[] = '<a href="#" id="add"><span>Add</span></a>'; } $html[] = '</p>'; } $html[] = '</div>'; $this->_attachScripts($jsInputHtml); return implode($html); }
function display($tpl = null) { $this->addPathway(JText::_('NAVIGATOR_LABEL_INBOX'), JRoute::_('index.php?option=com_stream&view=direct')); $this->_attachScripts(); $my = JXFactory::getUser(); $html = ''; $doc = JFactory::getDocument(); $doc->setTitle(JText::_("COM_STREAM_MY_PRIVATE_MESSAGES")); // Add attachment script $doc->addScript(JURI::root() . 'media/uploader/fileuploader.js'); $doc->addStyleSheet(JURI::root() . 'media/uploader/fileuploader.css'); jimport('joomla.html.pagination'); $jconfig = new JConfig(); $filter = array(); if ($mention = JRequest::getVar('mention', '')) { $filter['mention'] = '@' . $mention; } if ($search = JRequest::getVar('search', '')) { $filter['search'] = $search; } $status = JRequest::getVar('status', ''); if ($status != '') { $filter['status'] = $status; } $filter['type'] = 'direct'; $model = StreamFactory::getModel('stream'); $data = $model->getStream($filter); $total = $model->countStream($filter); $pagination = new JPagination($total, JRequest::getVar('limitstart', 0), $jconfig->list_limit); $html = ''; $tmpl = new StreamTemplate(); $tmpl->set('rows', $data); $tmpl->set('total', $total); $tmpl->set('pagination', $pagination); $html .= $tmpl->fetch('direct.list'); echo $html; }
/** * Ajax: add member to group */ public function memberAdd() { $my = JXFactory::getUser(); $user = JXFactory::getUser(JRequest::getVar('user_id')); $group = JTable::getInstance('Group', 'StreamTable'); $group->load(JRequest::getVar('group_id')); // If you join, you'd also follow it $group->members = JXUtility::csvInsert($group->members, $user->id); $group->followers = JXUtility::csvInsert($group->followers, $user->id); $group->store(); // Store user cache $groupList = $user->getParam('groups_member'); $groupList = JXUtility::csvInsert($groupList, $group->id); $user->setParam('groups_member', $groupList); $user->save(); $newUser = new JXUser($user->id); //TODO: JXFactory::getUser causes user params to sync to their session when the user is still logged in $tmpl = new StreamTemplate(); $tmpl->set('user', $newUser); $tmpl->set('my', $my); $tmpl->set('group', $group); $data = array(); $data['html'] = $tmpl->fetch('group.members.list.add'); header('Content-Type: text/json'); echo json_encode($data); exit; }
} } ?> (<?php echo StreamMessage::formatBytes($row->filesize); ?> ) </span> <div class="file-list-meta-content"> <div class="file-list-meta-inner"> <span>Attached in:</span> <a href="<?php echo $streamObj->getUri(); ?> "><?php echo StreamTemplate::escape(JHtmlString::truncate($streamObj->message, 200)); ?> </a> </div> <span class="uploader"><a href="<?php echo $user->getURL(); ?> " class="actor-link"><?php echo $this->escape($user->name); ?> </a></span> </div> </div> <?php /*
echo $position->category; } } } else { // If it's not decoded it means it's not a multiple value field/array echo StreamTemplate::escape($field->value); } } else { echo '<ul>'; foreach ($values as $value) { echo '<li><div class="profile-arrow">›</div>'; // Get the last item so we can wrap it with rounded brackets $last_item = end($value); foreach ($value as $elementKey => $elementValue) { echo '<div class="' . $elementKey . ' details-' . strtolower(str_replace(' ', '-', $elementValue)) . '">'; echo StreamTemplate::escape($elementValue); echo '</div>'; } echo '<div class="clear"></div></li>'; } echo '</ul>'; } echo '</div>'; echo '</div>'; echo '<div class="clear"></div>'; ?> </li> <?php } ?>
<ul> <?php foreach ($users as $user) { $name = $user->name; ?> <li class="eList" onclick="S.suggestMember.add(this, '<?php echo $user->id; ?> ');"><img src="<?php echo $user->getThumbAvatarURL(); ?> "><span><span class="eList-Bold"></span><?php echo StreamTemplate::escape($name); ?> </span></li> <?php } ?> </ul>
public function getTodoHtml($todoStreamObj) { $tmpl = new StreamTemplate(); $tmpl->set('task', $todoStreamObj)->set('my', JXFactory::getUser()); return $tmpl->fetch('todo.item'); }
public function getFilteredTagsHTML($tags) { $tagObjs = array(); foreach ($tags as $tag) { $obj = new stdClass(); $obj->tag = $tag; $tagObjs[] = $obj; } $tmpl = new StreamTemplate(); $tmpl->set('title', JText::_('Tags')); $tmpl->set('trendingTags', $tagObjs); $html = $tmpl->fetch('stream.tag.trending'); return $html; }
<?php } else { // Even when there are no like data, add the div structure since // it is needed when people actually 'like' something ?> <div class="stream-like" style="display:none;"></div> <?php } ?> <?php if ($count > 0) { // If there are comment, we show all the comment since our last visit // We need to caculate it here since we need to know if we need to show // the show all link or not $tmpl = new StreamTemplate(); $limit = 0; $shown = 0; // number of comment actually shown $unread = 0; // number of unread comments foreach ($comment as $row) { $lastCommentView = $my->getParam('group_' . $row->group_id . '_comment'); if ($row->id > $lastCommentView) { $unread++; } if ($task == 'show') { $commentHTML .= $tmpl->set('comment', $row)->fetch('comment.item'); } $limit++; }
<?php if ($group->isMember($my->id) || $my->isAdmin()) { if ($group->archived) { ?> <div class="alert-message block-message warning group-filter"> <p>This group has been archived. You can no longer leave a message in this group. An achived group simply mean that this group is no longer active and has either completed its objectives</p> </div> <?php } else { // Allow only group members to see the stream.post box $userGroups = $my->getParam('groups_member'); if (JXUtility::csvExist($userGroups, $group->id)) { if (JRequest::getVar('template') != 'mobile') { $tmpl = new StreamTemplate(); echo $tmpl->set('title', "title")->set('group_id', $group->id)->fetch('stream.post'); } } } } ?> <script type="text/javascript"> $(function() { /* Follow group */ $('a[href="#followGroup"]').click(function() { $.ajax({ type: "POST", url: S.path['group.follow'], data: $('form[name="group-actions"]').serialize(), dataType: 'json',
/** * Return */ public function modGetPendingTask($inFilter) { $tasks = ''; $tmpl = new StreamTemplate(); $model = StreamFactory::getModel('stream'); $my = JXFactory::getUser(); // Get todo list with due date $filter = array(); $filter['type'] = 'todo'; $filter['has_end_date'] = true; $filter['order_by_asc'] = 'end_date'; $filter = array_merge($filter, $inFilter); $data = $model->getStream($filter); // calculate total task $hasWarnDue = false; $hasWarnToday = false; $hasWarnThisWeek = false; $hasWarnLater = false; $username = ''; $showName = JRequest::getVar('option') == 'com_stream'; $today = new JXDate(); //echo count($data); exit; foreach ($data as $stream) { $dueDate = new JDate($stream->end_date); $raw = json_decode($stream->raw); $todoIndex = 0; $class = $my->authorise('stream.todo.done', $stream) ? '' : 'readonly'; foreach ($raw->todo as $todo) { if (!empty($todo)) { if (!$stream->getState($todoIndex)) { // Put the due labels if ($today->isOverdue($dueDate)) { if (!$hasWarnDue) { $tasks .= '<li class="todo-overdue"><span class="label label-important">' . JText::_('COM_PROFILE_LABEL_OVERDUE') . '</span></li>'; $hasWarnDue = true; } } elseif ($today->isToday($dueDate)) { if (!$hasWarnToday) { $tasks .= '<li class="todo-today"><span class="label label-success">' . JText::_('COM_PROFILE_LABEL_TODAY') . '</span></li>'; $hasWarnToday = true; } } elseif ($today->isThisWeek($dueDate)) { if (!$hasWarnThisWeek) { $tasks .= '<li class="todo-thisweek"><span class="label label-warning">' . JText::_('COM_PROFILE_LABEL_THIS_WEEK') . '</span></li>'; $hasWarnThisWeek = true; } } elseif (!$hasWarnLater) { $tasks .= '<li class="todo-later"><span class="label">' . JText::_('COM_PROFILE_LABEL_LATER') . '</span></li>'; $hasWarnLater = true; } // end due labels if ($showName) { $username = '******' . StreamTemplate::escape(JXFactory::getUser($stream->user_id)->name) . '</span>'; } $tasks .= '<li class="clearfix todo-item"><a class="done-todo-item ' . $class . '" data-message_id="' . $stream->id . '" data-todo_index="' . $todoIndex . '" href="javascript: void(0);"></a><span>' . StreamMessage::format($todo) . $username . '</span></li>'; } $todoIndex++; } } } // Get todo with NO due date unset($filter); $filter = array(); $filter['type'] = 'todo'; $filter['!has_end_date'] = true; $filter['order_by_asc'] = 'id'; $filter = array_merge($filter, $inFilter); $data = $model->getStream($filter); $hasWarnAnytime = false; foreach ($data as $stream) { $raw = json_decode($stream->raw); $todoIndex = 0; foreach ($raw->todo as $todo) { if (!empty($todo)) { $class = $my->authorise('stream.todo.done', $stream) ? '' : 'readonly'; if (!$stream->getState($todoIndex)) { if (!$hasWarnAnytime) { $tasks .= '<li class="todo-anytime"><span class="label">' . JText::_('COM_PROFILE_LABEL_ANYTIME') . '</span></li>'; $hasWarnAnytime = true; } if ($showName) { $username = '******' . StreamTemplate::escape(JXFactory::getUser($stream->user_id)->name) . '</span>'; } $tasks .= '<li class="clearfix todo-item"><a class="done-todo-item ' . $class . '" data-message_id="' . $stream->id . '" data-todo_index="' . $todoIndex . '" href="javascript:void(0);"></a><span>' . StreamMessage::format($todo) . $username . '</span></li>'; } $todoIndex++; } } } if (empty($tasks)) { $tasks = '<div class="alert-message block-message info"><p>' . JText::_('COM_STREAM_LABEL_NO_PENDING_TASK') . '</p></div>'; } $tmpl->set('tasks', $tasks); return $tmpl->fetch('todo.module.pending'); }
public function getStreamDataHTML() { jimport('joomla.html.pagination'); $jconfig = new JConfig(); $filter = array(); if ($mention = JRequest::getVar('mention', '')) { $filter['mention'] = '@' . $mention; } if ($user_id = JRequest::getVar('user_id', '')) { $filter['user_id'] = $user_id; } if ($search = JRequest::getVar('search', '')) { $filter['search'] = $search; } if ($group_id = JRequest::getVar('group_id', '')) { $filter['group_id'] = $group_id; } if ($limit_start = JRequest::getVar('limitstart', '')) { $filter['limitstart'] = $limit_start; } /* Month/year created */ if ($month = JRequest::getVar('month', '')) { $filter['month'] = $month; } if ($year = JRequest::getVar('year', '')) { $filter['year'] = $year; } // to check if category is in valid type preg_match('/[0-9]+/', JRequest::getVar('category_id'), $match); if (isset($match[0])) { $filter['category_id'] = $match[0]; } $filter['type'] = 'page'; $tmpl = new StreamTemplate(); $model = StreamFactory::getModel('stream'); $data = $model->getStream($filter, $jconfig->list_limit, JRequest::getVar('limitstart', 0)); $total = $model->countStream($filter); $pagination = new JPagination($total, JRequest::getVar('limitstart', 0), $jconfig->list_limit); JXModule::addBuffer('right', $this->modTagsTrendingHTML()); JXModule::addBuffer('right', $this->getArchiveHTML()); $html = ''; //$tmpl = new StreamTemplate(); //$html = $tmpl->fetch('stream.filter'); $tmpl = new StreamTemplate(); $tmpl->set('rows', $data); $tmpl->set('total', $total); $tmpl->set('pagination', $pagination); $html .= $tmpl->fetch('stream.data'); return $html; }
* To change this template, choose Tools | Templates * and open the template in the editor. */ ?> <div class="task-list"> <div class="milestone-task <?php //if($task->status == StreamTodoType::COMPLETED) { echo 'toggle-item'; } ?> "> <!--CSSHACK--> <div class="milestone-task-title"> <a href="<?php echo $task->getUri(); ?> "><?php echo StreamTemplate::escape($task->message); ?> </a> <span> • <a href="#toggleTasks">View all tasks</a></span> </div> <ul class="todolist noBorder" id="todo-list-<?php echo $task->id; ?> "> <?php $todoData = json_decode($task->raw); $todoIndex = 0; $numTodo = count($todoData->todo); $doneTodo = 0; foreach ($todoData->todo as $todo) { // @todo: move checking to input filtering
echo StreamTemplate::escape($user->name); ?> created Milestone: <?php } else { ?> Milestone updated - <?php } ?> <a href="<?php echo $stream->getUri(); ?> "> <?php echo StreamTemplate::escape($stream->message); ?> </a> </span> <span class="meta-date-compact"> - <?php //$date = new JDate( $stream->created ); $startDate = new JDate($stream->start_date); ?> <a class="meta-date" href="<?php echo $stream->getUri(); ?> "><?php echo $startDate->format(JText::_('JXLIB_DATE_SHORT_FORMAT'));
public function modUserFilesHTML($user, $limit = 10) { $fileModel = StreamFactory::getModel('files'); $files = $fileModel->getFiles(array('user_id' => $user->id), $limit); $total = $fileModel->countFiles(array('user_id' => $user->id)); $tmpl = new StreamTemplate(); $tmpl->set('title', JText::_('COM_STREAM_LABEL_FILES')); $tmpl->set('files', $files)->set('total', $total); $tmpl->set('user', $user); $html = $tmpl->fetch('file.module.list'); return $html; }
/** * AJAX Tag Delete */ public function tagDelete() { $message_id = JRequest::getInt('message_id'); $tag = JRequest::getVar('tag'); $hashedTag = '#' . $tag . '#'; $stream = JTable::getInstance('Stream', 'StreamTable'); $stream->load($message_id); $rawData = json_decode($stream->raw); $rawData->tags = isset($rawData->tags) ? $rawData->tags : ''; $rawData->tags = JXUtility::csvRemove($rawData->tags, $hashedTag); $stream->raw = json_encode($rawData); $stream->store(true); $tmpl = new StreamTemplate(); $tmpl->set('stream', $stream); $data = array(); $data['html'] = $tmpl->fetch('stream.tag'); $data['id'] = $message_id; $tagsTrend = new StreamTag(); $tagsTrend->updateTrending($tag, $stream->group_id, false); header('Content-Type: text/json'); echo json_encode($data); exit; }
public static function getFooterContent() { $jsConfig = new JConfig(); $tmpl = new StreamTemplate(); $tmpl->set('jsConfig', $jsConfig); $html = $tmpl->fetch('notification.footer'); return $html; }
function offiria_list_groups($groups, $title, $groupIJoin, $groupIFollow) { $group_id = JRequest::getVar('group_id'); $my = JXFactory::getUser(); $streamModel = StreamFactory::getModel('stream'); ?> <div class="groups-listing followed"> <h3><?php echo $title; ?> </h3> <?php // Only show list of groups if there is any if (!empty($groups)) { ?> <ul> <?php foreach ($groups as $group) { ?> <li class="groups <?php if ($group_id == $group->id) { echo 'active'; } ?> "> <?php $lastReadId = $my->getParam('group_' . $group->id . '_read'); $statusClass = JXUtility::csvExist($groupIJoin, $group->id) ? 'joined' : 'followed'; $groupLastMsg = $group->getParam('last_message'); $groupNewMsg = 0; // Only calculate if there is a diff here if ($lastReadId != $groupLastMsg) { $groupNewMsg = $streamModel->countStream(array('!user_id' => $my->id, 'id_more' => $lastReadId, 'group_id' => $group->id)); } $styleHide = ''; ?> <a class="<?php echo $statusClass; ?> " id="groups_<?php echo $group->id; ?> _link" href="<?php echo JRoute::_('index.php?option=com_stream&view=groups&task=show&group_id=' . $group->id); ?> "><?php echo StreamTemplate::escape($group->name); ?> </a> <?php if (intval($groupNewMsg) == 0) { $styleHide = 'display:none'; } echo '<span style="' . $styleHide . '" class="navigator-notice" id="groups_' . $group->id . '">' . intval($groupNewMsg) . '</span>'; ?> <!-- <span class="navigator-notice"></span> --> </li> <?php } ?> </ul> <?php } ?> </div> <?php }
?> <?php if (isset($filterArr['create_start'])) { ?> <span class="filtered-item tags">from <strong><?php echo StreamTemplate::escape($filterArr['create_start'][0]); ?> </strong></span> <?php } ?> <?php if (isset($filterArr['create_end'])) { ?> <span class="filtered-item tags">to <strong><?php echo StreamTemplate::escape($filterArr['create_end'][0]); ?> </strong></span> <?php } ?> </div> <?php } ?> <div class="customlist-filter clearfix" id="cl-view-edit" style="display: none"> <div class="cl-text pull-left">Messages</div> <ul class="customlist-list clearfix pull-left"> <li class="filter-item groups">
public function getGroupEventHTML($filter = null) { jimport('joomla.html.pagination'); $jconfig = new JConfig(); if ($filter == null) { $filter = array(); } $group_id = !empty($filter['group_id']) ? $filter['group_id'] : null; $filter['type'] = 'event'; $filter['order_by_desc'] = 'start_date'; $filterStatus = JRequest::getVar('status', 'upcoming'); if ($filterStatus == 'upcoming') { $filter['event_occurring_date'] = date('Y-m-d'); } elseif ($filterStatus == 'past') { $filter['event_past_date'] = date('Y-m-d'); } // Filter by "by/creator" $by = JRequest::getVar('by', ''); if ($by == 'mine') { $my = JXFactory::getUser(); $title = JText::sprintf("%1s's files", $my->name); $filter['user_id'] = $my->id; } else { if ($user_id = JRequest::getVar('user_id', '')) { $user = JXFactory::getUser($user_id); $title = JText::sprintf("%1s's events", $user->name); $filter['user_id'] = $user->id; } } $eventsModel = StreamFactory::getModel('stream'); $events = $eventsModel->getStream($filter, $jconfig->list_limit, JRequest::getVar('limitstart', 0)); $total = $eventsModel->countStream($filter); $tempArray = array(); $eventsDue = array(); $now = new JDate(); // Sort events ASC while past events as DESC. Could have utilized the db's UNION ALL? foreach ($events as $key => $event) { $startDate = new JDate($event->start_date); $dateDiff = JXDate::timeDifference($startDate->toUnix(), $now->toUnix()); if (!empty($dateDiff['days']) && $dateDiff['days'] < 0) { // Store the events in a temporary array and then remove it from the main events $tempArray[] = $event; unset($events[$key]); $eventsDue[$key] = 1; } else { $eventsDue[$key] = 0; } } // Sort the moved events. Anonymous functions supported in 5.3 only usort($tempArray, function ($a, $b) { return strcmp($a->start_date, $b->start_date); }); // put it back in the main events $events = $tempArray + $events; $pagination = new JPagination($total, JRequest::getVar('limitstart', 0), $jconfig->list_limit); $tmpl = new StreamTemplate(); $tmpl->set('events', $events); $tmpl->set('eventsDue', $eventsDue); $tmpl->set('pagination', $pagination)->set('showOwnerFilter', JRequest::getVar('user_id', 0) == 0)->set('filterStatus', $filterStatus); $html = $tmpl->fetch('event.header'); $html .= $tmpl->fetch('events.list'); return $html; }