|
|
|
|
@ -968,7 +968,6 @@ class DocumentManager |
|
|
|
|
$sessionId = null, |
|
|
|
|
$documentId = null |
|
|
|
|
) { |
|
|
|
|
|
|
|
|
|
if (empty($sessionId)) { |
|
|
|
|
$sessionId = api_get_session_id(); |
|
|
|
|
} else { |
|
|
|
|
@ -1436,7 +1435,6 @@ class DocumentManager |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
if ($result && Database::num_rows($result) == 1) { |
|
|
|
|
$row = Database::fetch_array($result, 'ASSOC'); |
|
|
|
|
|
|
|
|
|
//@todo need to clarify the name of the URLs not nice right now |
|
|
|
|
$url_path = urlencode($row['path']); |
|
|
|
|
$path = str_replace('%2F', '/', $url_path); |
|
|
|
|
@ -1459,7 +1457,6 @@ class DocumentManager |
|
|
|
|
|
|
|
|
|
//Use to generate parents (needed for the breadcrumb) |
|
|
|
|
//@todo sorry but this for is here because there's not a parent_id in the document table so we parsed the path!! |
|
|
|
|
|
|
|
|
|
if ($load_parents) { |
|
|
|
|
$dir_array = explode('/', $row['path']); |
|
|
|
|
$dir_array = array_filter($dir_array); |
|
|
|
|
@ -1509,6 +1506,7 @@ class DocumentManager |
|
|
|
|
* @param int $document_id_for_template the document id |
|
|
|
|
* @param string $course_code |
|
|
|
|
* @param int $user_id |
|
|
|
|
* @param string $image |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public static function set_document_as_template( |
|
|
|
|
@ -1540,8 +1538,11 @@ class DocumentManager |
|
|
|
|
* @param string $course_code |
|
|
|
|
* @param int $user_id |
|
|
|
|
*/ |
|
|
|
|
public static function unset_document_as_template($document_id, $course_code, $user_id) |
|
|
|
|
{ |
|
|
|
|
public static function unset_document_as_template( |
|
|
|
|
$document_id, |
|
|
|
|
$course_code, |
|
|
|
|
$user_id |
|
|
|
|
) { |
|
|
|
|
$table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES); |
|
|
|
|
$course_code = Database::escape_string($course_code); |
|
|
|
|
$user_id = intval($user_id); |
|
|
|
|
@ -1576,8 +1577,12 @@ class DocumentManager |
|
|
|
|
* @param string |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public static function is_visible($doc_path, $course, $session_id = 0, $file_type = 'file') |
|
|
|
|
{ |
|
|
|
|
public static function is_visible( |
|
|
|
|
$doc_path, |
|
|
|
|
$course, |
|
|
|
|
$session_id = 0, |
|
|
|
|
$file_type = 'file' |
|
|
|
|
) { |
|
|
|
|
$docTable = Database::get_course_table(TABLE_DOCUMENT); |
|
|
|
|
$propTable = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
|
|
|
|
|
|
|
|
@ -2179,7 +2184,11 @@ class DocumentManager |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$is_file) { |
|
|
|
|
$attributes = self::parse_HTML_attributes($source_html, $wanted_attributes, $explode_attributes); |
|
|
|
|
$attributes = self::parse_HTML_attributes( |
|
|
|
|
$source_html, |
|
|
|
|
$wanted_attributes, |
|
|
|
|
$explode_attributes |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
if (is_file($source_html)) { |
|
|
|
|
$abs_path = $source_html; |
|
|
|
|
@ -2204,7 +2213,6 @@ class DocumentManager |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$files_list = array(); |
|
|
|
|
|
|
|
|
|
switch ($type) { |
|
|
|
|
case TOOL_DOCUMENT: |
|
|
|
|
case TOOL_QUIZ: |
|
|
|
|
@ -2408,7 +2416,12 @@ class DocumentManager |
|
|
|
|
$dir = dirname($abs_path).'/'; |
|
|
|
|
} |
|
|
|
|
$new_abs_path = realpath($dir.$source); |
|
|
|
|
$in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
|
|
|
|
$in_files_list[] = self::get_resources_from_source_html( |
|
|
|
|
$new_abs_path, |
|
|
|
|
true, |
|
|
|
|
TOOL_DOCUMENT, |
|
|
|
|
$recursivity + 1 |
|
|
|
|
); |
|
|
|
|
if (count($in_files_list) > 0) { |
|
|
|
|
$files_list = array_merge($files_list, $in_files_list); |
|
|
|
|
} |
|
|
|
|
@ -2423,7 +2436,12 @@ class DocumentManager |
|
|
|
|
$dir = dirname($abs_path).'/'; |
|
|
|
|
} |
|
|
|
|
$new_abs_path = realpath($dir.$source); |
|
|
|
|
$in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
|
|
|
|
$in_files_list[] = self::get_resources_from_source_html( |
|
|
|
|
$new_abs_path, |
|
|
|
|
true, |
|
|
|
|
TOOL_DOCUMENT, |
|
|
|
|
$recursivity + 1 |
|
|
|
|
); |
|
|
|
|
if (count($in_files_list) > 0) { |
|
|
|
|
$files_list = array_merge($files_list, $in_files_list); |
|
|
|
|
} |
|
|
|
|
@ -2743,7 +2761,6 @@ class DocumentManager |
|
|
|
|
//We do not select the $original_path becayse the file was already moved |
|
|
|
|
$content_html = file_get_contents($destiny_path.'/'.$file_name); |
|
|
|
|
$destination_file = $destiny_path.'/'.$file_name; |
|
|
|
|
|
|
|
|
|
$pre_original = strstr($original_path, 'document'); |
|
|
|
|
$pre_destin = strstr($destiny_path, 'document'); |
|
|
|
|
$pre_original = substr($pre_original, 8, strlen($pre_original)); |
|
|
|
|
@ -2815,7 +2832,6 @@ class DocumentManager |
|
|
|
|
if ($scope_url == 'local') { |
|
|
|
|
if ($type_url == 'abs' || $type_url == 'rel') { |
|
|
|
|
$document_file = strstr($real_orig_path, 'document'); |
|
|
|
|
|
|
|
|
|
if (strpos($real_orig_path, $document_file) !== false) { |
|
|
|
|
echo 'continue1'; |
|
|
|
|
continue; |
|
|
|
|
@ -3759,7 +3775,6 @@ class DocumentManager |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$directUrl = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId; |
|
|
|
|
|
|
|
|
|
$link .= Display::url( |
|
|
|
|
Display::return_icon('preview_view.png', get_lang('Preview')), |
|
|
|
|
$directUrl, |
|
|
|
|
|