Fixing bug: On Documents tool, I see more folder in the menu than in the list on the page see #5555

skala
Yoselyn Castillo 12 years ago
parent bc797636ac
commit 06132f1259
  1. 6
      main/document/document.php
  2. 11
      main/inc/lib/document.lib.php

@ -878,9 +878,9 @@ if (isset($_GET['keyword']) && !empty($_GET['keyword'])) {
} else {
$docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, false);
}
if (GroupManager::is_subscribed(api_get_user_id(), api_get_group_id()) || GroupManager :: is_tutor_of_group(api_get_user_id(), api_get_group_id()) || UserManager::is_admin(api_get_user_id())) {
$folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit || $group_member_with_upload_rights);
}
if ($folders === false) {
$folders = array();
}
@ -1010,6 +1010,7 @@ $table_footer = '';
$total_size = 0;
if (isset($docs_and_folders) && is_array($docs_and_folders)) {
if (GroupManager::is_subscribed(api_get_user_id(), api_get_group_id()) || GroupManager :: is_tutor_of_group(api_get_user_id(), api_get_group_id()) || UserManager::is_admin(api_get_user_id())) {
// Create a sortable table with our data
$sortable_data = array();
@ -1102,6 +1103,7 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) {
$sortable_data[] = $row;
}
}
}
} else {
$sortable_data = '';
$table_footer = get_lang('NoDocsInFolder');

@ -623,13 +623,24 @@ class DocumentManager {
//condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
if ($to_group_id <> 0) {
$sql = "SELECT DISTINCT docs.id, path
FROM $TABLE_ITEMPROPERTY AS last INNER JOIN $TABLE_DOCUMENT AS docs
ON (docs.id = last.ref AND last.tool = '" . TOOL_DOCUMENT . "' AND last.c_id = {$_course['real_id']} AND docs.c_id = {$_course['real_id']} )
WHERE
docs.filetype = 'folder' AND
last.to_group_id = " . $to_group_id . " AND
docs.path NOT LIKE '%shared_folder%' AND
last.visibility <> 2 $condition_session ";
} else {
$sql = "SELECT DISTINCT docs.id, path
FROM $TABLE_ITEMPROPERTY AS last INNER JOIN $TABLE_DOCUMENT AS docs
ON (docs.id = last.ref AND last.tool = '" . TOOL_DOCUMENT . "' AND last.c_id = {$_course['real_id']} AND docs.c_id = {$_course['real_id']} )
WHERE
docs.filetype = 'folder' AND
last.to_group_id = " . $to_group_id . " AND
last.visibility <> 2 $condition_session ";
}
$result = Database::query($sql);

Loading…
Cancel
Save