api/controller/vendor.controller.php
/**
 * 
 * TRACKING - parse array
 * with directories and files
 * to html
 * 
 */
parse array
with directories and files
to html
parse array with directories and files to html
function arrayToTree($a){
    $s = '';
    foreach($a as $e){
        if($e['type'] == 'dir'){
            $s .= "<li data-jstree='{}'>" . $e['name'] . "<ul>";
            $s .= arrayToTree($e['files']);
            $s .= "</ul></li>";
        } else {
            $s .= "<li data-jstree='" . '{ "type" : "file" }' . "'><a href=". '"' . $e['link']. '"' . ">" . $e['name'] . "</a></li>";
        }
    }
    return $s;
}
function arrayToTree ( $ a ) { $ s = '' ; foreach ( $ a as $ e ) { if ( $ e [ 'type' ] == 'dir' ) { $ s .= " <li data-jstree='{}'> " . $ e [ 'name' ] . " <ul> " ; $ s .= arrayToTree ( $ e [ 'files' ] ) ; $ s .= " </ul></li> " ; } else { $ s .= " <li data-jstree=' " . '{ "type" : "file" }' . " '><a href= " . '"' . $ e [ 'link' ] . '"' . " > " . $ e [ 'name' ] . " </a></li> " ; } } return $ s ; }
TRACKING - parse array
 with directories and files
 to html
TRACKING - parse array with directories and files to html