Date and time management; got rid of format_locale_date - Chamilo - CT#696

skala
Guillaume Viguier 15 years ago
parent d492bee5d3
commit f4c7015a3a
  1. 3
      main/admin/calendar.php
  2. 6
      main/admin/calendar_view_print.php
  3. 2
      main/announcements/announcements.inc.php
  4. 4
      main/announcements/announcements.php
  5. 1
      main/calendar/agenda.php
  6. 6
      main/calendar/print.php
  7. 8
      main/course_info/infocours.php
  8. 2
      main/exercice/exercice.php
  9. 9
      main/exercice/exercise_result.class.php
  10. 13
      main/gradebook/gradebook_result.class.php
  11. 3
      main/inc/lib/blog.lib.php
  12. 4
      main/inc/lib/social.lib.php
  13. 18
      main/inc/lib/text.lib.php
  14. 33
      main/inc/lib/tracking.lib.php
  15. 2
      main/mySpace/index.php
  16. 4
      main/mySpace/myStudents.php
  17. 2
      main/mySpace/session.php
  18. 16
      main/newscorm/learnpath_functions.inc.php
  19. 5
      main/newscorm/resourcelinker.php
  20. 5
      main/resourcelinker/resourcelinker.php
  21. 7
      main/tracking/logins_details.php
  22. 5
      main/tracking/personnalLog.php
  23. 4
      plugin/dashboard/block_session/block_session.class.php
  24. 7
      tests/main/inc/lib/text.lib.test.php
  25. 10
      user_portal.php

@ -139,7 +139,6 @@ else
SETTING SOME VARIABLES
============================================================================== */
// Variable definitions
$dateNow = format_locale_date($dateTimeFormatLong);
// Defining the shorts for the days. We use camelcase because these are arrays of language variables
$DaysShort = api_get_week_days_short();
// Defining the days of the week to allow translation of the days. We use camelcase because these are arrays of language variables
@ -396,4 +395,4 @@ if ($_GET['origin'] != 'learnpath')
Display::display_footer();
}
?>
?>

@ -82,15 +82,13 @@ while($row=Database::fetch_array($result))
echo get_lang('StartTime').' : ';
echo api_ucfirst(format_locale_date($dateFormatLong,strtotime($row["start_date"])))."   ";
echo ucfirst(strftime($timeNoSecFormat,strtotime($row["start_date"])))."";
echo api_ucfirst(api_convert_and_format_date($row["start_date"], null, date_default_timezone_get()));
echo '<br />';
echo get_lang('EndTime').' : ';
echo api_ucfirst(format_locale_date($dateFormatLong,strtotime($row["end_date"])))."&nbsp;&nbsp;&nbsp;";
echo ucfirst(strftime($timeNoSecFormat,strtotime($row["end_date"])))."";
echo api_ucfirst(api_convert_and_format_date($row["end_date"], null, date_default_timezone_get()));
echo '<br /><br />';

@ -63,7 +63,7 @@ function display_announcement($announcement_id)
echo "<table height=\"100\" width=\"100%\" border=\"1\" cellpadding=\"5\" cellspacing=\"0\" id=\"agenda_list\">\n";
echo "<tr class=\"data\"><td>" . $title . "</td></tr>\n";
echo "<tr><td class=\"announcements_datum\">" . get_lang('AnnouncementPublishedOn') . " : " . api_ucfirst(format_locale_date($dateFormatLong,strtotime($last_post_date) ) ) . "</td></tr>\n";
echo "<tr><td class=\"announcements_datum\">" . get_lang('AnnouncementPublishedOn') . " : " . api_ucfirst(api_convert_and_format_date($last_post_datetime, null, date_default_timezone_get()) ) . "</td></tr>\n";
echo "<tr class=\"text\"><td>$content</td></tr>\n";
echo "</table>";
}

