目錄檔案瀏覧

  1. moodle 2.3 版中的目錄檔案瀏覧,使用者無法更動其排序方式,預設順序為 sortorder, itemid, filepath, filename,增加以修改時間遞減 timemodified DESC 優先排列。
    [root@dywang moodle23]# diff -uN ../moodle23.bak/lib/filestorage/file_storage.php lib/filestorage/file_storage.php 
    --- ../moodle23.bak/lib/filestorage/file_storage.php	2012-07-06 08:44:15.000000000 +0800
    +++ lib/filestorage/file_storage.php	2017-08-04 09:15:06.024609587 +0800
    @@ -443,7 +443,7 @@
          */
         public function get_area_tree($contextid, $component, $filearea, $itemid) {
             $result = array('dirname'=>”, 'dirfile'=>null, 'subdirs'=>array(), 'files'=>array());
    -        $files = $this->get_area_files($contextid, $component, $filearea, $itemid, "sortorder, itemid, filepath, filename", true);
    +        $files = $this->get_area_files($contextid, $component, $filearea, $itemid, "timemodified DESC, sortorder, itemid, filepath, filename", true);
             // first create directory structure
             foreach ($files as $hash=>$dir) {
                 if (!$dir->is_directory()) {