/** * @param HISTORY_ITEM $obj * @param MAIL_OBJECT_RENDERER_OPTIONS $options * @access private */ protected function _echo_text_content($obj, $options) { if ($options->num_items > 1) { echo $this->line($obj->title_as_plain_text()); echo $this->sep(); } $renderer = $obj->handler_for(Handler_text_renderer, $options); $renderer->display($obj); }
/** * Record class-specific differences. * 'orig' is the same as {@link $_object}, but is passed here for convenience. * @param AUDITABLE $orig * @param AUDITABLE $new * @access private */ protected function _record_differences($orig, $new) { parent::_record_differences($orig, $new); $this->_record_time_difference('Time created', $orig->time_created, $new->time_created); if ($orig->creator_id != $new->creator_id) { $this->_record_object_difference('Creator', $orig->creator(), $new->creator()); } }
/** * Outputs the object as plain text. * @param HISTORY_ITEM $obj * @access private */ protected function _display_as_plain_text($obj) { $creator = $obj->creator(); echo $this->line(ucfirst($obj->kind_as_text()) . ' by ' . $creator->title_as_plain_text() . ' - ' . $this->time($obj->time_created)); echo $this->line($this->sep()); if (!$obj->description && !$obj->system_description) { switch ($obj->kind) { case History_item_created: echo $this->line('Created.'); break; case History_item_deleted: echo $this->line('Deleted.'); break; } } else { if ($obj->description) { echo $this->line($obj->description_as_plain_text()); } echo $obj->system_description_as_plain_text(); } }
/** * Stores this object if the history item warrants it. * The object is only stored if there are differences from 'history item'. If the object needs to be stored, the * function specified in the second parameter is called. * @param HISTORY_ITEM $history_item * @param string $store_func_name * @access private */ protected function _store_if_different($history_item, $store_func_name) { $history_item->record_differences($this); if ($history_item->differences_exist()) { $exists = $this->exists(); $this->{$store_func_name}(); /* If the object was just created, then the history item doesn't have the * proper object id stored. */ if (!$exists) { $history_item->update_object($this); } $history_item->store(); } }
/** * Should this history item trigger a notification? * This uses the {@link $send_own_changes} option. * @param HISTORY_ITEM $history_item * @return boolean */ public function wants_notification($history_item) { $Result = $this->send_own_changes; if (!$Result) { $creator = $history_item->creator(); $Result = $this->email != $creator->email; } return $Result; }
/** * @param HISTORY_ITEM $obj * @access private */ protected function _draw_box($obj) { $curr_date = $obj->time_created; if (!isset($this->last_date) || !$curr_date->equals($this->last_date, Date_time_date_part)) { $this->last_date = $curr_date; ?> <h2> <?php $t = $curr_date->formatter(); $t->type = Date_time_format_date_only; echo $curr_date->format($t); $now = new DATE_TIME(); if ($curr_date->equals($now, Date_time_date_part)) { echo ' (Today)'; } $now_yesterday = new DATE_TIME(time() - 86400); if ($curr_date->equals($now_yesterday, Date_time_date_part)) { echo ' (Yesterday)'; } ?> </h2> <?php } $this->_item_number += 1; $creator = $obj->creator(); ?> <h3> <?php echo $obj->title_as_html(); ?> </h3> <?php if ($obj->description || $obj->system_description) { echo $obj->description_as_html(); echo $obj->system_description_as_html(); } ?> <table class="basic columns left-labels top"> <tr> <th>Time</th> <td> <?php $tf = $obj->time_created->formatter(); $tf->type = Date_time_format_date_and_time; echo $obj->time_created->format(); ?> </td> </tr> <tr> <th>User</th> <td> <?php echo $this->context->get_icon_with_text($creator->icon_url, Sixteen_px, $creator->title_as_link()); ?> </td> </tr> <tr> <th>Kind</th> <td> <?php echo $this->context->get_icon_with_text($obj->kind_icon_url(), Sixteen_px, $obj->kind); ?> </td> </tr> <tr> <th>Emails</th> <td> <?php echo $this->context->get_icon_with_text($obj->publication_state_icon_url(), Sixteen_px, $obj->publication_state_as_text()); ?> </td> </tr> </table> <?php if (isset($this->_time_diffs[$this->_item_number - 1])) { ?> <p>⇓ <?php echo $this->_time_diffs[$this->_item_number - 1]->format(); ?> ⇓</p> <?php } ?> <?php }
/** * Perform any setup needed on each returned object. * @param HISTORY_ITEM $obj * @access private */ protected function _prepare_object($obj) { $obj->set_parent_folder($this->login->folder_at_id($obj->access_id)); }