@ -957,7 +957,7 @@ if (!$surveyid) {
//validation when belongs to a session
$session_img = api_get_session_image($myrow['session_id'], $_user['status']);
echo "\t\t\t\t\t\t".Display::return_icon('lp_announcement.png', api_ucfirst(format_locale_date($dateFormatLong,strtotime($myrow['end_date']))), array('align' => 'absmiddle', 'Width' => '10', 'Height' => '10'))." <a style=\"text-decoration:none\" href=\"announcements.php?".api_get_cidreq()."#".$myrow['id']."\" ".$class.">" . api_trunc_str($title, $length) . "</a>\n" . $session_img;
echo "\t\t\t\t\t\t".Display::return_icon('lp_announcement.png', api_ucfirst(api_convert_and_format_date($myrow['end_date'], DATE_FORMAT_LONG)), array('align' => 'absmiddle', 'Width' => '10', 'Height' => '10'))." <a style=\"text-decoration:none\" href=\"announcements.php?".api_get_cidreq()."#".$myrow['id']."\" ".$class.">" . api_trunc_str($title, $length) . "</a>\n" . $session_img;
echo "\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
}
echo "\t\t\t</table>\n";
@ -1407,7 +1407,7 @@ if ($display_announcement_list && !$surveyid) {
echo '&nbsp;&nbsp;&nbsp;'.get_lang('By').' : &nbsp;'.str_replace(' ', '&nbsp;', api_get_person_name($user_info['firstName'], $user_info['lastName']));
echo "\t\t\t\t\t</th>\n","\t\t\t\t</tr>\n";
echo "\t\t\t\t<tr class='row_odd'>\n\t\t\t\t\t<td class=\"announcements_datum\" colspan=\"3\">";
echo get_lang('AnnouncementPublishedOn')," : ",api_ucfirst(format_locale_date($dateFormatLong,strtotime($last_post_date)));
echo get_lang('AnnouncementPublishedOn')," : ",api_ucfirst(api_convert_and_format_date($last_post_datetime, null, date_default_timezone_get()));
echo "</td>\n\t\t\t\t</tr>\n";
/* CONTENT */

@ -199,7 +199,6 @@ event_access_tool(TOOL_CALENDAR_EVENT);
SETTING SOME VARIABLES
============================================================================== */
// Variable definitions
$dateNow = format_locale_date($dateTimeFormatLong);
// Defining the shorts for the days. We use camelcase because these are arrays of language variables
$DaysShort = api_get_week_days_short();
// Defining the days of the week to allow translation of the days. We use camelcase because these are arrays of language variables

@ -60,15 +60,13 @@ while($row=Database::fetch_array($result))
echo get_lang('StartTime').' : ';
echo api_ucfirst(format_locale_date($dateFormatLong,strtotime($row["start_date"])))."&nbsp;&nbsp;&nbsp;";
echo api_ucfirst(strftime($timeNoSecFormat,strtotime($row["start_date"])))."";
echo api_ucfirst(api_convert_and_format_date($row["start_date"], null, date_default_timezone_get()));
echo '<br />';
echo get_lang('EndTime').' : ';
echo api_ucfirst(format_locale_date($dateFormatLong,strtotime($row["end_date"])))."&nbsp;&nbsp;&nbsp;";
echo api_ucfirst(strftime($timeNoSecFormat,strtotime($row["end_date"])))."";
echo api_ucfirst(api_convert_and_format_date($row["end_date"], null, date_default_timezone_get()));
echo '<br /><br />';

@ -441,7 +441,7 @@ $form->display();
?>
<tr>
<td><?php echo get_lang('LastEdit'); ?>&nbsp;:</td>
<td><?php echo format_locale_date($dateTimeFormatLong,strtotime($currentCourseLastEdit)); ?></td>
<td><?php echo api_convert_and_format_date($currentCourseLastEdit, null, date_default_timezone_get()); ?></td>
</tr>
<?php
@ -451,7 +451,7 @@ $form->display();
?>
<tr>
<td><?php echo get_lang('LastVisit'); ?>&nbsp;:</td>
<td><?php echo format_locale_date($dateTimeFormatLong,strtotime($currentCourseLastVisit)); ?></td>
<td><?php echo api_convert_and_format_date($currentCourseLastVisit, null, date_default_timezone_get()); ?></td>
</tr>
<?php
@ -461,7 +461,7 @@ $form->display();
?>
<tr>
<td><?php echo get_lang('CreationDate'); ?>&nbsp;:</td>
<td><?php echo format_locale_date($dateTimeFormatLong,strtotime($currentCourseCreationDate)); ?></td>
<td><?php echo api_convert_and_format_date($currentCourseCreationDate, null, date_default_timezone_get()); ?></td>
</tr>
<?php
@ -474,7 +474,7 @@ $form->display();
<td>
<?php
echo format_locale_date($dateTimeFormatLong, strtotime($currentCourseExpirationDate));
echo api_convert_and_format_date($currentCourseExpirationDate, null, date_default_timezone_get());
echo "<br />".get_lang('OrInTime')." : ";
$nbJour = (strtotime($currentCourseExpirationDate) - time()) / (60 * 60 * 24);
$nbAnnees = round($nbJour / 365);

@ -1288,8 +1288,6 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
$duration_list = get_lang('NoLogOfDuration');
//echo get_lang('NoLogOfDuration');
}
//echo '</td>';
//echo '<td>' . $add_start_date . format_locale_date('%b %d, %Y %H:%M', $results[$i][4]) . '</td>'; //get_lang('dateTimeFormatLong')
// Date conversion
$date_list = api_get_local_time($results[$i][7], null, date_default_timezone_get()). ' / ' . api_get_local_time($results[$i][4], null, date_default_timezone_get());
// there are already a duration test period calculated??

