next up previous contents
Next: 未完成事項 Up: Timetable 課表 Previous: zh_tw/block_mrbs.php 程式修改   Contents

view_entry.php 程式修改

  1. MRBS 修改成 timetable 後,一般用戶不能再瀏覽其他用戶的課表,如果是自己建立的課表或是管理者,就直接進入編輯頁面,否則就直接 return,不再顯示課表內容。
    [root@moodle mod_tmp]# diff -uNwB mrbs/web/view_entry.php ../blocks/mrbs/web/view_entry.php 
    --- mrbs/web/view_entry.php	2012-10-21 19:24:42.000000000 +0800
    +++ ../blocks/mrbs/web/view_entry.php	2014-09-23 10:30:29.222906144 +0800
    @@ -36,7 +36,7 @@
     
     //if the booking belongs to the user looking at it, they probably want to edit it
     if($record=$DB->get_record('block_mrbs_entry',array('id'=>$id))) {
    -    if(strtolower($record->create_by)==strtolower($USER->username)) {
    +    if(if($record->room_id ==  $USER->id or authGetUserLevel($USER->id) == 2) {
             $redirect = true;
             if (has_capability('block/mrbs:editmrbsunconfirmed', $context, null, false)) {
                 if ($USER->email != $DB->get_field('block_mrbs_room', 'room_admin_email', array('id'=>$record->room_id))) {
    @@ -49,6 +49,7 @@
                 redirect(new moodle_url('/blocks/mrbs/web/edit_entry.php', array('id'=>$id)));
             }
         }
    +	else {return;}
     }
     
     //If we dont know the right date then make it up
    



2017-08-04