/** * Record difference in times, if any * @param string $name * @param DATE_TIME $orig_date * @param DATE_TIME $new_date * @param string $type Type of date-time formatting to use. * @access private */ protected function _record_time_difference($name, $orig_date, $new_date, $type = Date_time_format_short_date_and_time) { if (!$orig_date->equals($new_date)) { $f = $orig_date->formatter(); $f->set_type_and_clear_flags($type); if ($orig_date->is_valid()) { $orig_text = $orig_date->format($f); } else { $orig_text = '[not set]'; } if ($new_date->is_valid()) { $new_text = $new_date->format($f); } else { $new_text = '[not set]'; } $this->_record_string_difference($name, $orig_text, $new_text); } }
protected function _finish_body() { $page = $this->page; $options = $page->template_options; $browser = $this->env->browser(); if ($options->close_logger) { $this->env->logs->close_all(); } ?> </div> <?php if ($options->footer_visible && !$browser->is(Browser_previewer)) { ?> <div class="footer"> <?php /* Build the left side of the footer with the copyright and version info. */ $lines = array(); if ($options->show_links) { $lines[] = '<div class="footer-links">' . $this->_links_as_text($options) . '</div>'; } if ($options->copyright) { $lines[] = '<div class="copyright">' . $options->copyright . '</div>'; } if ($options->show_versions) { $lines[] = '<div class="versions">' . $this->_versions_as_text($options) . '</div>'; } if ($options->show_last_time_modified) { $date = new DATE_TIME(getlastmod()); $f = $date->formatter(); $f->set_type_and_clear_flags(Date_time_format_short_date_and_time); $lines[] = '<div class="modification-time">Last modified on ' . $date->format($f) . '</div>'; } if ($options->show_statistics) { $lines[] = '<div class="statistics">' . $this->_page_statistics_as_text($options) . '</div>'; } echo '<div class="footer-data">'; echo join('</div><div class="footer-data">', $lines); echo '</div>'; $this->_handle_browser_warnings($options, false); ?> </div> <?php } ?> </div> <?php parent::_finish_body(); }
/** * Show set of user details. * @param string $title * @param USER $user * @param DATE_TIME $date * @access private */ protected function _echo_user_information($title, $user, $date) { ?> <tr> <th><?php echo $title; ?> </th> <td><?php echo $user->title_as_link(); ?> </td> </tr> <tr> <th>Date</th> <td><?php echo $date->format(); ?> </td> </tr> <?php }
/** * Format a date for display. * @param DATE_TIME $date * @param boolean $text_only Do not use tags when formatting. * @return string * @access private */ protected function _date($date, $text_only) { $Result = ''; if (isset($date) && $date->is_valid()) { $f = $date->formatter(); $f->type = Date_time_format_short_date; $f->show_local_time = !$text_only && $this->context->local_times_allowed(); $f->show_CSS = !$text_only; $Result = $date->format($f); if (!$text_only) { $Result = '<span class="visible">' . $Result . '</span>'; } } return $Result; }
/** * Format a date using album options. * Pass in a formatter to customize (toggling local time generation). * @param DATE_TIME $d * @param DATE_TIME_FORMATTER $f * @return string * @access private */ public function format_date($d, $f = 0) { if (!$f) { $f = $d->formatter(); } if ($this->show_times) { $f->type = Date_time_format_date_and_time; } else { $f->type = Date_time_format_date_only; } $f->show_local_time = false; $f->show_time_zone = false; return $d->format($f); }
$tag_validator = $App->make_tag_validator(Tag_validator_multi_line); $tag_validator->validate($newDescription); $errors = array(); if (sizeof($tag_validator->errors)) { $message = 'Input contained errors.'; $message_type = 'error'; foreach ($tag_validator->errors as $error) { $validation_error = new TEXT_VALIDATION_ERROR(); $validation_error->message = sprintf($error->message, $error->token->data()); $validation_error->line_number = $error->line_number; $validation_error->column_start = $error->column; $validation_error->column_end = $error->column + strlen($error->token->data()); $errors[] = $validation_error; } } else { $now = new DATE_TIME(); $now->set_now(); $f = $now->formatter(); $f->type = Date_time_format_date_and_time; $f->clear_flags(); $formatted_text = $munger->transform($newDescription, $obj); $message = 'Preview updated at ' . $now->format($f) . '.'; $message_type = 'info'; } } else { $message = 'Object for that ID was not found.'; $message_type = 'error'; } $message = $App->get_begin_message($message_type) . $message . $App->get_end_message(); $result = array('text' => $formatted_text, 'errors' => $errors, 'message' => $message, 'modified' => $obj->time_modified->as_iso()); echo json_encode($result);
/** * Format a {@link DATE_TIME} as plain text. * @param DATE_TIME $t * @param integer $type Override the default formatting type. * @return string */ public function time($t, $type = null) { $f = $t->formatter(); $f->clear_flags(); if (isset($type)) { $f->type = $type; } return $t->format($f); }
/** * Draw the given project entry in the list. * * @param PROJECT_ENTRY $entry * @param USER $user * @param DATE_TIME $time * @access private */ protected function _draw_entry($entry, $user, $time) { $this->_draw_component_break($entry); if ($this->show_date) { $f = $time->formatter(); $f->type = Date_time_format_short_date; $details[] = $time->format($f); } if ($this->show_user && isset($user)) { $uf = $user->title_formatter(); $uf->css_class = ''; $details[] = $user->title_as_link($uf); } $detail = ''; if (!empty($details)) { $detail = '[' . implode(' - ', $details) . '] '; } $detail .= $entry->title_as_link(); $props = $entry->kind_properties(); echo '<li>' . $this->context->get_icon_with_text($props->icon, Sixteen_px, $detail); if ($this->show_description) { $munger = $entry->html_formatter(); $munger->force_paragraphs = false; $desc = $entry->description_as_html($munger); if ($desc) { echo "<div class=\"description\">{$desc}</div>"; } } echo '</li>'; }
/** * Display a user and date in HTML. * Formatted as: 'caption' by 'user' on 'time' * @param string $caption * @param USER $user * * @param DATE_TIME $time * @access private */ protected function _echo_html_user($caption, $user, $time) { echo "<p>\n"; echo $caption . ' by ' . $user->title_as_link() . ' on ' . $time->format() . "\n"; echo "</p>\n"; }