示例#1
0
 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;
 }
示例#2
0
 function display($tpl = null)
 {
     jimport('joomla.html.pagination');
     $configHelper = new JXConfig();
     $usersInvite = AccountFactory::getModel('usersInvite');
     $my = JXFactory::getUser();
     $total = $usersInvite->getTotal(array('from_email' => $my->email));
     $result = $usersInvite->getList(array('from_email' => $my->email, 'order_by' => 'status, last_invite_date'), $configHelper->get('list_limit'), JRequest::getVar('limitstart', 0));
     $inviteEmail = '';
     if ($_POST) {
         $postVar = JRequest::getVar('params');
         $inviteEmail = $postVar['invitation'];
     }
     // Extranet/Limited groups
     $groupModel = StreamFactory::getModel('groups');
     $myJoinedGroups = $groupModel->getGroups(array('id' => $my->getParam('groups_member')), 100);
     // Pagination
     $pagination = new JPagination($total, JRequest::getVar('limitstart', 0), $configHelper->get('list_limit'));
     $pendingStat = AccountTableUsersInvite::PENDING;
     $doc = JFactory::getDocument();
     $doc->setTitle(JText::_("COM_ACCOUNT_LABEL_INVITE_USERS"));
     $this->assignRef('inviteEmail', $inviteEmail);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('pendingStat', $pendingStat);
     $this->assign('allowInvite', $configHelper->allowUsersRegister());
     $this->assignRef('results', $result);
     $this->assignRef('myJoinedGroups', $myJoinedGroups);
     parent::display($tpl);
 }
示例#3
0
 /**
  *
  */
 public function display($cachable = false, $urlparams = false)
 {
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = JRequest::getCmd('view', 'todo');
     $view = StreamFactory::getView($viewName, '', $viewType);
     echo $view->display();
 }
示例#4
0
 public function display()
 {
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = JRequest::getCmd('view', 'direct');
     $view = StreamFactory::getView($viewName, '', $viewType);
     echo $view->display();
 }
示例#5
0
 /**
  *
  */
 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');
 }
示例#6
0
 public function getFilteredGroupsHTML($groupids)
 {
     $filter = array();
     $filter['id'] = implode(',', $groupids);
     $model = StreamFactory::getModel('groups');
     $data = $model->getGroups($filter);
     $tmpl = new StreamTemplate();
     $tmpl->set('title', JText::_('Groups'));
     $tmpl->set('groups', $data);
     $html = $tmpl->fetch('group.module.groups');
     return $html;
 }
示例#7
0
 /**
  * Initialize the video
  */
 private function _init()
 {
     StreamFactory::load('libraries.slideshare');
     jimport('joomla.http.http');
     $feedURL = 'http://www.slideshare.net/api/oembed/2?url=' . $this->source . '&format=json';
     $options = new JRegistry();
     $transport = new JHttpTransportCurl($options);
     $http = new JHttp($options, $transport);
     $response = $http->get($feedURL);
     $this->response = $response->body;
     return true;
 }
示例#8
0
 /**
  *
  */
 public static function run()
 {
     $now = new JDate();
     // Clear all old uploaded, but unused files
     $fileModel = StreamFactory::getModel('files');
     $files = $fileModel->getUnusedFiles();
     foreach ($files as $file) {
         $file->delete();
     }
     //
     return true;
 }
示例#9
0
 public function updateCalendar()
 {
     $month = JRequest::getVar('month');
     $year = JRequest::getVar('year');
     StreamFactory::load('helpers' . DS . 'calendar');
     $html = StreamCalendarHelper::generate_calendar($year, $month);
     $data = array();
     $data['html'] = $html;
     $data['script'] = '$(\'div.popover\').hide();$(\'td.running\').popmodal({html:true, live:true, placement: \'below\'});';
     echo json_encode($data);
     exit;
 }
