本文整理汇总了PHP中format_descriptive_date函数的典型用法代码示例。如果您正苦于以下问题:PHP format_descriptive_date函数的具体用法?PHP format_descriptive_date怎么用?PHP format_descriptive_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_descriptive_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatted_date
function formatted_date($css_class, $date, $label)
{
?>
<div class="<?php
echo $css_class;
?>
">
<span><?php
echo lang('start date');
?>
:</span>
<?php
if ($date->getYear() > DateTimeValueLib::now()->getYear()) {
echo format_date($date, null, 0);
} else {
echo format_descriptive_date($date, 0);
}
?>
</div>
<?php
}
示例2: format_days
?>
- <?php
echo format_days('days left', $upcoming_milestone->getLeftInDays());
?>
)</li>
<?php
} else {
?>
<li><a href="<?php
echo $upcoming_milestone->getViewUrl();
?>
"><?php
echo clean($upcoming_milestone->getName());
?>
</a> (<?php
echo format_descriptive_date($upcoming_milestone->getDueDate());
?>
- <?php
echo format_days('days left', $upcoming_milestone->getLeftInDays());
?>
)</li>
<?php
}
// if
?>
<?php
} else {
?>
</ul>
<p><a href="<?php
示例3: friendly_date
function friendly_date(DateTimeValue $date, $timezone = null)
{
if ($timezone == null) {
$timezone = logged_user()->getTimezone();
}
//TODO: 7 days before: "Dom at 13:43", older: "Oct, 06 at 15:20"
if ($date->isToday()) {
$now = DateTimeValueLib::now();
$diff = DateTimeValueLib::get_time_difference($date->getTimestamp(), $now->getTimestamp());
if ($diff['hours'] == 0) {
if ($diff['minutes'] >= 0) {
return lang('minutes ago', $diff['minutes']);
} else {
return format_descriptive_date($date);
}
} else {
if ($diff['hours'] > 0) {
return lang('about hours ago', round($diff['hours'] + ($diff['minutes'] > 30 ? 1 : 0)));
} else {
return format_descriptive_date($date);
}
}
} else {
if ($date->isYesterday()) {
return lang('yesterday at', format_time($date));
} else {
$now = DateTimeValueLib::now();
$diff = DateTimeValueLib::get_time_difference($date->getTimestamp(), $now->getTimestamp());
if ($diff['days'] < 7) {
return lang('day at', Localization::dateByLocalization("D", $date->getTimestamp()), format_time($date));
} else {
if ($now->getYear() != $date->getYear()) {
return lang('day at', Localization::dateByLocalization("M d, Y", $date->getTimestamp()), format_time($date));
} else {
return lang('day at', Localization::dateByLocalization("M, d", $date->getTimestamp()), format_time($date));
}
}
}
}
}
示例4: lang
$typeofevent = $event->getTypeId();
if ($typeofevent == "2") {
$duration = lang('CAL_FULL_DAY');
} elseif ($typeofevent == "3") {
$time = lang('CAL_NOT_SPECIFIED');
$duration = lang('CAL_NOT_SPECIFIED');
} elseif ($typeofevent == "4") {
$duration = lang('CAL_NOT_SPECIFIED');
}
$permission = ProjectEvents::findById($id)->canEdit(logged_user());
?>
<div style="padding:7px;">
<div class="event" style="height:100%;">
<?php
$title = lang($event->getObjectTypeName()) . ": " . format_descriptive_date($event->getStart()) . ' - ' . clean($event->getObjectName());
$description = $event->getTypeId() == 2 ? lang('CAL_FULL_DAY') : lang('CAL_TIME') . ": {$time}";
tpl_assign('description', $description);
$att_form = '';
if (!$event->isNew() && !$event->isTrashed()) {
$event_inv = EventInvitations::findById(array('event_id' => $event->getId(), 'contact_id' => logged_user()->getId()));
if ($event_inv != null) {
$event->addInvitation($event_inv);
$event_inv_state = $event_inv->getInvitationState();
if (!SystemPermissions::userHasSystemPermission(logged_user(), 'can_update_other_users_invitations')) {
$options = array(option_tag(lang('yes'), 1, $event_inv_state == 1 ? array('selected' => 'selected') : null), option_tag(lang('no'), 2, $event_inv_state == 2 ? array('selected' => 'selected') : null), option_tag(lang('maybe'), 3, $event_inv_state == 3 ? array('selected' => 'selected') : null));
if ($event_inv_state == 0) {
$options[] = option_tag(lang('decide later'), 0, $event_inv_state == 0 ? array('selected' => 'selected') : null);
}
$att_form = '<form style="height:100%;background-color:white" class="internalForm" action="' . get_url('event', 'change_invitation_state') . '" method="post">';
$att_form .= '<table><tr><td style="padding-right:6px;"><b>' . lang('attendance') . '<b></td><td>';
示例5: format_date
<td class="timeCheck">
<input type="checkbox" name="item[<?php
echo $time->getId();
?>
]" />
</td>
<td class="timeDateSmall">
<?php
if ($time->getDoneDate()->getYear() > DateTimeValueLib::now()->getYear()) {
?>
<?php
echo format_date($time->getDoneDate(), 'D j M', 0);
} else {
?>
<?php
echo format_descriptive_date($time->getDoneDate(), 0, 'D j M');
}
// if
?>
</td>
<td class="timeProject">
<?php
if ($time->getProject() instanceof ApplicationDataObject) {
?>
<?php
echo clean($time->getProject()->getObjectName());
?>
<?php
}
// if
?>
示例6: format_date
?>
:</span> <?php
echo format_date($task->getDueDate(), null, 0);
?>
@ <?php
echo format_time($task->getDuetDate(), null, 0);
?>
</div>
<?php
} else {
?>
<div class="dueDate"><span><?php
echo lang('due date');
?>
:</span> <?php
echo format_descriptive_date($task->getDueDate(), 0);
?>
@ <?php
echo format_time($task->getDueDate(), null, 0);
?>
</div>
<?php
}
// if
}
// if
?>
<?php
if ($task->getAssignedTo()) {
?>
<div id="taskAssigned"><?php
示例7: lang
?>
<div class="dueDate messageText"><span><?php
echo lang('due date');
?>
:</span> <?php
echo format_date($milestone->getDueDate(), null, 0);
?>
</div>
<?php
} else {
?>
<div class="dueDate messageText"><span><?php
echo lang('due date');
?>
:</span> <?php
echo format_descriptive_date($milestone->getDueDate(), 0);
?>
</div>
<?php
}
// if
}
// if
?>
<?php
if ($milestone->getGoal() > 0) {
?>
<div class="goal"><span><?php
echo lang('goal');
?>
示例8: format_descriptive_date
echo format_descriptive_date($task_list->getStartDate());
if ($task_list->getUseStartTime()) {
echo ", " . format_time($task_list->getStartDate(), user_config_option('time_format_use_24') ? 'G:i' : 'g:i A');
}
?>
</div>
<?php } // if ?>
<?php } // if ?>
<?php if ($task_list->getDueDate() instanceof DateTimeValue) { ?>
<?php if ($task_list->getDueDate()->getYear() > DateTimeValueLib::now()->getYear()) { ?>
<div class="dueDate"><span class="bold"><?php echo lang('due date') ?>: </span><?php echo format_datetime($task_list->getDueDate(), null, 0) ?></div>
<?php } else { ?>
<div class="dueDate"><span class="bold"><?php echo lang('due date') ?>: </span>
<?php
echo format_descriptive_date($task_list->getDueDate());
if ($task_list->getUseDueTime()) {
echo ", " . format_time($task_list->getDueDate(), user_config_option('time_format_use_24') ? 'G:i' : 'g:i A');
}
?>
</div>
<?php } ?>
<?php } ?>
<?php if ($task_list->getObjectSubtype() > 0) {
$subType = ProjectCoTypes::findById($task_list->getObjectSubtype());
if ($subType instanceOf ProjectCoType ) {
echo "<div><span class='bold'>" . lang('object type') . ":</span> " . $subType->getName() . "</div>";
}
}
?>
示例9: getProjectFiles
/**
* Return paged project files
*
* @param Project $project
* @param ProjectFolder $folder
* @param boolean $hide_private Don't show private files
* @param string $order Order files by name or by posttime (desc)
* @param integer $page Current page
* @param integer $files_per_page Number of files that will be showed per single page
* @param boolean $group_by_order Group files by order field
* @return array
*/
static function getProjectFiles(Project $project, $folder = null, $hide_private = false, $order = null, $page = null, $files_per_page = null, $group_by_order = false)
{
trace(__FILE__, 'getProjectFiles()');
if ($order == self::ORDER_BY_POSTTIME) {
$order_by = '`created_on` DESC';
} else {
$order_by = '`filename`';
}
// if
// #PAGE# is reserved as a placeholder
//if (!($page == '#PAGE#')) {
if ((int) $page < 1) {
$page = 1;
}
if ((int) $files_per_page < 1) {
$files_per_page = 10;
}
//} // if
$folder_ids = array();
if ($folder instanceof ProjectFolder && $folder->getProjectId() == $project->getId()) {
if ($hide_private) {
$conditions = array('`project_id` = ? AND `folder_id` = ? AND `is_private` = ? AND `is_visible` = ?', $project->getId(), $folder->getId(), false, true);
} else {
$conditions = array('`project_id` = ? AND `folder_id` = ? AND `is_visible` = ?', $project->getId(), $folder->getId(), true);
}
// if
} else {
if ($hide_private) {
$conditions = array('`project_id` = ? AND `is_private` = ? AND `is_visible` = ?', $project->getId(), false, true);
} else {
$conditions = array('`project_id` = ? AND `is_visible` = ?', $project->getId(), true);
}
// if
}
// if
list($files, $pagination) = ProjectFiles::paginate(array('conditions' => $conditions, 'order' => $order_by), $files_per_page, $page);
if ($group_by_order) {
$grouped_files = array();
if (is_array($files) && count($files)) {
$today = DateTimeValueLib::now();
foreach ($files as $file) {
$group_by_str = '';
if ($order == self::ORDER_BY_POSTTIME) {
$created_on = $file->getCreatedOn();
if ($created_on->getYear() == $today->getYear()) {
$group_by_str = format_descriptive_date($created_on);
} else {
$group_by_str = format_date($created_on);
}
// if
} else {
$group_by_str = strtoupper(substr_utf($file->getFilename(), 0, 1));
}
// if
if (!isset($grouped_files[$group_by_str]) || !is_array($grouped_files[$group_by_str])) {
$grouped_files[$group_by_str] = array();
}
$grouped_files[$group_by_str][] = $file;
}
// foreach
}
// if
$files = is_array($grouped_files) ? $grouped_files : null;
}
// if
return array($files, $pagination);
}
示例10: foreach
if ($headers_outputted) {
echo '<tr><td>' . '<strong>Total</strong>' . '</td><td></td><td></td><td><strong>' . $tt . '</strong></td></tr>';
echo '</table>';
}
}
}
if (is_array($task_list->getTasks()) && $tl_time > 0) {
foreach ($task_list->getTasks() as $task) {
echo '<h4>' . $task->getText() . '</h4>';
$ts = ProjectTimes::getTimeByTask($task);
if (is_array($ts)) {
$tt = 0;
echo '<table class="timeLogs blank"><tr><th>Date</th><th>Name</th><th>Details</th><th>Hours</th></tr>';
foreach ($ts as $t) {
echo '<tr>';
echo '<td class="timeDate">' . format_descriptive_date($t->getDoneDate(), 0) . '</td>';
if ($t->getAssignedTo() instanceof ApplicationDataObject) {
echo '<td class="timeUser">' . clean($t->getAssignedTo()->getObjectName()) . '</td>';
} else {
echo '<td class="timeUser">' . '' . '</td>';
}
echo '<td class="timeDetails">' . clean($t->getName()) . '</td>';
echo '<td class="timeHours">' . $t->getHours() . '</td>';
echo '</tr>';
$tt += $t->getHours();
}
echo '<tr><td>' . '<strong>Total</strong>' . '</td><td></td><td></td><td><strong>' . $tt . '</strong></td></tr>';
echo '</table>';
}
}
}
示例11: lang
if ($last_revision instanceof ProjectFileRevision) {
$description .= '<div id="fileLastRevision"><span class="propertyName">' . lang('last revision') . ':</span>';
if ($last_revision->getCreatedBy() instanceof Contact) {
$description .= lang('file revision info long', $last_revision->getRevisionNumber(), $last_revision->getCreatedBy()->getCardUserUrl(), clean($last_revision->getCreatedBy()->getObjectName()), format_descriptive_date($last_revision->getCreatedOn()));
} else {
$description .= lang('file revision info short', $last_revision->getRevisionNumber(), format_descriptive_date($last_revision->getCreatedOn()));
}
$description .= "</div>";
}
// if
if ($file->isCheckedOut()) {
$description .= '<div id="fileCheckedOutBy" class="coViewAction ico-locked">';
if ($file->getCheckedOutBy() instanceof Contact) {
$description .= lang('file checkout info long', $file->getCheckedOutBy()->getCardUserUrl(), clean($file->getCheckedOutBy()->getObjectName()), format_descriptive_date($file->getCheckedOutOn()) . ", " . format_time($file->getCheckedOutOn()));
} else {
$description .= lang('file checkout info short', format_descriptive_date($file->getCheckedOutOn()) . ", " . format_time($file->getCheckedOutOn()));
}
// if
$description .= "</div>";
}
// if
if (!$file->isTrashed() && !$file->isArchived() && $file->getType() != ProjectFiles::TYPE_WEBLINK) {
tpl_assign('image', '<div class="coViewIconImage"><img src="' . $file->getTypeIconUrl(false) . '" alt="' . clean($file->getFilename()) . '" /></div>');
}
if ($file->isTrashed()) {
tpl_assign('iconclass', 'ico-large-files-trashed');
} else {
if ($file->isArchived()) {
tpl_assign('iconclass', 'ico-large-files-archived');
} else {
tpl_assign('iconclass', $file->getType() != ProjectFiles::TYPE_WEBLINK ? 'ico-large-files' : 'ico-large-webfile');
示例12: lang
if($typeofevent=="2") $duration = lang('CAL_FULL_DAY');
elseif($typeofevent=="3"){
$time = lang('CAL_NOT_SPECIFIED');
$duration = lang('CAL_NOT_SPECIFIED');
}
elseif($typeofevent=="4") $duration = lang('CAL_NOT_SPECIFIED');
$permission = ProjectEvents::findById($id)->canEdit(logged_user());
?>
<div style="padding:7px;">
<div class="event" style="height:100%;">
<?php
$title = format_descriptive_date($event->getStart()) . ' - ' . clean($event->getObjectName());
$description = $event->getTypeId() == 2 ? lang('CAL_FULL_DAY') : lang('CAL_TIME').": $time" ;
tpl_assign('description', $description);
$att_form = '';
if (!$event->isNew() && !$event->isTrashed()) {
$event_inv = EventInvitations::findById(array('event_id' => $event->getId(), 'contact_id' => logged_user()->getId()));
if ($event_inv != null) {
$event->addInvitation($event_inv);
$event_inv_state = $event_inv->getInvitationState();
$options = array(
option_tag(lang('yes'), 1, ($event_inv_state == 1)?array('selected' => 'selected'):null),
option_tag(lang('no'), 2, ($event_inv_state == 2)?array('selected' => 'selected'):null),
option_tag(lang('maybe'), 3, ($event_inv_state == 3)?array('selected' => 'selected'):null)
);
if ($event_inv_state == 0) {
示例13: if
<?php if (is_array($task_list->getOpenTasks())): ?>
<div class="openTasks">
<ul id="<?php echo $task_list->getId() ?>"><!--table class="blank"-->
<?php foreach ($task_list->getOpenTasks() as $task): ?>
<li id="<?php echo $task->getId() ?>" class="<?php odd_even_class($task_list_ln) ?>"><!--tr class="<?php odd_even_class($task_list_ln); ?>"-->
<!-- Task text and options -->
<!--td class="taskText"-->
<div class="task-text">
<?php echo $task->getText() ?>
<?php if ($task->getAssignedTo()):?>
<span class="assignedTo"><?php echo clean($task->getAssignedTo()->getObjectName()) ?></span>
<?php endif ?>
</div>
<?php if (!is_null($task->getDueDate())) { ?>
<div class="dueDate"><span><?php echo lang('due date') ?>:</span> <?php echo ($task->getDueDate()->getYear() > DateTimeValueLib::now()->getYear()) ? format_date($task->getDueDate(), null, 0) : format_descriptive_date($task->getDueDate(), 0) ?></div>
<?php } // if ?>
<?php
$task_options = array();
if ($can_reorder_tasks) { $task_options[] = '<span class="reorder"><img src="'.get_image_url('icons/arrow-sort.png').'" /></span>'; }
if ($task->canEdit(logged_user())) {
$task_options[] = '<a href="' . $task->getEditUrl() . '"><img width="16" height="16" src="' . get_image_url('icons/pencil.png') . '" alt="'.lang('edit') .'" title="'.lang('edit').'" /></a>';
} // if
if ($task->canDelete(logged_user())) {
$task_options[] = '<a href="' . $task->getDeleteUrl() . '"><img src="'.get_image_url('icons/delete.png'). '" alt="'. lang('delete') . '" title="'.lang('delete').'" /></a>';
} // if
if ($task->canView(logged_user())) {
$task_options[] = '<a href="' . $task->getViewUrl($on_list_page) . '"><img src="'.get_image_url('icons/comment_add.png').'" alt="' . lang('view') . '" title="" /></a>';
} // if
示例14: add_page_action
add_page_action(lang('copy milestone'), get_url("milestone", "copy_milestone", array("id" => $milestone->getId())), 'ico-copy');
if (can_manage_templates(logged_user())) {
add_page_action(lang('add to a template'), get_url("template", "add_to", array("manager" => 'ProjectMilestones', "id" => $milestone->getId())), 'ico-template');
}
}
}
?>
<div style="padding:7px">
<div class="milestone">
<?php
$content = '';
if ($milestone->getDueDate()->getYear() > DateTimeValueLib::now()->getYear()) {
$content = '<div class="dueDate"><b>' . lang('due date') . ':</b> ' . format_date($milestone->getDueDate(), null, 0) . '</div>';
} else {
$content = '<div class="dueDate"><b>' . lang('due date') . ':</b> ' . format_descriptive_date($milestone->getDueDate(), 0) . '</div>';
}
// if
if ($milestone->getDescription()) {
$content .= '<fieldset><legend>' . lang('description') . '</legend>' . escape_html_whitespace(convert_to_links(clean($milestone->getDescription()))) . '</fieldset>';
}
$openSubtasks = $milestone->getOpenSubTasks();
if (is_array($openSubtasks)) {
// $content .= '<p>' . lang('task lists') . ':</p><ul>';
//show open sub task list
$content .= '<br/><table style="border:1px solid #717FA1;width:100%; padding-left:10px;"><tr><th style="padding-left:10px;padding-top:4px;padding-bottom:4px;background-color:#E8EDF7;font-size:120%;font-weight:bolder;color:#717FA1;width:100%;">' . lang("view open tasks") . '</th></tr><tr><td style="padding-left:10px;">
<div class="openTasks">
<table class="blank">';
foreach ($openSubtasks as $task) {
$content .= '<tr>';
// Checkboxes
示例15: lang
echo $object->getObjectUrl();
?>
" style="font-size:120%;"><?php
echo $object_name;
?>
</a>
<?php
}
// if
?>
</td>
<td style="padding:6px;vertical-align:middle" align=right><?php
if ($object instanceof MailContent) {
echo lang("created by on short", $object->getSenderUrl(), clean($object->getSenderName()), format_descriptive_date($object->getReceivedDate()));
} else {
echo lang("modified by on short", $object->getUpdatedByCardUrl(), $object->getUpdatedBy() instanceof User ? clean($object->getUpdatedByDisplayName()) : clean($object->getCreatedByDisplayName()), format_descriptive_date($object->getObjectUpdateTime()));
}
?>
</td>
</tr>
<?php
foreach ($srrow['context'] as $context) {
// Draw context
if ($context['context'] != '' && $context['column_name'] != 'title' && $context['column_name'] != 'name' && $context['column_name'] != 'firstname' && $context['column_name'] != 'lastname' && $context['column_name'] != 'subject' && $context['column_name'] != 'filename') {
?>
<tr style="vertical-align:middle" class="<?php
echo $alt ? "searchAltRow" : 'searchRow';
?>
">
<td></td><td colspan=2 style="padding:6px;padding-top:0px">
<b><?php