Date and time management; correcting calls to api_get_local_time - Chamilo - CT#696

skala
Guillaume Viguier 15 years ago
parent 3aa8a5b8f4
commit d492bee5d3
  1. 48
      main/admin/calendar.lib.php
  2. 4
      main/admin/statistics/statistics.lib.php
  3. 6
      main/admin/system_announcements.php
  4. 2
      main/admin/user_edit.php
  5. 47
      main/calendar/agenda.inc.php
  6. 4
      main/calendar/myagenda.inc.php
  7. 6
      main/document/document.php
  8. 22
      main/exercice/exercice.php
  9. 2
      main/forum/index.php
  10. 6
      main/forum/viewforum.php
  11. 2
      main/forum/viewthread_flat.inc.php
  12. 4
      main/forum/viewthread_nested.inc.php
  13. 4
      main/forum/viewthread_threaded.inc.php
  14. 4
      main/gradebook/gradebook_view_result.php
  15. 8
      main/gradebook/lib/be/abstractlink.class.php
  16. 8
      main/gradebook/lib/be/evaluation.class.php
  17. 4
      main/gradebook/lib/fe/displaygradebook.php
  18. 2
      main/gradebook/lib/fe/evalform.class.php
  19. 22
      main/gradebook/lib/gradebook_data_generator.class.php
  20. 2
      main/inc/lib/attendance.lib.php
  21. 15
      main/inc/lib/blog.lib.php
  22. 4
      main/inc/lib/glossary.lib.php
  23. 4
      main/inc/lib/notebook.lib.php
  24. 28
      main/inc/lib/tracking.lib.php
  25. 10
      main/mySpace/myspace.lib.php
  26. 18
      main/wiki/index.php
  27. 4
      main/work/work.lib.php
  28. 6
      main/work/work.php

