/** * Displays the user's points achievement history * * @since 2.0 * @access public */ public function history($tmpl = null) { $app = JFactory::getApplication(); $id = JRequest::getInt('id'); if (!$id) { DiscussHelper::setMessageQueue(JText::_('Unable to locate the id of the user.'), DISCUSS_QUEUE_ERROR); $app->redirect('index.php?option=com_easydiscuss'); $app->close(); } $model = DiscussHelper::getModel('Points', true); $history = $model->getPointsHistory($id); foreach ($history as $item) { $date = DiscussDateHelper::dateWithOffSet($item->created); $item->created = $date->toFormat('%A, %b %e %Y'); $points = DiscussHelper::getHelper('Points')->getPoints($item->command); if ($points) { if ($points[0]->rule_limit < 0) { $item->class = 'badge-important'; $item->points = $points[0]->rule_limit; } else { $item->class = 'badge-info'; $item->points = '+' . $points[0]->rule_limit; } } else { $item->class = 'badge-info'; $item->points = '+'; } } $theme = new DiscussThemes(); $theme->set('history', $history); echo $theme->fetch('points.history.php'); }
?> </th> </tr> </thead> <tbody> <?php if ($this->reports) { $k = 0; $x = 0; $config = DiscussHelper::getJConfig(); for ($i = 0, $n = count($this->reports); $i < $n; $i++) { $row = $this->reports[$i]; $user = JFactory::getUser($row->reporter); $editLink = JRoute::_('index.php?option=com_easydiscuss&controller=reports&task=edit&id=' . $row->id); $published = JHTML::_('grid.published', $row, $i); $date = DiscussDateHelper::dateWithOffSet($row->lastreport); $actions = array(); $actions[] = JHTML::_('select.option', '', '- ' . JText::_('COM_EASYDISCUSS_SELECT_ACTION') . ' -'); $actions[] = JHTML::_('select.option', 'D', JText::_('COM_EASYDISCUSS_DELETE_POST')); $actions[] = JHTML::_('select.option', 'C', JText::_('COM_EASYDISCUSS_REMOVE_REPORT')); $actions[] = JHTML::_('select.option', 'P', JText::_('COM_EASYDISCUSS_REPORT_PUBLISHED')); $actions[] = JHTML::_('select.option', 'U', JText::_('COM_EASYDISCUSS_REPORT_UNPUBLISHED')); if ($row->user_id != 0) { $actions[] = JHTML::_('select.option', 'E', JText::_('COM_EASYDISCUSS_EMAIL_AUTHOR')); } $actionsDropdown = JHTML::_('select.genericlist', $actions, 'report-action-' . $row->id, ' style="width:250px;margin: 0;" size="1" onchange="admin.reports.change(\'' . $row->id . '\');"', 'value', 'text', '*'); $viewLink = JURI::root() . 'index.php?option=com_easydiscuss&view=post&id=' . $row->id; if ($row->parent_id != 0) { $viewLink = JURI::root() . 'index.php?option=com_easydiscuss&view=post&id=' . $row->parent_id . '#' . JText::_('COM_EASYDISCUSS_REPORT_REPLY_PERMALINK') . '-' . $row->id; } ?>
public function getLastOnline($front = false) { $config = DiscussHelper::getConfig(); $date = DiscussDateHelper::dateWithOffSet($this->user->lastvisitDate); if ($front) { return $date->toFormat('%l.%M %P, %d/%m/%Y'); } else { return $date->toFormat('%d/%m/%Y'); } }
if ($row->user_id == '0') { $creatorName = $row->poster_name; } else { $user = JFactory::getUser($row->user_id); $creatorName = $user->name; } $pid = ''; if (!empty($this->parentId)) { $pid = '&pid=' . $this->parentId; } // frontend link //$editLink = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=ask&id='.$row->id, false, true); $editLink = JURI::root() . 'index.php?option=com_easydiscuss&view=ask&id=' . $row->id; // backend link $editLink = 'index.php?option=com_easydiscuss&view=post&task=edit&id=' . $row->id; $date = DiscussDateHelper::dateWithOffSet($row->created); // display only safe content. $row->content = strip_tags($row->content); ?> <tr class="<?php echo "row{$k}"; ?> "> <td width="7"> <?php echo JHTML::_('grid.id', $x++, $row->id); ?> </td> <td align="left"> <?php if (empty($this->parentId)) {
function formatDate($format, $dateString) { $date = DiscussDateHelper::dateWithOffSet($dateString); return DiscussDateHelper::toFormat($date, $format); }