示例#10
0
 public function edit()
 {
     $mainframe = JFactory::getApplication();
     $view = StreamFactory::getView('blog', '', 'html');
     $message_id = JRequest::getVar('message_id');
     // @todo: make sure message id and message type is valid
     $stream = JTable::getInstance('Stream', 'StreamTable');
     $stream->load($message_id);
     $my = JXFactory::getUser();
     if (!$my->authorise('stream.message.edit', $stream)) {
         $mainframe->redirect($stream->getUri(), JText::_('You do not have permission to edit this message'), 'error');
         return;
     }
     // Save blog post
     // @todo: validation
     if (JRequest::getVar('action') == 'save') {
         //	Update attachement there might be addition and removals
         $oldFiles = $stream->getFiles();
         //@todo: validate content
         $errors = array();
         $stream->bind(JRequest::get('POST', JREQUEST_ALLOWRAW));
         $stream->raw = json_encode(JRequest::get('POST', JREQUEST_ALLOWRAW));
         if (empty($_POST['title'])) {
             $errors[] = JText::_('COM_STREAM_BLOG_POST_NO_TITLE');
         }
         if (empty($_POST['message'])) {
             $errors[] = JText::_('COM_STREAM_BLOG_POST_EMPTY');
         }
         if (empty($errors)) {
             $stream->store();
             $mainframe->enqueueMessage(JText::_('COM_STREAM_BLOG_POST_UPDATED'));
             // Delete file attachment that are no longer used
             foreach ($oldFiles as $file) {
                 if (!in_array($file->id, JRequest::getVar('attachment', array()))) {
                     $file->delete();
                 }
             }
             // For all new attachment, we need to set their owner
             $fileModel = StreamFactory::getModel('files');
             $fileModel->updateOwner($stream);
         } else {
             foreach ($errors as $err) {
                 $mainframe->enqueueMessage($err, 'error');
             }
         }
     }
     echo $view->edit($stream);
 }
示例#11
0
 /**
  *
  */
 public static function getSelectList($group_id = null, $selected = '')
 {
     $streamModel = StreamFactory::getModel('stream');
     $milestones = $streamModel->getStream(array('type' => 'milestone', 'group_id' => $group_id));
     $html = ' <select name="milestone"><option value="">None</option>';
     $now = new JDate();
     foreach ($milestones as $mstone) {
         // Don't list overdue milestones
         $startDate = new JDate($mstone->start_date);
         $dateDiff = JXDate::timeDifference($startDate->toUnix(), $now->toUnix());
         if (!empty($dateDiff['days']) && $dateDiff['days'] > 0) {
             continue;
         }
         $html .= '<option value="' . $mstone->id . '">' . $mstone->message . '</option>';
     }
     $html .= '</select>';
     return $html;
 }
示例#12
0
 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;
 }
示例#13
0
 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;
 }
示例#14
0
 /**
  *
  */
 public function load($keys = null, $reset = true)
 {
     if (!is_array($keys)) {
         // Load by primary key.
         $keys = array($this->_tbl_key => $keys);
     } else {
         // Return false for videos link
         StreamFactory::load('libraries.video');
         $videoLib = new StreamVideo();
         $videos = $videoLib->getURL($keys['link']);
         if (in_array($keys['link'], $videos)) {
             return false;
         }
         // Return false for slidehshare links
         StreamFactory::load('libraries.slideshare');
         $ssLib = new StreamSlideshare();
         $slideShares = $ssLib->getURL($keys['link']);
         if (in_array($keys['link'], $slideShares)) {
             return false;
         }
     }
     $result = parent::load($keys, $reset);
     $this->_params = new JParameter($this->params);
     if (!$result && isset($keys['link'])) {
         $this->link = $keys['link'];
     }
     if (empty($this->params)) {
         $this->params = StreamLinks::grab($this->link);
         if ($this->params) {
             $date = new JDate();
             $this->timestamp = $date->format('Y-m-d h:i:s');
             $this->store(true);
         }
     }
     return $result;
 }
