private function formatDate($dayOnly, $format)
 {
     $lang = new MockBaseLanguage();
     $lang->setReturnValue('getText', $format);
     $firstOfDecember2011_12_01 = 1322752769;
     return DateHelper::formatForLanguage($lang, $firstOfDecember2011_12_01, $dayOnly);
 }
 /**
  * Get the text body for notification
  *
  * @param Boolean $is_update    It is an update, not a new artifact
  * @param String  $recipient    The recipient who will receive the notification
  * @param BaseLanguage $language The language of the message
  * @param Boolean $ignore_perms indicates if permissions have to be ignored
  *
  * @return String
  */
 public function getBodyText($is_update, $recipient_user, BaseLanguage $language, $ignore_perms)
 {
     $format = 'text';
     $art = $this->getArtifact();
     $um = $this->getUserManager();
     $user = $um->getUserById($this->submitted_by);
     $output = '+============== ' . '[' . $art->getTracker()->getItemName() . ' #' . $art->getId() . '] ' . $art->fetchMailTitle($recipient_user, $format, $ignore_perms) . ' ==============+';
     $output .= PHP_EOL;
     $output .= PHP_EOL;
     $proto = $GLOBALS['sys_force_ssl'] ? 'https' : 'http';
     $output .= ' <' . $proto . '://' . $GLOBALS['sys_default_domain'] . TRACKER_BASE_URL . '/?aid=' . $art->getId() . '>';
     $output .= PHP_EOL;
     $output .= $language->getText('plugin_tracker_include_artifact', 'last_edited');
     $output .= ' ' . $this->getUserHelper()->getDisplayNameFromUserId($this->submitted_by);
     $output .= ' on ' . DateHelper::formatForLanguage($language, $this->submitted_on);
     if ($comment = $this->getComment()) {
         $output .= PHP_EOL;
         $output .= $comment->fetchMailFollowUp($format);
     }
     $output .= PHP_EOL;
     $output .= ' -------------- ' . $language->getText('plugin_tracker_artifact_changeset', 'header_changeset') . ' ---------------- ';
     $output .= PHP_EOL;
     $output .= $this->diffToPrevious($format, $recipient_user, $ignore_perms);
     $output .= PHP_EOL;
     $output .= ' -------------- ' . $language->getText('plugin_tracker_artifact_changeset', 'header_artifact') . ' ---------------- ';
     $output .= PHP_EOL;
     $output .= $art->fetchMail($recipient_user, $format, $ignore_perms);
     $output .= PHP_EOL;
     return $output;
 }
Exemple #3
0
/**
 * Convert a timestamp unix into the user defined format.
 * This format is depending on the choosen language, and is defined
 * in the site-content file <language>.tab
 *
 * @global $sys_datefmt the user preference date format defined in the language file
 *
 * @param string $date the date in the unix timestamp format
 * @param boolean $day_only false: return the day AND the time, true only the date.
 *
 * @deprecated Use DateHelper::formatForLanguage() instead
 *
 * @return string the date in the user format, or null if the conversion was not possible or wrong
 */
function util_timestamp_to_userdateformat($date, $day_only = false)
{
    return DateHelper::formatForLanguage($GLOBALS['Language'], $date, $day_only);
}