/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Initialize variables. $html = array(); $time_created = $this->value; if (!strtotime($time_created)) { $time_created = ImcFrontendHelper::convert2UTC(date("Y-m-d H:i:s")); } $hidden = (bool) $this->element['hidden']; if ($hidden == null || !$hidden) { $jdate = new JDate(ImcFrontendHelper::convertFromUTC($time_created)); $pretty_date = $jdate->format(JText::_('DATE_FORMAT_LC2')); $html[] = "<span>" . $pretty_date . "</span>"; } $html[] = '<input type="hidden" name="' . $this->name . '" value="' . $time_created . '" />'; return implode("\n", $html); }
echo $this->item->title; ?> </h4> <div class="alert alert-info"> <p><?php echo JText::_('COM_IMC_FORM_LBL_ISSUE_CREATED_BY'); ?> : <?php foreach ($this->item->creatorDetails as $details) { echo $details . ' / '; } ?> <br /> <strong><?php echo ImcFrontendHelper::convertFromUTC($this->item->created); ?> </strong></p> </div> <p><strong><?php echo JText::_('COM_IMC_FORM_LBL_ISSUE_ID'); ?> </strong>: <?php echo $this->item->id; ?> </p> <p><strong><?php echo JText::_('COM_IMC_FORM_LBL_ISSUE_STEPID');
public static function getRelativeTime($time) { if (strtotime($time) <= 0) { return ''; } $time = ImcFrontendHelper::convertFromUTC($time); // Load the parameters. $app = JFactory::getApplication(); /* $params = $app->getParams(); $showrelativedates = $params->get('showrelativedates'); $dateformat = $params->get('dateformat'); if(!$showrelativedates){ //$item->reported_rel = date("d/m/Y",strtotime($item->reported)); return date($dateformat,strtotime($time)); } */ $SECOND = 1; $MINUTE = 60 * $SECOND; $HOUR = 60 * $MINUTE; $DAY = 24 * $HOUR; $MONTH = 30 * $DAY; $delta = time() - strtotime($time); if ($delta < 1 * $MINUTE) { return $delta == 1 ? JText::_('ONE_SECOND_AGO') : sprintf(JText::_('SECONDS_AGO'), $delta); } if ($delta < 2 * $MINUTE) { return JText::_('A_MINUTE_AGO'); } if ($delta < 45 * $MINUTE) { return sprintf(JText::_('MINUTES_AGO'), floor($delta / $MINUTE)); } if ($delta < 90 * $MINUTE) { return JText::_('AN_HOUR_AGO'); } if ($delta < 24 * $HOUR) { return sprintf(JText::_('HOURS_AGO'), floor($delta / $HOUR)); } if ($delta < 48 * $HOUR) { return JText::_('YESTERDAY'); } if ($delta < 30 * $DAY) { return sprintf(JText::_('DAYS_AGO'), floor($delta / $DAY)); } if ($delta < 12 * $MONTH) { $months = floor($delta / $DAY / 30); return $months <= 1 ? JText::_('ONE_MONTH_AGO') : sprintf(JText::_('MONTHS_AGO'), $months); } else { $years = floor($delta / $DAY / 365); if ($years < 100) { //TODO: needed for versions older than PHP5.3 return $years <= 1 ? JText::_('ONE_YEAR_AGO') : sprintf(JText::_('YEARS_AGO'), $years); } else { return ''; } } }
?> </th> <th><?php echo JText::_("COM_IMC_LOGS_DESCRIPTION"); ?> </th> </tr> </thead> <tbody> <?php foreach ($this->logs as $log) { ?> <tr> <td><?php echo ImcFrontendHelper::convertFromUTC($log['created']); ?> </td> <td><?php echo $log['action']; ?> </td> <td><?php echo $log['created_by']; ?> </td> <td> <span style="font-size: 20px;color: <?php echo $log['stepid_color']; ?> ">▮</span>
public function comments() { try { // Check for request forgeries. if (!JSession::checkToken('get')) { throw new Exception('Invalid session token'); } $app = JFactory::getApplication(); $issueid = $app->input->getInt('issueid', null); if (is_null($issueid)) { throw new Exception('Invalid issueid'); } $userid = $app->input->getInt('userid', 0); //$commentsModel = JModelLegacy::getInstance( 'Comments', 'ImcModel', array('ignore_request' => true) ); $commentsModel = $this->getModel(); $commentsModel->setState('imc.filter.issueid', $issueid); $commentsModel->setState('imc.filter.userid', $userid); $commentsModel->setState('imc.filter.state', 1); $items = $commentsModel->getItems(); //$items contains too much overhead, set only necessary data $comments = array(); foreach ($items as $item) { $comment = new StdClass(); $comment->id = $item->id; $comment->created = ImcFrontendHelper::convertFromUTC($item->created); $comment->fullname = $item->fullname; $comment->description = $item->description; $comment->profile_picture_url = JURI::base() . 'components/com_imc/assets/images/user-icon.png'; if ($item->moderation) { $comment->profile_picture_url = JURI::base() . 'components/com_imc/assets/images/user-icon-moderated.png'; } if ($item->isAdmin) { $comment->profile_picture_url = JURI::base() . 'components/com_imc/assets/images/admin-user-icon.png'; } if ($item->parentid > 0) { $comment->parentid = $item->parentid; } $comment->created_by_admin = (bool) $item->isAdmin; $comment->created_by_current_user = $item->created_by == $userid ? true : false; $comments[] = $comment; } echo new JResponseJson($comments); } catch (Exception $e) { header("HTTP/1.0 403 Accepted"); echo new JResponseJson($e); } }