Minor - format code.

1.9.x
Julio Montoya 10 years ago
parent f014515131
commit 5c5dfe00ce
  1. 6
      main/document/document.php
  2. 36
      main/inc/lib/document.lib.php

@ -849,6 +849,7 @@ if ($is_allowed_to_edit ||
false,
$session_id
);
$move_path = $document_to_move['path'];
if (!empty($document_to_move)) {
$folders = DocumentManager::get_all_document_folders(
@ -1534,6 +1535,7 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
} else {
$document_name = basename($document_data['path']);
}
$row['name'] = $document_name;
// Data for checkbox
if (($is_allowed_to_edit || $group_member_with_upload_rights) && count($documentAndFolders) > 1) {
@ -1577,6 +1579,7 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
// Comments => display comment under the document name
$display_size = format_file_size($size);
$row[] = '<span style="display:none;">'.$size.'</span>'.
$invisibility_span_open.
$display_size.
@ -1587,9 +1590,10 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
$last_edit_date = api_get_local_time($document_data['lastedit_date']);
$display_date = date_to_str_ago($last_edit_date).
' <div class="muted"><small>'.$last_edit_date."</small></div>";
$row[] = $invisibility_span_open.$display_date.$invisibility_span_close;
// Admins get an edit column
// Admins get an edit column
if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder(api_get_user_id(), $curdirpath, $session_id)) {
$is_template = isset($document_data['is_template']) ? $document_data['is_template'] : false;
// If readonly, check if it the owner of the file or if the user is an admin

@ -17,8 +17,10 @@ class DocumentManager
}
/**
* @param string
* @return the document folder quota for the current course, in bytes, or the default quota
* @param string $course_code
*
* @return int the document folder quota for the current course in bytes
* or the default quota
*/
public static function get_course_quota($course_code = null)
{
@ -300,6 +302,7 @@ class DocumentManager
* @param string $full_file_name
* @param boolean $forced
* @param string $name
*
* @return false if file doesn't exist, true if stream succeeded
*/
public static function file_send_for_download($full_file_name, $forced = false, $name = '')
@ -339,6 +342,7 @@ class DocumentManager
$res = fopen($full_file_name, 'r');
fpassthru($res);
return true;
} else {
//no forced download, just let the browser decide what to do according to the mimetype
@ -377,6 +381,7 @@ class DocumentManager
header('Content-Disposition: inline; filename= ' . $filename);
}
readfile($full_file_name);
return true;
}
}
@ -387,9 +392,10 @@ class DocumentManager
* otherwise it may cause subsequent use of the page to want to download
* other pages in php rather than interpreting them.
*
* @param string The string contents
* @param boolean Whether "save" mode is forced (or opening directly authorized)
* @param string The name of the file in the end (including extension)
* @param string $full_string The string contents
* @param boolean $forced Whether "save" mode is forced (or opening directly authorized)
* @param string $name The name of the file in the end (including extension)
*
* @return false if file doesn't exist, true if stream succeeded
*/
public static function string_send_for_download($full_string, $forced = false, $name = '')
@ -522,7 +528,7 @@ class DocumentManager
// The given path will not end with a slash, unless it's the root '/'
// so no root -> add slash
$added_slash = ($path == '/') ? '' : '/';
$added_slash = $path == '/' ? '' : '/';
// Condition for the session
$current_session_id = api_get_session_id();
@ -614,7 +620,7 @@ class DocumentManager
}
//@todo use the DocumentManager::is_visible function
// Checking disponibility in a session
// Checking visibility in a session
foreach ($my_repeat_ids as $id) {
foreach ($doc_list as $row) {
if ($id == $row['id']) {
@ -644,7 +650,7 @@ class DocumentManager
}
}
// Checking parents visibility
// Checking parents visibility.
$final_document_data = array();
foreach ($document_data as $row) {
$is_visible = DocumentManager::check_visibility_tree(
@ -671,6 +677,7 @@ class DocumentManager
/**
* Gets the paths of all folders in a course
* can show all folders (except for the deleted ones) or only visible ones
*
* @param array $_course
* @param int $to_group_id
* @param boolean $can_see_invisible
@ -679,7 +686,7 @@ class DocumentManager
*/
public static function get_all_document_folders(
$_course,
$to_group_id = '0',
$to_group_id = 0,
$can_see_invisible = false
) {
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
@ -725,7 +732,6 @@ class DocumentManager
last.visibility <> 2
$show_users_condition $condition_session ";
}
$result = Database::query($sql);
if ($result && Database::num_rows($result) != 0) {
@ -1498,7 +1504,6 @@ class DocumentManager
*/
public static function is_visible_by_id($doc_id, $course_info, $session_id, $user_id, $admins_can_see_everything = true)
{
$is_visible = false;
$user_in_course = false;
//1. Checking the course array
@ -1512,7 +1517,6 @@ class DocumentManager
$doc_id = intval($doc_id);
$session_id = intval($session_id);
//2. Course and Session visibility are handle in local.inc.php/global.inc.php
//3. Checking if user exist in course/session
@ -1532,11 +1536,11 @@ class DocumentManager
}
}
//4. Checking document visibility (i'm repeating the code in order to be more clear when reading ) - jm
// 4. Checking document visibility (i'm repeating the code in order to be more clear when reading ) - jm
if ($user_in_course) {
//4.1 Checking document visibility for a Course
// 4.1 Checking document visibility for a Course
if ($session_id == 0) {
$item_info = api_get_item_property_info($course_info['real_id'], 'document', $doc_id, 0);
@ -1551,7 +1555,7 @@ class DocumentManager
}
}
} else {
//4.2 Checking document visibility for a Course in a Session
// 4.2 Checking document visibility for a Course in a Session
$item_info = api_get_item_property_info($course_info['real_id'], 'document', $doc_id, 0);
$item_info_in_session = api_get_item_property_info($course_info['real_id'], 'document', $doc_id, $session_id);
@ -4028,7 +4032,7 @@ class DocumentManager
}
/**
* Sets
* Sets
* @param string $file ($document_data['path'])
* @param string $file_url_sys
* @return string

Loading…
Cancel
Save