/** * An AJAX called function which will return HTML containing a full history * of a particular session, from login to logout. * @param $id The ID of the session */ public function actionViewSessionHistory($id) { $sessions = X2Model::model('SessionLog')->findAllByAttributes(array('sessionId' => $id)); $firstTimestamp = 0; $lastTimestamp = 0; $str = "<table class='items'><thead><tr><th>User</th><th>Status</th><th>Timestamp</th></tr></thead>"; foreach ($sessions as $session) { $str .= "<tr>"; $str .= "<td>" . User::getUserLinks($session->user) . "</td>"; $str .= "<td>" . SessionLog::parseStatus($session->status) . "</td>"; $str .= "<td>" . Formatter::formatCompleteDate($session->timestamp) . "</td>"; $str .= "</tr>"; } $str .= "</table>"; echo $str; }
protected function renderDateTime($field, $makeLinks, $textOnly, $encode) { $fieldName = $field->fieldName; if (empty($this->owner->{$fieldName})) { return ' '; } elseif (is_numeric($this->owner->{$fieldName})) { return Formatter::formatCompleteDate($this->owner->{$fieldName}); } else { return $this->render($this->owner->{$fieldName}, $encode); } }
echo "</span>"; echo "<div class='field-value'>"; echo "<span style='color:grey'>" . $model->getAttributeLabel('dueDate', true) . ':' . " </span>" . '<b>' . $model->formatDueDate() . '</b>'; echo "</div>"; if (in_array($model->type, array('event', 'time', 'call'))) { echo "<div class='field-value'>"; echo "<span style='color:grey'>" . $model->getAttributeLabel('completeDate', true) . ':' . " </span>" . '<b>' . Formatter::formatDateTime($model->completeDate) . '</b>'; echo "</div>"; } } elseif (!empty($model->createDate)) { echo Yii::t('actions', 'Created:') . " " . Formatter::formatLongDateTime($model->createDate) . '</b>'; } else { echo " "; } } else { echo Yii::t('actions', 'Completed {date}', array('{date}' => Formatter::formatCompleteDate($model->completeDate))); } ?> </span> <span> <span id="controls"> <?php if (Yii::app()->user->checkAccess('ActionsComplete', array('X2Model' => $model))) { if ($model->complete != 'Yes') { ?> <div class="control-button icon complete-button" title="<?php echo Yii::t('actions', 'Complete action'); ?> "> </div>
} } else { echo Formatter::formatLongDateTime($data->dueDate); if ($data->completeDate) { echo ' - ' . Formatter::formatLongDateTime($data->completeDate); } } echo '</b>'; } elseif ($data->type == 'call') { echo Yii::t('actions', 'Call:') . ' ' . ($data->completeDate == $data->dueDate ? Formatter::formatCompleteDate($data->completeDate) : Formatter::formatTimeInterval($data->dueDate, $data->completeDate, '{start}; {decHours} ' . Yii::t('app', 'hours'))); } elseif ($data->type == 'webactivity') { echo Yii::t('actions', 'This contact visited your website'); } elseif ($data->type == 'time') { echo Formatter::formatTimeInterval($data->dueDate, $data->dueDate + $data->timeSpent); } else { $timeFormat = Formatter::formatCompleteDate($data->getRelevantTimestamp()); if ($data->type == 'attachment') { if ($data->completedBy === 'Email') { $label = 'Email Message:'; } else { $label = 'Attachment:'; } } elseif ($data->type == 'quotes') { $label = 'Quote:'; } elseif (in_array($data->type, array('email', 'emailFrom', 'email_quote', 'email_invoice'))) { $label = 'Email Message:'; } elseif (in_array($data->type, array('emailOpened', 'emailOpened_quote', 'email_opened_invoice'))) { $label = 'Email Opened:'; } if (isset($label)) { echo Yii::t('actions', $label) . ' ';
public static function dynamicDate($date) { return '<span title="' . CHtml::encode(Formatter::formatCompleteDate($date)) . '">' . CHtml::encode(Formatter::formatDateDynamic($date)) . '</span>'; }