Merge branch 'MDL-43648_m35v2' of https://github.com/sbourget/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 9 Jan 2018 03:43:33 +0000 (11:43 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 9 Jan 2018 03:43:33 +0000 (11:43 +0800)
1  2 
course/edit_form.php

diff --combined course/edit_form.php
@@@ -88,7 -88,7 +88,7 @@@ class course_edit_form extends moodlefo
              }
          } else {
              if (has_capability('moodle/course:changecategory', $coursecontext)) {
 -                $displaylist = coursecat::make_categories_list('moodle/course:create');
 +                $displaylist = coursecat::make_categories_list('moodle/course:changecategory');
                  if (!isset($displaylist[$course->category])) {
                      //always keep current
                      $displaylist[$course->category] = coursecat::get($course->category, MUST_EXIST, true)->get_formatted_name();
                  $mform->setConstant('visible', $courseconfig->visible);
              }
          }
-         $mform->addElement('date_selector', 'startdate', get_string('startdate'));
+         $mform->addElement('date_time_selector', 'startdate', get_string('startdate'));
          $mform->addHelpButton('startdate', 'startdate');
-         $mform->setDefault('startdate', time() + 3600 * 24);
+         $date = (new DateTime())->setTimestamp(usergetmidnight(time()));
+         $date->modify('+1 day');
+         $mform->setDefault('startdate', $date->getTimestamp());
  
-         $mform->addElement('date_selector', 'enddate', get_string('enddate'), array('optional' => true));
+         $mform->addElement('date_time_selector', 'enddate', get_string('enddate'), array('optional' => true));
          $mform->addHelpButton('enddate', 'enddate');
  
          $mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100"  size="10"');