From bef7801ec135f2663ffdaa893d1977eb345eb356 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 21 Oct 2014 10:28:37 +0200 Subject: [PATCH] Minor - format code. --- main/inc/lib/main_api.lib.php | 56 ++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index ce8a7d3afd..b3fbf5a241 100755 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -102,7 +102,7 @@ define('TOOL_QUIZ', 'quiz'); define('TOOL_TEST_CATEGORY', 'test_category'); define('TOOL_USER', 'user'); define('TOOL_GROUP', 'group'); -define('TOOL_BLOGS', 'blog_management'); // Smartblogs (Kevin Van Den Haute :: kevin@develop-it.be) +define('TOOL_BLOGS', 'blog_management'); define('TOOL_CHAT', 'chat'); define('TOOL_CONFERENCE', 'conference'); define('TOOL_STUDENTPUBLICATION', 'student_publication'); @@ -349,10 +349,8 @@ define('CATALOG_COURSES_SESSIONS', 2); /** * Inclusion of internationalization libraries */ - require_once __DIR__.'/internationalization.lib.php'; - /* PATHS & FILES - ROUTINES */ /** @@ -791,7 +789,8 @@ function apiGetDisplayGroupsForumInGeneralTool() { /** * This function checks whether a given path points inside the system. - * @param string $path The path to be tested. It should be full path, web-absolute (WEB), semi-absolute (REL) or system-absolyte (SYS). + * @param string $path The path to be tested. + * It should be full path, web-absolute (WEB), semi-absolute (REL) or system-absolyte (SYS). * @return bool Returns true when the given path is inside the system, false otherwise. */ function api_is_internal_path($path) { @@ -944,8 +943,12 @@ function api_protect_course_script($print_headers = false, $allow_session_admins } break; } + //If password is set and user is not registered to the course then the course is not visible - if ($is_allowed_in_course == false & isset($course_info['registration_code']) && !empty($course_info['registration_code'])) { + if ($is_allowed_in_course == false & + isset($course_info['registration_code']) && + !empty($course_info['registration_code']) + ) { $is_visible = false; } } @@ -1518,9 +1521,11 @@ function api_format_course_array($course_data) { $_course['directory' ] = $course_data['directory' ]; //@todo should be deprecated - $_course['dbName' ] = $course_data['db_name' ]; // Use as key in db list. + // Use as key in db list. + $_course['dbName' ] = $course_data['db_name' ]; $_course['db_name' ] = $course_data['db_name' ]; - $_course['dbNameGlu' ] = $_configuration['table_prefix'] . $course_data['db_name'] . $_configuration['db_glue']; // Use in all queries. + // Use in all queries. + $_course['dbNameGlu' ] = $_configuration['table_prefix'] . $course_data['db_name'] . $_configuration['db_glue']; $_course['titular' ] = $course_data['tutor_name' ]; $_course['language' ] = $course_data['course_language']; @@ -1557,12 +1562,11 @@ function api_format_course_array($course_data) { $url_image = Display::return_icon('course.png', null, null, ICON_SIZE_BIG, null, true); } $_course['course_image'] = $url_image; + return $_course; } - /* SESSION MANAGEMENT */ - /* * DEPRECATED: @see Session */ @@ -3281,7 +3285,6 @@ function api_not_allowed($print_headers = false, $message = null) ); } } -// $msg = Display::div($msg, array('align'=>'center')); $tpl->assign('content', $msg); $tpl->display_one_col_template(); exit; @@ -3604,9 +3607,7 @@ function api_item_property_update( break; case 'invisible' : // Change item to invisible. $visibility = '0'; - if (!empty($session_id)) { - // Check whether session id already exist into item_properties for updating visibility or add it $sql = "SELECT id_session FROM $TABLE_ITEMPROPERTY WHERE c_id=$course_id AND tool = '$tool' AND ref='$item_id' AND id_session = '$session_id'"; @@ -3752,9 +3753,13 @@ function api_get_item_property_id($course_code, $tool, $ref) { } /** - * * Inserts a record in the track_e_item_property table (No update) - * + * @param string $tool + * @param int $ref + * @param string $title + * @param string $content + * @param int $progress + * @return bool|int */ function api_track_item_property_update($tool, $ref, $title, $content, $progress) { @@ -3779,6 +3784,11 @@ function api_track_item_property_update($tool, $ref, $title, $content, $progress return false; } +/** + * @param string $tool + * @param int $ref + * @return array|resource + */ function api_get_track_item_property_history($tool, $ref) { $tbl_stats_item_property = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY); @@ -4279,7 +4289,13 @@ function api_time_to_hms($seconds) { // $seconds = -1 means that we have wrong data in the db. if ($seconds == -1) { - return get_lang('Unknown').Display::return_icon('info2.gif', get_lang('WrongDatasForTimeSpentOnThePlatform'), array('align' => 'absmiddle', 'hspace' => '3px')); + return + get_lang('Unknown'). + Display::return_icon( + 'info2.gif', + get_lang('WrongDatasForTimeSpentOnThePlatform'), + array('align' => 'absmiddle', 'hspace' => '3px') + ); } // How many hours ? @@ -4477,8 +4493,14 @@ function copyr($source, $dest, $exclude = array(), $copied_files = array()) { } // TODO: Using DIRECTORY_SEPARATOR is not recommended, this is an obsolete approach. Documentation header to be added here. -function copy_folder_course_session($pathname, $base_path_document, $session_id, $course_info, $document, $source_course_id) -{ +function copy_folder_course_session( + $pathname, + $base_path_document, + $session_id, + $course_info, + $document, + $source_course_id +) { $table = Database :: get_course_table(TABLE_DOCUMENT); $session_id = intval($session_id); $source_course_id = intval($source_course_id);