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'); } }
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; }
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; }
public function getTodoHtml($todoStreamObj) { $tmpl = new StreamTemplate(); $tmpl->set('task', $todoStreamObj)->set('my', JXFactory::getUser()); return $tmpl->fetch('todo.item'); }
/** * 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 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; }
public static function getFooterContent() { $jsConfig = new JConfig(); $tmpl = new StreamTemplate(); $tmpl->set('jsConfig', $jsConfig); $html = $tmpl->fetch('notification.footer'); return $html; }
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; }
public function notification() { $my = JXFactory::getUser(); $data = array(); // No notification for guest. Trigger a logout in user's browser if (!$my->id) { $data['logout'] = true; echo json_encode($data); exit; } include_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'string.php'; $phash = JRequest::getVar('pHash'); // public data cache hash $data['notification'] = array(); $data['comments'] = array(); $data['updates'] = array(); // Get my groups $streamModel = StreamFactory::getModel('stream'); $groupsModel = StreamFactory::getModel('groups'); $groupIJoin = $my->getParam('groups_member'); $groupIFollow = $my->getParam('groups_follow'); $myGroups = JXUtility::csvMerge($groupIFollow, $groupIJoin); $myGroups = $groupsModel->getGroups(array('id' => $myGroups)); // Get public notices $lastMessageRead = $my->getParam('message_last_read'); $publicCount = StreamMessage::countMessageSince($lastMessageRead); $data['notification']['company_updates'] = $publicCount; // we can merge this request with the group request so that template are fetched on the same loop but the group content is unique to each group // @todo: optimize the whole request $publicMessageContents = $streamModel->getStream(array('group_id' => 0), $publicCount); $publicMessagesHTML = '<ul>'; foreach ($publicMessageContents as $row) { $tmpl = new StreamTemplate(); $tmpl->set('stream', $row); $publicMessagesHTML .= $tmpl->fetch('notification.message'); $data['updates'][0]['message_id'][] = $row->id; } $publicMessagesHTML .= '</ul>'; $data['data_content'][0] = $publicMessagesHTML; $data['updates'][0]['name'] = 'public'; $data['updates'][0]['notification'] = $publicCount; $data['updates'][0]['content'] = $publicMessagesHTML; // @todo: this is kinda heavy. Optimize further. Otherwise the live update // will kill us $updatedGroups = array(); $updatedGroupsComment = array(); foreach ($myGroups as $group) { $lastReadId = $my->getParam('group_' . $group->id . '_read'); $lastCommentId = $my->getParam('group_' . $group->id . '_comment'); $groupLastMsg = $group->getParam('last_message'); $groupLastComment = $group->getParam('last_comment'); $groupNewMsg = $streamModel->countStream(array('!user_id' => $my->id, 'id_more' => $lastReadId, 'group_id' => $group->id)); $groupNewComment = $streamModel->countComments(array('group_id' => $group->id, 'id_more' => $lastCommentId)); // // the array key is the same as html id element of the <span> that // will take this value $data['notification']['groups_' . $group->id] = intval($groupNewMsg); // rand ( 0 , 20 ); $data['comments']['groups_' . $group->id] = intval($groupNewComment); // rand ( 0 , 20 ); $data['updates'][$group->id]['name'] = $group->name; $data['updates'][$group->id]['notification'] = intval($groupNewMsg); $data['updates'][$group->id]['comments'] = intval($groupNewComment); // Add popover data if ($groupNewMsg > 0) { $updatedGroups[] = $group; } if ($groupNewComment > 0) { $updatedGroupsComment[] = $group; } } // Get the popover data if necessary // This is done saperately to give opportunity for caching if (md5(serialize($data['notification']) . serialize($data['comments'])) != $phash) { if (!empty($updatedGroups)) { foreach ($updatedGroups as $group) { $limit = $data['notification']['groups_' . $group->id]; $newMessages = $streamModel->getStream(array('group_id' => $group->id), $limit); $newMessagesHTML = '<ul>'; foreach ($newMessages as $row) { $tmpl = new StreamTemplate(); $tmpl->set('stream', $row); $newMessagesHTML .= $tmpl->fetch('notification.message'); } $newMessagesHTML .= '</ul>'; $data['data_content']['#groups_' . $group->id . '_link'] = $newMessagesHTML; $data['updates'][$group->id]['content'] = $newMessagesHTML; } } /* if(!empty($updatedGroupsComment)){ foreach($updatedGroupsComment as $group) { $data['data_comment']['#groups_'.$group->id.'_link'] = ''; } } */ } if ($phash == md5(serialize($data['notification']) . serialize($data['comments']))) { $data['data_content'] = array(); $data['notification'] = array(); $data['comments'] = array(); $data['updates'] = array(); } $data['pHash'] = md5(serialize($data['notification']) . serialize($data['comments'])); header('Content-Type: text/json'); echo json_encode($data); exit; }
/** * Return list groups the user is most involed in lately */ public function getUserActiveGroupsHTML($userid = null, $limit = 6) { $my = JXFactory::getUser($userid); $ids = $my->getParam('groups_member'); $model = StreamFactory::getModel('groups'); $data = $model->getActiveGroups($userid, $limit); $tmpl = new StreamTemplate(); $tmpl->set('title', JText::sprintf("COM_STREAM_LABEL_GROUP_FAVORITE", $my->name)); $tmpl->set('groups', $data); $html = $tmpl->fetch('group.module.groups'); return $html; }
/** * Draw the triple zoomer map * @param type $address * @param type $width * @param type $height */ public static function drawZoomableMap($address, $width, $height) { $tmpl = new StreamTemplate(); $tmpl->set('address', $address)->set('width', $width)->set('height', $height); return $tmpl->fetch('map.zoom'); }
public function getMilestoneHTML($milestoneObj, $addClass = '') { $tmpl = new StreamTemplate(); $tmpl->set('milestone', $milestoneObj)->set('addClass', $addClass)->set('my', JXFactory::getUser()); return $tmpl->fetch('milestone.item'); }
public static function getTagsHTML($stream) { $tmpl = new StreamTemplate(); $tmpl->set('stream', $stream); return $tmpl->fetch('stream.tag'); }
/** * 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 getItemHTML($format = null) { $tmpl = new StreamTemplate(); $tmpl->set('stream', $this->data)->set('comment', StreamComment::getCommentSummaryHTML($this->data)); return $tmpl->fetch('stream.item.update'); }
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; }
public function showMessages() { jimport('joomla.html.pagination'); $app = JFactory::getApplication(); $my = JXFactory::getUser(); $jconfig = new JConfig(); $html = ''; if ($ids = JRequest::getVar('ids', '')) { $filter['id'] = $ids; } $model = StreamFactory::getModel('stream'); $data = $model->getStream($filter, $jconfig->list_limit, JRequest::getVar('limitstart', 0)); // for some reason, data retrieved has not permissable view message foreach ($data as $streamMsg) { if (!$my->authorise('stream.message.read', $streamMsg)) { $app = JFactory::getApplication(); $app->redirect(JURI::base(), JText::_('COM_STREAM_ERROR_NO_ACCESS'), 'error'); exit; } } $total = $model->countStream($filter); // Pagination $pagination = new JPagination($total, JRequest::getVar('limitstart', 0), $jconfig->list_limit); // If URI is defined, we need to set the pagination link properly if ($uri = JRequest::getVar('uri', '')) { $uri = new JURI($uri); $router = $app->getRouter(); $result = $router->parse($uri); foreach ($result as $key => $val) { $pagination->setAdditionalUrlParam($key, $val); } } $tmpl = new StreamTemplate(); $tmpl->set('rows', $data); $tmpl->set('total', $total); $tmpl->set('pagination', $pagination); $html .= $tmpl->fetch('stream.data'); return $html; }
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; }
public function modGetDailyOverviewHtml() { $my = JXFactory::getUser(); $showPopup = false; $dailyOverview = $my->getParam('overview', ''); $dayOfWeek = date('w'); $weekOfYear = date('W'); $today = strtotime(date('Y-m-d')); // use 6 minus as dayOfWeek starts at 0 $lastDateofWeek = $today + (6 - $dayOfWeek) * 24 * 60 * 60; $firstDateofWeek = $today - $dayOfWeek * 24 * 60 * 60; // Need to check user param for popup require on each day $save = false; if (empty($dailyOverview)) { $dailyOverview = new stdClass(); $dailyOverview->date = $today; $save = true; } else { $dailyOverview = json_decode($dailyOverview); if ($dailyOverview->date < $today) { $dailyOverview->date = $today; $save = true; } } // save if require to popup to avoid subsequent popup on viewing homepage if ($save) { $my->setParam('overview', json_encode($dailyOverview)); $my->save(); $showPopup = true; } // display popup $yesterday = $today - 60 * 60 * 24; $streamModel = JModel::getInstance('Stream', 'StreamModel'); // find all incomplete milestone $milestones = $streamModel->getStreamIds(array('type' => 'milestone', 'user_id' => $my->id, 'status' => 0, 'custom' => '(start_date >= "' . date('Y-m-d', $today) . '" AND start_date <= "' . date('Y-m-d', $lastDateofWeek) . '")')); //var_dump($milestones); // find all upcoming events $events = $streamModel->getStreamIds(array('type' => 'event', 'user_id' => $my->id, 'custom' => '(start_date <= "' . date('Y-m-d', $lastDateofWeek) . '" AND (end_date >= "' . date('Y-m-d', $today) . '" AND end_date <= "' . date('Y-m-d', $lastDateofWeek) . '") OR (start_date >= "' . date('Y-m-d', $today) . '" AND start_date <= "' . date('Y-m-d', $lastDateofWeek) . '")) ')); //var_dump($events); // find all incomplete todos $todo = $streamModel->getStreamIds(array('type' => 'todo', 'user_id' => $my->id, 'custom' => '(params REGEXP \'"state_[0-9]+":"0","by_[0-9]+":"0"\' OR params NOT REGEXP \'"state_[0-9]+"\') AND (end_date >= "' . date('Y-m-d', $today) . '" AND end_date <= "' . date('Y-m-d', $lastDateofWeek) . '")')); //var_dump($todo); $tmpl = new StreamTemplate(); $firstDay = new JDate($firstDateofWeek); $lastDay = new JDate($lastDateofWeek); $tmpl->set('firstDay', $firstDay)->set('lastDay', $lastDay)->set('today', $today)->set('weekNumber', $weekOfYear); $tmpl->set('todos', $todo)->set('events', $events)->set('milestones', $milestones); $tmpl->set('todoCount', count($todo))->set('eventCount', count($events))->set('milestoneCount', count($milestones))->set('showPopup', $showPopup); return $tmpl->fetch('stream.module.dailyoverview'); }