示例#15
0
 public function getTrending($group = null)
 {
     $db = JFactory::getDbo();
     $my = JXFactory::getUser();
     $groupModel = StreamFactory::getModel('groups');
     $now = new JXDate();
     $nowDate = $now->format('Y-m-d');
     // Get the week's top trending tags
     //$where  = 'WHERE YEARWEEK(' . $db->nameQuote('occurrence_date') . ') = YEARWEEK(' . $db->Quote($nowDate) . ')' . ' '
     // Get the trending tags for the past n weeks
     $where = 'WHERE ' . $db->nameQuote('occurrence_date') . ' BETWEEN DATE_SUB(' . $db->Quote($nowDate) . ', INTERVAL 2 WEEK) AND ' . $db->Quote($nowDate) . ' ' . ' AND ' . $db->nameQuote('frequency') . ' > 0' . ' ';
     // Filter tags in group
     if (!is_null($group)) {
         $where .= 'AND ' . $db->nameQuote('group_id') . ' = ' . $db->Quote($group->id) . ' ';
     } else {
         // Get the groups joined (including private ones)
         $groupIJoinCsv = $my->getParam('groups_member', '-1');
         // Get the other public groups
         $otherGroups = $groupModel->getGroups(array('!id' => $groupIJoinCsv, 'access' => 0), 100);
         $otherGroupsCsv = '0';
         if (count($otherGroups)) {
             foreach ($otherGroups as $group) {
                 $otherGroupsCsv = JXUtility::csvInsert($otherGroupsCsv, $group->id);
             }
         } else {
             $otherGroupsCsv = '-1';
         }
         $myGroupsCsv = JXUtility::csvMerge($otherGroupsCsv, $groupIJoinCsv);
         $where .= 'AND ' . $db->nameQuote('group_id') . ' IN (' . $myGroupsCsv . ')' . ' ';
     }
     // Build the query
     $query = 'SELECT * FROM ' . $db->nameQuote('#__stream_tags_trend') . ' ' . $where . 'GROUP BY ' . $db->nameQuote('tag') . ' ' . 'ORDER BY ' . $db->nameQuote('frequency') . ' DESC, ' . $db->nameQuote('tag') . ' ASC' . ' ' . 'LIMIT 10';
     $db->setQuery($query);
     $result = $db->loadObjectList();
     return $result;
 }
示例#16
0
 /**
  *
  */
 public function getStream($filter = array(), $options = array())
 {
     jimport('joomla.html.pagination');
     $app = JFactory::getApplication();
     $jconfig = new JConfig();
     $html = '';
     $user = JXFactory::getUser();
     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;
     }
     if ($overdue = JRequest::getVar('overdue', '')) {
         $date = new JDate();
         $filter['end_date'] = $date->toMySQL();
     }
     if ($tag = JRequest::getVar('tag', '')) {
         $filter['tag'] = $tag;
     }
     // Order by 'updated'
     $filter['order_by_desc'] = 'updated';
     $model = StreamFactory::getModel('stream');
     $data = $model->getStream($filter, $jconfig->list_limit, JRequest::getVar('limitstart', 0));
     $total = $model->countStream($filter);
     // Set $user if user_id filter is specified
     if (isset($filter['user_id'])) {
         $user = JXFactory::getUser($filter['user_id']);
     }
     return $data;
 }
<?php

require_once JPATH_ROOT . DS . 'components' . DS . 'com_stream' . DS . 'helpers' . DS . 'html.php';
$data = $stream->getData();
$files = $stream->getFiles();
$model = StreamFactory::getModel('events');
$eventDate = $model->determinedEventDuration($stream->start_date, $stream->end_date);
$startDate = $eventDate['startDate'];
$endDate = $eventDate['endDate'];
$startTime = $eventDate['startTime'];
$endTime = $eventDate['endTime'];
?>

<div class="inline-edit">
<form name="message-edit">
	<div id="stream-post-event" class="stream-post-details">
		<textarea name="message"><?php 
echo $stream->message;
?>
</textarea>
	</div>
	<div class="stream-post-details">	
		<div class="stream-post-time location">
			<input type="text" placeholder="<?php 