@ -735,17 +735,17 @@ function display_agenda_items()
while($myrow=Database::fetch_array($result))
{
$is_repeated = !empty($myrow['parent_event_id']);
$myrow["start_date"] = api_get_local_time($myrow["start_date"], null, null, date_default_timezone_get());
echo '<table class="data_table">',"\n";
/*--------------------------------------------------
display: the month bar
--------------------------------------------------*/
// Make the month bar appear only once.
if ($month_bar != date("m",strtotime($myrow["start_date"])).date("Y",strtotime($myrow["start_date"])))
$myrow["start_date"] = api_get_local_time($myrow["start_date"], null, date_default_timezone_get());
if ($month_bar != api_format_date($myrow["start_date"], "%m%Y"))
{
$month_bar = date("m",strtotime($myrow["start_date"])).date("Y",strtotime($myrow["start_date"]));
$month_bar = api_format_date($myrow["start_date"], "%m%Y");
echo "\t<tr>\n\t\t<td class=\"agenda_month_divider\" colspan=\"3\" valign=\"top\">".
api_ucfirst(format_locale_date("%B %Y",strtotime($myrow["start_date"]))).
api_ucfirst(api_format_date($myrow["start_date"], "%B %Y")).
"</td>\n\t</tr>\n";
}
@ -755,7 +755,7 @@ function display_agenda_items()
echo '<tr>';
// highlight: if a date in the small calendar is clicked we highlight the relevant items
$db_date=(int)date("d",strtotime($myrow["start_date"])).date("n",strtotime($myrow["start_date"])).date("Y",strtotime($myrow["start_date"]));
$db_date = (int)api_format_date($myrow["start_date"], "%d").intval(api_format_date($myrow["start_date"], "%m")).api_format_date($myrow["start_date"], "%Y");
if ($_GET["day"].$_GET["month"].$_GET["year"] <>$db_date)
{
if ($myrow['visibility']=='0')
@ -814,16 +814,13 @@ function display_agenda_items()
--------------------------------------------------*/
echo "<tr class='row_odd'>";
echo "\t\t<td>".get_lang("StartTimeWindow").": ";
echo api_ucfirst(format_locale_date($dateFormatLong,strtotime($myrow["start_date"])))."&nbsp;&nbsp;&nbsp;";
echo ucfirst(strftime($timeNoSecFormat,strtotime($myrow["start_date"])))."";
echo api_ucfirst(api_format_date($myrow["start_date"]));
echo "</td>\n";
echo "\t\t<td>";
if ($myrow["end_date"]<>"0000-00-00 00:00:00")
{
$myrow["end_date"] = api_get_local_time($myrow["end_date"], null, null, date_default_timezone_get());
echo get_lang("EndTimeWindow").": ";
echo api_ucfirst(format_locale_date($dateFormatLong,strtotime($myrow["end_date"])))."&nbsp;&nbsp;&nbsp;";
echo ucfirst(strftime($timeNoSecFormat,strtotime($myrow["end_date"])))."";
echo api_ucfirst(api_convert_and_format_date($myrow["end_date"], null, date_default_timezone_get()));
}
echo "</td>\n";
@ -1008,9 +1005,9 @@ function display_one_agenda_item($agenda_id)
echo "\t<tr>\n";
// highlight: if a date in the small calendar is clicked we highlight the relevant items
$myrow["start_date"] = api_get_local_time($myrow["start_date"], null, null, date_default_timezone_get());
$db_date=(int)date("d",strtotime($myrow["start_date"])).date("n",strtotime($myrow["start_date"])).date("Y",strtotime($myrow["start_date"]));
if ($_GET["day"].$_GET["month"].$_GET["year"] <>$db_date)
$myrow["start_date"] = api_get_local_time($myrow["start_date"], null, date_default_timezone_get());
$db_date = (int)api_format_date($myrow["start_date"], "%d").intval(api_format_date($myrow["start_date"], "%m")).api_format_date($myrow["start_date"], "%Y");
if ($_GET["day"].$_GET["month"].$_GET["year"] <>$db_date)
{
if ($myrow['visibility']=='0')
{
@ -1061,13 +1058,10 @@ function display_one_agenda_item($agenda_id)
--------------------------------------------------*/
echo "\t<tr class=\"".$stylenotbold."\">\n";
echo "\t\t<td>".get_lang("StartTime").": ";
echo api_ucfirst(format_locale_date($dateFormatLong,strtotime($myrow["start_date"])))."&nbsp;&nbsp;&nbsp;";
echo ucfirst(strftime($timeNoSecFormat,strtotime($myrow["start_date"])))."";
echo api_ucfirst(api_format_date($myrow["start_date"]));
echo "</td>\n";
echo "\t\t<td>".get_lang("EndTime").": ";
$myrow["end_date"] = api_get_local_time($myrow["end_date"], null, null, date_default_timezone_get());
echo api_ucfirst(format_locale_date($dateFormatLong,strtotime($myrow["end_date"])))."&nbsp;&nbsp;&nbsp;";
echo ucfirst(strftime($timeNoSecFormat,strtotime($myrow["end_date"])))."";
echo api_ucfirst(api_convert_and_format_date($myrow["end_date"], null, date_default_timezone_get()));
echo "</td>\n";
echo "\n\t</tr>\n";
@ -1675,9 +1669,9 @@ function get_agendaitems($month, $year)
$result = Database::query($sqlquery);
while ($item = Database::fetch_array($result))
{
$item['start_date'] = api_get_local_time($item['start_date'], null, null, date_default_timezone_get());
$agendaday = date('j',strtotime($item['start_date']));
$time= date('H:i',strtotime($item['start_date']));
$agendaday_string = api_convert_and_format_date($item['start_date'], "%d", date_default_timezone_get());
$agendaday = intval($agendaday_string);
$time = api_convert_and_format_date($item['start_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get());
$URL = $portal_url.'main/admin/agenda.php?day='.$agendaday."&amp;month=".$month."&amp;year=".$year; // RH //Patrick Cool: to highlight the relevant agenda item
$items[$agendaday][$item['start_time']] .= '<i>'.$time.'</i> <a href="'.$URL.'" title="'.$item['title'].'<br />';
}
@ -1998,7 +1992,7 @@ function get_day_agendaitems($courses_dbs, $month, $year, $day)
{
// in the display_daycalendar function we use $i (ranging from 0 to 47) for each halfhour
// we want to know for each agenda item for this day to wich halfhour it must be assigned
$item['start_date'] = api_get_local_time($item['start_date'], null, null, date_default_timezone_get());
$item['start_date'] = api_get_local_time($item['start_date'], null, date_default_timezone_get());
list ($datepart, $timepart) = split(" ", $item['start_date']);
list ($year, $month, $day) = explode("-", $datepart);
list ($hours, $minutes, $seconds) = explode(":", $timepart);
@ -2108,10 +2102,10 @@ function get_week_agendaitems($courses_dbs, $month, $year, $week = '')
while ($item = Database::fetch_array($result))
{
$item['start_date'] = api_get_local_time($item['start_date'], null, null, date_default_timezone_get());
$agendaday = date("j",strtotime($item['start_date']));
$time= date("H:i",strtotime($item['start_date']));
$agendaday_string = api_convert_and_format_date($item['start_date'], "%d", date_default_timezone_get());
$agendaday = intval($agendaday_string);
$time = api_convert_and_format_date($item['start_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get());
if ($setting_agenda_link == 'coursecode')
{
$title=$array_course_info['title'];

@ -122,7 +122,7 @@ class Statistics
$res = Database::query($sql);
$activities = array ();
while ($row = Database::fetch_row($res)) {
$row[4] = api_get_local_time($row[4], DATE_TIME_FORMAT_LONG, null, date_default_timezone_get());
$row[4] = api_get_local_time($row[4], null, date_default_timezone_get());
$activities[] = $row;
}
return $activities;
@ -425,7 +425,7 @@ class Statistics
{
$course = array ();
$course[]= '<a href="'.api_get_path(WEB_PATH).'courses/'.$obj->access_cours_code.'">'.$obj->access_cours_code.' <a>';
$course[] = api_get_local_time($obj->access_date, null, null, date_default_timezone_get());
$course[] = api_convert_and_format_date($obj->access_date, null, date_default_timezone_get());
$courses[] = $course;
}
$parameters['action'] = 'courselastvisit';

@ -245,8 +245,8 @@ if ($show_announcement_list)
$row = array ();
$row[] = $announcement->id;
$row[] = Display::return_icon(($announcement->visible ? 'accept.png' : 'exclamation.png'), ($announcement->visible ? get_lang('AnnouncementAvailable') : get_lang('AnnouncementNotAvailable')));
$row[] = api_get_local_time($announcement->date_start, null, null, date_default_timezone_get());
$row[] = api_get_local_time($announcement->date_end, null, null, date_default_timezone_get());
$row[] = api_convert_and_format_date($announcement->date_start, null, date_default_timezone_get());
$row[] = api_convert_and_format_date($announcement->date_end, null, date_default_timezone_get());
$row[] = "<a href=\"?id=".$announcement->id."&amp;person=".VISIBLE_TEACHER."&amp;action=". ($announcement->visible_teacher ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_teacher ? 'visible.gif' : 'invisible.gif'), get_lang('show_hide'))."</a>";
$row[] = "<a href=\"?id=".$announcement->id."&amp;person=".VISIBLE_STUDENT."&amp;action=". ($announcement->visible_student ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_student ? 'visible.gif' : 'invisible.gif'), get_lang('show_hide'))."</a>";
$row[] = "<a href=\"?id=".$announcement->id."&amp;person=".VISIBLE_GUEST."&amp;action=". ($announcement->visible_guest ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_guest ? 'visible.gif' : 'invisible.gif'), get_lang('show_hide'))."</a>";
@ -277,4 +277,4 @@ if ($show_announcement_list)
==============================================================================
*/
Display :: display_footer();
?>
?>

@ -86,7 +86,7 @@ $user_data['platform_admin'] = is_null($user_data['is_admin']) ? 0 : 1;
$user_data['send_mail'] = 0;
$user_data['old_password'] = $user_data['password'];
//Convert the registration date of the user
$user_data['registration_date'] = api_get_local_time($user_data['registration_date'], null, null, date_default_timezone_get());
$user_data['registration_date'] = api_get_local_time($user_data['registration_date'], null, date_default_timezone_get());
unset($user_data['password']);
$user_data = array_merge($user_data, Usermanager :: get_extra_user_data($user_id, true));

@ -444,8 +444,8 @@ function display_monthcalendar($month, $year)
foreach ($agenda_item as $key=>$value) {
$month_start_date = (int)substr($value['start_date'],5,2);
if ($month == $month_start_date) {
$start_time = api_get_local_time($value['start_date'], "H:i", null, date_default_timezone_get());
$end_time = api_get_local_time($value['end_date'], "H:i", null, date_default_timezone_get());
$start_time = api_convert_and_format_date($value['start_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get());
$end_time = api_convert_and_format_date($value['end_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get());
if ($value['end_date']=='0000-00-00 00:00:00'){
$dayheader .= '<br />'.get_lang("Work").'<br />';
@ -2063,11 +2063,12 @@ function display_agenda_items()
display: the month bar
--------------------------------------------------*/
// Make the month bar appear only once.
if ($month_bar != date("m",strtotime($myrow["start_date"])).date("Y",strtotime($myrow["start_date"])))
$myrow["start_date"] = api_get_local_time($myrow["start_date"], null, date_default_timezone_get());
if ($month_bar != api_format_date($myrow["start_date"], "%m%Y"))
{
$month_bar = date("m",strtotime($myrow["start_date"])).date("Y",strtotime($myrow["start_date"]));
$month_bar = api_format_date($myrow["start_date"], "%m%Y");
echo "\t<tr>\n\t\t<td class=\"agenda_month_divider\" colspan=\"3\" valign=\"top\">".
api_ucfirst(format_locale_date("%B %Y",strtotime($myrow["start_date"]))).
api_ucfirst(api_format_date($myrow["start_date"], "%B %Y")).
"</td>\n\t</tr>\n";
}
@ -2077,7 +2078,7 @@ function display_agenda_items()
echo '<tr>';
// highlight: if a date in the small calendar is clicked we highlight the relevant items
$db_date=(int)date("d",strtotime($myrow["start_date"])).date("n",strtotime($myrow["start_date"])).date("Y",strtotime($myrow["start_date"]));
$db_date = (int)api_format_date($myrow["start_date"], "%d").intval(api_format_date($myrow["start_date"], "%m")).api_format_date($myrow["start_date"], "%Y");
if ($_GET["day"].$_GET["month"].$_GET["year"] <>$db_date)
{
if ($myrow['visibility']=='0')
@ -2103,7 +2104,7 @@ function display_agenda_items()
echo "\t\t<th>\n";
// adding an internal anchor
echo "\t\t\t<a name=\"".(int)date("d",strtotime($myrow["start_date"]))."\"></a>";
echo "\t\t\t<a name=\"".(int)api_format_date($myrow["start_date"], "%d")."\"></a>";
// the icons. If the message is sent to one or more specific users/groups
// we add the groups icon
// 2do: if it is sent to groups we display the group icon, if it is sent to a user we show the user icon
@ -2136,14 +2137,12 @@ function display_agenda_items()
--------------------------------------------------*/
echo "<tr class='row_odd'>";
echo "\t\t<td>".get_lang("StartTimeWindow").": ";
echo api_ucfirst(api_get_local_time($myrow['start_date'], $dateFormatLong, null, date_default_timezone_get()))."&nbsp;&nbsp;&nbsp;";
echo api_ucfirst(api_get_local_time($myrow['start_date'], $timeNoSecFormat, null, date_default_timezone_get()))."";
echo api_ucfirst(api_format_date($myrow['start_date']));
echo "</td>\n";
echo "\t\t<td>";
if ($myrow["end_date"]<>"0000-00-00 00:00:00") {
echo get_lang("EndTimeWindow").": ";
echo api_ucfirst(api_get_local_time($myrow['end_date'], $dateFormatLong, null, date_default_timezone_get()))."&nbsp;&nbsp;&nbsp;";
echo api_ucfirst(api_get_local_time($myrow['end_date'], $timeNoSecFormat, null, date_default_timezone_get()))."";
echo api_ucfirst(api_convert_and_format_date($myrow['end_date'], null, date_default_timezone_get()));
}
echo "</td>\n";
@ -2369,10 +2368,12 @@ function display_one_agenda_item($agenda_id)
DISPLAY : the icon, title, destinees of the item
--------------------------------------------------*/
echo "\t<tr>\n";
$myrow["start_date"] = api_get_local_time($myrow["start_date"], null, date_default_timezone_get());
// highlight: if a date in the small calendar is clicked we highlight the relevant items
$db_date=(int)date("d",strtotime($myrow["start_date"])).date("n",strtotime($myrow["start_date"])).date("Y",strtotime($myrow["start_date"]));
if ($_GET["day"].$_GET["month"].$_GET["year"] <>$db_date)
$db_date = (int)api_format_date($myrow["start_date"], "%d").intval(api_format_date($myrow["start_date"], "%m")).api_format_date($myrow["start_date"], "%Y");
if ($_GET["day"].$_GET["month"].$_GET["year"] <>$db_date)
{
if ($myrow['visibility']=='0')
{
@ -2398,7 +2399,7 @@ function display_one_agenda_item($agenda_id)
echo "\t\t<th>\n";
// adding an internal anchor
echo "\t\t\t<a name=\"".(int)date("d",strtotime($myrow["start_date"]))."\"></a>";
echo "\t\t\t<a name=\"".(int)api_format_date($myrow["start_date"], "%d")."\"></a>";
// the icons. If the message is sent to one or more specific users/groups
// we add the groups icon
@ -2429,12 +2430,10 @@ function display_one_agenda_item($agenda_id)
--------------------------------------------------*/
echo "\t<tr class='row_odd'>\n";
echo "\t\t<td>".get_lang("StartTime").": ";
echo api_ucfirst(api_get_local_time($myrow['start_date'], $dateFormatLong, null, date_default_timezone_get()))."&nbsp;&nbsp;&nbsp;";
echo api_ucfirst(api_get_local_time($myrow['start_date'], $timeNoSecFormat, null, date_default_timezone_get()))."";
echo api_ucfirst(api_format_date($myrow['start_date']));
echo "</td>\n";
echo "\t\t<td>".get_lang("EndTime").": ";
echo api_ucfirst(api_get_local_time($myrow['end_date'], $dateFormatLong, null, date_default_timezone_get()))."&nbsp;&nbsp;&nbsp;";
echo api_ucfirst(api_get_local_time($myrow['end_date'], $timeNoSecFormat, null, date_default_timezone_get()))."";
echo api_ucfirst(api_convert_and_format_date($myrow['end_date'], null, date_default_timezone_get()));
echo "</td>\n";
/*--------------------------------------------------
@ -3114,8 +3113,9 @@ function get_agendaitems($month, $year)
while ($item = Database::fetch_array($result))
{
$agendaday = date('j',strtotime($item['start_date']));
$time = api_get_local_time($item['start_date'], 'H:i', null, date_default_timezone_get());
$agendaday_string = api_convert_and_format_date($item['start_date'], "%d", date_default_timezone_get());
$agendaday = intval($agendaday_string);
$time = api_convert_and_format_date($item['start_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get());
$URL = $root_url.'main/calendar/agenda.php?cidReq='.$mycourse['id']."&amp;day=$agendaday&amp;month=$month&amp;year=$year#$agendaday"; // RH //Patrick Cool: to highlight the relevant agenda item
$items[$agendaday][$item['start_time']] .= '<i>'.$time.'</i> <a href="'.$URL.'" title="'.$mycourse['name'].'">'.$mycourse['official_code'].'</a> '.$item['title'].'<br />';
}
@ -3474,7 +3474,7 @@ function get_day_agendaitems($courses_dbs, $month, $year, $day)
{
// in the display_daycalendar function we use $i (ranging from 0 to 47) for each halfhour
// we want to know for each agenda item for this day to wich halfhour it must be assigned
$item['start_date'] = api_get_local_time($item['start_date'], null, null, date_default_timezone_get());
$item['start_date'] = api_get_local_time($item['start_date'], null, date_default_timezone_get());
list ($datepart, $timepart) = split(" ", $item['start_date']);
list ($year, $month, $day) = explode("-", $datepart);
list ($hours, $minutes, $seconds) = explode(":", $timepart);
@ -3600,8 +3600,9 @@ function get_week_agendaitems($courses_dbs, $month, $year, $week = '')
$result = Database::query($sqlquery);
while ($item = Database::fetch_array($result))
{
$agendaday = date("j",strtotime($item['start_date']));
$time = api_get_local_time($item['start_date'], "H:i", null, date_default_timezone_get());
$agendaday_string = api_convert_and_format_date($item['start_date'], "%d", date_default_timezone_get());
$agendaday = intval($agendaday_string);
$time = api_convert_and_format_date($item['start_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get());
if ($setting_agenda_link == 'coursecode')
{

@ -117,8 +117,8 @@ function get_myagendaitems($courses_dbs, $month, $year)
$agendaday = date("j",strtotime($item['start_date']));
if(!isset($items[$agendaday])){$items[$agendaday]=array();}
$time = api_get_local_time($item['start_date'], "H:i", null, date_default_timezone_get());
$end_time = api_get_local_time($item['end_date'], "H:i", null, date_default_timezone_get());
$time = api_convert_and_format_date($item['start_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get());
$end_time = api_convert_and_format_date($item['end_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get());
$URL = api_get_path(WEB_PATH)."main/calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&amp;day=$agendaday&amp;month=$month&amp;year=$year#$agendaday"; // RH //Patrick Cool: to highlight the relevant agenda item
if ($setting_agenda_link == 'coursecode') {
$title=$array_course_info['title'];

@ -671,8 +671,8 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) {
//last edit date
$last_edit_date=$id['lastedit_date'];
$last_edit_date=api_get_local_time($last_edit_date, null, null, date_default_timezone_get());
$display_date = date_to_str_ago($last_edit_date).'<br><span class="dropbox_date">'.$last_edit_date.'</span>';
$last_edit_date=api_get_local_time($last_edit_date, null, date_default_timezone_get());
$display_date = date_to_str_ago($last_edit_date).'<br><span class="dropbox_date">'.api_format_date($last_edit_date).'</span>';
$row[] = $invisibility_span_open.$display_date.$invisibility_span_close.'<!--uts='.strtotime($last_edit_date).'-->';
//admins get an edit column
@ -811,4 +811,4 @@ if (!empty($table_footer)) {
}
// footer
Display::display_footer();
Display::display_footer();

@ -1168,14 +1168,14 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
}
$sql="SELECT ".(api_is_western_name_order() ? "CONCAT(firstname,' ',lastname)" : "CONCAT(lastname,' ',firstname)")." as users, ce.title, te.exe_result ,
te.exe_weighting, UNIX_TIMESTAMP(te.exe_date), te.exe_id, email, UNIX_TIMESTAMP(te.start_date), steps_counter,cuser.user_id,te.exe_duration
te.exe_weighting, te.exe_date, te.exe_id, email, te.start_date, steps_counter,cuser.user_id,te.exe_duration
FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES 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 $user_id_and $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 users, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";
$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)
tth.exe_result , tth.exe_weighting, tth.exe_date
FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid) . " $user_id_and '
ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC";
@ -1185,13 +1185,13 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
$user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
$sql="SELECT ".(api_is_western_name_order() ? "CONCAT(firstname,' ',lastname)" : "CONCAT(lastname,' ',firstname)")." as users,ce.title, te.exe_result ,
te.exe_weighting, UNIX_TIMESTAMP(te.exe_date), te.exe_id, email, UNIX_TIMESTAMP(te.start_date), steps_counter,cuser.user_id,te.exe_duration, ce.results_disabled
te.exe_weighting, te.exe_date, te.exe_id, email, te.start_date, steps_counter,cuser.user_id,te.exe_duration, ce.results_disabled
FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user,$tbl_course_rel_user AS cuser
WHERE user.user_id=cuser.user_id 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 cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." $user_id_and $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 users, 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['user_id'] . "' AND exe_cours_id = '" . Database :: escape_string($_cid) . "'
ORDER BY exe_cours_id ASC, exe_date DESC";
@ -1248,7 +1248,7 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
$user = $results[$i][0];
$test = $results[$i][1];
$quiz_name_list = $test;
$dt = strftime($dateTimeFormatLong, $results[$i][4]);
$dt = api_convert_and_format_date($results[$i][4], null, date_default_timezone_get());
$res = $results[$i][2];
$duration = intval($results[$i][10]);
@ -1274,14 +1274,16 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
}
//echo '<td>' . $test . '</td>';
//echo '<td>';
if ($results[$i][7] > 1) {
if ($results[$i][7] != "0000-00-00 00:00:00") {
//echo ceil((($results[$i][4] - $results[$i][7]) / 60)) . ' ' . get_lang('MinMinutes');
$duration_list = ceil((($results[$i][4] - $results[$i][7]) / 60)) . ' ' . get_lang('MinMinutes');
$exe_date_timestamp = api_strtotime($results[$i][4], date_default_timezone_get());
$start_date_timestamp = api_strtotime($results[$i][7], date_default_timezone_get());
$duration_list = ceil((($exe_date_timestamp - $start_date_timestamp) / 60)) . ' ' . get_lang('MinMinutes');
if ($results[$i][8] > 1) {
//echo ' ( ' . $results[$i][8] . ' ' . get_lang('Steps') . ' )';
$duration_list = ' ( ' . $results[$i][8] . ' ' . get_lang('Steps') . ' )';
}
$add_start_date = format_locale_date('%b %d, %Y %H:%M', $results[$i][7]) . ' / ';
$add_start_date = api_convert_and_format_date($results[$i][7], null, date_default_timezone_get()) . ' / ';
} else {
$duration_list = get_lang('NoLogOfDuration');
//echo get_lang('NoLogOfDuration');
@ -1289,7 +1291,7 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
//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((int)$results[$i][7], null, null, date_default_timezone_get()). ' / ' . api_get_local_time((int)$results[$i][4], null, null, date_default_timezone_get());
$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??
//echo '<td>'.sprintf(get_lang('DurationFormat'), $duration).'</td>';
@ -1396,7 +1398,7 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
echo '<td class="content">' . $hpresults[$i][0] . '</td>';
}
echo '<td class="content">' . $title . '</td>';
echo '<td class="content">' . strftime($dateTimeFormatLong, $hpresults[$i][4]) . '</td>';
echo '<td class="content">' . api_convert_and_format_date($hpresults[$i][4], null, date_default_timezone_get()) . '</td>';
echo '<td class="content">' . round(($hpresults[$i][2] / ($hpresults[$i][3] != 0 ? $hpresults[$i][3] : 1)) * 100, 2) . '% (' . $hpresults[$i][2] . ' / ' . $hpresults[$i][3] . ')</td>';
echo '<td></td>'; //there is no possibility to edit the results of a Hotpotatoes test
echo '</tr>';

@ -422,7 +422,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'notify' AND isset($_GET['conte
echo "\t\t<td nowrap=\"nowrap\">";
if (!empty($forum['last_post_id'])) {
echo api_get_local_time($forum['last_post_date'], null, null, date_default_timezone_get())."<br /> ".get_lang('By').' '.display_user_link($poster_id, $name);
echo api_convert_and_format_date($forum['last_post_date'], null, date_default_timezone_get())."<br /> ".get_lang('By').' '.display_user_link($poster_id, $name);
}
echo "</td>\n";
echo "\t\t<td nowrap=\"nowrap\" align=\"center\">";

@ -430,19 +430,19 @@ if(is_array($threads)) {
// if the last post is invisible and it is not the teacher who is looking then we have to find the last visible post of the thread
if (($row['visible']=='1' OR api_is_allowed_to_edit(false,true)) && $origin!='learnpath') {
$last_post=api_get_local_time($row['thread_date'], null, null, date_default_timezone_get())." ".get_lang('By').' '.display_user_link($row['last_poster_user_id'], $name);
$last_post=api_convert_and_format_date($row['thread_date'], null, date_default_timezone_get())." ".get_lang('By').' '.display_user_link($row['last_poster_user_id'], $name);
} elseif ($origin!='learnpath') {
$last_post_sql="SELECT post.*, user.firstname, user.lastname FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' ORDER BY post_id DESC";
$last_post_result=Database::query($last_post_sql);
$last_post_row=Database::fetch_array($last_post_result);
$name=api_get_person_name($last_post_row['firstname'], $last_post_row['lastname']);
$last_post=$last_post_row['post_date']." ".get_lang('By').' '.display_user_link($last_post_row['poster_id'], $name);
$last_post=api_convert_and_format_date($last_post_row['post_date'], null, date_default_timezone_get())." ".get_lang('By').' '.display_user_link($last_post_row['poster_id'], $name);
} else {
$last_post_sql="SELECT post.*, user.firstname, user.lastname FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' ORDER BY post_id DESC";
$last_post_result=Database::query($last_post_sql);
$last_post_row=Database::fetch_array($last_post_result);
$name=api_get_person_name($last_post_row['firstname'], $last_post_row['lastname']);
$last_post=$last_post_row['post_date']." ".get_lang('By').' '.$name;
$last_post=api_convert_and_format_date($last_post_row['post_date'], null, date_default_timezone_get())." ".get_lang('By').' '.$name;
}
echo "\t\t<td>".$last_post."</td>\n";

@ -40,7 +40,7 @@ foreach ($rows as $row) {
} else {
echo $name. '<br />';
}
echo api_get_local_time($row['post_date'], null, null, date_default_timezone_get()).'<br /><br />';
echo api_convert_and_format_date($row['post_date'], null, date_default_timezone_get()).'<br /><br />';
// get attach id
$attachment_list=get_attachment($row['post_id']);
$id_attach = !empty($attachment_list)?$attachment_list['id']:'';

@ -52,7 +52,7 @@ foreach ($rows as $post) {
echo '<br />'.display_user_image($post['user_id'],$name,$origin).'<br />';
}
echo display_user_link($post['user_id'], $name, $origin).'<br />';
echo api_get_local_time($post['post_date'], null, null, date_default_timezone_get()).'<br /><br />';
echo api_convert_and_format_date($post['post_date'], null, date_default_timezone_get()).'<br /><br />';
// get attach id
$attachment_list=get_attachment($post['post_id']);
$id_attach = !empty($attachment_list)?$attachment_list['id']:'';
@ -142,4 +142,4 @@ foreach ($rows as $post) {
echo "</table>\n";
echo "</div>";
$count++;
}
}

@ -191,7 +191,7 @@ if ($rows[$display_post_id]['user_id']=='0') {
if (api_get_course_setting('allow_user_image_forum')) {echo '<br />'.display_user_image($rows[$display_post_id]['user_id'],$name, $origin).'<br />'; }
echo display_user_link($rows[$display_post_id]['user_id'], $name, $origin).'<br />';
echo api_get_local_time($rows[$display_post_id]['post_date'], null, null, date_default_timezone_get()).'<br /><br />';
echo api_convert_and_format_date($rows[$display_post_id]['post_date'], null, date_default_timezone_get()).'<br /><br />';
// get attach id
$attachment_list=get_attachment($display_post_id);
$id_attach = !empty($attachment_list)?$attachment_list['id']:'';
@ -316,4 +316,4 @@ echo "</table>";
// Displaying the thread (structure)
// --------------------------------------
echo $thread_structure;
echo $thread_structure;

@ -229,7 +229,7 @@ if ($export_result_form->validate()) {
$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
$pdf->ezSetMargins(30, 30, 50, 30);
$pdf->ezSetY(800);
$pdf->ezText(get_lang('EvaluationName') . ' : ' . $eval[0]->get_name() . ' (' . date('j/n/Y g:i', $eval[0]->get_date()) . ')', 12, array (
$pdf->ezText(get_lang('EvaluationName') . ' : ' . $eval[0]->get_name() . ' (' . api_format_date($eval[0]->get_date(), "%d/%m/%Y %R") . ')', 12, array (
'justification' => 'left'
));
$pdf->ezText(get_lang('Description') . ' : ' . $eval[0]->get_description());
@ -295,7 +295,7 @@ if ($export_result_form->validate()) {
$data['lastname']= $userinfo['lastname'];
$data['firstname']= $userinfo['firstname'];
$data['score']= $result->get_score();
$data['date']= date('Y-n-j g:i', $result->get_date());
$data['date'] = api_convert_and_format_date($result->get_date(), "%d/%m/%Y %R");
$alldata[]= $data;
}
switch ($file_type) {

@ -203,7 +203,7 @@ abstract class AbstractLink implements GradebookItem
$link->set_user_id($data['user_id']);
$link->set_course_code($data['course_code']);
$link->set_category_id($data['category_id']);
$link->set_date($data['date']);
$link->set_date(api_get_local_time($data['date']));
$link->set_weight($data['weight']);
$link->set_visible($data['visible']);
$links[]=$link;
@ -261,12 +261,6 @@ abstract class AbstractLink implements GradebookItem
.', user_id = '.$this->get_user_id()
.", course_code = '".$this->get_course_code()."'"
.', category_id = '.$this->get_category_id();
//.', date = ';
/*if (isset($this->link_date)) {
$sql .= $this->get_date();
} else {
$sql .= 'null';
}*/
$sql .= ', weight = '.$this->get_weight()
.', visible = '.$this->is_visible()
.' WHERE id = '.$this->id;

@ -191,7 +191,7 @@ class Evaluation implements GradebookItem
$eval->set_user_id($data['user_id']);
$eval->set_course_code($data['course_code']);
$eval->set_category_id($data['category_id']);
$eval->set_date($data['date']);
$eval->set_date(api_get_local_time($data['date']));
$eval->set_weight($data['weight']);
$eval->set_max($data['max']);
$eval->set_visible($data['visible']);
@ -291,12 +291,6 @@ class Evaluation implements GradebookItem
} else {
$sql .= 'null';
}
//$sql .= ', date = ';
/*if (isset($this->eval_date)) {
$sql .= $this->get_date();
} else {
$sql .= 'null';
}*/
$sql .= ', weight = '.$this->get_weight()
.', max = '.$this->get_max()
.', visible = '.$this->is_visible()

@ -75,7 +75,7 @@ class DisplayGradebook
}
$evalinfo= '<table width="100%" border="0"><tr><td>';
$evalinfo .= get_lang('EvaluationName') . ' :<b> ' . $evalobj->get_name() . ' </b>(' . date('j/n/Y g:i', $evalobj->get_date()) . ')<br>' . get_lang('Course') . ' :<b> ' . $course . '</b><br>' . get_lang('Weight') . ' :<b> ' . $evalobj->get_weight() . '</b><br>' . get_lang('Max') . ' :<b> ' . $evalobj->get_max() . '</b><br>' . $description . get_lang('Visible') . ' :<b> ' . $visible . '</b><br>' . $average;
$evalinfo .= get_lang('EvaluationName') . ' :<b> ' . $evalobj->get_name() . ' </b>(' . api_format_date($evalobj->get_date(), "%d/%m/%Y %R") . ')<br>' . get_lang('Course') . ' :<b> ' . $course . '</b><br>' . get_lang('Weight') . ' :<b> ' . $evalobj->get_weight() . '</b><br>' . get_lang('Max') . ' :<b> ' . $evalobj->get_max() . '</b><br>' . $description . get_lang('Visible') . ' :<b> ' . $visible . '</b><br>' . $average;
if (!$evalobj->has_results())
$evalinfo .= '<br /><i>' . get_lang('NoResultsInEvaluation') . '</i>';
elseif ($scoredisplay->is_custom() && api_get_self() != '/dokeos/main/gradebook/gradebook_statistics.php')
@ -431,4 +431,4 @@ class DisplayGradebook
//$scoreinfo.= '<br />'.get_lang('Total') . ' : <b>' . $scoretotal_display . '</b>';
Display :: display_normal_message($info,false);
}
}
}

@ -302,7 +302,7 @@ class EvalForm extends FormValidator
*/
protected function build_editing_form() {
$this->setDefaults(array (
'hid_id' => $this->evaluation_object->get_id(), 'name' => $this->evaluation_object->get_name(), 'description' => $this->evaluation_object->get_description(), 'hid_user_id' => $this->evaluation_object->get_user_id(), 'hid_course_code' => $this->evaluation_object->get_course_code(), 'hid_category_id' => $this->evaluation_object->get_category_id(), 'date' => $this->evaluation_object->get_date(), 'weight' => $this->evaluation_object->get_weight(), 'max' => $this->evaluation_object->get_max(), 'visible' => $this->evaluation_object->is_visible()));
'hid_id' => $this->evaluation_object->get_id(), 'name' => $this->evaluation_object->get_name(), 'description' => $this->evaluation_object->get_description(), 'hid_user_id' => $this->evaluation_object->get_user_id(), 'hid_course_code' => $this->evaluation_object->get_course_code(), 'hid_category_id' => $this->evaluation_object->get_category_id(), 'date' => api_strtotime($this->evaluation_object->get_date()), 'weight' => $this->evaluation_object->get_weight(), 'max' => $this->evaluation_object->get_max(), 'visible' => $this->evaluation_object->is_visible()));
$id_current=isset($this->id)?$this->id :null;
$this->addElement('hidden', 'hid_id',$id_current);
$this->build_basic_form(1);

@ -174,10 +174,22 @@ class GradebookDataGenerator
}
function sort_by_date($item1, $item2) {
if ($item1->get_date() == $item2->get_date()) {
if(is_int($item1->get_date())) {
$timestamp1 = $item1->get_date();
} else {
$timestamp1 = api_strtotime($item1->get_date());
}
if(is_int($item2->get_date())) {
$timestamp2 = $item2->get_date();
} else {
$timestamp2 = api_strtotime($item2->get_date());
}
if ($timestamp1 == $timestamp2) {
return $this->sort_by_name($item1,$item2);
} else {
return ($item1->get_date() < $item2->get_date() ? -1 : 1);
return ($timestamp1 < $timestamp2 ? -1 : 1);
}
}
@ -217,7 +229,11 @@ class GradebookDataGenerator
if (!isset($date) || empty($date)) {
return '';
} else {
return api_get_local_time((int)$date, null, null, date_default_timezone_get());
if(is_int($date)) {
return api_convert_and_format_date($date);
} else {
return api_format_date($date);
}
}
}
}

@ -671,7 +671,7 @@ class Attendance
$data = array();
if (Database::num_rows($rs) > 0) {
while ($row = Database::fetch_array($rs)) {
$row['date_time'] = api_get_local_time($row['date_time'], null, null, date_default_timezone_get());
$row['date_time'] = api_get_local_time($row['date_time']);
$data = $row;
}
}

@ -734,8 +734,7 @@ class Blog {
// Prepare data
$blog_post_id = $blog_post['post_id'];
$blog_post_text = make_clickable(stripslashes($blog_post['full_text']));
$blog_post_date = api_get_local_time($blog_post['date_creation'], $dateFormatLong, null, date_default_timezone_get());
$blog_post_time = api_get_local_time($blog_post['date_creation'], 'H:i', null, date_default_timezone_get());
$blog_post_date = api_convert_and_format_date($blog_post['date_creation'], null, date_default_timezone_get());
// Create an introduction text (but keep FULL sentences)
$limit = 100; //nmbr of words in introduction text
@ -769,7 +768,7 @@ class Blog {
echo '<div class="blogpost">'."\n";
echo '<span class="blogpost_title"><a href="blog.php?action=view_post&amp;blog_id=' . $blog_id . '&amp;post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>'."\n";
echo '<span class="blogpost_date"><a href="blog.php?action=view_post&amp;blog_id=' . $blog_id . '&amp;post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . $blog_post_date . ' (' . $blog_post_time . ')</a></span>'."\n";
echo '<span class="blogpost_date"><a href="blog.php?action=view_post&amp;blog_id=' . $blog_id . '&amp;post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . $blog_post_date . '</a></span>'."\n";
echo '<span class="blogpost_introduction" id="blogpost_introduction_' . $blog_post_id . '">' . $introduction_text . $readMoreLink . '</span>'."\n";
echo '<span class="blogpost_text" id="blogpost_text_' . $blog_post_id . '" style="display: none">' . $blog_post_text . '</span>'."\n";
$file_name_array=get_blog_attachment($blog_id,$blog_post_id,0);
@ -873,8 +872,7 @@ class Blog {
// Prepare data
$blog_post_text = make_clickable(stripslashes($blog_post['full_text']));
$blog_post_date = format_locale_date($dateFormatLong,strtotime($blog_post['date_creation']));
$blog_post_time = date('H:m',strtotime($blog_post['date_creation']));
$blog_post_date = api_convert_and_format_date($blog_post['date_creation'], null, date_default_timezone_get());
$blog_post_actions = "";
$task_id = (isset($_GET['task_id']) && is_numeric($_GET['task_id'])) ? intval($_GET['task_id']) : 0;
@ -893,7 +891,7 @@ class Blog {
// Display post
echo '<div class="blogpost">';
echo '<span class="blogpost_title"><a href="blog.php?action=view_post&amp;blog_id=' . $blog_id . '&amp;post_id=' . $blog_post['post_id'] . '" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>';
echo '<span class="blogpost_date">' . $blog_post_date . ' (' . $blog_post_time . ')</span>';
echo '<span class="blogpost_date">' . $blog_post_date . '</span>';
echo '<span class="blogpost_text">' . $blog_post_text . '</span><br />';
$file_name_array=get_blog_attachment($blog_id,$post_id);
@ -1086,8 +1084,7 @@ class Blog {
// Prepare data
$comment_text = make_clickable(stripslashes($comment['comment']));
$blog_comment_date = format_locale_date($dateFormatLong,strtotime($comment['date_creation']));
$blog_comment_time = date('H:i',strtotime($comment['date_creation']));
$blog_comment_date = api_convert_and_format_date($comment['date_creation'], null, date_default_timezone_get());
$blog_comment_actions = "";
if(api_is_allowed('BLOG_' . $blog_id, 'article_comments_delete', $task_id)) { $blog_comment_actions .= '<a href="blog.php?action=view_post&amp;blog_id=' . $blog_id . '&amp;post_id=' . $post_id . '&amp;do=delete_comment&amp;comment_id=' . $comment['comment_id'] . '&amp;task_id=' . $task_id . '" title="' . get_lang('DeleteThisComment') . '" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"><img src="../img/delete.gif" border="0" /></a>'; }
if(api_is_allowed('BLOG_' . $blog_id, 'article_comments_rate')) { $rating_select = Blog::display_rating_form('comment', $blog_id, $post_id, $comment['comment_id']); }
@ -1103,7 +1100,7 @@ class Blog {
$margin = $current_level * 30;
echo '<div class="blogpost_comment" style="margin-left: ' . $margin . 'px;' . $border_color . '">';
echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\'' . $comment['comment_id'] . '\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']) . '\'" title="' . get_lang('ReplyToThisComment') . '" >'.stripslashes($comment['title']) . '</a></span>';
echo '<span class="blogpost_comment_date">' . $blog_comment_date . ' (' . $blog_comment_time . ')</span>';
echo '<span class="blogpost_comment_date">' . $blog_comment_date . '</span>';
echo '<span class="blogpost_text">' . $comment_text . '</span>';
$file_name_array=get_blog_attachment($blog_id,$post_id, $comment['comment_id']);

@ -381,8 +381,8 @@ class GlossaryManager {
}
// Date treatment for timezones
$array[3] = api_get_local_time($array[3], null, null, date_default_timezone_get());
$array[4] = api_get_local_time($array[4], null, null, date_default_timezone_get());
$array[3] = api_get_local_time($array[3], null, date_default_timezone_get());
$array[4] = api_get_local_time($array[4], null, date_default_timezone_get());
$return[] = $array;
}

@ -195,8 +195,8 @@ class NotebookManager
while ($row = Database::fetch_array($result)) {
//validacion when belongs to a session
$session_img = api_get_session_image($row['session_id'], $_user['status']);
$creation_date = api_get_local_time($row['creation_date'], null, null, date_default_timezone_get());
$update_date = api_get_local_time($row['update_date'], null, null, date_default_timezone_get());
$creation_date = api_get_local_time($row['creation_date'], null, date_default_timezone_get());
$update_date = api_get_local_time($row['update_date'], null, date_default_timezone_get());
echo '<div class="sectiontitle">';
echo '<span style="float: right;"> ('.get_lang('CreationDate').': '.date_to_str_ago($creation_date).'&nbsp;&nbsp;<span class="dropbox_date">'.$creation_date.'</span>';
if ($row['update_date'] <> $row['creation_date']) {

@ -118,7 +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, null, date_default_timezone_get());
$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));
}
}
@ -144,7 +144,7 @@ class Tracking {
{
if ($last_login_date = Database::result($rs, 0, 0))
{
$last_login_date = api_get_local_time($last_login_date, null, null, date_default_timezone_get());
$last_login_date = api_get_local_time($last_login_date, null, date_default_timezone_get());
if ($return_timestamp)
{
return strtotime($last_login_date);
@ -200,7 +200,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, null, date_default_timezone_get());
$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));
}
}
@ -231,7 +231,7 @@ class Tracking {
$rs = Database::query($sql);
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, null, date_default_timezone_get());
$last_login_date = api_get_local_time($last_login_date, null, date_default_timezone_get());
$timestamp = strtotime($last_login_date);
$currentTimestamp = mktime();
//If the last connection is > than 7 days, the text is red
@ -1377,7 +1377,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, null, date_default_timezone_get());
$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);
@ -1826,7 +1826,7 @@ class TrackingCourseLog {
$row[1] = get_lang($row[1]);
$row[5] = api_ucfirst(api_get_local_time($row['col5'], $dateTimeFormatLong, null, date_default_timezone_get()));
$row[5] = api_ucfirst(api_convert_and_format_date($row['col5'], null, date_default_timezone_get()));
$row[4] = '';
if ($table_name['table_name'] == 'document') {
@ -2255,7 +2255,7 @@ class TrackingUserLog {
if (is_array($results)) {
for($i = 0; $i < sizeof($results); $i++) {
$display_date = api_get_local_time($results[$i][3], $dateTimeFormatLong, null, date_default_timezone_get());
$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
echo "<tr>\n";
echo "<td class='content'>".$results[$i][0]."</td>\n";
echo "<td class='content'>".$display_date."</td>\n";
@ -2273,7 +2273,7 @@ class TrackingUserLog {
$title = GetQuizName($hpresults[$i][0],'');
if ($title == '')
$title = basename($hpresults[$i][0]);
$display_date = api_get_local_time($hpresults[$i][3], $dateTimeFormatLong, null, date_default_timezone_get());
$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
?>
<tr>
<td class="content"><?php echo $title; ?></td>
@ -2341,9 +2341,7 @@ class TrackingUserLog {
if (is_array($results)) {
for($j = 0 ; $j < count($results) ; $j++) {
$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
$upload_date = api_get_local_time($results[$j][0], null, null, date_default_timezone_get());
$timestamp = strtotime($upload_date);
$beautifulDate = format_locale_date($dateTimeFormatLong,$timestamp);
$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
echo "<tr>";
echo "<td class='content'>"
."<a href ='".$pathToFile."'>".$results[$j][1]."</a>"
@ -2592,7 +2590,7 @@ class TrackingUserLogCSV {
{
for($i = 0; $i < sizeof($results); $i++)
{
$display_date = api_get_local_time($results[$i][3], $dateTimeFormatLong, null, date_default_timezone_get());
$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
$line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n";
}
}
@ -2611,7 +2609,7 @@ class TrackingUserLogCSV {
if ($title == '')
$title = basename($hpresults[$i][0]);
$display_date = api_get_local_time($hpresults[$i][3], $dateTimeFormatLong, null, date_default_timezone_get());
$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
$line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n";
}
@ -2661,9 +2659,7 @@ class TrackingUserLogCSV {
for($j = 0 ; $j < count($results) ; $j++)
{
$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
$upload_date = api_get_local_time($results[$j][0], null, null, date_default_timezone_get());
$timestamp = strtotime($upload_date);
$beautifulDate = format_locale_date($dateTimeFormatLong,$timestamp);
$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
$line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n";
}

@ -82,11 +82,11 @@ class MySpace {
$login_date = $row['login_course_date'];
$logout_date = $row['logout_course_date'];
$login_date = api_get_local_time($login_date, null, null, date_default_timezone_get());
$logout_date = api_get_local_time($logout_date, null, null, date_default_timezone_get());
$login_date = api_get_local_time($login_date, null, date_default_timezone_get());
$logout_date = api_get_local_time($logout_date, null, date_default_timezone_get());
$timestamp_login_date = strtotime($login_date);
$timestamp_logout_date = strtotime($logout_date);
$timestamp_login_date = api_strtotime($login_date);
$timestamp_logout_date = api_strtotime($logout_date);
$connections[] = array('login' => $timestamp_login_date, 'logout' => $timestamp_logout_date);
}
@ -1087,4 +1087,4 @@ class MySpace {
xml_parser_free($parser);
return $users;
}
}
}

@ -1362,7 +1362,7 @@ if ($_GET['action']=='edit')
//check tasks
if (!empty($row['startdate_assig']) && $row['startdate_assig']!='0000-00-00 00:00:00' && time()<strtotime($row['startdate_assig']))
{
$message=get_lang('TheTaskDoesNotBeginUntil').': '.api_get_local_time($row['startdate_assig'], null, null, date_default_timezone_get());
$message=get_lang('TheTaskDoesNotBeginUntil').': '.api_convert_and_format_date($row['startdate_assig'], null, date_default_timezone_get());
Display::display_warning_message($message);
if(!api_is_allowed_to_edit(false,true))
{
@ -1373,7 +1373,7 @@ if ($_GET['action']=='edit')
//
if (!empty($row['enddate_assig']) && $row['enddate_assig']!='0000-00-00 00:00:00' && time()>strtotime($row['enddate_assig']) && $row['enddate_assig']!='0000-00-00 00:00:00' && $row['delayedsubmit']==0)
{
$message=get_lang('TheDeadlineHasBeenCompleted').': '.api_get_local_time($row['enddate_assig'], null, null, date_default_timezone_get());
$message=get_lang('TheDeadlineHasBeenCompleted').': '.api_convert_and_format_date($row['enddate_assig'], null, date_default_timezone_get());
Display::display_warning_message($message);
if(!api_is_allowed_to_edit(false,true))
{
@ -1414,7 +1414,7 @@ if ($_GET['action']=='edit')
}
else
{
$message_task_startdate=api_get_local_time($row['startdate_assig'], null, null, date_default_timezone_get());
$message_task_startdate=api_convert_and_format_date($row['startdate_assig'], null, date_default_timezone_get());
}
if ($row['enddate_assig']=='0000-00-00 00:00:00')
@ -1423,7 +1423,7 @@ if ($_GET['action']=='edit')
}
else
{
$message_task_endate=api_get_local_time($row['enddate_assig'], null, null, date_default_timezone_get());
$message_task_endate=api_convert_and_format_date($row['enddate_assig'], null, date_default_timezone_get());
}
if ($row['delayedsubmit']==0)
@ -1777,7 +1777,7 @@ if ($_GET['action']=='history' or Security::remove_XSS($_POST['HistoryDifference
echo '<a href="'.api_get_self().'?action=showpage&amp;title='.$page.'&amp;view='.$row['id'].'">';
echo '<a href="'.api_get_self().'?cidReq='.$_course[id].'&action=showpage&amp;title='.$page.'&amp;view='.$row['id'].'&group_id='.$group_id.'">';
echo api_get_local_time($row['dtime'], null, null, date_default_timezone_get());
echo api_convert_and_format_date($row['dtime'], null, date_default_timezone_get());
echo '</a>';
echo ' ('.get_lang('Version').' '.$row['version'].')';
echo ' '.get_lang('By').' ';
@ -1976,7 +1976,7 @@ if ($_GET['action']=='recentchanges')
$row = array ();
$row[] = api_get_local_time($obj->dtime, null, null, date_default_timezone_get());
$row[] = api_convert_and_format_date($obj->dtime, null, date_default_timezone_get());
$row[] = $ShowAssignment.$icon_task;
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course[id].'&action=showpage&title='.urlencode($obj->reflink).'&amp;view='.$obj->id.'&group_id='.Security::remove_XSS($_GET['group_id']).'">'.$obj->title.'</a>';
$row[] = $obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy');
@ -2060,7 +2060,7 @@ if ($_GET['action']=='allpages')
$row[] =$ShowAssignment.$icon_task;
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course[id].'&action=showpage&title='.urlencode(Security::remove_XSS($obj->reflink)).'&group_id='.Security::remove_XSS($_GET['group_id']).'">'.Security::remove_XSS($obj->title).'</a>';
$row[] = $obj->user_id <>0 ? '<a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a>' : get_lang('Anonymous').' ('.$obj->user_ip.')';
$row[] = api_get_local_time($obj->dtime, null, null, date_default_timezone_get());
$row[] = api_convert_and_format_date($obj->dtime, null, date_default_timezone_get());
if(api_is_allowed_to_edit(false,true)|| api_is_platform_admin())
{
@ -2102,7 +2102,7 @@ if ($_GET['action']=='discuss')
$sql='SELECT * FROM '.$tbl_wiki.'WHERE reflink="'.html_entity_decode(Database::escape_string(stripslashes(urldecode($page)))).'" AND '.$groupfilter.$condition_session.' ORDER BY id DESC';
$result=Database::query($sql);
$row=Database::fetch_array($result);
$lastversiondate=api_get_local_time($row['dtime'], null, null, date_default_timezone_get());
$lastversiondate=api_convert_and_format_date($row['dtime'], null, date_default_timezone_get());
$lastuserinfo=Database::get_user_info_from_id($row['user_id']);
//select page to discuss
@ -2385,7 +2385,7 @@ if ($_GET['action']=='discuss')
echo '<p><table>';
echo '<tr>';
echo '<td rowspan="2">'.$author_photo.'</td>';
echo '<td style=" color:#999999"><a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a> ('.$author_status.') '.api_get_local_time($row['dtime'], null, null, date_default_timezone_get()).' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.' </td>';
echo '<td style=" color:#999999"><a href="../user/userInfo.php?uInfo='.$userinfo['user_id'].'">'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'</a> ('.$author_status.') '.api_convert_and_format_date($row['dtime'], null, date_default_timezone_get()).' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.' </td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.$row['comment'].'</td>';

@ -694,7 +694,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
if ($direc_date != '' && $direc_date != '0000-00-00 00:00:00') {
$direc_date_local = api_get_local_time($direc_date, null, date_default_timezone_get());
$row[] = date_to_str_ago($direc_date_local).'<br /><span class="dropbox_date">'.api_format_date($direc_date_local).'</span>'.'<!--uts='.strtotime($direc_date).'-->';
$row[] = date_to_str_ago($direc_date_local).'<br /><span class="dropbox_date">'.api_format_date($direc_date_local).'</span>'.'<!--uts='.api_strtotime($direc_date_local).'-->';
} else {
$row[] = '';
}
@ -755,7 +755,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$row[] = display_user_link_work($row2['insert_user_id'], $work->author).$qualification_string; // $work->author;
$work_sent_date_local = api_get_local_time($work->sent_date, null, date_default_timezone_get());
$row[] = date_to_str_ago($work_sent_date_local).$add_string.'<br /><span class="dropbox_date">'.api_format_date($work_sent_date_local).'</span>'.'<!--uts='.strtotime($work_sent_date).'-->';
$row[] = date_to_str_ago($work_sent_date_local).$add_string.'<br /><span class="dropbox_date">'.api_format_date($work_sent_date_local).'</span>'.'<!--uts='.api_strtotime($work_sent_date_local).'-->';
if ($is_allowed_to_edit) {

@ -1117,11 +1117,9 @@ if ($is_special > 0) {
define('ASSIGNMENT_EXPIRES', $time_expires);
}
$ends_on_datetime = api_get_local_time($homework['ends_on'], null, date_default_timezone_get());
$ends_on = api_format_date($ends_on_datetime);
$ends_on = api_convert_and_format_date($homework['ends_on'], null, date_default_timezone_get());
$expires_on_datetime = api_get_local_time($homework['expires_on'], null, date_default_timezone_get());
$expires_on = api_format_date($expires_on_datetime);
$expires_on = api_convert_and_format_date($homework['expires_on'], null, date_default_timezone_get());
if ($has_ended) {
display_action_links($cur_dir_path, $always_show_tool_options, true);

Loading…
Cancel
Save