@ -148,13 +148,13 @@ class ExerciseResult
{ // get only this user's results
$sql="SELECT '', ce.title, te.exe_result ,
te.exe_weighting, UNIX_TIMESTAMP(te.exe_date), te.exe_id
te.exe_weighting, te.exe_date, te.exe_id
FROM $TBL_EXERCISES AS ce , $TBL_TRACK_EXERCISES AS te, $TBL_USER AS user,$TBL_COURSE_REL_USER AS cuser
WHERE user.user_id=cuser.user_id AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id AND te.exe_cours_id='" . Database :: escape_string($cid) . "'
AND cuser.status<>1 AND te.exe_user_id='".Database::escape_string($user_id)."' $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0
AND cuser.course_code=te.exe_cours_id ORDER BY te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";
$hpsql = "SELECT '',exe_name, exe_result , exe_weighting, UNIX_TIMESTAMP(exe_date)
$hpsql = "SELECT '',exe_name, exe_result , exe_weighting, exe_date
FROM $TBL_TRACK_HOTPOTATOES
WHERE exe_user_id = '" . $user_id . "' AND exe_cours_id = '" . Database :: escape_string($cid) . "'
ORDER BY exe_cours_id ASC, exe_date DESC";
@ -201,7 +201,6 @@ class ExerciseResult
$mailid = $results[$i][6];
$user = $results[$i][0];
$test = $results[$i][1];
$dt = strftime(get_lang('dateTimeFormatLong'),$results[$i][4]);
$res = $results[$i][2];
if(empty($user_id))
{
@ -210,7 +209,7 @@ class ExerciseResult
$return[$i]['user_id'] = $results[$i][7];
}
$return[$i]['title'] = $test;
$return[$i]['time'] = format_locale_date(get_lang('dateTimeFormatLong'),$results[$i][4]);
$return[$i]['time'] = api_convert_and_format_date($results[$i][4], null, date_default_timezone_get());
$return[$i]['result'] = $res;
$return[$i]['max'] = $results[$i][3];
$j=$i;
@ -235,7 +234,7 @@ class ExerciseResult
}
$return[$j+$i]['title'] = $title;
$return[$j+$i]['time'] = strftime(get_lang('dateTimeFormatLong'),$hpresults[$i][4]);
$return[$j+$i]['time'] = api_convert_and_format_date($hpresults[$i][4], null, date_default_timezone_get());
$return[$j+$i]['result'] = $hpresults[$i][2];
$return[$j+$i]['max'] = $hpresults[$i][3];
}