echo JText::_('COM_STREAM_DEFAULT_LABEL_WHERE');
?>
" name="location" class="location bottom-border" autocomplete="off" value="<?php 
echo $this->escape($stream->location);
?>
"/>
			<label>
示例#18
0
:
						<span class="last-invite-date"><?php 
echo JXDate::formatDate($rowData->last_invite_date);
?>
</span>

						<?php 
if (!empty($rowData->group_limited)) {
    ?>
							<?php 
    echo JText::_('Limited to these groups');
    ?>
:
							<span class="last-invite-date">
								<?php 
    $groupModel = StreamFactory::getModel('groups');
    $limitedGroups = $groupModel->getGroups(array('id' => $rowData->group_limited), 100);
    foreach ($limitedGroups as $idx => $group) {
        echo '&bull;&nbsp;' . StreamTemplate::escape($group->name) . '<br />';
    }
    ?>
							</span>
						<?php 
}
?>
					</span>
				</div>
			
			</td>
			<td><span class="label label-info"><?php 
echo $rowData->translateStatus($rowData->status);
<?php

$my = JXFactory::getUser();
$user = JXFactory::getUser($stream->user_id);
$data = json_decode($stream->raw);
$date = new JDate($stream->created);
$commentCount = $stream->getParam('comment_count', null);
// TODO: method
if ($commentCount) {
    $model = StreamFactory::getModel('stream');
    $recentComments = $model->getComments(array('message_id' => $stream->id, 'order_by_desc' => 'id'), 1);
    $recentPosterId = $recentComments[0]->user_id;
    $recentMessage = $recentComments[0]->comment;
    $messageCreated = $recentComments[0]->created;
    $recentMessageElId = '#comment-' . $recentComments[0]->id;
    // used for message highlighting
} else {
    $recentPosterId = $stream->user_id;
    $recentMessage = $stream->message;
    $messageCreated = $stream->created;
    $recentMessageElId = '';
    // doesn't highlight first message
}
$messageURL = JRoute::_('index.php?option=com_stream&view=direct&message_id=' . $stream->id) . $recentMessageElId;
$members = array();
if (!empty($stream->group_id)) {
    $group = $stream->getGroup();
    // Message sent to
    $memberIds = $group->members;
    $memberIds = explode(',', trim($memberIds, ','));
    // Message sent to
示例#20
0
 public function tagFilter()
 {
     $view = StreamFactory::getView('company', '', 'html');
     echo $view->tagFilter();
 }
示例#21
0
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 
}
示例#22
0
%;"></div>
			</div>
			<?php 
}
?>
			<div class="content">
				<div class="small">
					<span>Due date: <?php 
echo $startDate->format(JText::_('JXLIB_DATE_SHORT_FORMAT'));
?>
</span>
				</div>
				<!-- TASK LIST PLACEHOLDER. REMOVE EVERYTHING IN BETWEEN THIS COMMENT ONCE COMPLETED. -->
				<?php 
if ($todoIds) {
    $tasks = StreamFactory::getModel('stream')->getStream(array('id' => $todoIds));
    foreach ($tasks as $task) {
        echo $task->getTodoHtml($task);
    }
}
?>
				<!--  -->
			</div>
				
			<?php 
if ($my->authorise('stream.message.edit', $milestone)) {
    ?>
			<div class="milestone-action" data-id="<?php 
    echo $milestone->id;
    ?>
">
示例#23
0
 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;
 }
示例#24
0
 /**
  * Delete a group
  */
 public function delete()
 {
     $my = JXFactory::getUser();
     $group = JTable::getInstance('Group', 'StreamTable');
     $group->load(JRequest::getVar('group_id'));
     if ($my->authorise('stream.group.delete', $group)) {
         // Delete all related stream as well
         $streamModel = StreamFactory::getModel('stream');
         $streamModel->delete(array('group_id' => $group->id));
         // Delete all related files
         $fileModel = StreamFactory::getModel('files');
         $fileModel->delete(array('group_id' => $group->id));
         $group->delete();
     }
     // Delete related comments
     // @todo: delete all related messages
     //StreamComment::deleteComments($stream_id);
     // redirect
     $data = array();
     $data['redirect'] = JRoute::_('index.php?option=com_stream&view=groups', FALSE);
     header('Content-Type: text/json');
     echo json_encode($data);
     exit;
 }
