next up previous contents
Next: edit_entry_handler.php 程式修改 Up: Timetable 課表 Previous: import.php 程式修改   Contents

config.inc.php 程式修改

  1. 修改區塊模組設定週期為第 1 節至第 E 節,而非 period 1 ...等,且固定區域顯示格式為 select,area_list_format = "select"
    [root@moodle mod_tmp]# diff -urNwbBE mrbs/web/config.inc.php ../blocks/mrbs/web/config.inc.php
    --- mrbs/web/config.inc.php	2012-10-21 19:24:42.000000000 +0800
    +++ ../blocks/mrbs/web/config.inc.php	2013-02-25 13:15:17.000000000 +0800
    @@ -106,18 +106,21 @@
     // Moodle HACK
     
     if (!isset($cfg_mrbs->periods) or empty($cfg_mrbs->periods)) {
    -    $periods[] = "Period 1";
    -    $periods[] = "Period 2";
    -    $periods[] = "Period 3";
    -    $periods[] = "Period 4";
    -    $periods[] = "Period 5";
    -    $periods[] = "Period 6";
    -    $periods[] = "Period 7";
    -    $periods[] = "Period 8";
    -    $periods[] = "Period 9";
    -    $periods[] = "Period 10";
    -    $periods[] = "Period 11";
    -    $periods[] = "Period 12";
    +    $periods[] = "第1節";
    +    $periods[] = "第2節";
    +    $periods[] = "第3節";
    +    $periods[] = "第4節";
    +    $periods[] = "中午";
    +    $periods[] = "第5節";
    +    $periods[] = "第6節";
    +    $periods[] = "第7節";
    +    $periods[] = "第8節";
    +    $periods[] = "第9節";
    +    $periods[] = "第A節";
    +    $periods[] = "第B節";
    +    $periods[] = "第C節";
    +    $periods[] = "第D節";
    +    $periods[] = "第E節";
     } else {
         $pds = explode("\n", $cfg_mrbs->periods);
         foreach ($pds as $pd) {
    @@ -156,7 +159,8 @@
     //$refresh_rate = $cfg_mrbs->refresh_rate;
     
     # should areas be shown as a list or a drop-down select box?
    -$area_list_format = $cfg_mrbs->area_list_format;
    +$area_list_format = "select";
     
     # Entries in monthly view can be shown as start/end slot, brief description or
     # both. Set to "description" for brief description, "slot" for time slot and
    
  2. 課表若以「時間」顯示,表格會出現 8:00, 9:00 等每小時一格方式顯示。但這不符合學校課表作息,修改成以「週期」顯示後,雖然不會出現時間訊息,但課表匯入時還是必須符合週期時間。也就是每天第一週期的起始、最後一週期結束時間、每一週期時間間隔,此設定在程式 web/week.php,以下設定為起始及結束時間皆為 12:00,以「分」為間隔,故可以有 60 個週期,並以 0 分開始。
    [root@moodle mrbs]# grep '$format = \"Gi\"' web/week.php -A8
    $format = "Gi";
    if( $enable_periods ) {
        $format = "i";
        $resolution = 60;
        $morningstarts = 12;
        $morningstarts_minutes = 0;
        $eveningends = 12;
        $eveningends_minutes = count($periods)-1;
    }
    .....
    .....
    // Define the start and end of each day of the week in a way which is not
    // affected by daylight saving...
    for ($j = 0; $j<=($num_of_days-1); $j++) {
        // are we entering or leaving daylight saving
        // dst_change:
        // -1 => no change
        //  0 => entering DST
        //  1 => leaving DST
        $dst_change[$j] = is_dst($month,$day+$j,$year);
        $am7[$j]=mktime($morningstarts,$morningstarts_minutes,0,$month,$day+$j,$year,is_dst($month,$day+$j,$year,$morningstarts));
        $pm7[$j]=mktime($eveningends,$eveningends_minutes,0,$month,$day+$j,$year,is_dst($month,$day+$j,$year,$eveningends));
    }
    



2017-08-04