Minor - format code.

1.9.x
Julio Montoya 12 years ago
parent 654c6bbf03
commit ef5ede298c
  1. 2
      main/document/document.php
  2. 35
      main/inc/lib/document.lib.php

@ -35,6 +35,7 @@ $language_file = array('document', 'slideshow', 'gradebook', 'create_course');
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_DOCUMENT;
$this_section = SECTION_COURSES;
$to_user_id = null;
require_once 'document.inc.php';
$lib_path = api_get_path(LIBRARY_PATH);
@ -518,7 +519,6 @@ $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
$htmlHeadXtra[] = '<link rel="stylesheet" href="'.$js_path.'jquery-jplayer/skins/chamilo/jplayer.blue.monday.css" type="text/css">';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.$js_path.'jquery-jplayer/jquery.jplayer.min.js"></script>';
//$htmlHeadXtra[] = '<script type="text/javascript" src="'.$js_path.'jquery-jplayer/jquery.jplayer.inspector.js"></script>';
$to_group_id = api_get_group_id();
$mediaplayer_path = api_get_path(WEB_LIBRARY_PATH).'mediaplayer/player.swf';
$docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, false);

@ -472,13 +472,14 @@ class DocumentManager
* @param int $to_group_id
* @param int $to_user_id
* @param boolean $can_see_invisible
* @param boolean $search
* @return array with all document data
*/
public static function get_all_document_data(
$_course,
$path = '/',
$to_group_id = 0,
$to_user_id = NULL,
$to_user_id = null,
$can_see_invisible = false,
$search = false
) {
@ -522,14 +523,14 @@ class DocumentManager
." last.lastedit_date, "
." last.visibility, "
." last.insert_user_id "
." FROM $TABLE_ITEMPROPERTY AS last INNER JOIN $TABLE_DOCUMENT AS docs "
." ON (docs.id = last.ref AND last.tool = '".TOOL_DOCUMENT."' AND "
." docs.c_id = {$_course['real_id']} AND last.c_id = {$_course['real_id']}) "
." WHERE "
." docs.path LIKE '" . $path . $added_slash . "%' AND "
." docs.path NOT LIKE '" . $path . $added_slash . "%/%' AND "
.$to_field." = ".$to_value." AND "
." last.visibility ".$visibility_bit.$condition_session;
." FROM $TABLE_ITEMPROPERTY AS last INNER JOIN $TABLE_DOCUMENT AS docs "
." ON (docs.id = last.ref AND last.tool = '".TOOL_DOCUMENT."' AND "
." docs.c_id = {$_course['real_id']} AND last.c_id = {$_course['real_id']}) "
." WHERE "
." docs.path LIKE '" . $path . $added_slash . "%' AND "
." docs.path NOT LIKE '" . $path . $added_slash . "%/%' AND "
.$to_field." = ".$to_value." AND "
." last.visibility ".$visibility_bit.$condition_session;
$result = Database::query($sql);
@ -634,10 +635,10 @@ class DocumentManager
/**
* Gets the paths of all folders in a course
* can show all folders (exept for the deleted ones) or only visible ones
* can show all folders (except for the deleted ones) or only visible ones
* @param array $_course
* @param boolean $can_see_invisible
* @param int $to_group_id
* @param boolean $can_see_invisible
* @return array with paths
*/
public static function get_all_document_folders($_course, $to_group_id = '0', $can_see_invisible = false)
@ -775,6 +776,8 @@ class DocumentManager
* @param int $user_id id of the current user
* @param string $file path stored in the database
* @param int $document_id in case you dont have the file path ,insert the id of the file here and leave $file in blank ''
* @param bool $to_delete
* @param int $sessionId
* @return boolean true/false
* */
public static function check_readonly(
@ -1241,21 +1244,21 @@ class DocumentManager
* @param string $title
* @param string $description
* @param int $document_id_for_template the document id
* @param string $couse_code
* @param string $course_code
* @param int $user_id
*/
public static function set_document_as_template($title, $description, $document_id_for_template, $couse_code, $user_id, $image)
public static function set_document_as_template($title, $description, $document_id_for_template, $course_code, $user_id, $image)
{
// Database table definition
$table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES);
// creating the sql statement
$sql = "INSERT INTO " . $table_template . "
(title, description, course_code, user_id, ref_doc, image)
$sql = "INSERT INTO $table_template
(title, description, course_code, user_id, ref_doc, image)
VALUES (
'" . Database::escape_string($title) . "',
'" . Database::escape_string($description) . "',
'" . Database::escape_string($couse_code) . "',
'" . Database::escape_string($course_code) . "',
'" . Database::escape_string($user_id) . "',
'" . Database::escape_string($document_id_for_template) . "',
'" . Database::escape_string($image) . "')";

Loading…
Cancel
Save