]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15262 fixing previous incorrect merging
authorskodak <skodak>
Wed, 26 Nov 2008 09:05:04 +0000 (09:05 +0000)
committerskodak <skodak>
Wed, 26 Nov 2008 09:05:04 +0000 (09:05 +0000)
course/edit_form.php

index 93d412ba940dbc72f05a63b9b055990e038c641b..627b9a0190e20308494fc7b79f89c17f8739aef8 100644 (file)
@@ -75,9 +75,16 @@ class course_edit_form extends moodleform {
         $mform->setDefault('category', $courseconfig->category);
         $mform->setType('category', PARAM_INT);
 
-        $mform->addElement('text','fullname', get_string('fullname'),'maxlength="254" size="50"');
-        $mform->setHelpButton('fullname', array('coursefullname', get_string('fullname')), true);
-        $mform->setDefault('fullname', get_string('defaultcoursefullname'));
+        $fullname  = get_string('defaultcoursefullname');
+        $shortname = get_string('defaultcourseshortname');
+        while ($DB->record_exists('course', array('fullname'=>$fullname))
+            or $DB->record_exists('course', array('fullname'=>$fullname))) {
+            $fullname++;
+            $shortname++;
+        }
+
+        $mform->addElement('text','fullname', get_string('fullnamecourse'),'maxlength="254" size="50"');
+        $mform->setHelpButton('fullname', array('coursefullname', get_string('fullnamecourse')), true);
         $mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
         $mform->setType('fullname', PARAM_MULTILANG);
         if ($course and !has_capability('moodle/course:changefullname', $coursecontext)) {
@@ -85,9 +92,10 @@ class course_edit_form extends moodleform {
             $mform->setConstant('fullname', $course->fullname);
         }
 
-        $mform->addElement('text','shortname', get_string('shortname'),'maxlength="100" size="20"');
-        $mform->setHelpButton('shortname', array('courseshortname', get_string('shortname')), true);
-        $mform->setDefault('shortname', get_string('defaultcourseshortname'));
+        $mform->setDefault('fullname', $fullname);
+
+        $mform->addElement('text','shortname', get_string('shortnamecourse'),'maxlength="100" size="20"');
+        $mform->setHelpButton('shortname', array('courseshortname', get_string('shortnamecourse')), true);
         $mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
         $mform->setType('shortname', PARAM_MULTILANG);
         if ($course and !has_capability('moodle/course:changeshortname', $coursecontext)) {
@@ -95,6 +103,8 @@ class course_edit_form extends moodleform {
             $mform->setConstant('shortname', $course->shortname);
         }
 
+        $mform->setDefault('shortname', $shortname);
+
         $mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100"  size="10"');
         $mform->setHelpButton('idnumber', array('courseidnumber', get_string('idnumbercourse')), true);
         $mform->setType('idnumber', PARAM_RAW);