Example #1
0
 public function updateTrending($tag, $group_id, $add = true)
 {
     $db = JFactory::getDbo();
     $now = new JXDate();
     $nowDate = $now->format('Y-m-d');
     $tagTrending = JTable::getInstance('TagTrend', 'StreamTable');
     $exist = $tagTrending->load(array('tag' => $tag, 'group_id' => $group_id, 'occurrence_date' => $nowDate));
     if ($add) {
         if ($exist) {
             // Record's there, just update it
             $tagTrending->frequency++;
         } else {
             // Create a new record
             $tagTrending->bind(array('tag' => $tag, 'frequency' => 1, 'group_id' => $group_id, 'occurrence_date' => $nowDate));
         }
         $tagTrending->store();
     } else {
         if ($exist) {
             // If it's the last frequency count, delete the record
             if ($tagTrending->frequency > 1) {
                 $tagTrending->frequency--;
             } else {
                 $tagTrending->delete();
             }
             $tagTrending->store();
         }
     }
 }
Example #2
0
 /**
  * Update the action by the user
  * Action that been tracked is the action that encourages user participation
  * @param String $type
  * available options:
  * 		  - message
  * 		  - blog
  * 		  - groups
  * 		  - events
  * 		  - todo
  * @return Boolean true on success
  */
 public function update($user_id, $type)
 {
     /* update the user activity */
     if (!$this->load(array('user_id' => $user_id))) {
         return;
     }
     $xdate = new JXDate();
     /* bind the selected type with current time */
     $this->bind(array($type => $xdate->toMySQL()));
     return $this->store();
 }
Example #3
0
 public function modInvitationList()
 {
     $usersInvite = AccountFactory::getModel('usersInvite');
     $result = $usersInvite->getList(array('status' => AccountTableUsersInvite::PENDING), '10');
     $html = '<ul>';
     if (!empty($result)) {
         foreach ($result as $record) {
             $date = JXDate::formatDate($record->last_invite_date);
             $html .= '<li>' . $record->invite_email . ' invited on ' . $date . '</li>';
         }
     }
     $html .= '</ul>';
     return $html;
 }
Example #4
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;
 }
Example #5
0
 public static function formatLapse($date)
 {
     $now = new JDate();
     $dateDiff = JXDate::timeDifference($date->toUnix(), $now->toUnix());
     if ($dateDiff['days'] > 0) {
         if ($dateDiff['days'] < 30) {
             $lapse = JText::sprintf(JXString::isPlural($dateDiff['days']) ? 'JXLIB_LAPSED_DAY_MANY' : 'JXLIB_LAPSED_DAY', $dateDiff['days']);
         } else {
             $lapse = self::formatDate($date, false);
         }
     } elseif ($dateDiff['hours'] > 0) {
         $lapse = JText::sprintf(JXString::isPlural($dateDiff['hours']) ? 'JXLIB_LAPSED_HOUR_MANY' : 'JXLIB_LAPSED_HOUR', $dateDiff['hours']);
     } elseif ($dateDiff['minutes'] > 0) {
         $lapse = JText::sprintf(JXString::isPlural($dateDiff['minutes']) ? 'JXLIB_LAPSED_MINUTE_MANY' : 'JXLIB_LAPSED_MINUTE', $dateDiff['minutes']);
     } else {
         if ($dateDiff['seconds'] == 0) {
             $lapse = JText::_("JXLIB_LAPSED_MOMENT_AGO");
         } else {
             $lapse = JText::sprintf(JXString::isPlural($dateDiff['seconds']) ? 'JXLIB_LAPSED_SECOND_MANY' : 'JXLIB_LAPSED_SECOND', $dateDiff['seconds']);
         }
     }
     return $lapse;
 }
