if (isset($_GET['set_invisible']) && !empty($_GET['set_invisible']) || isset($_GET['set_visible']) && !empty($_GET['set_visible'])) { // Make visible or invisible? if (isset($_GET['set_visible'])) { $update_id = intval($_GET['set_visible']); $visibility_command = 'visible'; } else { $update_id = intval($_GET['set_invisible']); $visibility_command = 'invisible'; } if (!$is_allowed_to_edit) { if (api_is_coach()) { if (!DocumentManager::is_visible_by_id($update_id, $courseInfo, $sessionId, api_get_user_id())) { api_not_allowed(true); } } if (DocumentManager::check_readonly($courseInfo, api_get_user_id(), '', $update_id)) { api_not_allowed(true); } } // Update item_property to change visibility if (api_item_property_update($courseInfo, TOOL_DOCUMENT, $update_id, $visibility_command, api_get_user_id(), null, null, null, null, $sessionId)) { Display::addFlash(Display::return_message(get_lang('VisibilityChanged'), 'confirmation')); } else { Display::addFlash(Display::return_message(get_lang('ViModProb'), 'error')); } header('Location: ' . $currentUrl); exit; } } $templateForm = null; /* TEMPLATE ACTION */
$interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); } else { foreach ($document_data['parents'] as $document_sub_data) { if ($document_data['title'] == $document_sub_data['title']) { continue; } $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); } } if (!$is_allowed_to_edit) { api_not_allowed(true); } Event::event_access_tool(TOOL_DOCUMENT); //TODO:check the below code and his functionality if (!api_is_allowed_to_edit()) { if (DocumentManager::check_readonly($course_info, $user_id, $file)) { api_not_allowed(); } } /* MAIN TOOL CODE */ /* Code to change the comment */ if (isset($_POST['comment'])) { // Fixing the path if it is wrong $comment = trim(Database::escape_string($_POST['comment'])); $title = trim(Database::escape_string($_POST['title'])); //Just in case see BT#3525 if (empty($title)) { $title = $documen_data['title']; } if (empty($title)) { $title = FileManager::get_document_title($_POST['filename']);
if (!empty($_course['path'])) { //find path $mainPath = '../../../../../../../courses/' . $_course['path'] . '/document/'; //get Chamilo $fullPath = $doc; //get Ajaxfilemanager $chamiloPath = substr($fullPath, strlen($mainPath) - strlen($fullPath) - 1); //find base_work_dir $course_dir = $_course['path'] . "/document"; //get Chamilo $sys_course_path = api_get_path(SYS_COURSE_PATH); //get Chamilo $base_work_dir = $sys_course_path . $course_dir; // sample c:/xampp/htdocs/chamilo2009beta/courses/JUAN2009/document //delete file if (!$is_allowed_to_edit && DocumentManager::check_readonly($_course, api_get_user_id(), $chamiloPath)) { $error = get_lang('CantDeleteReadonlyFiles'); //From Chamilo to Ajaxfilemanager } else { $deleted = DocumentManager::delete_document($_course, $chamiloPath, $base_work_dir); //deleted by Chamilo //$file->delete($doc); // disabled deleted by ajaxfilemanager } } else { $file->delete($doc); //deleted by ajaxfilemanager event_system(LOG_USER_PERSONAL_DOC_DELETED, 'document_path', $doc); event_system(LOG_MY_FOLDER_DELETE, LOG_MY_FOLDER_PATH, $doc); } //////end bridge to Chamilo }