mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Now the dates are showed in the locale of user. TICKET: #2487
This commit is contained in:
parent
d6de026c4a
commit
82c890410d
@ -447,4 +447,7 @@ define("CHART_DEFAULT_ALPHA", 50);
|
|||||||
/* Statwin */
|
/* Statwin */
|
||||||
define("STATWIN_DEFAULT_CHART_WIDTH", 555);
|
define("STATWIN_DEFAULT_CHART_WIDTH", 555);
|
||||||
define("STATWIN_DEFAULT_CHART_HEIGHT", 245);
|
define("STATWIN_DEFAULT_CHART_HEIGHT", 245);
|
||||||
|
|
||||||
|
/* Dashboard */
|
||||||
|
define("DASHBOARD_DEFAULT_COUNT_CELLS", 9);
|
||||||
?>
|
?>
|
||||||
|
@ -2535,4 +2535,80 @@ function get_refresh_time_array() {
|
|||||||
(string)SECONDS_30MINUTES => __('30 minutes'),
|
(string)SECONDS_30MINUTES => __('30 minutes'),
|
||||||
(string)SECONDS_1HOUR => __('1 hour'));
|
(string)SECONDS_1HOUR => __('1 hour'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function date2strftime_format($date_format) {
|
||||||
|
$replaces_list = array(
|
||||||
|
'D' => '%a',
|
||||||
|
'l' => '%A',
|
||||||
|
'd' => '%d',
|
||||||
|
'j' => '%e',
|
||||||
|
'N' => '%u',
|
||||||
|
'w' => '%w',
|
||||||
|
'W' => '%W',
|
||||||
|
'M' => '%b',
|
||||||
|
'F' => '%B',
|
||||||
|
'm' => '%m',
|
||||||
|
'o' => '%G',
|
||||||
|
'y' => '%y',
|
||||||
|
'Y' => '%Y',
|
||||||
|
'H' => '%H',
|
||||||
|
'h' => '%I',
|
||||||
|
'g' => '%l',
|
||||||
|
'a' => '%P',
|
||||||
|
'A' => '%p',
|
||||||
|
'i' => '%M',
|
||||||
|
's' => '%S',
|
||||||
|
'u' => '%s',
|
||||||
|
'O' => '%z',
|
||||||
|
'T' => '%Z',
|
||||||
|
'%' => '%%',
|
||||||
|
);
|
||||||
|
|
||||||
|
$return = "";
|
||||||
|
|
||||||
|
//character to character because
|
||||||
|
// Replacement order gotcha
|
||||||
|
// http://php.net/manual/en/function.str-replace.php
|
||||||
|
$chars = str_split($date_format);
|
||||||
|
foreach ($chars as $c) {
|
||||||
|
if (isset($replaces_list[$c])) {
|
||||||
|
$return .= $replaces_list[$c];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$return .= $c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pandora_setlocale() {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$replace_locale = array(
|
||||||
|
'ca' => 'ca_ES',
|
||||||
|
'de' => 'de_DE',
|
||||||
|
'en_GB' => 'de',
|
||||||
|
'es' => 'es_ES',
|
||||||
|
'fr' => 'fr_FR',
|
||||||
|
'it' => 'it_IT',
|
||||||
|
'nl' => 'nl_BE',
|
||||||
|
'pl' => 'pl_PL',
|
||||||
|
'pt' => 'pt_PT',
|
||||||
|
'pt_BR' => 'pt_BR',
|
||||||
|
'sk' => 'sk_SK',
|
||||||
|
'tr' => 'tr_TR',
|
||||||
|
'cs' => 'cs_CZ',
|
||||||
|
'el' => 'el_GR',
|
||||||
|
'ru' => 'ru_RU',
|
||||||
|
'ar' => 'ar_MA',
|
||||||
|
'ja' => 'ja_JP',
|
||||||
|
'zh_CN' => 'zh_CN',
|
||||||
|
);
|
||||||
|
|
||||||
|
$user_language = get_user_language($config['id_user']);
|
||||||
|
|
||||||
|
setlocale(LC_ALL,
|
||||||
|
str_replace(array_keys($replace_locale), $replace_locale, $user_language));
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -431,7 +431,7 @@ function ui_print_timestamp ($unixtime, $return = false, $option = array ()) {
|
|||||||
$style = 'style="white-space:nowrap;"';
|
$style = 'style="white-space:nowrap;"';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$style = 'style="'.$option["style"].'"';
|
$style = 'style="' . $option["style"] . '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty ($option["prominent"])) {
|
if (!empty ($option["prominent"])) {
|
||||||
@ -447,12 +447,15 @@ function ui_print_timestamp ($unixtime, $return = false, $option = array ()) {
|
|||||||
|
|
||||||
//prominent_time is either timestamp or comparation
|
//prominent_time is either timestamp or comparation
|
||||||
if ($unixtime <= 0) {
|
if ($unixtime <= 0) {
|
||||||
$title = __('Unknown').'/'.__('Never');
|
$title = __('Unknown') . '/' . __('Never');
|
||||||
$data = __('Unknown');
|
$data = __('Unknown');
|
||||||
}
|
}
|
||||||
elseif ($prominent == "timestamp") {
|
elseif ($prominent == "timestamp") {
|
||||||
|
pandora_setlocale();
|
||||||
|
|
||||||
$title = human_time_comparation ($unixtime);
|
$title = human_time_comparation ($unixtime);
|
||||||
$data = date ($config["date_format"], $unixtime);
|
$data = strftime(date2strftime_format($config["date_format"]),
|
||||||
|
$unixtime);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$title = date ($config["date_format"], $unixtime);
|
$title = date ($config["date_format"], $unixtime);
|
||||||
|
@ -77,20 +77,24 @@ if ($multiple_delete) {
|
|||||||
if ($show_sent) { //sent view
|
if ($show_sent) { //sent view
|
||||||
$num_messages = messages_get_count_sent($config['id_user']);
|
$num_messages = messages_get_count_sent($config['id_user']);
|
||||||
if ($num_messages > 0 && !is_ajax()) {
|
if ($num_messages > 0 && !is_ajax()) {
|
||||||
echo '<p>'.__('You have').' <b>'.$num_messages.'</b> '.' '.__('sent message(s)').'.</p>';
|
echo '<p>' . __('You have') . ' <b>' . $num_messages . '</b> ' .
|
||||||
|
' ' . __('sent message(s)') . '.</p>';
|
||||||
}
|
}
|
||||||
$messages = messages_get_overview_sent ('', 'DESC');
|
$messages = messages_get_overview_sent ('', 'DESC');
|
||||||
}
|
}
|
||||||
else { //messages received
|
else { //messages received
|
||||||
$num_messages = messages_get_count ($config["id_user"]);
|
$num_messages = messages_get_count ($config["id_user"]);
|
||||||
if ($num_messages > 0 && !is_ajax()) {
|
if ($num_messages > 0 && !is_ajax()) {
|
||||||
echo '<p>'.__('You have').' <b>'.$num_messages.'</b> '.' '.__('unread message(s)').'.</p>';
|
echo '<p>' . __('You have') . ' <b>' . $num_messages . '</b> ' .
|
||||||
|
' ' . __('unread message(s)') . '.</p>';
|
||||||
}
|
}
|
||||||
$messages = messages_get_overview ();
|
$messages = messages_get_overview ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty ($messages)) {
|
if (empty ($messages)) {
|
||||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no messages.') ) );
|
ui_print_info_message (
|
||||||
|
array('no_close'=>true,
|
||||||
|
'message'=> __('There are no messages.') ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
@ -180,7 +184,9 @@ else {
|
|||||||
}
|
}
|
||||||
$data[2] .= '</a>';
|
$data[2] .= '</a>';
|
||||||
|
|
||||||
$data[3] = ui_print_timestamp ($message["timestamp"], true, array ("prominent" => "timestamp"));
|
$data[3] = ui_print_timestamp(
|
||||||
|
$message["timestamp"], true,
|
||||||
|
array ("prominent" => "timestamp"));
|
||||||
|
|
||||||
if ($show_sent) {
|
if ($show_sent) {
|
||||||
$data[4] = '<a href="index.php?sec=workspace&sec2=operation/messages/message_list&show_sent=1&delete_message=1&id='.$message_id.'"
|
$data[4] = '<a href="index.php?sec=workspace&sec2=operation/messages/message_list&show_sent=1&delete_message=1&id='.$message_id.'"
|
||||||
@ -202,12 +208,13 @@ echo "<table width='100%'>";
|
|||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
echo "<div style='float: right;'>";
|
echo "<div style='float: right;'>";
|
||||||
if (!empty($messages)){
|
if (!empty($messages)) {
|
||||||
if ($show_sent)
|
if ($show_sent)
|
||||||
echo '<form method="post" style="float:right;" action="index.php?sec=workspace&sec2=operation/messages/message_list&show_sent=1&multiple_delete=1">';
|
echo '<form method="post" style="float:right;" action="index.php?sec=workspace&sec2=operation/messages/message_list&show_sent=1&multiple_delete=1">';
|
||||||
else
|
else
|
||||||
echo '<form method="post" action="index.php?sec=workspace&sec2=operation/messages/message_list&multiple_delete=1">';
|
echo '<form method="post" action="index.php?sec=workspace&sec2=operation/messages/message_list&multiple_delete=1">';
|
||||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
html_print_submit_button(__('Delete'), 'delete_btn',
|
||||||
|
false, 'class="sub delete"');
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
}
|
}
|
||||||
echo '<form method="post" style="float:right;" action="index.php?sec=workspace&sec2=operation/messages/message_edit">';
|
echo '<form method="post" style="float:right;" action="index.php?sec=workspace&sec2=operation/messages/message_edit">';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user