if (!$is_certificate_mode) { $req_gid = null; if (api_is_in_group()) { $req_gid = '&gidReq=' . $groupId; $interbreadcrumb[] = array("url" => "../group/group_space.php?gidReq=" . $groupId, "name" => get_lang('GroupSpace')); $noPHP_SELF = true; $path = explode('/', $dir); if ('/' . $path[1] != $group_properties['directory']) { api_not_allowed(true); } } $interbreadcrumb[] = array("url" => "./document.php?curdirpath=" . urlencode($dir) . $req_gid, "name" => get_lang('Documents')); } else { $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); } if (!($is_allowed_to_edit || GroupManager::groupMemberWithUploadRights() || is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id()))) { api_not_allowed(true); } Event::event_access_tool(TOOL_DOCUMENT); $display_dir = $dir; if (isset($group_properties)) { $display_dir = explode('/', $dir); unset($display_dir[0]); unset($display_dir[1]); $display_dir = implode('/', $display_dir); } $select_cat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : null; // Create a new form $form = new FormValidator('create_document', 'post', api_get_self() . '?' . api_get_cidreq() . '&dir=' . Security::remove_XSS(urlencode($dir)) . '&selectcat=' . $select_cat, null, array('class' => 'form-horizontal')); // form title $form->addElement('header', $nameTools);
// "2" because at the begin and end there are 2 "/" // Level correction for group documents. if (!empty($group_properties['directory'])) { $count_dir = $count_dir > 0 ? $count_dir - 1 : 0; } $relative_url = ''; for ($i = 0; $i < $count_dir; $i++) { $relative_url .= '../'; } $html_editor_config = array('ToolbarSet' => api_is_allowed_to_edit(null, true) ? 'Documents' : 'DocumentsStudent', 'Width' => '100%', 'Height' => '600', 'FullPage' => true, 'InDocument' => true, 'CreateDocumentDir' => $relative_url, 'CreateDocumentWebDir' => empty($group_properties['directory']) ? api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document/' : api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document' . $group_properties['directory'] . '/', 'BaseHref' => api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . $dir); if ($is_certificate_mode) { $html_editor_config['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document/'; $html_editor_config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document/'; $html_editor_config['BaseHref'] = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . $dir; } $is_allowed_to_edit = api_is_allowed_to_edit(null, true) || GroupManager::groupMemberWithUploadRights() || is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); $noPHP_SELF = true; /* Other initialization code */ $dbTable = Database::get_course_table(TABLE_DOCUMENT); $course_id = api_get_course_int_id(); if (!empty($group_id)) { $interbreadcrumb[] = array('url' => '../group/group_space.php?' . api_get_cidreq(), 'name' => get_lang('GroupSpace')); $group_document = true; $noPHP_SELF = true; } if (!$is_certificate_mode) { $interbreadcrumb[] = array("url" => "./document.php?curdirpath=" . urlencode($my_cur_dir_path) . '&' . api_get_cidreq(), "name" => get_lang('Documents')); } else { $interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); } // Interbreadcrumb for the current directory root path