Example #6
0
 public function ajaxResendInvitation()
 {
     // Only admin can use this function to invite guests
     $jxConfig = new JXConfig();
     $my = JXFactory::getUser();
     $accessHelper = new AccountAccessHelper();
     if (!$my->authorise('stream.setting.edit', $accessHelper)) {
         echo '{"error":"1","info":""';
         exit;
     }
     $invitation = JRequest::getVar('invitation_id', 0);
     $returnData = array();
     //if ($email !== false)
     if ($invitation) {
         $usersInvite = JTable::getInstance('usersInvite', 'AccountTable');
         $usersInvite->load(array('id' => $invitation));
         if ($usersInvite->id) {
             $emailToInvite = $usersInvite->invite_email;
             $dummy = new JXUser();
             $loadUser = $dummy->loadUserByEmail($usersInvite->from_email);
             if (!$loadUser) {
                 // Delete invitations which invitor email cannot be found from registered users
                 $dummy = JXFactory::getUser();
                 $usersInvite->delete();
             }
             $result = $this->processInvitation($dummy, $emailToInvite);
             $now = new JDate();
             if ($result['flag'] == self::SENT_FLAG) {
                 $usersInvite->load(array('from_email' => $dummy->email, 'invite_email' => $emailToInvite));
                 $returnData["info"] = JXDate::formatDate($now->format('Y-m-d h:i:s'));
                 $returnData["html"] = $usersInvite->getRowHtml();
             } elseif ($result['flag'] == self::ALREADY_REGISTERED_FLAG) {
                 $returnData["msg"] = JText::sprintf('COM_ACCOUNT_MSG_INVITATION_EMAIL_ALREADY_REGISTERED', $result['email']);
             }
             $returnData["error"] = '0';
         } else {
             $returnData["error"] = '1';
         }
     } else {
         $returnData["error"] = '1';
     }
     echo json_encode($returnData);
     exit;
 }
Example #7
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');
 }
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
	<tr>
		<td valign="top" style="background:#f9f9f9;font-size:14px;" width="50" >
			<img src="<?php 
echo $actor->getThumbAvatarURL();
?>
" alt="logo" style="display:block;border:3px solid #ffffff;outline:1px solid #ccc;margin:20px 0 0 20px;" width="50" height="50" /> 
		</td>
		<td valign="top" style="background:#f9f9f9;font-size:14px;" width="20" >
		</td>
		<td valign="middle" style="background:#f9f9f9;font-size:14px;" width="538" >		
			<p style="padding:0;margin:20px 20px 0 0;font-family:Helvetica,Geneva,sans-serif;"><strong><?php 
echo StreamMessage::formatShortDisplay($todoName, $linkOption);
?>
</strong></p>
			<p style="padding:0;margin:20px 20px 0 0;font-family:Helvetica,Geneva,sans-serif;">&#10004; <?php 
echo $todoItem;
?>
</p>	
			<?php 
$now = new JDate();
?>
			<p style="margin:0;padding:0;font-size:13px;color:#777;"><?php 
echo JText::sprintf('COM_STREAM_POST_DETAIL', $actor->get('name'), $actor->get('designation'), JXDate::formatDate($now, $formatDateShort, $recipient));
?>
</p>
		</td>
	</tr>
Example #9
0
 /**
  * Unlike a message
  */
 public function unlike()
 {
     $user = JXFactory::getUser();
     $stream_id = JRequest::getVar('message_id');
     $stream = JTable::getInstance('Stream', 'StreamTable');
     $stream->load($stream_id);
     // People need to be able to read the message to add comment
     if (!$user->authorise('stream.message.read', $stream)) {
         // No reason this code would ever get here!
         exit;
     }
     $stream->unlike();
     $now = new JDate();
     $updated = new JDate($stream->updated);
     $timediff = JXDate::timeDifference($updated->toUnix(), $now->toUnix());
     $preventUpdate = $updated->toUnix() > $now->toUnix() || $timediff['days'] == 0 && $timediff['hours'] == 0 && $timediff['minutes'] < STREAM_EDIT_INTERVAL ? true : false;
     $stream->store($preventUpdate);
     $data = $this->_streamShowLikes($stream);
     header('Content-Type: text/json');
     echo json_encode($data);
     exit;
 }
Example #10
0
 /**
  * To check if the event is already a passed event
  * @param JDate $endDate the end of event to compare to
  * @return Boolean true on passed event
  */
 public function isEventPassed($endDate)
 {
     $userTime = JXUser::getUserTime();
     $now = new JDate($userTime);
     $dateDiff = JXDate::timeDifference($endDate->toUnix(), $now->toUnix());
     $eventIsDue = !empty($dateDiff['days']) && $dateDiff['days'] < 0 ? false : true;
     return $eventIsDue;
 }
