|
@@ -747,7 +747,8 @@ class DocumentManager
|
|
public static function get_all_document_folders(
|
|
public static function get_all_document_folders(
|
|
$_course,
|
|
$_course,
|
|
$to_group_id = 0,
|
|
$to_group_id = 0,
|
|
- $can_see_invisible = false
|
|
|
|
|
|
+ $can_see_invisible = false,
|
|
|
|
+ $getInvisibleList = false
|
|
) {
|
|
) {
|
|
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
|
|
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
|
|
$TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
|
|
$TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
|
|
@@ -778,7 +779,7 @@ class DocumentManager
|
|
$session_id = api_get_session_id();
|
|
$session_id = api_get_session_id();
|
|
$condition_session = api_get_session_condition($session_id, true, false, 'docs.session_id');
|
|
$condition_session = api_get_session_condition($session_id, true, false, 'docs.session_id');
|
|
$show_users_condition = "";
|
|
$show_users_condition = "";
|
|
- if (api_get_setting('show_users_folders') == 'false') {
|
|
|
|
|
|
+ if (api_get_setting('show_users_folders') === 'false') {
|
|
$show_users_condition = " AND docs.path NOT LIKE '%shared_folder%'";
|
|
$show_users_condition = " AND docs.path NOT LIKE '%shared_folder%'";
|
|
}
|
|
}
|
|
|
|
|
|
@@ -797,7 +798,7 @@ class DocumentManager
|
|
$groupCondition AND
|
|
$groupCondition AND
|
|
docs.path NOT LIKE '%shared_folder%' AND
|
|
docs.path NOT LIKE '%shared_folder%' AND
|
|
docs.path NOT LIKE '%_DELETED_%' AND
|
|
docs.path NOT LIKE '%_DELETED_%' AND
|
|
- last.visibility <> 2
|
|
|
|
|
|
+ last.visibility <> 2
|
|
$condition_session ";
|
|
$condition_session ";
|
|
} else {
|
|
} else {
|
|
$sql = "SELECT DISTINCT docs.id, path
|
|
$sql = "SELECT DISTINCT docs.id, path
|
|
@@ -810,10 +811,10 @@ class DocumentManager
|
|
docs.c_id = {$_course['real_id']}
|
|
docs.c_id = {$_course['real_id']}
|
|
)
|
|
)
|
|
WHERE
|
|
WHERE
|
|
- docs.filetype = 'folder' AND
|
|
|
|
|
|
+ docs.filetype = 'folder' AND
|
|
docs.path NOT LIKE '%_DELETED_%' AND
|
|
docs.path NOT LIKE '%_DELETED_%' AND
|
|
$groupCondition AND
|
|
$groupCondition AND
|
|
- last.visibility <> 2
|
|
|
|
|
|
+ last.visibility <> 2
|
|
$show_users_condition $condition_session ";
|
|
$show_users_condition $condition_session ";
|
|
}
|
|
}
|
|
$result = Database::query($sql);
|
|
$result = Database::query($sql);
|
|
@@ -841,29 +842,44 @@ class DocumentManager
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
|
|
+
|
|
// No invisible folders
|
|
// No invisible folders
|
|
// Condition for the session
|
|
// Condition for the session
|
|
$session_id = api_get_session_id();
|
|
$session_id = api_get_session_id();
|
|
$condition_session = api_get_session_condition($session_id, true, false, 'docs.session_id');
|
|
$condition_session = api_get_session_condition($session_id, true, false, 'docs.session_id');
|
|
|
|
+
|
|
|
|
+ $visibilityCondition = 'last.visibility = 1';
|
|
|
|
+ $fileType = "docs.filetype = 'folder' AND";
|
|
|
|
+ if ($getInvisibleList) {
|
|
|
|
+ $visibilityCondition = 'last.visibility = 0';
|
|
|
|
+ $fileType = '';
|
|
|
|
+ }
|
|
|
|
+
|
|
//get visible folders
|
|
//get visible folders
|
|
$sql = "SELECT DISTINCT docs.id, path
|
|
$sql = "SELECT DISTINCT docs.id, path
|
|
FROM
|
|
FROM
|
|
$TABLE_ITEMPROPERTY AS last, $TABLE_DOCUMENT AS docs
|
|
$TABLE_ITEMPROPERTY AS last, $TABLE_DOCUMENT AS docs
|
|
WHERE
|
|
WHERE
|
|
docs.id = last.ref AND
|
|
docs.id = last.ref AND
|
|
- docs.filetype = 'folder' AND
|
|
|
|
|
|
+ $fileType
|
|
last.tool = '" . TOOL_DOCUMENT . "' AND
|
|
last.tool = '" . TOOL_DOCUMENT . "' AND
|
|
$groupCondition AND
|
|
$groupCondition AND
|
|
- last.visibility = 1
|
|
|
|
|
|
+ $visibilityCondition
|
|
$condition_session AND
|
|
$condition_session AND
|
|
last.c_id = {$_course['real_id']} AND
|
|
last.c_id = {$_course['real_id']} AND
|
|
docs.c_id = {$_course['real_id']} ";
|
|
docs.c_id = {$_course['real_id']} ";
|
|
$result = Database::query($sql);
|
|
$result = Database::query($sql);
|
|
|
|
+
|
|
$visibleFolders = array();
|
|
$visibleFolders = array();
|
|
while ($row = Database::fetch_array($result, 'ASSOC')) {
|
|
while ($row = Database::fetch_array($result, 'ASSOC')) {
|
|
$visibleFolders[$row['id']] = $row['path'];
|
|
$visibleFolders[$row['id']] = $row['path'];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if ($getInvisibleList) {
|
|
|
|
+
|
|
|
|
+ return $visibleFolders;
|
|
|
|
+ }
|
|
|
|
+
|
|
// Condition for the session
|
|
// Condition for the session
|
|
$session_id = api_get_session_id();
|
|
$session_id = api_get_session_id();
|
|
$condition_session = api_get_session_condition($session_id, true, false, 'docs.session_id');
|
|
$condition_session = api_get_session_condition($session_id, true, false, 'docs.session_id');
|
|
@@ -902,6 +918,7 @@ class DocumentManager
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
//if both results are arrays -> //calculate the difference between the 2 arrays -> only visible folders are left :)
|
|
//if both results are arrays -> //calculate the difference between the 2 arrays -> only visible folders are left :)
|
|
if (is_array($visibleFolders) && is_array($invisibleFolders)) {
|
|
if (is_array($visibleFolders) && is_array($invisibleFolders)) {
|
|
$document_folders = array_diff($visibleFolders, $invisibleFolders);
|
|
$document_folders = array_diff($visibleFolders, $invisibleFolders);
|
|
@@ -2828,12 +2845,6 @@ class DocumentManager
|
|
$upload_ok = process_uploaded_file($files[$fileKey], $show_output);
|
|
$upload_ok = process_uploaded_file($files[$fileKey], $show_output);
|
|
|
|
|
|
if ($upload_ok) {
|
|
if ($upload_ok) {
|
|
- // File got on the server without problems, now process it
|
|
|
|
- if ($title) {
|
|
|
|
- $titleAndExt = explode('.', $files[$fileKey]['name']);
|
|
|
|
- $ext = end($titleAndExt);
|
|
|
|
- $files[$fileKey]['name'] = $title.'.'.$ext;
|
|
|
|
- }
|
|
|
|
$new_path = handle_uploaded_document(
|
|
$new_path = handle_uploaded_document(
|
|
$course_info,
|
|
$course_info,
|
|
$files[$fileKey],
|
|
$files[$fileKey],
|
|
@@ -2896,6 +2907,10 @@ class DocumentManager
|
|
}
|
|
}
|
|
}*/
|
|
}*/
|
|
|
|
|
|
|
|
+ if (!empty($title)) {
|
|
|
|
+ $params['title'] = $title;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!empty($comment)) {
|
|
if (!empty($comment)) {
|
|
$params['comment'] = trim($comment);
|
|
$params['comment'] = trim($comment);
|
|
}
|
|
}
|
|
@@ -4534,6 +4549,7 @@ class DocumentManager
|
|
file_exists($documentData['absolute_path'])
|
|
file_exists($documentData['absolute_path'])
|
|
) {
|
|
) {
|
|
$mp3FilePath = self::convertWavToMp3($documentData['absolute_path']);
|
|
$mp3FilePath = self::convertWavToMp3($documentData['absolute_path']);
|
|
|
|
+ error_log($mp3FilePath);
|
|
|
|
|
|
if (!empty($mp3FilePath) && file_exists($mp3FilePath)) {
|
|
if (!empty($mp3FilePath) && file_exists($mp3FilePath)) {
|
|
|
|
|