@ -117,25 +117,25 @@ class GradeBookResult
//get all results (ourself and the others) as an admin should see them
//AND exe_user_id <> $_user['user_id'] clause has been removed
$sql="SELECT ".(api_is_western_name_order() ? "CONCAT(firstname,' ',lastname)" : "CONCAT(lastname,' ',firstname)").", ce.title, te.exe_result ,
te.exe_weighting, UNIX_TIMESTAMP(te.exe_date),te.exe_id, user.email, user.user_id
te.exe_weighting, te.exe_date,te.exe_id, user.email, user.user_id
FROM $TBL_EXERCISES ce , $TBL_TRACK_EXERCISES te, $TBL_USER user
WHERE te.exe_exo_id = ce.id AND user_id=te.exe_user_id AND te.exe_cours_id='$cid'
ORDER BY te.exe_cours_id ASC, ce.title ASC, te.exe_date ASC";
$hpsql="SELECT ".(api_is_western_name_order() ? "CONCAT(tu.firstname,' ',tu.lastname)" : "CONCAT(tu.lastname,' ',tu.firstname)").", tth.exe_name,
tth.exe_result , tth.exe_weighting, UNIX_TIMESTAMP(tth.exe_date), tu.email, tu.user_id
tth.exe_result , tth.exe_weighting, tth.exe_date, tu.email, tu.user_id
FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '".$cid."'
ORDER BY tth.exe_cours_id ASC, tth.exe_date ASC";
} else { // get only this user's results
$sql="SELECT '',ce.title, te.exe_result , te.exe_weighting, " .
"UNIX_TIMESTAMP(te.exe_date),te.exe_id
"te.exe_date,te.exe_id
FROM $TBL_EXERCISES ce , $TBL_TRACK_EXERCISES te
WHERE te.exe_exo_id = ce.id AND te.exe_user_id='".$user_id."' AND te.exe_cours_id='$cid'
ORDER BY te.exe_cours_id ASC, ce.title ASC, te.exe_date ASC";
$hpsql="SELECT '',exe_name, exe_result , exe_weighting, UNIX_TIMESTAMP(exe_date)
$hpsql="SELECT '',exe_name, exe_result , exe_weighting, exe_date
FROM $TBL_TRACK_HOTPOTATOES
WHERE exe_user_id = '".$user_id."' AND exe_cours_id = '".$cid."'
ORDER BY exe_cours_id ASC, exe_date ASC";
@ -155,7 +155,6 @@ class GradeBookResult
$mailid = $results[$i][6];
$user = $results[$i][0];
$test = $results[$i][1];
$dt = strftime(get_lang('dateTimeFormatLong'),$results[$i][4]);
$res = $results[$i][2];
if(empty($user_id)) {
$user = $results[$i][0];
@ -163,7 +162,7 @@ class GradeBookResult
$return[$i]['user_id'] = $results[$i][7];
}
$return[$i]['title'] = $test;
$return[$i]['time'] = format_locale_date(get_lang('dateTimeFormatLong'),$results[$i][4]);
$return[$i]['time'] = api_convert_and_format_date($results[$i][4], null, date_default_timezone_get());
$return[$i]['result'] = $res;
$return[$i]['max'] = $results[$i][3];
$j=$i;
@ -184,7 +183,7 @@ class GradeBookResult
}
$return[$j+$i]['title'] = $title;
$return[$j+$i]['time'] = strftime(get_lang('dateTimeFormatLong'),$hpresults[$i][4]);
$return[$j+$i]['time'] = api_convert_and_format_date($hpresults[$i][4], null, date_default_timezone_get());
$return[$j+$i]['result'] = $hpresults[$i][2];
$return[$j+$i]['max'] = $hpresults[$i][3];
}

@ -832,10 +832,9 @@ class Blog {
$date_output = $query_string;
$date = explode('-',$query_string);
$query_string = ' DAYOFMONTH(date_creation) =' . $date[2] . ' AND MONTH(date_creation) =' . $date[1] . ' AND YEAR(date_creation) =' . $date[0];
global $dateFormatLong;
// Put date in correct output format
$date_output = format_locale_date($dateFormatLong,strtotime($date_output));
$date_output = api_format_date($date_output, DATE_FORMAT_LONG);
// Display the posts
echo '<span class="blogpost_title">' . get_lang('PostsOf') . ': ' . $date_output . '</span>';

@ -485,7 +485,7 @@ class SocialManager extends UserManager {
$result .= "<a href=\"$toolsList[$key2] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key2][\"name\"]</a>";
} else {
$result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key2));
$result .= api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get());
}
$result .= '</li>';
$result .= '<ul>';
@ -496,7 +496,7 @@ class SocialManager extends UserManager {
$result .= "<a href=\"$toolsList[$key3] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key3][\"name\"]</a>";
} else {
$result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key3));
$result .= api_convert_and_format_date($key3, DATE_FORMAT_LONG, date_default_timezone_get());
}
$result .= '<ul compact="compact">';
reset($digest[$thisCourseSysCode][$key2][$key3]);

