edit_form.php 課程編輯

  1. 課程顯示方式,只開放週曆及主題兩種方式。
    [root@moodle html]# diff -urNwbBE moodle/course/edit_form.php moodle23/course/edit_form.php 
    --- moodle/course/edit_form.php	2012-07-13 08:04:39.000000000 +0800
    +++ moodle23/course/edit_form.php	2014-03-25 10:44:11.747969393 +0800
    @@ -114,8 +114,10 @@
             $courseformats = get_plugin_list('format');
             $formcourseformats = array();
             foreach ($courseformats as $courseformat => $formatdir) {
    +			if ( $courseformat == "topics" or $courseformat == "weeks" ) { //dywang
                 $formcourseformats[$courseformat] = get_string('pluginname', "format_$courseformat");
             }
    +        }
             $mform->addElement('select', 'format', get_string('format'), $formcourseformats);
             $mform->addHelpButton('format', 'format');
             $mform->setDefault('format', $courseconfig->format);
    
  2. 限制課程全名、簡稱、編號,不開放讓老師更動,可由角色權限定義,但課程開始日期,則無此權限設定,所以利用是否可變更課程全名權限,一併限制開學日期的更動。
    @@ -135,6 +137,10 @@
             $mform->addElement('date_selector', 'startdate', get_string('startdate'));
             $mform->addHelpButton('startdate', 'startdate');
             $mform->setDefault('startdate', time() + 3600 * 24);
    +        if (!empty($course->id) and !has_capability('moodle/course:changefullname', $coursecontext)) { //dywang
    +            $mform->hardFreeze('startdate');
    +            $mform->setConstant('startdate', $course->startdate );
    +        } 
     
             $choices = array();
             $choices['0'] = get_string('hiddensectionscollapsed');
    
  3. course/edit_form.php 第 239 到 293 行包含語言選擇及角色更名,系統暫時不開放,都先註解程式。
    @@ -233,7 +239,7 @@
                 }
             }
     
    -//--------------------------------------------------------------------------------
    +/*/-------------------------------------------------------------------------------//dywang
             $mform->addElement('header',”, get_string('language'));
     
             $languages=array();
    @@ -284,7 +290,7 @@
                 }
             }
     
    -//--------------------------------------------------------------------------------
    +*///dywang--------------------------------------------------------------------------------
             $this->add_action_buttons();
     //--------------------------------------------------------------------------------
             $mform->addElement('hidden', 'id', null);