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

Updated to moodle 3.0.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • moodle/trunk/fuentes/enrol/manual/manage.php

    r136 r1331  
    2929$roleid       = optional_param('roleid', -1, PARAM_INT);
    3030$extendperiod = optional_param('extendperiod', 0, PARAM_INT);
    31 $extendbase   = optional_param('extendbase', 3, PARAM_INT);
     31$extendbase   = optional_param('extendbase', 0, PARAM_INT);
    3232
    3333$instance = $DB->get_record('enrol', array('id'=>$enrolid, 'enrol'=>'manual'), '*', MUST_EXIST);
     
    8484    $periodmenu[$seconds] = get_string('numdays', '', $i);
    8585}
    86 // Work out the apropriate default setting.
     86// Work out the apropriate default settings.
    8787if ($extendperiod) {
    8888    $defaultperiod = $extendperiod;
     
    9090    $defaultperiod = $instance->enrolperiod;
    9191}
     92if (empty($extendbase)) {
     93    if (!$extendbase = get_config('enrol_manual', 'enrolstart')) {
     94        // Default to now if there is no system setting.
     95        $extendbase = 4;
     96    }
     97}
    9298
    9399// Build the list of options for the starting from dropdown.
    94 $timeformat = get_string('strftimedatefullshort');
    95 $today = time();
    96 $today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
     100$now = time();
     101$today = make_timestamp(date('Y', $now), date('m', $now), date('d', $now), 0, 0, 0);
     102$dateformat = get_string('strftimedatefullshort');
    97103
    98104// Enrolment start.
    99105$basemenu = array();
    100106if ($course->startdate > 0) {
    101     $basemenu[2] = get_string('coursestart') . ' (' . userdate($course->startdate, $timeformat) . ')';
    102 }
    103 $basemenu[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ;
     107    $basemenu[2] = get_string('coursestart') . ' (' . userdate($course->startdate, $dateformat) . ')';
     108}
     109$basemenu[3] = get_string('today') . ' (' . userdate($today, $dateformat) . ')';
     110$basemenu[4] = get_string('now', 'enrol_manual') . ' (' . userdate($now, get_string('strftimedatetimeshort')) . ')';
    104111
    105112// Process add and removes.
     
    111118                case 2:
    112119                    $timestart = $course->startdate;
     120                    break;
     121                case 4:
     122                    // We mimic get_enrolled_sql round(time(), -2) but always floor as we want users to always access their
     123                    // courses once they are enrolled.
     124                    $timestart = intval(substr($now, 0, 8) . '00') - 1;
    113125                    break;
    114126                case 3:
Note: See TracChangeset for help on using the changeset viewer.