예제 #1
0
 /**
 * Context is an array with these keys:
 *   isExpanded          an array of absolute dir names mapped to booleans
 */
 function display($context)
 {
     echo $this->pageHeader("View & download files", "files");
     $list = listRecursive($_SESSION['dataDir']);
     $list = sortFilesAlpha($list);
     $this->displayDownloadForm($list, $context['isExpanded']);
     echo $this->pageFooter();
 }
예제 #2
0
 function displayAllFiles($context)
 {
     echo "<h5 class='welcome'>Popular Downloads (<a href='" . makeEventURL('onCall', 'file_browser.php') . "'>all downloads</a>)</h5>\n";
     echo "<div class='indent'>\n";
     $list = listRecursive($_SESSION['dataDir']);
     unset($list[MP_DIR_SYSTEM]);
     unset($list[MP_DIR_WORK]);
     unset($list[MP_DIR_RAWDATA]);
     $list = sortFilesAlpha($list);
     $this->displayDownloadForm($list, $context['isExpanded']);
     echo "</div>\n";
     // end indent
 }
예제 #3
0
파일: core.php 프로젝트: smlewis/MolProbity
/**
* The original $list is not modified.
* Directories and files are sorted separately -- directories always come first.
*/
function sortFilesAlpha($list)
{
    $d = array();
    // dirs
    $f = array();
    // files
    foreach ($list as $key => $val) {
        if (is_array($val)) {
            $d[$key] = sortFilesAlpha($val);
        } else {
            $f[$key] = $val;
        }
    }
    ksort($d);
    ksort($f);
    return array_merge($d, $f);
    // This version mixes files and directories
    /*foreach($list as $el)
        {
            if(is_array($el))
                $el = sortFilesAlpha($el);
        }
        ksort($list);
    
        return $list;*/
}