diff --git a/main/admin/dashboard_add_courses_to_user.php b/main/admin/dashboard_add_courses_to_user.php index 0203eb1a40..6a2fe78081 100755 --- a/main/admin/dashboard_add_courses_to_user.php +++ b/main/admin/dashboard_add_courses_to_user.php @@ -21,7 +21,7 @@ api_protect_admin_script(true); // setting breadcrumbs $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); -$interbreadcrumb[] = array('url' => 'user_list.php','name' => get_lang('UserList')); +$interbreadcrumb[] = array('url' => 'user_list.php', 'name' => get_lang('UserList')); // Database Table Definitions $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); @@ -36,11 +36,11 @@ $current_user_id = api_get_user_id(); // setting the name of the tool if (UserManager::is_admin($user_id)) { - $tool_name= get_lang('AssignCoursesToPlatformAdministrator'); + $tool_name = get_lang('AssignCoursesToPlatformAdministrator'); } else if ($user_info['status'] == SESSIONADMIN) { - $tool_name= get_lang('AssignCoursesToSessionsAdministrator'); + $tool_name = get_lang('AssignCoursesToSessionsAdministrator'); } else { - $tool_name= get_lang('AssignCoursesToHumanResourcesManager'); + $tool_name = get_lang('AssignCoursesToHumanResourcesManager'); } $add_type = 'multiple'; @@ -54,7 +54,7 @@ if (!api_is_platform_admin()) { function search_courses($needle, $type) { - global $tbl_course, $tbl_course_rel_access_url,$user_id; + global $tbl_course, $tbl_course_rel_access_url, $user_id; $xajax_response = new xajaxResponse(); $return = ''; @@ -68,7 +68,7 @@ function search_courses($needle, $type) } $without_assigned_courses = ''; if (count($assigned_courses_code) > 0) { - $without_assigned_courses = " AND c.code NOT IN(".implode(',',$assigned_courses_code).")"; + $without_assigned_courses = " AND c.code NOT IN(".implode(',', $assigned_courses_code).")"; } if (api_is_multiple_url_enabled()) { @@ -87,14 +87,14 @@ function search_courses($needle, $type) $without_assigned_courses "; } - $rs = Database::query($sql); + $rs = Database::query($sql); $return .= ''; - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); + $xajax_response -> addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return)); } return $xajax_response; } @@ -151,7 +151,7 @@ function remove_item(origin) { } '; -$formSent=0; +$formSent = 0; $errorMsg = $firstLetterCourse = ''; $UserList = array(); @@ -210,19 +210,19 @@ if (api_is_multiple_url_enabled()) { ORDER BY c.title"; } else { - $sql= " SELECT c.code, c.title + $sql = " SELECT c.code, c.title FROM $tbl_course c WHERE c.code LIKE '$needle' $without_assigned_courses ORDER BY c.title"; } -$result = Database::query($sql); +$result = Database::query($sql); ?>
@@ -234,7 +234,7 @@ if(!empty($msg)) {
@@ -242,8 +242,8 @@ if(!empty($msg)) {
- -

:

+ +

:

'; + $html .= ''; + $html .= ''; - $html .= ''; - $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; return $html; } @@ -4455,7 +4455,7 @@ function api_get_themes($getOnlyThemeFromVirtualInstance = false) // This configuration value is set by the vchamilo plugin $virtualTheme = api_get_configuration_value('virtual_css_theme_folder'); - $readCssFolder = function ($dir) use ($virtualTheme) { + $readCssFolder = function($dir) use ($virtualTheme) { $finder = new Finder(); $themes = $finder->directories()->in($dir)->depth(0)->sortByName(); $list = []; @@ -4616,7 +4616,7 @@ function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = fals if (is_file($dirname) || is_link($dirname)) { $res = unlink($dirname); if ($res === false) { - error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); + error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); } return $res; } @@ -4653,7 +4653,7 @@ function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = fals if ($delete_only_content_in_folder == false) { $res = rmdir($dirname); if ($res === false) { - error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); + error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); } } return $res; @@ -4738,7 +4738,7 @@ function copy_folder_course_session( $course_id = $course_info['real_id']; - $folders = explode(DIRECTORY_SEPARATOR,str_replace($base_path_document.DIRECTORY_SEPARATOR,'',$pathname)); + $folders = explode(DIRECTORY_SEPARATOR, str_replace($base_path_document.DIRECTORY_SEPARATOR, '', $pathname)); $new_pathname = $base_path_document; $path = ''; @@ -4756,7 +4756,7 @@ function copy_folder_course_session( path = '$path' AND filetype = 'folder' AND session_id = '$session_id'"; - $rs1 = Database::query($sql); + $rs1 = Database::query($sql); $num_rows = Database::num_rows($rs1); if ($num_rows == 0) { @@ -4916,7 +4916,7 @@ function api_parse_info_file($filename) { foreach (array('key', 'value1', 'value2', 'value3') as $var) { $$var = isset($match[++$i]) ? $match[$i] : ''; } - $value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3; + $value = stripslashes(substr($value1, 1, -1)).stripslashes(substr($value2, 1, -1)).$value3; // Parse array syntax. $keys = preg_split('/\]?\[/', rtrim($key, ']')); @@ -5087,7 +5087,7 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); $var = Database::escape_string($var); $value = Database::escape_string($value); - $access_url = (int)$access_url; + $access_url = (int) $access_url; if (empty($access_url)) { $access_url = 1; } $select = "SELECT id FROM $t_settings WHERE variable = '$var' "; if (!empty($subvar)) { @@ -5128,11 +5128,11 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url $row = Database::fetch_array($res); $insert = "INSERT INTO $t_settings (variable, subkey, type,category, selected_value, title, comment, scope, subkeytext, access_url) VALUES - ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . - "'".$row['type']."','".$row['category']."'," . - "'$value','".$row['title']."'," . - "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . - "".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)"; + ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". + "'".$row['type']."','".$row['category']."',". + "'$value','".$row['title']."',". + "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". + "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url)"; Database::query($insert); } else { // Such a setting does not exist. @@ -5154,11 +5154,11 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url if ($row['access_url_changeable'] == 1) { $insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES ('".$row['variable']."',". - (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . - "'".$row['type']."','".$row['category']."'," . - "'$value','".$row['title']."'," . + (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". + "'".$row['type']."','".$row['category']."',". + "'$value','".$row['title']."',". "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",". - (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . + (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url,".$row['access_url_changeable'].")"; Database::query($insert); } @@ -5192,10 +5192,10 @@ function api_set_settings_category($category, $value = null, $access_url = 1, $f $value = Database::escape_string($value); $sql = "UPDATE $t_s SET selected_value = '$value' WHERE category = '$category' AND access_url = $access_url"; - if (is_array($fieldtype) && count($fieldtype)>0) { + if (is_array($fieldtype) && count($fieldtype) > 0) { $sql .= " AND ( "; $i = 0; - foreach ($fieldtype as $type){ + foreach ($fieldtype as $type) { if ($i > 0) { $sql .= ' OR '; } @@ -5210,10 +5210,10 @@ function api_set_settings_category($category, $value = null, $access_url = 1, $f } else { $sql = "UPDATE $t_s SET selected_value = NULL WHERE category = '$category' AND access_url = $access_url"; - if (is_array($fieldtype) && count($fieldtype)>0) { + if (is_array($fieldtype) && count($fieldtype) > 0) { $sql .= " AND ( "; $i = 0; - foreach ($fieldtype as $type){ + foreach ($fieldtype as $type) { if ($i > 0) { $sql .= ' OR '; } @@ -5329,7 +5329,7 @@ function &api_get_settings($cat = null, $ordering = 'list', $access_url = 1, $ur if ($result === null) { return []; } - $result = Database::store_result($result,'ASSOC'); + $result = Database::store_result($result, 'ASSOC'); return $result; } @@ -5396,12 +5396,12 @@ function api_add_setting( // Item not found for this access_url, we have to check if the whole thing is missing // (in which case we ignore the insert) or if there *is* a record but just for access_url = 1 - $insert = "INSERT INTO $t_settings " . - "(variable,selected_value," . - "type,category," . - "subkey,title," . - "comment,scope," . - "subkeytext,access_url,access_url_changeable)" . + $insert = "INSERT INTO $t_settings ". + "(variable,selected_value,". + "type,category,". + "subkey,title,". + "comment,scope,". + "subkeytext,access_url,access_url_changeable)". " VALUES ('$var','$val',"; if (isset($type)) { $type = Database::escape_string($type); @@ -5566,7 +5566,7 @@ function api_is_course_visible_for_user($userid = null, $cid = null) { $result = Database::query($sql); //if ($row = Database::fetch_array($result)) { - if (Database::num_rows($result) > 0 ) { + if (Database::num_rows($result) > 0) { $is_courseMember = true; $is_courseTutor = true; $is_courseCoach = true; @@ -5856,7 +5856,7 @@ function api_is_windows_os() { } else { return false; } - return strtolower(substr((string)$os, 0, 3 )) == 'win'; + return strtolower(substr((string) $os, 0, 3)) == 'win'; } /** @@ -6454,7 +6454,7 @@ function api_get_jquery_ui_css_web_path() function api_get_jquery_ui_js($include_jqgrid = false) { $libraries = array(); if ($include_jqgrid) { - $libraries[]='jqgrid'; + $libraries[] = 'jqgrid'; } return api_get_jquery_libraries_js($libraries); } @@ -6477,12 +6477,12 @@ function api_get_jquery_libraries_js($libraries) { //jqgrid js and css if (in_array('jqgrid', $libraries)) { - $languaje = 'en'; + $languaje = 'en'; $platform_isocode = strtolower(api_get_language_isocode()); //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n $jqgrid_langs = array( - 'bg', 'bg1251', 'cat','cn','cs','da','de','el','en','es','fa','fi','fr','gl','he','hu','is','it','ja','nl','no','pl','pt-br','pt','ro','ru','sk','sr','sv','tr','ua' + 'bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'is', 'it', 'ja', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sr', 'sv', 'tr', 'ua' ); if (in_array($platform_isocode, $jqgrid_langs)) { @@ -6513,7 +6513,7 @@ function api_get_jquery_libraries_js($libraries) { // jquery datepicker if (in_array('datepicker', $libraries)) { - $languaje = 'en-GB'; + $languaje = 'en-GB'; $platform_isocode = strtolower(api_get_language_isocode()); // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n @@ -6685,7 +6685,7 @@ function api_block_course_item_locked_by_gradebook($item_id, $link_type, $course */ function api_check_php_version($my_inc_path = null) { - if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<')) { + if (!function_exists('version_compare') || version_compare(phpversion(), REQUIRED_PHP_VERSION, '<')) { $global_error_code = 1; // Incorrect PHP version $global_page = $my_inc_path.'global_error_message.inc.php'; @@ -6703,7 +6703,7 @@ function api_check_php_version($my_inc_path = null) function api_check_archive_dir() { if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) { - $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning'); + $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning'); api_not_allowed(true, $message); } } @@ -6794,23 +6794,23 @@ function api_get_real_ip() * @author Yannick Warnier for improvements and managment of multiple ranges * @todo check for IPv6 support */ -function api_check_ip_in_range($ip,$range) +function api_check_ip_in_range($ip, $range) { if (empty($ip) or empty($range)) { return false; } - $ip_ip = ip2long ($ip); + $ip_ip = ip2long($ip); // divide range param into array of elements - if (strpos($range,',')!==false) { - $ranges = explode(',',$range); + if (strpos($range, ',') !== false) { + $ranges = explode(',', $range); } else { $ranges = array($range); } foreach ($ranges as $range) { $range = trim($range); if (empty($range)) { continue; } - if (strpos($range,'/')===false) { - if (strcmp($ip,$range)===0) { + if (strpos($range, '/') === false) { + if (strcmp($ip, $range) === 0) { return true; // there is a direct IP match, return OK } continue; //otherwise, get to the next range @@ -6818,7 +6818,7 @@ function api_check_ip_in_range($ip,$range) // the range contains a "/", so analyse completely list ($net, $mask) = explode("/", $range); - $ip_net = ip2long ($net); + $ip_net = ip2long($net); // mask binary magic $ip_mask = ~((1 << (32 - $mask)) - 1); @@ -7167,7 +7167,7 @@ function api_set_memory_limit($mem) } $memory_limit = ini_get('memory_limit'); - if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)){ + if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)) { ini_set('memory_limit', $mem); return true; } @@ -7186,20 +7186,20 @@ function api_set_memory_limit($mem) */ function api_get_bytes_memory_limit($mem) { - $size = strtolower(substr($mem,-1)); + $size = strtolower(substr($mem, -1)); switch ($size) { case 't': - $mem = intval(substr($mem,-1))*1024*1024*1024*1024; + $mem = intval(substr($mem, -1)) * 1024 * 1024 * 1024 * 1024; break; case 'g': - $mem = intval(substr($mem,0,-1))*1024*1024*1024; + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024 * 1024; break; case 'm': - $mem = intval(substr($mem,0,-1))*1024*1024; + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024; break; case 'k': - $mem = intval(substr($mem,0,-1))*1024; + $mem = intval(substr($mem, 0, -1)) * 1024; break; default: // we assume it's integer only @@ -7262,7 +7262,7 @@ function api_get_password_checker_js($usernameInputId, $passwordInputId) ]; $js = api_get_asset('pwstrength-bootstrap/dist/pwstrength-bootstrap.min.js'); - $js .= "