@ -43,24 +43,6 @@ function make_clickable($string) {
return $string;
}
/**
* Formats the date according to the locale settings
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @author Christophe Gesché <gesche@ipm.ucl.ac.be>
* originally inspired from from PhpMyAdmin
* @param string $date_format date pattern
* @param integer $time_stamp, default is NOW.
* @return the formatted date
*/
function format_locale_date($date_format, $time_stamp = -1, $language = null) {
if ($time_stamp == -1) {
$time_stamp = time();
}
return api_format_date($time_stamp, $date_format, $language);
}
/**
* @desc This function does some parsing on the text that gets inputted. This parsing can be of any kind
* LaTeX notation, Word Censoring, Glossary Terminology (extension will available soon), Musical Notations, ...

@ -118,8 +118,7 @@ class Tracking {
if(Database::num_rows($rs)>0)
{
if ($first_login_date = Database::result($rs, 0, 0)) {
$first_login_date_local = api_get_local_time($first_login_date, null, date_default_timezone_get());
return format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($first_login_date_local));
return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
}
}
return false;
@ -147,28 +146,28 @@ class Tracking {
$last_login_date = api_get_local_time($last_login_date, null, date_default_timezone_get());
if ($return_timestamp)
{
return strtotime($last_login_date);
return api_strtotime($last_login_date);
}
else
{
if (!$warning_message)
{
return format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($last_login_date));
return api_format_date($last_login_date, DATE_FORMAT_SHORT);
}
else
{
$timestamp = strtotime($last_login_date);
$currentTimestamp = mktime();
$timestamp = api_strtotime($last_login_date);
$currentTimestamp = time();
//If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds
if ($currentTimestamp - $timestamp > 604800)
{
return '<span style="color: #F00;">' . format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($last_login_date)) . '</span>';
return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>';
}
else
{
return format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($last_login_date));
return api_format_date($last_login_date, DATE_FORMAT_SHORT);
}
}
}
@ -200,8 +199,7 @@ class Tracking {
$rs = Database::query($sql);
if (Database::num_rows($rs)>0) {
if ($first_login_date = Database::result($rs, 0, 0)) {
$first_login_date = api_get_local_time($first_login_date, null, date_default_timezone_get());
return format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($first_login_date));
return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
}
}
return false;
@ -232,14 +230,14 @@ class Tracking {
if (Database::num_rows($rs)>0) {
if ($last_login_date = Database::result($rs, 0, 0)) {
$last_login_date = api_get_local_time($last_login_date, null, date_default_timezone_get());
$timestamp = strtotime($last_login_date);
$currentTimestamp = mktime();
$timestamp = api_strtotime($last_login_date);
$currentTimestamp = time();
//If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds
if ($currentTimestamp - $timestamp > 604800) {
return '<span style="color: #F00;">' . format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($last_login_date)) . (api_is_allowed_to_edit()?' <a href="'.api_get_path(REL_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'" title="'.get_lang('RemindInactiveUser').'"><img align="middle" src="'.api_get_path(WEB_IMG_PATH).'messagebox_warning.gif" /></a>':'').'</span>';
return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . (api_is_allowed_to_edit()?' <a href="'.api_get_path(REL_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'" title="'.get_lang('RemindInactiveUser').'"><img align="middle" src="'.api_get_path(WEB_IMG_PATH).'messagebox_warning.gif" /></a>':'').'</span>';
} else {
return format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($last_login_date));
return api_format_date($last_login_date, DATE_FORMAT_SHORT);
}
}
}
@ -1377,12 +1375,7 @@ class Tracking {
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
$row = Database::fetch_array($rs);
$last_connection = api_get_local_time($row['access_date'], null, date_default_timezone_get());
if (!empty($last_connection)) {
$date_format_long = format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($last_connection));
$time = explode(' ',$last_connection);
$date_time = $date_format_long.' '.$time[1];
}
$date_time = api_convert_and_format_date($row['access_date'], null, date_default_timezone_get());
}
return $date_time;
}

@ -525,7 +525,7 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') {
$row[] = $session['name'];
if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') {
$row[] = get_lang('From').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_start'])).' '.get_lang('To').' '.format_locale_date(get_lang('DateFormatLongWithoutDay'), strtotime($session['date_end']));
$row[] = get_lang('From').' '.api_convert_and_format_date($session['date_start'], DATE_FORMAT_SHORT, date_default_timezone_get()).' '.get_lang('To').' '.api_convert_and_format_date($session['date_end'], DATE_FORMAT_SHORT, date_default_timezone_get());
} else {
$row[] = ' - ';
}

@ -608,7 +608,7 @@ if ($timezone !== null) {
api_time_to_hms($total_time),
$score . '%',
$progress,
date('Y-m-d', $start_time)
api_convert_and_format_date($start_time, "%Y-%m-%d")
);
?>
<tr class="<?php echo $css_class;?>">
@ -640,7 +640,7 @@ if ($timezone !== null) {
<td align="center">
<?php
if ($start_time != '' && $start_time > 0) {
echo format_locale_date(get_lang('DateFormatLongWithoutDay'), $start_time);
echo api_convert_and_format_date($start_time, DATE_FORMAT_SHORT);
} else {
echo '-';
}

@ -139,7 +139,7 @@ if ($nb_sessions > 0) {
//$row[] = $session['status'];
if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') {
$row[] = get_lang('From').' '.format_locale_date(DATE_FORMAT_LONG_WITHOUT_DAY, strtotime($session['date_start'])).' '.get_lang('To').' '.format_locale_date(DATE_FORMAT_LONG_WITHOUT_DAY, strtotime($session['date_end']));
$row[] = get_lang('From').' '. api_convert_and_format_date($session['date_start'], DATE_FORMAT_SHORT, date_default_timezone_get()).' '.get_lang('To').' '.api_convert_and_format_date($session['date_end'], DATE_FORMAT_SHORT, date_default_timezone_get());
} else {
$row[] = ' - ';
}

@ -1702,17 +1702,18 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
//3 For each event corresponding to this agenda, do the following:
while ($myrow = Database::fetch_array($result))
{
$start_date_local = api_get_local_time($myrow["start_date"], null, date_default_timezone_get());
//3.1 Make the blue month bar appear only once.
if ($barreMois != date("m", strtotime($myrow["start_date"])))
if ($barreMois != api_format_date($start_date_local, "%m"))
{
//3.1.1 Update the check value for the month bar
$barreMois = date("m", strtotime($myrow["start_date"]));
$barreMois = api_format_date($start_date_local, "%m");
//3.1.2 Display the month bar
$expcontent .= "<tr><td id=\"title\" colspan=\"2\" class=\"month\" valign=\"top\">".api_ucfirst(format_locale_date("%B %Y", strtotime($myrow["start_date"])))."</td></tr>";
$expcontent .= "<tr><td id=\"title\" colspan=\"2\" class=\"month\" valign=\"top\">".api_ucfirst(api_format_date($start_date_local, "%B %Y"))."</td></tr>";
}
//3.2 Display the agenda items (of this month): the date, hour and title
$db_date = (int) date(d, strtotime($myrow["start_date"]));
$db_date = (int) api_format_date($start_date_local, "%d");
if ($_GET["day"] <> $db_date)
{ //3.2.1.a If the day given in the URL (might not be set) is different from this element's day, use style 'data'
$expcontent .= "<tr><td class=\"data\" colspan='2'>";
@ -1722,10 +1723,9 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
$expcontent .= "<tr><td class=\"datanow\" colspan='2'>";
}
//3.2.2 Mark an anchor for this date
$expcontent .= "<a name=\"".(int) date(d, strtotime($myrow["start_date"]))."\"></a>"; // anchoring
$expcontent .= "<a name=\"".$db_date."\"></a>"; // anchoring
//3.2.3 Write the date and time of this event to the export string
$expcontent .= api_ucfirst(format_locale_date($dateFormatLong, strtotime($myrow["start_date"])))."&nbsp;&nbsp;&nbsp;";
$expcontent .= api_ucfirst(strftime($timeNoSecFormat, strtotime($myrow["start_time"])))."";
$expcontent .= api_ucfirst(api_format_date($start_date_local));
//3.2.4 If a duration is set, write it, otherwise ignore
if ($myrow["duration"] == "")
{
@ -1801,7 +1801,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
}
//3.5 Write this content to the export string (formatted HTML array)
$expcontent .= "<tr>\n"."<td class=\"cell_header\">\n"."<font ".$colorBecauseNew.">".$langPubl." : ".api_ucfirst(format_locale_date($dateFormatLong, strtotime($last_post_date)))."</font>\n"."</td>\n"."</tr>\n"."<tr>\n"."<td>\n".$content."</td>\n"."</tr>\n";
$expcontent .= "<tr>\n"."<td class=\"cell_header\">\n"."<font ".$colorBecauseNew.">".$langPubl." : ".api_ucfirst(api_convert_and_format_date($last_post_datetime, null, date_default_timezone_get()))."</font>\n"."</td>\n"."</tr>\n"."<tr>\n"."<td>\n".$content."</td>\n"."</tr>\n";
} // while loop

@ -754,8 +754,7 @@ if ($content == "Agenda")
{
echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\">";
echo "<img src='../img/agenda.gif' alt='agenda'>";
echo api_ucfirst(format_locale_date($dateFormatLong, strtotime($myrow["start_date"])))."&nbsp;";
echo api_ucfirst(strftime($timeNoSecFormat, strtotime($myrow["start_date"])))."<br />";
echo api_ucfirst(api_convert_and_format_date($myrow["start_date"], null, date_default_timezone_get()))."<br />";
echo "<b>".$myrow["title"]."</b></td></tr><tr><td>";
echo $myrow["content"]."<br />";
showorhide_addresourcelink($content, $myrow["id"]);
@ -825,7 +824,7 @@ if ($content == "Ad_Valvas")
{
echo "<table width=\"100%\"><tr><td>";
echo "<img src='../img/valves.gif' alt='advalvas'>";
echo api_ucfirst(format_locale_date($dateFormatLong, strtotime($myrow["end_date"])));
echo api_ucfirst(api_convert_and_format_date($myrow["end_date"], DATE_FORMAT_LONG, date_default_timezone_get());
echo "</td></tr><tr><td>";
echo $myrow["title"]."<br />";
showorhide_addresourcelink($content, $myrow["id"]);

@ -657,8 +657,7 @@ if ($content == "Agenda")
{
echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\">";
echo "<img src='../img/agenda.gif' alt='agenda'>";
echo api_ucfirst(format_locale_date($dateFormatLong, strtotime($myrow["start_date"])))."&nbsp;";
echo api_ucfirst(strftime($timeNoSecFormat, strtotime($myrow["start_date"])))."<br />";
echo api_ucfirst(api_convert_and_format_date($myrow["start_date"], null, date_default_timezone_get()))."<br />";
echo "<b>".$myrow["title"]."</b></td></tr><tr><td>";
echo $myrow["content"]."<br />";
showorhide_addresourcelink($content, $myrow["id"]);
@ -727,7 +726,7 @@ if ($content == "Ad_Valvas")
{
echo "<table width=\"100%\"><tr><td>";
echo "<img src='../img/valves.gif' alt='advalvas'>";
echo api_ucfirst(format_locale_date($dateFormatLong, strtotime($myrow["end_date"])));
echo api_ucfirst(api_convert_and_format_date($myrow["end_date"], DATE_FORMAT_LONG, date_default_timezone_get()));
echo "</td></tr><tr><td>";
echo $myrow["title"]."<br />";
showorhide_addresourcelink($content, $myrow["id"]);

@ -209,10 +209,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
{
for ($j = 0 ; $j < sizeof($results); $j++)
{
$timestamp = strtotime($results[$j]);
//$beautifulDate = $langDay_of_weekNames['long'][date("w" , $timestamp)].date(" d " , $timestamp);
//$beautifulHour = date("H : i" , $timestamp);
$beautifulDateTime = format_locale_date($dateTimeFormatLong,$timestamp);
$beautifulDateTime = api_convert_and_format_date($results[$j], null, date_default_timezone_get());
echo "<tr>";
echo "<td style='padding-left : 40px;' valign='top'>".$beautifulDateTime."</td>";
echo"</tr>";
@ -286,4 +283,4 @@ else
<?php
Display::display_footer();
?>
?>

@ -136,10 +136,7 @@ if ( $_configuration['tracking_enabled'] )
while ( list($key,$value) = each($results))
{
$timestamp = strtotime($value);
//$beautifulDate = $langDay_of_weekNames['long'][date("w" , $timestamp)].date(" d " , $timestamp).$langMonthNames['long'][date("n", $timestamp)-1].date(" Y" , $timestamp);
//$beautifulHour = date("H : i" , $timestamp);
$beautifulDate = format_locale_date($dateTimeFormatLong,$timestamp);
$beautifulDate = api_convert_and_format_date($value, null, date_default_timezone_get());
echo "
<tr>
<td class='secLine'>

@ -115,7 +115,7 @@ class BlockSession extends Block {
$title = $session['name'];
if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') {
$date = get_lang('From').' '.format_locale_date(DATE_FORMAT_LONG_WITHOUT_DAY,strtotime($session['date_start'])).' '.get_lang('To').' '.format_locale_date(DATE_FORMAT_LONG_WITHOUT_DAY, strtotime($session['date_end']));
$date = get_lang('From').' '.api_convert_and_format_date($session['date_start'], DATE_FORMAT_SHORT, date_default_timezone_get()).' '.get_lang('To').' '.api_convert_and_format_date($session['date_end'], DATE_FORMAT_SHORT, date_default_timezone_get());
} else {
$date = ' - ';
}
@ -156,4 +156,4 @@ class BlockSession extends Block {
}
}
?>
?>

@ -55,13 +55,6 @@ class TestText extends UnitTestCase {
//var_dump($res);
}
function testformat_locale_date() {
$date_format='';
$res=format_locale_date($date_format, $time_stamp = -1);
$this->assertTrue(is_bool($res));
//var_dump($res);
}
function testlatex_gif_renderer() {
ob_start();
$latex_code="";

@ -634,7 +634,7 @@ function display_digest($toolsList, $digest, $orderKey, $courses) {
$courseSysCode = $key1;
echo "<a href=\"", api_get_path(WEB_COURSE_PATH), $courses[$key1]['coursePath'], "\">", $courses[$key1]['courseCode'], "</a>\n";
} elseif ($orderKey[0] == 'keyTime') {
echo format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($digest[$key1]));
echo api_convert_and_format_date($digest[$key1], DATE_FORMAT_LONG, date_default_timezone_get());
}
echo "</strong>\n";
// // // End Of Title of LEVEL 1 // // //
@ -650,7 +650,7 @@ function display_digest($toolsList, $digest, $orderKey, $courses) {
$courseSysCode = $key2;
echo "<a href=\"", api_get_path(WEB_COURSE_PATH), $courses[$key2]['coursePath'], "\">", $courses[$key2]['courseCode'], "</a>\n";
} elseif ($orderKey[1] == 'keyTime') {
echo format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key2));
echo api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get());
}
echo "\n";
echo "</p>";
@ -664,7 +664,7 @@ function display_digest($toolsList, $digest, $orderKey, $courses) {
} elseif ($orderKey[2] == 'keyCourse') {
$level3title = "&#8226; <a href=\"".$toolsList[$tools]["path"].$key3."\">".$courses[$key3]['courseCode']."</a>\n";
} elseif ($orderKey[2] == 'keyTime') {
$level3title = "&#8226; <a href=\"".$toolsList[$tools]["path"].$courseSysCode."\">".format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key3))."</a>";
$level3title = "&#8226; <a href=\"".$toolsList[$tools]["path"].$courseSysCode."\">".api_convert_and_format_date($key3, DATE_FORMAT_LONG, date_default_timezone_get())."</a>";
}
// // // End Of Title of LEVEL 3 // // //
// // // LEVEL 4 (data) // // //
@ -874,7 +874,7 @@ function get_logged_user_course_html($course, $session_id = 0, $class='courses')
$result .= "<a href=\"$toolsList[$key2] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key2][\"name\"]</a>";
} else {
$result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key2));
$result .= api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get());
}
$result .= '</li>';
$result .= '<ul>';
@ -885,7 +885,7 @@ function get_logged_user_course_html($course, $session_id = 0, $class='courses')
$result .= "<a href=\"$toolsList[$key3] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key3][\"name\"]</a>";
} else {
$result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key3));
$result .= api_convert_and_format_date($key3, DATE_FORMAT_LONG, date_default_timezone_get());
}
$result .= '<ul compact="compact">';
reset($digest[$thisCourseSysCode][$key2][$key3]);

Loading…
Cancel
Save