$querypath=''; // to prevent ...path LIKE '//%'... in query
if($path=='/') {
$querypath=''; // to prevent ...path LIKE '//%'... in query
} else {
$querypath=$path;
$querypath=$path;
}
//search for all files that are not deleted => visibility != 2
$query = Database::query("SELECT url FROM $tbl_student_publication AS work,$prop_table AS props WHERE props.tool='work' AND work.id=props.ref AND work.url LIKE 'work".$querypath."/%' AND work.filetype='file' AND props.visibility<>'2'");
//add tem to the zip file
while ($not_deleted_file = Database::fetch_assoc($query)) { //var_dump($sys_course_path.$_course['path']."/".$not_deleted_file['url']);exit();
//for other users, we need to create a zipfile with only visible files and folders
else
{
if ($path=='/') {
$querypath=''; // to prevent ...path LIKE '//%'... in query
else {
if ($path == '/') {
$querypath = ''; // to prevent ...path LIKE '//%'... in query
} else {
$querypath=$path;
$querypath=$path;
}
//big problem: visible files that are in a hidden folder are included when we do a query for visiblity='v'!!!
//so... I do it in a couple of steps:
@ -96,7 +93,7 @@ else
$query2 = Database::query("SELECT url FROM $tbl_student_publication AS work,$prop_table AS props WHERE props.tool='work' AND work.id=props.ref AND work.url LIKE 'work".$querypath."/%' AND work.filetype='file' AND props.visibility<>'1' AND props.lastedit_user_id='".api_get_user_id()."'");
//if we get invisible folders, we have to filter out these results from all visible files we found
if (Database::num_rows($query2)>0) {
if (Database::num_rows($query2)>0) {
//add tem to an array
while ($invisible_folders = Database::fetch_assoc($query2)) {
//3rd: get all files that are in the found invisible folder (these are "invisible" too)
@ -108,14 +105,14 @@ else
}
//compare the array with visible files and the array with files in invisible folders
//and keep the difference (= all visible files that are not in an invisible folder)