示例#25
0
 /**
  *  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');
 }
示例#26
0
 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;
 }
示例#27
0
    /**
     * 
     */
    private function getArchiveHTML()
    {
        $model = StreamFactory::getModel('stream');
        $data = $model->getMessageStats();
        $html = '<div class="moduletable">
			<h3>Archives</h3>
			<ul class="archivelist">';
        $monthList = array(1 => 'JANUARY', 2 => 'FEBRUARY', 3 => 'MARCH', 4 => 'APRIL', 5 => 'MAY', 6 => 'JUNE', 7 => 'JULY', 8 => 'AUGUST', 9 => 'SEPTEMBER', 10 => 'OCTOBER', 11 => 'NOVEMBER', 12 => 'DECEMBER');
        foreach ($data as $row) {
            $link = JRoute::_('index.php?option=com_stream&view=blog&month=' . $row->month . '&year=' . $row->year, false);
            $html .= '<li><a href="' . $link . '">' . JText::_($monthList[$row->month]) . '&nbsp;' . $row->year . '</a>&nbsp;(' . $row->count . ')</li>';
        }
        $html .= '</ul></div>';
        return $html;
    }
示例#28
0
 public function filter()
 {
     $view = StreamFactory::getView('company');
     $html = $view->getStreamDataHTML();
     $data = array();
     $data['html'] = $html;
     $data['type'] = JRequest::getVar('type');
     header('Content-Type: text/json');
     echo json_encode($data);
     exit;
 }
示例#29
0
 function display($tpl = null)
 {
     /**
     * Response values
     * ======================
     * 
     // profile: {
     // 	 name: string,
     // 	 id: int
     // },
     // groups: {
     // 	 group: {
     // 		name: string,
     // 		description: string,
     // 	 },
     // 	 params: json
     // 	 followers: {
     // 	 	follower: {
     // 	 		name: string,
     // 	 		email: string
     // 	 	}
     // 	 },
     // 	 members: {
     // 	 	member: {
     // 	 		name: string,
     // 	 		email: string
     // 	 	}
     // 	 },
     // 	 archived: boolean
     // 	 category: string
     // }		
     // 			
     */
     header('Content-Type: application/json');
     $my = JXFactory::getUser();
     $groupsModel = StreamFactory::getModel('groups');
     $filter = array();
     if (JRequest::getVar('filter', 'all') == 'joined') {
         $groupIJoin = $my->getParam('groups_member');
         $filter['id'] = $groupIJoin;
     }
     if (JRequest::getVar('filter', 'all') == 'followed') {
         $groupIJoin = $my->getParam('groups_follow');
         $filter['id'] = $groupIJoin;
     }
     if (JRequest::getVar('filter', 'all') == 'archived') {
         $filter['archived'] = 1;
     }
     if (JRequest::getVar('filter', 'all') == 'category') {
         $filter['category_id'] = JRequest::getVar('category_id', NULL);
     }
     if (JRequest::getVar('category_id')) {
         $filter['category_id'] = JRequest::getVar('category_id', NULL);
     }
     $groups = $groupsModel->getGroups($filter, NULL, JRequest::getVar('limitstart', 0));
     $total = $groupsModel->getTotal($filter);
     $output['profile']['username'] = $my->username;
     $output['profile']['id'] = $my->id;
     $Category = new StreamCategory();
     foreach ($groups as $group) {
         // dont load private group
         if ($group->access == 1) {
             continue;
         }
         $followersCsv = json_encode($group->followers);
         $followers_id = explode(',', $followersCsv);
         foreach ($followers_id as $follower_id) {
             $usr = JXFactory::getUser(intval($follower_id));
             $followers['follower']['username'] = $usr->username;
             $followers['follower']['name'] = $usr->name;
             $followers['follower']['email'] = $usr->email;
         }
         $membersCsv = json_encode($group->members);
         $members_id = explode(',', $membersCsv);
         foreach ($members_id as $member_id) {
             $usr = JXFactory::getUser(intval($member_id));
             $members['member']['username'] = $usr->username;
             $members['member']['name'] = $usr->name;
             $members['member']['email'] = $usr->email;
         }
         $category = $Category->getCategoryName($group->category_id);
         $output['groups']['group'][] = array('name' => $group->name, 'description' => $group->description, 'creator' => $group->creator, 'followers' => $followers, 'members' => $members, 'archived' => $group->archived, 'category' => $category);
         echo json_encode($output);
     }
     exit;
 }