Example #11
0
		</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
    $isDone = $task->getState($todoIndex);
    $doneBy = JXFactory::getUser(intval($task->getDoneBy($todoIndex)));
    $doneOn = $task->getDoneOn($todoIndex);
    $doneOn = empty($doneOn) ? '' : ' - ' . JXDate::formatDate($doneOn);
    if (!empty($todo)) {
        ?>
					<li class="clearfix todo-item <?php 
        if ($isDone) {
            echo 'todo-done';
            $doneTodo++;
        }
        ?>
">
						<a href="javascript: void(0);" data-message_id="<?php 
        echo $task->id;
        ?>
" data-type="list" data-todo_index="<?php 
        echo $todoIndex;
        ?>
Example #12
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;
 }
echo $rowData->from_email;
?>
</span></div></td>
			<td class="to-update">
				<div class="key">
					<span><?php 
echo $rowData->invite_email;
?>
</span>
					<span class="small">
						<?php 
echo JText::_('COM_ACCOUNT_LABEL_LAST_INVITED_DATE');
?>
:
						<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) {
Example #14
0
<?php

// Placed in stream type when necessary
if (!defined("OVERDUE")) {
    define("OVERDUE", 1);
    define("INCOMPLETE", 2);
    define("COMPLETED", 3);
}
$filterStatus = JRequest::getVar('status', 'all');
$now = new JDate();
$data = $milestone->getData();
$todoIds = $milestone->getParam('todo');
$startDate = new JDate($milestone->start_date);
$dateDiff = JXDate::timeDifference($startDate->toUnix(), $now->toUnix());
$milestoneTaskCompletedCount = $milestone->getTaskCompletedCount();
$milestoneTaskCount = $milestone->getTaskCount();
$milestoneStatus = !empty($dateDiff['days']) && $dateDiff['days'] > 0 ? OVERDUE : INCOMPLETE;
$milestoneStatus = $milestone->status == StreamMilestoneType::COMPLETED ? COMPLETED : $milestoneStatus;
$milestoneDays = abs($dateDiff['days']);
$milestoneClass = '';
$milestoneDaysText = '';
$milestoneDaysClass = '';
$milestoneLabel = '';
switch ($milestoneStatus) {
    case OVERDUE:
        $milestoneClass = 'overdue';
        $milestoneDaysText = $milestoneDays . ' days late';
        $milestoneDaysClass = 'day-overdue';
        $milestoneLabel = 'label-important';
        break;
    case INCOMPLETE:
Example #15
0
							<a href="<?php 
            echo $result->addhref;
            ?>
" target="_blank"><?php 
            echo $result->title;
            ?>
</a>
							<br/>
							<div class="message-meta small">
								<a class="meta-date" href="<?php 
            echo $result->href;
            ?>
" target="_blank">
							<?php 
            $date = new JDate($result->created);
            echo JXDate::formatLapse($date);
            ?>
								</a>
							</div>
						</div>
					</div>
				</div>
				<div class="clear"></div>
			</li>
		</ul>
	</div>
<?php 
            break;
            // case default
    }
    // end if $result->section
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
	
	<tr>
		<td valign="top" style="background:#f9f9f9;font-size:14px;" width="50" >
			<img src="<?php 
echo $owner->getThumbAvatarURL();
?>
" alt="logo" style="display:block;border:3px solid #ffffff;outline:1px solid #ccc;margin:20px 0 0 20px;" width="50" height="50" /> 
		</td>
		<td valign="top" style="background:#f9f9f9;font-size:14px;" width="10" >
			<div style="width:0;min-height:0;border-width:8px;border-style:solid;border-color:#f8fafb #dbf5f7 #f8fafb #f8fafb;margin-top:35px;"></div>
		</td>

		<td valign="middle" style="background:#f9f9f9;font-size:14px;" width="548" >		
			<div id="topic" style="background:#dbf5f7;padding:10px;color:#333333;display:block;margin:20px 20px 5px 0;">
				<p style="padding:0;margin:0;font-style:italic;font-family:georgia,serif;">&#8220; <?php 
echo JText::sprintf('COM_STREAM_NOTIFICATION_FILE_REPLACE_CONTENT', $owner->get('name'), $previousFilename);
?>
 &#8221;</p>			
			</div>
			<p style="margin:0;padding:0;font-size:13px;color:#777;"><?php 
echo JText::sprintf('COM_STREAM_POST_DETAIL', $owner->get('name'), $owner->get('designation'), JXDate::formatDate($fileTable->created, $formatDateShort));
?>
</p>
		</td>
	</tr>
?>
</p>
		</td>
	</tr>
	<tr>

		<td valign="top" style="background:#f9f9f9;font-size:14px;" width="50" >
			<img src="<?php 
echo $postOwner->getThumbAvatarURL();
?>
" alt="logo" style="display:block;border:3px solid #ffffff;outline:1px solid #ccc;margin:20px 0 0 20px;" width="50" height="50" /> 
		</td>
		<td valign="top" style="background:#f9f9f9;font-size:14px;" width="10" >
			<div style="width:0;min-height:0;border-width:8px;border-style:solid;border-color:#f8fafb #3ea7af #f8fafb #f8fafb;margin-top:35px;"></div>
		</td>
		<td valign="middle" style="background:#f9f9f9;font-size:14px;" width="548" >		
			<div id="topic" style="background:#3ea7af;padding:10px;color:#fefefe;display:block;margin:20px 20px 5px 0;">
				<p style="padding:0;margin:0;font-style:italic;font-family:georgia,serif;">&#8220; <?php 
echo StreamMessage::formatShortDisplay($streamMessage->get('message'), $linkOption);
?>
 &#8221;</p>			
			</div>
			<?php 
$date = new JDate($streamMessage->created);
?>
			<p style="margin:0;padding:0;font-size:13px;color:#777;"><?php 
echo JText::sprintf('COM_STREAM_POST_DETAIL', $postOwner->get('name'), $postOwner->get('designation'), JXDate::formatDate($streamMessage->created, $formatDateShort, $recipient));
?>
</p>
		</td>
	</tr>
echo $eventCount;
?>
</span></a>
		</li>
	</ul>
</div>
	
<div class="modal weekly-overview" id="daily-overview" style="display:none;">	
	<h1>Weekly Overview:</h1>
	<h3>
		<span><?php 
echo JText::sprintf('COM_STREAM_LABEL_WEEKLY_OVERVIEW_DATE_RANGE', $weekNumber);
?>
</span>
		<span class="pull-right"><?php 
echo '( ' . JXDate::formatDate($firstDay, JXDate::SHORT_DATE_FORMAT) . ' - ' . JXDate::formatDate($lastDay, JXDate::SHORT_DATE_FORMAT) . ' )';
?>
</span>
	</h3>
	<ul class="nav">
		<li class="ov-milestone">
			<a href="<?php 
echo $milestoneLink;
?>
"><span><?php 
echo $milestoneCount;
?>
</span></a>
		</li>
		<li class="ov-todo">
			<a href="<?php 
Example #19
0
    $my->setParam('group_' . $comment->group_id . '_comment', $comment->id);
    $my->save();
}
?>
	<a href="<?php 
