Ignore:
Timestamp:
May 2, 2016, 12:09:23 PM (3 years ago)
Author:
jrpelegrina
Message:

Updated to moodle 3.0.3

Location:
moodle/trunk/fuentes/calendar/type/gregorian
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • moodle/trunk/fuentes/calendar/type/gregorian/classes/structure.php

    r136 r1331  
    6969        $months = array();
    7070
     71        $date = new \DateTime('@1263556800');
     72        $date->setTimezone(new \DateTimeZone('UTC'));
    7173        for ($i = 1; $i <= 12; $i++) {
    72             $months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), '%B');
     74            $date->setDate(2000, $i, 15);
     75            $months[$i] = userdate($date->getTimestamp(), '%B', 'UTC');
    7376        }
    7477
     
    321324        }
    322325
    323         // Add daylight saving offset for string timezones only, as we can't get dst for
    324         // float values. if timezone is 99 (user default timezone), then try update dst.
    325         if ((99 == $timezone) || !is_numeric($timezone)) {
    326             $time += dst_offset_on($time, $timezone);
    327         }
    328 
    329         $timezone = get_user_timezone_offset($timezone);
    330 
    331         // If we are running under Windows convert to windows encoding and then back to UTF-8
    332         // (because it's impossible to specify UTF-8 to fetch locale info in Win32).
    333         if (abs($timezone) > 13) { // Server time.
    334             $datestring = date_format_string($time, $format, $timezone);
    335             if ($fixday) {
    336                 $daystring  = ltrim(str_replace(array(' 0', ' '), '', strftime(' %d', $time)));
    337                 $datestring = str_replace('DD', $daystring, $datestring);
    338             }
    339             if ($fixhour) {
    340                 $hourstring = ltrim(str_replace(array(' 0', ' '), '', strftime(' %I', $time)));
    341                 $datestring = str_replace('HH', $hourstring, $datestring);
    342             }
    343         } else {
    344             $time += (int)($timezone * 3600);
    345             $datestring = date_format_string($time, $format, $timezone);
    346             if ($fixday) {
    347                 $daystring  = ltrim(str_replace(array(' 0', ' '), '', gmstrftime(' %d', $time)));
    348                 $datestring = str_replace('DD', $daystring, $datestring);
    349             }
    350             if ($fixhour) {
    351                 $hourstring = ltrim(str_replace(array(' 0', ' '), '', gmstrftime(' %I', $time)));
    352                 $datestring = str_replace('HH', $hourstring, $datestring);
    353             }
    354         }
     326        $time = (int)$time; // Moodle allows rubbish in input...
     327        $datestring = date_format_string($time, $format, $timezone);
     328
     329        date_default_timezone_set(\core_date::get_user_timezone($timezone));
     330
     331        if ($fixday) {
     332            $daystring  = ltrim(str_replace(array(' 0', ' '), '', strftime(' %d', $time)));
     333            $datestring = str_replace('DD', $daystring, $datestring);
     334        }
     335        if ($fixhour) {
     336            $hourstring = ltrim(str_replace(array(' 0', ' '), '', strftime(' %I', $time)));
     337            $datestring = str_replace('HH', $hourstring, $datestring);
     338        }
     339
     340        \core_date::set_default_server_timezone();
    355341
    356342        return $datestring;
  • moodle/trunk/fuentes/calendar/type/gregorian/version.php

    r136 r1331  
    2525defined('MOODLE_INTERNAL') || die();
    2626
    27 $plugin->version   = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
    28 $plugin->requires  = 2014110400; // Requires this Moodle version.
     27$plugin->version   = 2015111600; // The current plugin version (Date: YYYYMMDDXX).
     28$plugin->requires  = 2015111000; // Requires this Moodle version.
    2929$plugin->component = 'calendartype_gregorian'; // Full name of the plugin (used for diagnostics).
Note: See TracChangeset for help on using the changeset viewer.