From caa7a737795c5cc00b0284fa7b2118f4855b0f3b Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 27 Aug 2013 13:46:23 +0200 Subject: [PATCH] Minor - adding comments, format code --- main/create_course/add_course.php | 1 - main/document/document.inc.php | 5 ++-- .../gradebook/lib/gradebook_functions.inc.php | 4 +-- main/inc/lib/course.lib.php | 29 +++++++++++-------- .../DataFilesystem/DataFilesystem.php | 4 +-- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/main/create_course/add_course.php b/main/create_course/add_course.php index 2e3497e5f0..9ce5f99691 100644 --- a/main/create_course/add_course.php +++ b/main/create_course/add_course.php @@ -190,7 +190,6 @@ if ($form->validate()) { $course_values = $form->exportValues(); $wanted_code = $course_values['wanted_code']; - //$tutor_name = $course_values['tutor_name']; $category_code = $course_values['category_code']; $title = $course_values['title']; $course_language = $course_values['course_language']; diff --git a/main/document/document.inc.php b/main/document/document.inc.php index 26971c0a89..dd893ca58f 100644 --- a/main/document/document.inc.php +++ b/main/document/document.inc.php @@ -336,8 +336,7 @@ function create_document_link($document_data, $show_as_icon = false, $counter = //yox view //$url = 'showinframesmin.php?'.api_get_cidreq().'&id='.$document_data['id'].$req_gid; //Simpler version of showinframesmin.php with no headers - $url = 'show_content.php?'.api_get_cidreq( - ).'&id='.$document_data['id'].$req_gid.'&width=700&height=500'; + $url = 'show_content.php?id='.$document_data['id'].$req_gid.'&'.api_get_cidreq().'&width=700&height=500'; $class = 'ajax'; if ($visibility == false) { $class = "ajax invisible"; @@ -1312,4 +1311,4 @@ function check_and_create_resource_directory($repository_path, $resource_directo } return true; -} \ No newline at end of file +} diff --git a/main/gradebook/lib/gradebook_functions.inc.php b/main/gradebook/lib/gradebook_functions.inc.php index 552b245a91..e7f2b06c65 100644 --- a/main/gradebook/lib/gradebook_functions.inc.php +++ b/main/gradebook/lib/gradebook_functions.inc.php @@ -592,7 +592,7 @@ function get_user_certificate_content($user_id, $course_code, $is_preview = fals $path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path($course_code).'/document/images/gallery'; $new_content_html = str_replace('../images/gallery',$path_image,$new_content_html); - $path_image_in_default_course = api_get_path(WEB_CODE_PATH).'default_course_document'; + $path_image_in_default_course = api_get_path(WEB_DEFAULT_COURSE_DOCUMENT_PATH); $new_content_html = str_replace('/main/default_course_document',$path_image_in_default_course,$new_content_html); $new_content_html = str_replace('/main/img/', api_get_path(WEB_IMG_PATH), $new_content_html); @@ -823,4 +823,4 @@ function score_badges($list_values) { } return Display::badge_group($badges); -} \ No newline at end of file +} diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index 53886bc655..c077cf2fec 100644 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -18,10 +18,10 @@ */ class CourseManager { - CONST MAX_COURSE_LENGTH_CODE = 40; + const MAX_COURSE_LENGTH_CODE = 40; //This constant is used to show separate user names in the course list (userportal), footer, etc - CONST USER_SEPARATOR = ' |'; + const USER_SEPARATOR = ' |'; public $columns = array(); @@ -3978,7 +3978,6 @@ class CourseManager */ static function prepare_course_repository($course_repository, $course_code) { - $perm = api_get_permissions_for_new_directories(); $perm_file = api_get_permissions_for_new_files(); $htmlpage = "\n\n \n \n Not authorized\n \n \n \n"; @@ -4162,22 +4161,25 @@ class CourseManager return $tables; } - static function browse_folders($path, $files, $media) { + static function browse_folders($path, $files, $media) + { + $defaultCourseDocumentPath = api_get_path(SYS_DEFAULT_COURSE_DOCUMENT_PATH); if ($media == 'images') { - $code_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'; + $code_path = $defaultCourseDocumentPath.'images/'; } if ($media == 'audio') { - $code_path = api_get_path(SYS_CODE_PATH).'default_course_document/audio/'; + $code_path = $defaultCourseDocumentPath.'audio/'; } if ($media == 'flash') { - $code_path = api_get_path(SYS_CODE_PATH).'default_course_document/flash/'; + $code_path = $defaultCourseDocumentPath.'flash/'; } if ($media == 'video') { - $code_path = api_get_path(SYS_CODE_PATH).'default_course_document/video/'; + $code_path = $defaultCourseDocumentPath.'video/'; } if ($media == 'certificates') { - $code_path = api_get_path(SYS_CODE_PATH).'default_course_document/certificates/'; + $code_path = $defaultCourseDocumentPath.'certificates/'; } + if (is_dir($path)) { $handle = opendir($path); while (false !== ($file = readdir($handle))) { @@ -4189,6 +4191,7 @@ class CourseManager } } } + return $files; } @@ -4396,7 +4399,7 @@ class CourseManager 'certificates', ); - $default_course_path = api_get_path(SYS_CODE_PATH).'default_course_document/'; + $default_course_path = api_get_path(SYS_DEFAULT_COURSE_DOCUMENT_PATH); $default_document_array = array(); foreach ($folders_to_copy_from_default_course as $folder) { @@ -4430,7 +4433,7 @@ class CourseManager } $course_documents_folder = $sys_course_path.$course_repository."/document/$media_type/"; - $default_course_path = api_get_path(SYS_CODE_PATH).'default_course_document'.$path_documents; + $default_course_path = api_get_path(SYS_DEFAULT_COURSE_DOCUMENT_PATH).$path_documents; //echo 'try '.$course_documents_folder; echo '
'; @@ -4561,7 +4564,7 @@ class CourseManager $html = Database::escape_string('
- '.get_lang('Antique').' + '.get_lang('Antique').'
'); // Insert exercise @@ -4668,6 +4671,7 @@ class CourseManager } else { $visibility = $params['visibility']; } + $subscribe = isset($params['subscribe']) ? intval($params['subscribe']) : ($visibility == COURSE_VISIBILITY_OPEN_PLATFORM ? 1 : 0); $unsubscribe = isset($params['unsubscribe']) ? intval($params['unsubscribe']) : 0; $expiration_date = isset($params['expiration_date']) ? $params['expiration_date'] : null; @@ -4767,6 +4771,7 @@ class CourseManager user_course_cat = '0'"; Database::query($sql); } + if (!empty($teachers)) { if (!is_array($teachers)) { $teachers = array($teachers); diff --git a/src/ChamiloLMS/Component/DataFilesystem/DataFilesystem.php b/src/ChamiloLMS/Component/DataFilesystem/DataFilesystem.php index d011e33c9d..1e253e092f 100644 --- a/src/ChamiloLMS/Component/DataFilesystem/DataFilesystem.php +++ b/src/ChamiloLMS/Component/DataFilesystem/DataFilesystem.php @@ -21,7 +21,7 @@ class DataFilesystem private $fs; /** - * @param string $path + * @param array $paths * @param Filesystem $filesystem */ public function __construct($paths, Filesystem $filesystem) @@ -32,7 +32,7 @@ class DataFilesystem /** * Gets a file from the "data" folder - * @param $file + * @param string $file * @return SplFileInfo * @throws \InvalidArgumentException */