示例#30
0
 public static function sendCommentAdd()
 {
     $funcArgs = func_get_args();
     // Get notification type from caller
     $notificationType = $funcArgs[0];
     // Get the comment table object from passed in parameter
     $commentTable = $funcArgs[1];
     $userList = array();
     $emailList = array();
     $jConfig = new JConfig();
     if ($commentTable instanceof JTable) {
         if (self::sentNotificationCheck($notificationType, $commentTable->user_id, $commentTable->id) === false) {
             // Get commentor
             $commentor = JXFactory::getUser($commentTable->user_id);
             // Get comment's main Stream Message
             $streamTable = JTable::getInstance('Stream', 'StreamTable');
             $streamTable->load($commentTable->stream_id);
             // Get Stream Message Owner
             $streamMessageOwner = JXFactory::getUser($streamTable->user_id);
             // Get Wall Post like users
             $likeUser = $streamTable->likes;
             // Get Wall Post followers users
             $followers = $streamTable->followers;
             // Get Wall Post all comments to fetch participated users
             $streamModel = StreamFactory::getModel('Stream');
             $commentRows = $streamModel->getComments(array('message_id' => $commentTable->stream_id));
             foreach ($commentRows as $comment) {
                 $userList[] = $comment->user_id;
             }
             $userList[] = $streamTable->user_id;
             // Add Like Users into list
             $userList = JXUtility::csvMerge(implode(',', $userList), $likeUser);
             // Add Followers into list
             $userList = explode(',', JXUtility::csvMerge($userList, $followers));
             $userList = self::groupUserByLanguage($userList, $commentor->id, $notificationType);
             $messageUrl = StreamMessage::getMessageUri($commentTable->stream_id);
             $arrParam = array('streamMessage' => $streamTable, 'messageComment' => $commentTable, 'sender' => $commentor, 'postOwner' => $streamMessageOwner);
             foreach ($userList as $lang => $bccEmail) {
                 self::loadLanguage($lang);
                 // subject and content based on message type (direct messages or comments)
                 if ($streamTable->type == 'direct') {
                     $subject = JText::sprintf('COM_STREAM_NOTIFICATION_PROFILE_POST_DIRECT_SUBJECT', $commentor->name);
                     $bodyContent = self::getHeaderContent(JText::_('COM_STREAM_NOTIFICATION_DIRECT_POST_TITLE'), $messageUrl);
                 } else {
                     $subject = JText::sprintf('COM_STREAM_NOTIFICATION_PROFILE_POST_COMMENT_SUBJECT', $commentor->name);
                     $bodyContent = self::getHeaderContent(JText::_('COM_STREAM_NOTIFICATION_COMMENT_POST_TITLE'), $messageUrl);
                 }
                 $bodyContent .= self::getBodyContent('notification.post.comment', $arrParam);
                 $bodyContent .= self::getFooterContent();
                 self::sendMail($jConfig->mailfrom, $jConfig->fromname, $jConfig->mailfrom, $subject, $bodyContent, $bccEmail);
             }
         }
     }
 }