echo $user->getURL();
?>
"><?php 
echo $this->escape($user->name);
?>
</a> <?php 
echo StreamMessage::format($comment->comment);
?>
	<div class="comment-meta">
		<span><?php 
echo JXDate::formatLapse($commentDate);
?>
</span>
		<span style="<?php 
if ($commentLikeCount <= 0) {
    echo 'display: none;';
}
?>
">• <span class="comment-like"><?php 
echo $commentLikeCount;
?>
</span></span>
		<span class="comment-option" style="display:none;">
			<span>• <a href="#comment<?php 
echo !$comment->isLike($my->id) ? '' : 'un';
?>
Example #20
0
        if (JRequest::getVar('task') == 'sent' && !empty($message->smallAvatar[0])) {
            echo $message->to_name[0];
        } else {
            $recipientsName = array();
            foreach ($message->recipients as $recipient) {
                $user = JXFactory::getUser($recipient);
                $recipientsName[] = $user->name;
            }
            echo implode(', ', $recipientsName);
        }
        ?>
							</span>
							<span class="small">
								<?php 
        $postdate = new JDate($message->posted_on);
        echo JXDate::formatLapse($postdate);
        ?>
							</span>
						</div>
					</li>
					<li class="inbox-delete">
						<a href="" class="close">&times;</a>
					</li>
				</ul>
				<div class="clear"></div>
			</li>
			<?php 
    }
    ?>
		</ul>
		<div class="clear"></div>
	</tr>
	<tr>

		<td valign="top" style="background:#f9f9f9;font-size:14px;" width="50" >
			<img src="<?php 
