mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-78742 tool_uploadcourse: configure show activity dates value.
This commit is contained in:
parent
272fdb321a
commit
5f35d838d1
@ -101,7 +101,7 @@ class tool_uploadcourse_course {
|
|||||||
/** @var array fields allowed as course data. */
|
/** @var array fields allowed as course data. */
|
||||||
static protected $validfields = array('fullname', 'shortname', 'idnumber', 'category', 'visible', 'startdate', 'enddate',
|
static protected $validfields = array('fullname', 'shortname', 'idnumber', 'category', 'visible', 'startdate', 'enddate',
|
||||||
'summary', 'format', 'theme', 'lang', 'newsitems', 'showgrades', 'showreports', 'legacyfiles', 'maxbytes',
|
'summary', 'format', 'theme', 'lang', 'newsitems', 'showgrades', 'showreports', 'legacyfiles', 'maxbytes',
|
||||||
'groupmode', 'groupmodeforce', 'enablecompletion', 'downloadcontent');
|
'groupmode', 'groupmodeforce', 'enablecompletion', 'downloadcontent', 'showactivitydates');
|
||||||
|
|
||||||
/** @var array fields required on course creation. */
|
/** @var array fields required on course creation. */
|
||||||
static protected $mandatoryfields = array('fullname', 'category');
|
static protected $mandatoryfields = array('fullname', 'category');
|
||||||
|
@ -192,6 +192,10 @@ class tool_uploadcourse_step2_form extends tool_uploadcourse_base_form {
|
|||||||
$mform->addHelpButton('defaults[enablecompletion]', 'enablecompletion', 'completion');
|
$mform->addHelpButton('defaults[enablecompletion]', 'enablecompletion', 'completion');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mform->addElement('selectyesno', 'defaults[showactivitydates]', get_string('showactivitydates'));
|
||||||
|
$mform->addHelpButton('defaults[showactivitydates]', 'showactivitydates');
|
||||||
|
$mform->setDefault('defaults[showactivitydates]', $courseconfig->showactivitydates);
|
||||||
|
|
||||||
// Add custom fields to the form.
|
// Add custom fields to the form.
|
||||||
$handler = \core_course\customfield\course_handler::create();
|
$handler = \core_course\customfield\course_handler::create();
|
||||||
$handler->instance_form_definition($mform, 0, 'defaultvaluescustomfieldcategory', 'tool_uploadcourse');
|
$handler->instance_form_definition($mform, 0, 'defaultvaluescustomfieldcategory', 'tool_uploadcourse');
|
||||||
|
@ -166,6 +166,7 @@ $defaults['groupmodeforce'] = $courseconfig->groupmodeforce;
|
|||||||
$defaults['visible'] = $courseconfig->visible;
|
$defaults['visible'] = $courseconfig->visible;
|
||||||
$defaults['lang'] = $courseconfig->lang;
|
$defaults['lang'] = $courseconfig->lang;
|
||||||
$defaults['enablecompletion'] = $courseconfig->enablecompletion;
|
$defaults['enablecompletion'] = $courseconfig->enablecompletion;
|
||||||
|
$defaults['showactivitydates'] = $courseconfig->showactivitydates;
|
||||||
|
|
||||||
// Course template.
|
// Course template.
|
||||||
if (isset($options['templatecourse'])) {
|
if (isset($options['templatecourse'])) {
|
||||||
|
@ -425,6 +425,7 @@ class course_test extends \advanced_testcase {
|
|||||||
'groupmode' => '2',
|
'groupmode' => '2',
|
||||||
'groupmodeforce' => '1',
|
'groupmodeforce' => '1',
|
||||||
'enablecompletion' => '1',
|
'enablecompletion' => '1',
|
||||||
|
'showactivitydates' => '1',
|
||||||
'tags' => 'Cat, Dog',
|
'tags' => 'Cat, Dog',
|
||||||
|
|
||||||
'role_teacher' => 'Knight',
|
'role_teacher' => 'Knight',
|
||||||
@ -478,6 +479,7 @@ class course_test extends \advanced_testcase {
|
|||||||
$this->assertEquals($data['groupmode'], $course->groupmode);
|
$this->assertEquals($data['groupmode'], $course->groupmode);
|
||||||
$this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
|
$this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
|
||||||
$this->assertEquals($data['enablecompletion'], $course->enablecompletion);
|
$this->assertEquals($data['enablecompletion'], $course->enablecompletion);
|
||||||
|
$this->assertEquals($data['showactivitydates'], $course->showactivitydates);
|
||||||
$this->assertEquals($data['tags'], join(', ', \core_tag_tag::get_item_tags_array('core', 'course', $course->id)));
|
$this->assertEquals($data['tags'], join(', ', \core_tag_tag::get_item_tags_array('core', 'course', $course->id)));
|
||||||
|
|
||||||
// Roles.
|
// Roles.
|
||||||
@ -530,6 +532,7 @@ class course_test extends \advanced_testcase {
|
|||||||
'groupmode' => '1',
|
'groupmode' => '1',
|
||||||
'groupmodeforce' => '0',
|
'groupmodeforce' => '0',
|
||||||
'enablecompletion' => '0',
|
'enablecompletion' => '0',
|
||||||
|
'showactivitydates' => '0',
|
||||||
|
|
||||||
'role_teacher' => 'Teacher',
|
'role_teacher' => 'Teacher',
|
||||||
'role_manager' => 'Manager',
|
'role_manager' => 'Manager',
|
||||||
@ -583,6 +586,7 @@ class course_test extends \advanced_testcase {
|
|||||||
$this->assertEquals($data['groupmode'], $course->groupmode);
|
$this->assertEquals($data['groupmode'], $course->groupmode);
|
||||||
$this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
|
$this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
|
||||||
$this->assertEquals($data['enablecompletion'], $course->enablecompletion);
|
$this->assertEquals($data['enablecompletion'], $course->enablecompletion);
|
||||||
|
$this->assertEquals($data['showactivitydates'], $course->showactivitydates);
|
||||||
|
|
||||||
// Roles.
|
// Roles.
|
||||||
$roleids = array();
|
$roleids = array();
|
||||||
@ -644,6 +648,7 @@ class course_test extends \advanced_testcase {
|
|||||||
'groupmode' => '2',
|
'groupmode' => '2',
|
||||||
'groupmodeforce' => '1',
|
'groupmodeforce' => '1',
|
||||||
'enablecompletion' => '1',
|
'enablecompletion' => '1',
|
||||||
|
'showactivitydates' => '1',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse($DB->record_exists('course', array('shortname' => 'c1')));
|
$this->assertFalse($DB->record_exists('course', array('shortname' => 'c1')));
|
||||||
@ -673,6 +678,7 @@ class course_test extends \advanced_testcase {
|
|||||||
$this->assertEquals($defaultdata['groupmode'], $course->groupmode);
|
$this->assertEquals($defaultdata['groupmode'], $course->groupmode);
|
||||||
$this->assertEquals($defaultdata['groupmodeforce'], $course->groupmodeforce);
|
$this->assertEquals($defaultdata['groupmodeforce'], $course->groupmodeforce);
|
||||||
$this->assertEquals($defaultdata['enablecompletion'], $course->enablecompletion);
|
$this->assertEquals($defaultdata['enablecompletion'], $course->enablecompletion);
|
||||||
|
$this->assertEquals($defaultdata['showactivitydates'], $course->showactivitydates);
|
||||||
|
|
||||||
// Update.
|
// Update.
|
||||||
$cat = $this->getDataGenerator()->create_category();
|
$cat = $this->getDataGenerator()->create_category();
|
||||||
@ -701,6 +707,7 @@ class course_test extends \advanced_testcase {
|
|||||||
'groupmode' => '1',
|
'groupmode' => '1',
|
||||||
'groupmodeforce' => '0',
|
'groupmodeforce' => '0',
|
||||||
'enablecompletion' => '0',
|
'enablecompletion' => '0',
|
||||||
|
'showactivitydates' => '0',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue($DB->record_exists('course', array('shortname' => 'c1')));
|
$this->assertTrue($DB->record_exists('course', array('shortname' => 'c1')));
|
||||||
@ -730,6 +737,7 @@ class course_test extends \advanced_testcase {
|
|||||||
$this->assertEquals($defaultdata['groupmode'], $course->groupmode);
|
$this->assertEquals($defaultdata['groupmode'], $course->groupmode);
|
||||||
$this->assertEquals($defaultdata['groupmodeforce'], $course->groupmodeforce);
|
$this->assertEquals($defaultdata['groupmodeforce'], $course->groupmodeforce);
|
||||||
$this->assertEquals($defaultdata['enablecompletion'], $course->enablecompletion);
|
$this->assertEquals($defaultdata['enablecompletion'], $course->enablecompletion);
|
||||||
|
$this->assertEquals($defaultdata['showactivitydates'], $course->showactivitydates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_rename() {
|
public function test_rename() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user