echo $sender->getThumbAvatarURL();
?>
" alt="logo" style="display:block;border:3px solid #ffffff;outline:1px solid #ccc;margin:20px 0 0 20px;" width="50" height="50" /> 
		</td>
		<td valign="top" style="background:#f9f9f9;font-size:14px;" width="10" >
		</td>
		<td valign="middle" style="background:#f9f9f9;font-size:14px;" width="548" >
			<p style="padding:0;margin:20px 20px 0 0;font-family:Helvetica,Geneva,sans-serif;"><strong> &hearts; <?php 
echo JText::_('COM_STREAM_LIKE_LABEL');
?>
</strong> <?php 
echo JText::_('COM_STREAM_LABEL_YOUR_WALL_POST');
?>
 <span style="font-size:12px;color:#999;"><?php 
echo JText::sprintf('COM_STREAM_LIKE_AND_OTHER_MANY', $streamMessage->countLike() - 1);
?>
</span></p>
			<?php 
$now = new JDate();
?>
			<p style="margin:0;padding:0;font-size:13px;color:#777;"><?php 
echo JText::sprintf('COM_STREAM_POST_DETAIL', $sender->get('name'), $sender->get('designation'), JXDate::formatDate($now, $formatDateShort, $postOwner));
?>
</p>
		</td>
	</tr>
Example #22
0
 /**
  * This will return the user timezone
  * @param int $user_id id of the user
  * @param String $forDisplay get the display, if true then return value will be formatted to the proper display
  * @return String depends on the value of format
  */
 public static function getUserTime($user_id = null, $forDisplay = false)
 {
     $config = new JXConfig();
     $user = JFactory::getUser($user_id);
     // First load account setting (if any) timezone to override timezone in language file
     $defaultTz = $config->getTimezone() != '' ? $config->getTimezone() : JText::_('JXLIB_DEFAULT_TIMEZONE');
     $my = !$user instanceof JUser && !$user instanceof JXUser ? JXFactory::getUser() : $user;
     $timeZoneStr = $my->getParam('timezone');
     // Second load user personalize timezone (if any) to override system default timezone
     $timeZoneStr = empty($timeZoneStr) ? $defaultTz : $timeZoneStr;
     $tz = new DateTimeZone($timeZoneStr);
     $date2 = new JDate('now', $tz);
     $offset = $date2->getOffset() / 3600;
     $date = new JDate();
     $date->setOffset($offset);
     $xdate = new JXDate();
     /* if the value want to be used as display purposes */
     if ($forDisplay) {
         return $xdate->formatDate($date);
     } else {
         return $xdate->format($date);
     }
 }
		</div>
		<p style="margin:0;padding:0;font-size:13px;color:#777;"><?php 
echo JText::sprintf('COM_STREAM_POST_DETAIL', $postOwner->get('name'), $postOwner->get('designation'), JXDate::formatDate($streamMessage->created, $formatDateShort));
?>
</p>
	</td>
</tr>
<tr>
	<td valign="top" style="background:#f9f9f9;font-size:14px;" width="50" >
		<img src="<?php 
echo $sender->getThumbAvatarURL();
?>
" alt="logo" style="display:block;border:3px solid #ffffff;outline:1px solid #ccc;margin:20px 0 0 20px;" width="50" height="50" />
	</td>
	<td valign="top" style="background:#f9f9f9;font-size:14px;" width="10" >
		<div style="width:0;min-height:0;border-width:8px;border-style:solid;border-color:#f8fafb #3ea7af #f8fafb #f8fafb;margin-top:35px;"></div>
	</td>
	<td valign="middle" style="background:#f9f9f9;font-size:14px;" width="548" >
		<div id="topic" style="background:#3ea7af;padding:10px;color:#fefefe;display:block;margin:20px 20px 5px 0;">
			<p style="padding:0;margin:0;font-style:italic;font-family:georgia,serif;">&#8220; <?php 
echo StreamMessage::formatShortDisplay($messageComment->get('comment'), $linkOption);
?>
 &#8221;</p>
		</div>

		<p style="margin:0;padding:0;font-size:13px;color:#777;"><?php 
echo JText::sprintf('COM_STREAM_POST_DETAIL', $sender->get('name'), $sender->get('designation'), JXDate::formatDate($messageComment->created, $formatDateShort));
?>
</p>
	</td>
</tr>