@@ -15,36 +15,36 @@ discard block |
||
15 | 15 | api_protect_admin_script(); |
16 | 16 | |
17 | 17 | // Breadcrumb |
18 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
19 | -$interbreadcrumb[] = array ('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings')); |
|
18 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
19 | +$interbreadcrumb[] = array('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings')); |
|
20 | 20 | |
21 | 21 | $libpath = api_get_path(LIBRARY_PATH); |
22 | 22 | |
23 | 23 | include_once $libpath.'specific_fields_manager.lib.php'; |
24 | 24 | |
25 | 25 | // Create an add-field box |
26 | -$form = new FormValidator('add_field','post','','',null,false); |
|
27 | -$renderer =& $form->defaultRenderer(); |
|
26 | +$form = new FormValidator('add_field', 'post', '', '', null, false); |
|
27 | +$renderer = & $form->defaultRenderer(); |
|
28 | 28 | $renderer->setCustomElementTemplate('<span>{element}</span> '); |
29 | -$form->addElement('static','search_advanced_link',null,'<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>'); |
|
29 | +$form->addElement('static', 'search_advanced_link', null, '<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>'); |
|
30 | 30 | |
31 | 31 | // Create a sortable table with specific fields data |
32 | -$column_show = array(1,1,1); |
|
33 | -$column_order = array(3,2,1); |
|
32 | +$column_show = array(1, 1, 1); |
|
33 | +$column_order = array(3, 2, 1); |
|
34 | 34 | $extra_fields = get_specific_field_list(); |
35 | 35 | $number_of_extra_fields = count($extra_fields); |
36 | 36 | |
37 | -$table = new SortableTableFromArrayConfig($extra_fields,2,50,'',$column_show,$column_order); |
|
38 | -$table->set_header(0, ' ', false,null,'width="2%"', 'style="display:none"'); |
|
37 | +$table = new SortableTableFromArrayConfig($extra_fields, 2, 50, '', $column_show, $column_order); |
|
38 | +$table->set_header(0, ' ', false, null, 'width="2%"', 'style="display:none"'); |
|
39 | 39 | $table->set_header(1, get_lang('Code'), TRUE, 'width="10%"'); |
40 | 40 | $table->set_header(2, get_lang('Name')); |
41 | -$table->set_header(3, get_lang('Modify'),false,'width="10%"'); |
|
41 | +$table->set_header(3, get_lang('Modify'), false, 'width="10%"'); |
|
42 | 42 | $table->set_column_filter(3, 'edit_filter'); |
43 | 43 | |
44 | -function edit_filter($id,$url_params,$row) { |
|
44 | +function edit_filter($id, $url_params, $row) { |
|
45 | 45 | global $charset; |
46 | - $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>'; |
|
47 | - $return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>'; |
|
46 | + $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>'; |
|
47 | + $return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; |
|
48 | 48 | return $return; |
49 | 49 | } |
50 | 50 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | Display::display_header(get_lang('SpecificSearchFields')); |
61 | 61 | echo Display::display_normal_message(get_lang('SpecificSearchFieldsIntro')); |
62 | 62 | |
63 | -if(!empty($_GET['message'])) { |
|
63 | +if (!empty($_GET['message'])) { |
|
64 | 64 | Display::display_confirmation_message($_GET['message']); |
65 | 65 | } |
66 | 66 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $tool_name = get_lang('AddSpecificSearchField'); |
28 | 28 | |
29 | 29 | if (isset($_GET['action']) && $_GET['action'] === 'edit') { |
30 | - $tool_name = get_lang('EditSpecificSearchField'); |
|
30 | + $tool_name = get_lang('EditSpecificSearchField'); |
|
31 | 31 | } |
32 | 32 | // Create the form |
33 | 33 | $form = new FormValidator('specific_fields_add'); |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | // Create the form |
33 | 33 | $form = new FormValidator('specific_fields_add'); |
34 | 34 | // Field variable name |
35 | -$form->addElement('hidden','field_id', $fieldId); |
|
36 | -$form->addElement('text','field_name',get_lang('FieldName')); |
|
37 | -$form->applyFilter('field_name','html_filter'); |
|
38 | -$form->applyFilter('field_name','trim'); |
|
35 | +$form->addElement('hidden', 'field_id', $fieldId); |
|
36 | +$form->addElement('text', 'field_name', get_lang('FieldName')); |
|
37 | +$form->applyFilter('field_name', 'html_filter'); |
|
38 | +$form->applyFilter('field_name', 'trim'); |
|
39 | 39 | $form->addRule('field_name', get_lang('ThisFieldIsRequired'), 'required'); |
40 | 40 | $form->addRule('field_name', get_lang('OnlyLettersAndNumbersAllowed'), 'username'); |
41 | -$form->addRule('field_name', '', 'maxlength',20); |
|
41 | +$form->addRule('field_name', '', 'maxlength', 20); |
|
42 | 42 | |
43 | 43 | // Set default values (only not empty when editing) |
44 | 44 | $defaults = array(); |
45 | 45 | if ($fieldId) { |
46 | - $form_information = get_specific_field_list(array( 'id' => $fieldId )); |
|
46 | + $form_information = get_specific_field_list(array('id' => $fieldId)); |
|
47 | 47 | $defaults['field_name'] = $form_information[0]['name']; |
48 | 48 | } |
49 | 49 | $form->setDefaults($defaults); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if ($form->validate()) { |
55 | 55 | $field = $form->exportValues(); |
56 | 56 | $field_name = $field['field_name']; |
57 | - if (is_numeric($field['field_id']) && $field['field_id']<>0 && !empty($field['field_id'])) { |
|
57 | + if (is_numeric($field['field_id']) && $field['field_id'] <> 0 && !empty($field['field_id'])) { |
|
58 | 58 | edit_specific_field($field['field_id'], $field['field_name']); |
59 | 59 | $message = get_lang('FieldEdited'); |
60 | 60 | } else { |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | define('PLATFORM_ADMIN', 11); |
40 | 40 | define('SESSION_COURSE_COACH', 12); |
41 | 41 | define('SESSION_GENERAL_COACH', 13); |
42 | -define('COURSE_STUDENT', 14); //student subscribed in a course |
|
43 | -define('SESSION_STUDENT', 15); //student subscribed in a session course |
|
42 | +define('COURSE_STUDENT', 14); //student subscribed in a course |
|
43 | +define('SESSION_STUDENT', 15); //student subscribed in a session course |
|
44 | 44 | define('COURSE_TUTOR', 16); // student is tutor of a course (NOT in session) |
45 | 45 | define('STUDENT_BOSS', 17); // student is boss |
46 | 46 | define('INVITEE', 20); |
47 | 47 | |
48 | 48 | // Table of status |
49 | -$_status_list[COURSEMANAGER] = 'teacher'; // 1 |
|
50 | -$_status_list[SESSIONADMIN] = 'session_admin'; // 3 |
|
51 | -$_status_list[DRH] = 'drh'; // 4 |
|
52 | -$_status_list[STUDENT] = 'user'; // 5 |
|
53 | -$_status_list[ANONYMOUS] = 'anonymous'; // 6 |
|
54 | -$_status_list[INVITEE] = 'invited'; // 20 |
|
49 | +$_status_list[COURSEMANAGER] = 'teacher'; // 1 |
|
50 | +$_status_list[SESSIONADMIN] = 'session_admin'; // 3 |
|
51 | +$_status_list[DRH] = 'drh'; // 4 |
|
52 | +$_status_list[STUDENT] = 'user'; // 5 |
|
53 | +$_status_list[ANONYMOUS] = 'anonymous'; // 6 |
|
54 | +$_status_list[INVITEE] = 'invited'; // 20 |
|
55 | 55 | |
56 | 56 | // COURSE VISIBILITY CONSTANTS |
57 | 57 | /** only visible for course admin */ |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | define('IS_WINDOWS_OS', api_is_windows_os()); |
265 | 265 | |
266 | 266 | // Checks for installed optional php-extensions. |
267 | -define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
268 | -define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
269 | -define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
267 | +define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
268 | +define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
269 | +define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
270 | 270 | |
271 | 271 | // Patterns for processing paths. // Examples: |
272 | -define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
273 | -define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
274 | -define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
272 | +define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
273 | +define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
274 | +define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
275 | 275 | |
276 | 276 | // Constants for api_get_path() and api_get_path_type(), etc. - registered path types. |
277 | 277 | define('WEB_PATH', 'WEB_PATH'); |
@@ -375,19 +375,19 @@ discard block |
||
375 | 375 | define('LINK_HOTPOTATOES', 9); |
376 | 376 | |
377 | 377 | // Score display types constants |
378 | -define('SCORE_DIV', 1); // X / Y |
|
379 | -define('SCORE_PERCENT', 2); // XX % |
|
380 | -define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
381 | -define('SCORE_AVERAGE', 4); // XX % |
|
382 | -define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
383 | -define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
384 | -define('SCORE_SIMPLE', 7); // X |
|
385 | -define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
386 | -define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
387 | -define('SCORE_CUSTOM', 10); // Good! |
|
388 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
389 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
390 | -define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
378 | +define('SCORE_DIV', 1); // X / Y |
|
379 | +define('SCORE_PERCENT', 2); // XX % |
|
380 | +define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
381 | +define('SCORE_AVERAGE', 4); // XX % |
|
382 | +define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
383 | +define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
384 | +define('SCORE_SIMPLE', 7); // X |
|
385 | +define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
386 | +define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
387 | +define('SCORE_CUSTOM', 10); // Good! |
|
388 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
389 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
390 | +define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
391 | 391 | |
392 | 392 | define('SCORE_BOTH', 1); |
393 | 393 | define('SCORE_ONLY_DEFAULT', 2); |
@@ -555,8 +555,8 @@ discard block |
||
555 | 555 | define('TIMELINE_STATUS_INACTIVE', '2'); |
556 | 556 | |
557 | 557 | // Event email template class |
558 | -define ('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
559 | -define ('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
|
558 | +define('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
559 | +define('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
|
560 | 560 | |
561 | 561 | // Course home |
562 | 562 | define('SHORTCUTS_HORIZONTAL', 0); |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | |
733 | 733 | // To avoid that the api_get_access_url() function fails since global.inc.php also calls the main_api.lib.php |
734 | 734 | if ($path_type == WEB_PATH) { |
735 | - if (isset($_configuration['access_url']) && $_configuration['access_url'] != 1) { |
|
735 | + if (isset($_configuration['access_url']) && $_configuration['access_url'] != 1) { |
|
736 | 736 | //we look into the DB the function api_get_access_url |
737 | 737 | $url_info = api_get_access_url($_configuration['access_url']); |
738 | 738 | $root_web = $url_info['active'] == 1 ? $url_info['url'] : $_configuration['root_web']; |
@@ -762,8 +762,8 @@ discard block |
||
762 | 762 | : 'localhost'))); |
763 | 763 | if (isset($_SERVER['SERVER_PORT']) && !strpos($server_name, ':') |
764 | 764 | && (($server_protocol == 'http' |
765 | - && $_SERVER['SERVER_PORT'] != 80 ) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443 ))) { |
|
766 | - $server_name .= ":" . $_SERVER['SERVER_PORT']; |
|
765 | + && $_SERVER['SERVER_PORT'] != 80) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443))) { |
|
766 | + $server_name .= ":".$_SERVER['SERVER_PORT']; |
|
767 | 767 | } |
768 | 768 | $root_web = $server_protocol.'://'.$server_name.$root_rel; |
769 | 769 | $root_sys = str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/'; |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | $sys_course_code = |
938 | 938 | isset($_SESSION['_course']['sysCode']) // User is inside a course? |
939 | 939 | ? $_SESSION['_course']['sysCode'] // Yes, then use course's directory name. |
940 | - : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
940 | + : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
941 | 941 | $path = $matches[1].'courses/'.$sys_course_code.'/document/'.str_replace('//', '/', $matches[3].'/'.$matches[2]); |
942 | 942 | } |
943 | 943 | } |
@@ -981,15 +981,15 @@ discard block |
||
981 | 981 | { |
982 | 982 | global $_configuration; |
983 | 983 | $web_root = api_get_path(WEB_PATH); |
984 | - $ext = substr($web_path,strrpos($web_path,'.')); |
|
984 | + $ext = substr($web_path, strrpos($web_path, '.')); |
|
985 | 985 | if (isset($ext[2])) { // faster version of strlen to check if len>2 |
986 | 986 | // Check for CDN definitions |
987 | 987 | if (!empty($_configuration['cdn_enable']) && !empty($ext)) { |
988 | 988 | foreach ($_configuration['cdn'] as $host => $exts) { |
989 | - if (in_array($ext,$exts)) { |
|
989 | + if (in_array($ext, $exts)) { |
|
990 | 990 | //Use host as defined in $_configuration['cdn'], without |
991 | 991 | // trailing slash |
992 | - return str_replace($web_root,$host.'/',$web_path); |
|
992 | + return str_replace($web_root, $host.'/', $web_path); |
|
993 | 993 | } |
994 | 994 | } |
995 | 995 | } |
@@ -1438,10 +1438,10 @@ discard block |
||
1438 | 1438 | |
1439 | 1439 | if (isset($user['email'])) { |
1440 | 1440 | $result['mail'] = isset($user['email']) ? $user['email'] : null; |
1441 | - $result['email'] = isset($user['email'])? $user['email'] : null; |
|
1441 | + $result['email'] = isset($user['email']) ? $user['email'] : null; |
|
1442 | 1442 | } else { |
1443 | 1443 | $result['mail'] = isset($user['mail']) ? $user['mail'] : null; |
1444 | - $result['email'] = isset($user['mail'])? $user['mail'] : null; |
|
1444 | + $result['email'] = isset($user['mail']) ? $user['mail'] : null; |
|
1445 | 1445 | } |
1446 | 1446 | $user_id = intval($user['user_id']); |
1447 | 1447 | // Maintain the user_id index for backwards compatibility |
@@ -1917,7 +1917,7 @@ discard block |
||
1917 | 1917 | foreach ($param_list1 as $key => $enreg) { |
1918 | 1918 | list ($param_list1_keys[$key], $param_list1_vals[$key]) = explode('=', $enreg); |
1919 | 1919 | } |
1920 | - $param_list1 = array ('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1920 | + $param_list1 = array('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1921 | 1921 | foreach ($param_list2 as $enreg) { |
1922 | 1922 | $enreg = explode('=', $enreg); |
1923 | 1923 | $key = array_search($enreg[0], $param_list1['keys']); |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | $length = 2; |
1948 | 1948 | } |
1949 | 1949 | $password = ''; |
1950 | - for ($i = 0; $i < $length; $i ++) { |
|
1950 | + for ($i = 0; $i < $length; $i++) { |
|
1951 | 1951 | $password .= $characters[rand() % strlen($characters)]; |
1952 | 1952 | } |
1953 | 1953 | return $password; |
@@ -1974,10 +1974,10 @@ discard block |
||
1974 | 1974 | $digits = 0; |
1975 | 1975 | $consequent_characters = 0; |
1976 | 1976 | $previous_character_code = 0; |
1977 | - for ($i = 0; $i < $password_length; $i ++) { |
|
1977 | + for ($i = 0; $i < $password_length; $i++) { |
|
1978 | 1978 | $current_character_code = api_ord(api_substr($password, $i, 1)); |
1979 | 1979 | if ($i && abs($current_character_code - $previous_character_code) <= 1) { |
1980 | - $consequent_characters ++; |
|
1980 | + $consequent_characters++; |
|
1981 | 1981 | if ($consequent_characters == 3) { |
1982 | 1982 | return false; |
1983 | 1983 | } |
@@ -1985,9 +1985,9 @@ discard block |
||
1985 | 1985 | $consequent_characters = 1; |
1986 | 1986 | } |
1987 | 1987 | if ($current_character_code >= 97 && $current_character_code <= 122) { |
1988 | - $letters ++; |
|
1988 | + $letters++; |
|
1989 | 1989 | } elseif ($current_character_code >= 48 && $current_character_code <= 57) { |
1990 | - $digits ++; |
|
1990 | + $digits++; |
|
1991 | 1991 | } else { |
1992 | 1992 | return false; |
1993 | 1993 | } |
@@ -2183,7 +2183,7 @@ discard block |
||
2183 | 2183 | if (empty($session_id)) { return null; } |
2184 | 2184 | } |
2185 | 2185 | $t = Database::get_main_table(TABLE_MAIN_SESSION); |
2186 | - $s = "SELECT name FROM $t WHERE id = ".(int)$session_id; |
|
2186 | + $s = "SELECT name FROM $t WHERE id = ".(int) $session_id; |
|
2187 | 2187 | $r = Database::query($s); |
2188 | 2188 | $c = Database::num_rows($r); |
2189 | 2189 | if ($c > 0) { |
@@ -2208,7 +2208,7 @@ discard block |
||
2208 | 2208 | $sql = "SELECT * FROM $tbl_session WHERE id = $session_id"; |
2209 | 2209 | $result = Database::query($sql); |
2210 | 2210 | |
2211 | - if (Database::num_rows($result)>0) { |
|
2211 | + if (Database::num_rows($result) > 0) { |
|
2212 | 2212 | $data = Database::fetch_array($result, 'ASSOC'); |
2213 | 2213 | } |
2214 | 2214 | } |
@@ -2368,9 +2368,9 @@ discard block |
||
2368 | 2368 | */ |
2369 | 2369 | function api_get_session_image($session_id, $status_id) |
2370 | 2370 | { |
2371 | - $session_id = (int)$session_id; |
|
2371 | + $session_id = (int) $session_id; |
|
2372 | 2372 | $session_img = ''; |
2373 | - if ((int)$status_id != 5) { //check whether is not a student |
|
2373 | + if ((int) $status_id != 5) { //check whether is not a student |
|
2374 | 2374 | if ($session_id > 0) { |
2375 | 2375 | $session_img = " ".Display::return_icon( |
2376 | 2376 | 'star.png', |
@@ -2485,7 +2485,7 @@ discard block |
||
2485 | 2485 | $filename = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt'; |
2486 | 2486 | if (file_exists($filename)) { |
2487 | 2487 | $value = file_get_contents($filename); |
2488 | - return $value ; |
|
2488 | + return $value; |
|
2489 | 2489 | } else { |
2490 | 2490 | return ''; |
2491 | 2491 | } |
@@ -2494,7 +2494,7 @@ discard block |
||
2494 | 2494 | $filename = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt'; |
2495 | 2495 | if (file_exists($filename)) { |
2496 | 2496 | $value = file_get_contents($filename); |
2497 | - return $value ; |
|
2497 | + return $value; |
|
2498 | 2498 | } else { |
2499 | 2499 | return ''; |
2500 | 2500 | } |
@@ -2688,7 +2688,7 @@ discard block |
||
2688 | 2688 | } |
2689 | 2689 | $group_id = api_get_group_id(); |
2690 | 2690 | $course_id = api_get_course_int_id(); |
2691 | - $course_code= api_get_course_id(); |
|
2691 | + $course_code = api_get_course_id(); |
|
2692 | 2692 | $session_id = api_get_session_id(); |
2693 | 2693 | |
2694 | 2694 | //Group (in course) |
@@ -2696,7 +2696,7 @@ discard block |
||
2696 | 2696 | $group_status = array(); |
2697 | 2697 | $is_subscribed = GroupManager::is_subscribed($user_id, $group_id); |
2698 | 2698 | if ($is_subscribed) { |
2699 | - $group_status = array('id'=> $group_id , 'status' => 'student'); |
|
2699 | + $group_status = array('id'=> $group_id, 'status' => 'student'); |
|
2700 | 2700 | $is_tutor = GroupManager::is_tutor_of_group($user_id, $group_id); |
2701 | 2701 | if ($is_tutor) { |
2702 | 2702 | $group_status['status'] = 'tutor'; |
@@ -2730,7 +2730,7 @@ discard block |
||
2730 | 2730 | } |
2731 | 2731 | $status['session'] = $session_status; |
2732 | 2732 | |
2733 | - } elseif($course_id) { |
|
2733 | + } elseif ($course_id) { |
|
2734 | 2734 | //Course |
2735 | 2735 | $course_status = array(); |
2736 | 2736 | if ($course_id) { |
@@ -2738,7 +2738,7 @@ discard block |
||
2738 | 2738 | |
2739 | 2739 | if ($user_course_status) { |
2740 | 2740 | $course_status = array('id'=> $course_id); |
2741 | - switch($user_course_status) { |
|
2741 | + switch ($user_course_status) { |
|
2742 | 2742 | case 1; |
2743 | 2743 | $course_status['status'] = 'teacher'; |
2744 | 2744 | break; |
@@ -2768,7 +2768,7 @@ discard block |
||
2768 | 2768 | function api_is_course_session_coach($user_id, $courseId, $session_id) |
2769 | 2769 | { |
2770 | 2770 | $session_table = Database::get_main_table(TABLE_MAIN_SESSION); |
2771 | - $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2771 | + $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2772 | 2772 | |
2773 | 2773 | $user_id = intval($user_id); |
2774 | 2774 | $session_id = intval($session_id); |
@@ -2842,7 +2842,7 @@ discard block |
||
2842 | 2842 | ORDER BY access_start_date, access_end_date, name"; |
2843 | 2843 | $result = Database::query($sql); |
2844 | 2844 | if (!empty($sessionIsCoach)) { |
2845 | - $sessionIsCoach = array_merge($sessionIsCoach , Database::store_result($result)); |
|
2845 | + $sessionIsCoach = array_merge($sessionIsCoach, Database::store_result($result)); |
|
2846 | 2846 | } else { |
2847 | 2847 | $sessionIsCoach = Database::store_result($result); |
2848 | 2848 | } |
@@ -3019,7 +3019,7 @@ discard block |
||
3019 | 3019 | return ''; |
3020 | 3020 | } |
3021 | 3021 | $sourceurl = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')); |
3022 | - $sourceurl = str_replace('newscorm/lp_header.php', 'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.intval($_GET['lp_id']).'&isStudentView='.($_SESSION['studentview']=='studentview' ? 'false' : 'true'), $sourceurl); |
|
3022 | + $sourceurl = str_replace('newscorm/lp_header.php', 'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.intval($_GET['lp_id']).'&isStudentView='.($_SESSION['studentview'] == 'studentview' ? 'false' : 'true'), $sourceurl); |
|
3023 | 3023 | //showinframes doesn't handle student view anyway... |
3024 | 3024 | //return ''; |
3025 | 3025 | $is_framed = true; |
@@ -3418,7 +3418,7 @@ discard block |
||
3418 | 3418 | } |
3419 | 3419 | $content .= '<div class="well_login">'; |
3420 | 3420 | $content .= $form->return_form(); |
3421 | - $content .='</div>'; |
|
3421 | + $content .= '</div>'; |
|
3422 | 3422 | if (api_is_cas_activated()) { |
3423 | 3423 | $content .= "</div>"; |
3424 | 3424 | } |
@@ -3437,7 +3437,7 @@ discard block |
||
3437 | 3437 | exit; |
3438 | 3438 | } |
3439 | 3439 | |
3440 | - if ($user_id !=0 && !api_is_anonymous()) { |
|
3440 | + if ($user_id != 0 && !api_is_anonymous()) { |
|
3441 | 3441 | $tpl->display_one_col_template(); |
3442 | 3442 | exit; |
3443 | 3443 | } |
@@ -3468,7 +3468,7 @@ discard block |
||
3468 | 3468 | } |
3469 | 3469 | $msg .= '<div class="well">'; |
3470 | 3470 | $msg .= $form->return_form(); |
3471 | - $msg .='</div>'; |
|
3471 | + $msg .= '</div>'; |
|
3472 | 3472 | if (api_is_cas_activated()) { |
3473 | 3473 | $msg .= "</div>"; |
3474 | 3474 | } |
@@ -3504,7 +3504,7 @@ discard block |
||
3504 | 3504 | list ($last_post_date, $last_post_time) = explode(' ', $last_post_datetime); |
3505 | 3505 | list ($year, $month, $day) = explode('-', $last_post_date); |
3506 | 3506 | list ($hour, $min, $sec) = explode(':', $last_post_time); |
3507 | - return mktime((int)$hour, (int)$min, (int)$sec, (int)$month, (int)$day, (int)$year); |
|
3507 | + return mktime((int) $hour, (int) $min, (int) $sec, (int) $month, (int) $day, (int) $year); |
|
3508 | 3508 | } |
3509 | 3509 | |
3510 | 3510 | /** |
@@ -3955,7 +3955,7 @@ discard block |
||
3955 | 3955 | c_id = $course_id AND |
3956 | 3956 | tool = '$tool' |
3957 | 3957 | $session_condition "; |
3958 | - $rs = Database::query($sql); |
|
3958 | + $rs = Database::query($sql); |
|
3959 | 3959 | $list = array(); |
3960 | 3960 | if (Database::num_rows($rs) > 0) { |
3961 | 3961 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -4035,7 +4035,7 @@ discard block |
||
4035 | 4035 | tool = '$tool' AND |
4036 | 4036 | ref = $ref |
4037 | 4037 | $sessionCondition"; |
4038 | - $rs = Database::query($sql); |
|
4038 | + $rs = Database::query($sql); |
|
4039 | 4039 | $item_property_id = ''; |
4040 | 4040 | if (Database::num_rows($rs) > 0) { |
4041 | 4041 | $row = Database::fetch_array($rs); |
@@ -4093,7 +4093,7 @@ discard block |
||
4093 | 4093 | WHERE item_property_id = $item_property_id AND course_id = $course_id |
4094 | 4094 | ORDER BY lastedit_date DESC"; |
4095 | 4095 | $result = Database::query($sql); |
4096 | - $result = Database::store_result($result,'ASSOC'); |
|
4096 | + $result = Database::store_result($result, 'ASSOC'); |
|
4097 | 4097 | return $result; |
4098 | 4098 | } |
4099 | 4099 | |
@@ -4143,7 +4143,7 @@ discard block |
||
4143 | 4143 | $rs = Database::query($sql); |
4144 | 4144 | $row = array(); |
4145 | 4145 | if (Database::num_rows($rs) > 0) { |
4146 | - $row = Database::fetch_array($rs,'ASSOC'); |
|
4146 | + $row = Database::fetch_array($rs, 'ASSOC'); |
|
4147 | 4147 | } |
4148 | 4148 | |
4149 | 4149 | return $row; |
@@ -4179,7 +4179,7 @@ discard block |
||
4179 | 4179 | $languages = $language_list['name']; |
4180 | 4180 | $folder = $language_list['folder']; |
4181 | 4181 | |
4182 | - $ret .= '<select name="' . $name . '" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4182 | + $ret .= '<select name="'.$name.'" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4183 | 4183 | foreach ($languages as $key => $value) { |
4184 | 4184 | if ($folder[$key] == $default) { |
4185 | 4185 | $selected = ' selected="selected"'; |
@@ -4232,8 +4232,8 @@ discard block |
||
4232 | 4232 | //--> |
4233 | 4233 | </script>'; |
4234 | 4234 | $html .= '<form id="lang_form" name="lang_form" method="post" action="'.api_get_self().'">'; |
4235 | - $html .= '<label style="display: none;" for="language_list">' . get_lang('Language') . '</label>'; |
|
4236 | - $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4235 | + $html .= '<label style="display: none;" for="language_list">'.get_lang('Language').'</label>'; |
|
4236 | + $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4237 | 4237 | |
4238 | 4238 | foreach ($original_languages as $key => $value) { |
4239 | 4239 | if ($folder[$key] == $user_selected_language) { |
@@ -4241,13 +4241,13 @@ discard block |
||
4241 | 4241 | } else { |
4242 | 4242 | $option_end = '>'; |
4243 | 4243 | } |
4244 | - $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end; |
|
4244 | + $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end; |
|
4245 | 4245 | //echo substr($value, 0, 16); // Cut string to keep 800x600 aspect. |
4246 | - $html .= $value.'</option>'; |
|
4246 | + $html .= $value.'</option>'; |
|
4247 | 4247 | } |
4248 | - $html .= '</select>'; |
|
4249 | - $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4250 | - $html .= '</form>'; |
|
4248 | + $html .= '</select>'; |
|
4249 | + $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4250 | + $html .= '</form>'; |
|
4251 | 4251 | return $html; |
4252 | 4252 | } |
4253 | 4253 | |
@@ -4364,7 +4364,7 @@ discard block |
||
4364 | 4364 | $rs = Database::query($sql); |
4365 | 4365 | $language_info = array(); |
4366 | 4366 | if (Database::num_rows($rs)) { |
4367 | - $language_info = Database::fetch_array($rs,'ASSOC'); |
|
4367 | + $language_info = Database::fetch_array($rs, 'ASSOC'); |
|
4368 | 4368 | } |
4369 | 4369 | return $language_info; |
4370 | 4370 | } |
@@ -4442,7 +4442,7 @@ discard block |
||
4442 | 4442 | * Note: Directory names (names of themes) in the file system should contain ASCII-characters only. |
4443 | 4443 | */ |
4444 | 4444 | function api_get_themes() { |
4445 | - $cssdir = api_get_path(SYS_CSS_PATH) . 'themes/'; |
|
4445 | + $cssdir = api_get_path(SYS_CSS_PATH).'themes/'; |
|
4446 | 4446 | $list_dir = array(); |
4447 | 4447 | $list_name = array(); |
4448 | 4448 | |
@@ -4633,7 +4633,7 @@ discard block |
||
4633 | 4633 | if (is_file($dirname) || is_link($dirname)) { |
4634 | 4634 | $res = unlink($dirname); |
4635 | 4635 | if ($res === false) { |
4636 | - 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); |
|
4636 | + 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); |
|
4637 | 4637 | } |
4638 | 4638 | return $res; |
4639 | 4639 | } |
@@ -4670,7 +4670,7 @@ discard block |
||
4670 | 4670 | if ($delete_only_content_in_folder == false) { |
4671 | 4671 | $res = rmdir($dirname); |
4672 | 4672 | if ($res === false) { |
4673 | - 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); |
|
4673 | + 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); |
|
4674 | 4674 | } |
4675 | 4675 | } |
4676 | 4676 | return $res; |
@@ -4748,7 +4748,7 @@ discard block |
||
4748 | 4748 | |
4749 | 4749 | $course_id = $course_info['real_id']; |
4750 | 4750 | |
4751 | - $folders = explode(DIRECTORY_SEPARATOR,str_replace($base_path_document.DIRECTORY_SEPARATOR,'',$pathname)); |
|
4751 | + $folders = explode(DIRECTORY_SEPARATOR, str_replace($base_path_document.DIRECTORY_SEPARATOR, '', $pathname)); |
|
4752 | 4752 | |
4753 | 4753 | $new_pathname = $base_path_document; |
4754 | 4754 | $path = ''; |
@@ -4766,7 +4766,7 @@ discard block |
||
4766 | 4766 | path = '$path' AND |
4767 | 4767 | filetype = 'folder' AND |
4768 | 4768 | session_id = '$session_id'"; |
4769 | - $rs1 = Database::query($sql); |
|
4769 | + $rs1 = Database::query($sql); |
|
4770 | 4770 | $num_rows = Database::num_rows($rs1); |
4771 | 4771 | |
4772 | 4772 | if ($num_rows == 0) { |
@@ -4923,7 +4923,7 @@ discard block |
||
4923 | 4923 | foreach (array('key', 'value1', 'value2', 'value3') as $var) { |
4924 | 4924 | $$var = isset($match[++$i]) ? $match[$i] : ''; |
4925 | 4925 | } |
4926 | - $value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3; |
|
4926 | + $value = stripslashes(substr($value1, 1, -1)).stripslashes(substr($value2, 1, -1)).$value3; |
|
4927 | 4927 | |
4928 | 4928 | // Parse array syntax. |
4929 | 4929 | $keys = preg_split('/\]?\[/', rtrim($key, ']')); |
@@ -4963,7 +4963,7 @@ discard block |
||
4963 | 4963 | */ |
4964 | 4964 | function api_get_version() { |
4965 | 4965 | global $_configuration; |
4966 | - return (string)$_configuration['system_version']; |
|
4966 | + return (string) $_configuration['system_version']; |
|
4967 | 4967 | } |
4968 | 4968 | |
4969 | 4969 | /** |
@@ -5089,7 +5089,7 @@ discard block |
||
5089 | 5089 | $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
5090 | 5090 | $var = Database::escape_string($var); |
5091 | 5091 | $value = Database::escape_string($value); |
5092 | - $access_url = (int)$access_url; |
|
5092 | + $access_url = (int) $access_url; |
|
5093 | 5093 | if (empty($access_url)) { $access_url = 1; } |
5094 | 5094 | $select = "SELECT id FROM $t_settings WHERE variable = '$var' "; |
5095 | 5095 | if (!empty($subvar)) { |
@@ -5111,7 +5111,7 @@ discard block |
||
5111 | 5111 | // Found item for this access_url. |
5112 | 5112 | $row = Database::fetch_array($res); |
5113 | 5113 | $sql = "UPDATE $t_settings SET selected_value = '$value' |
5114 | - WHERE id = ".$row['id'] ; |
|
5114 | + WHERE id = ".$row['id']; |
|
5115 | 5115 | Database::query($sql); |
5116 | 5116 | } else { |
5117 | 5117 | // Item not found for this access_url, we have to check if it exist with access_url = 1 |
@@ -5132,11 +5132,11 @@ discard block |
||
5132 | 5132 | $row = Database::fetch_array($res); |
5133 | 5133 | $insert = "INSERT INTO $t_settings (variable, subkey, type,category, selected_value, title, comment, scope, subkeytext, access_url) |
5134 | 5134 | VALUES |
5135 | - ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
5136 | - "'".$row['type']."','".$row['category']."'," . |
|
5137 | - "'$value','".$row['title']."'," . |
|
5138 | - "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
5139 | - "".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)"; |
|
5135 | + ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
5136 | + "'".$row['type']."','".$row['category']."',". |
|
5137 | + "'$value','".$row['title']."',". |
|
5138 | + "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
5139 | + "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url)"; |
|
5140 | 5140 | Database::query($insert); |
5141 | 5141 | } else { // Such a setting does not exist. |
5142 | 5142 | error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all', 0); |
@@ -5156,16 +5156,16 @@ discard block |
||
5156 | 5156 | if ($row['access_url_changeable'] == 1) { |
5157 | 5157 | $insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES |
5158 | 5158 | ('".$row['variable']."',". |
5159 | - (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
5160 | - "'".$row['type']."','".$row['category']."'," . |
|
5161 | - "'$value','".$row['title']."'," . |
|
5159 | + (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
5160 | + "'".$row['type']."','".$row['category']."',". |
|
5161 | + "'$value','".$row['title']."',". |
|
5162 | 5162 | "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",". |
5163 | - (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
5163 | + (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
5164 | 5164 | "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url,".$row['access_url_changeable'].")"; |
5165 | 5165 | Database::query($insert); |
5166 | 5166 | } |
5167 | 5167 | } else { // Such a setting does not exist. |
5168 | - error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0); |
|
5168 | + error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ', 0); |
|
5169 | 5169 | } |
5170 | 5170 | } |
5171 | 5171 | } |
@@ -5191,10 +5191,10 @@ discard block |
||
5191 | 5191 | $value = Database::escape_string($value); |
5192 | 5192 | $sql = "UPDATE $t_s SET selected_value = '$value' |
5193 | 5193 | WHERE category = '$category' AND access_url = $access_url"; |
5194 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5194 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5195 | 5195 | $sql .= " AND ( "; |
5196 | 5196 | $i = 0; |
5197 | - foreach ($fieldtype as $type){ |
|
5197 | + foreach ($fieldtype as $type) { |
|
5198 | 5198 | if ($i > 0) { |
5199 | 5199 | $sql .= ' OR '; |
5200 | 5200 | } |
@@ -5209,10 +5209,10 @@ discard block |
||
5209 | 5209 | } else { |
5210 | 5210 | $sql = "UPDATE $t_s SET selected_value = NULL |
5211 | 5211 | WHERE category = '$category' AND access_url = $access_url"; |
5212 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5212 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5213 | 5213 | $sql .= " AND ( "; |
5214 | 5214 | $i = 0; |
5215 | - foreach ($fieldtype as $type){ |
|
5215 | + foreach ($fieldtype as $type) { |
|
5216 | 5216 | if ($i > 0) { |
5217 | 5217 | $sql .= ' OR '; |
5218 | 5218 | } |
@@ -5357,7 +5357,7 @@ discard block |
||
5357 | 5357 | function & api_get_settings_categories($exceptions = array(), $access_url = 1) { |
5358 | 5358 | $access_url = (int) $access_url; |
5359 | 5359 | $t_cs = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
5360 | - $list = "'".implode("','",$exceptions)."'"; |
|
5360 | + $list = "'".implode("','", $exceptions)."'"; |
|
5361 | 5361 | $sql = "SELECT DISTINCT category FROM $t_cs WHERE category is NOT NULL "; |
5362 | 5362 | if ($list != "'',''" && $list != "''" && !empty($list)) { |
5363 | 5363 | $sql .= " AND category NOT IN ($list) "; |
@@ -5453,12 +5453,12 @@ discard block |
||
5453 | 5453 | |
5454 | 5454 | // Item not found for this access_url, we have to check if the whole thing is missing |
5455 | 5455 | // (in which case we ignore the insert) or if there *is* a record but just for access_url = 1 |
5456 | - $insert = "INSERT INTO $t_settings " . |
|
5457 | - "(variable,selected_value," . |
|
5458 | - "type,category," . |
|
5459 | - "subkey,title," . |
|
5460 | - "comment,scope," . |
|
5461 | - "subkeytext,access_url,access_url_changeable)" . |
|
5456 | + $insert = "INSERT INTO $t_settings ". |
|
5457 | + "(variable,selected_value,". |
|
5458 | + "type,category,". |
|
5459 | + "subkey,title,". |
|
5460 | + "comment,scope,". |
|
5461 | + "subkeytext,access_url,access_url_changeable)". |
|
5462 | 5462 | " VALUES ('$var','$val',"; |
5463 | 5463 | if (isset($type)) { |
5464 | 5464 | $type = Database::escape_string($type); |
@@ -5624,7 +5624,7 @@ discard block |
||
5624 | 5624 | $result = Database::query($sql); |
5625 | 5625 | |
5626 | 5626 | //if ($row = Database::fetch_array($result)) { |
5627 | - if (Database::num_rows($result) > 0 ) { |
|
5627 | + if (Database::num_rows($result) > 0) { |
|
5628 | 5628 | $is_courseMember = true; |
5629 | 5629 | $is_courseTutor = true; |
5630 | 5630 | $is_courseCoach = true; |
@@ -5845,8 +5845,8 @@ discard block |
||
5845 | 5845 | { |
5846 | 5846 | $tbl_rel_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
5847 | 5847 | if (!empty($user_id) && !empty($courseId)) { |
5848 | - $user_id = intval($user_id); |
|
5849 | - $courseId = intval($courseId); |
|
5848 | + $user_id = intval($user_id); |
|
5849 | + $courseId = intval($courseId); |
|
5850 | 5850 | $sql = 'SELECT status |
5851 | 5851 | FROM '.$tbl_rel_course_user.' |
5852 | 5852 | WHERE user_id='.$user_id.' AND c_id = '.$courseId; |
@@ -5952,7 +5952,7 @@ discard block |
||
5952 | 5952 | } else { |
5953 | 5953 | return false; |
5954 | 5954 | } |
5955 | - return strtolower(substr((string)$os, 0, 3 )) == 'win'; |
|
5955 | + return strtolower(substr((string) $os, 0, 3)) == 'win'; |
|
5956 | 5956 | } |
5957 | 5957 | |
5958 | 5958 | /** |
@@ -6477,7 +6477,7 @@ discard block |
||
6477 | 6477 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6478 | 6478 | $libraries = array(); |
6479 | 6479 | if ($include_jqgrid) { |
6480 | - $libraries[]='jqgrid'; |
|
6480 | + $libraries[] = 'jqgrid'; |
|
6481 | 6481 | } |
6482 | 6482 | return api_get_jquery_libraries_js($libraries); |
6483 | 6483 | } |
@@ -6501,12 +6501,12 @@ discard block |
||
6501 | 6501 | |
6502 | 6502 | //jqgrid js and css |
6503 | 6503 | if (in_array('jqgrid', $libraries)) { |
6504 | - $languaje = 'en'; |
|
6504 | + $languaje = 'en'; |
|
6505 | 6505 | $platform_isocode = strtolower(api_get_language_isocode()); |
6506 | 6506 | |
6507 | 6507 | //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
6508 | 6508 | $jqgrid_langs = array( |
6509 | - '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' |
|
6509 | + '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' |
|
6510 | 6510 | ); |
6511 | 6511 | |
6512 | 6512 | if (in_array($platform_isocode, $jqgrid_langs)) { |
@@ -6537,7 +6537,7 @@ discard block |
||
6537 | 6537 | |
6538 | 6538 | // jquery datepicker |
6539 | 6539 | if (in_array('datepicker', $libraries)) { |
6540 | - $languaje = 'en-GB'; |
|
6540 | + $languaje = 'en-GB'; |
|
6541 | 6541 | $platform_isocode = strtolower(api_get_language_isocode()); |
6542 | 6542 | |
6543 | 6543 | // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
@@ -6639,7 +6639,7 @@ discard block |
||
6639 | 6639 | $clean_url = str_replace('/', '-', $clean_url); |
6640 | 6640 | $clean_url .= '/'; |
6641 | 6641 | |
6642 | - $home = 'app/home/' . $clean_url; |
|
6642 | + $home = 'app/home/'.$clean_url; |
|
6643 | 6643 | |
6644 | 6644 | } |
6645 | 6645 | |
@@ -6700,7 +6700,7 @@ discard block |
||
6700 | 6700 | * @return void |
6701 | 6701 | */ |
6702 | 6702 | function api_check_php_version($my_inc_path = null) { |
6703 | - if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6703 | + if (!function_exists('version_compare') || version_compare(phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6704 | 6704 | $global_error_code = 1; |
6705 | 6705 | // Incorrect PHP version |
6706 | 6706 | $global_page = $my_inc_path.'global_error_message.inc.php'; |
@@ -6716,7 +6716,7 @@ discard block |
||
6716 | 6716 | */ |
6717 | 6717 | function api_check_archive_dir() { |
6718 | 6718 | if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) { |
6719 | - $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning'); |
|
6719 | + $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning'); |
|
6720 | 6720 | api_not_allowed(true, $message); |
6721 | 6721 | } |
6722 | 6722 | } |
@@ -6781,7 +6781,7 @@ discard block |
||
6781 | 6781 | * @author Jorge Frisancho Jibaja <[email protected]>, USIL - Some changes to allow the use of real IP using reverse proxy |
6782 | 6782 | * @version CEV CHANGE 24APR2012 |
6783 | 6783 | */ |
6784 | -function api_get_real_ip(){ |
|
6784 | +function api_get_real_ip() { |
|
6785 | 6785 | // Guess the IP if behind a reverse proxy |
6786 | 6786 | global $debug; |
6787 | 6787 | $ip = trim($_SERVER['REMOTE_ADDR']); |
@@ -6806,23 +6806,23 @@ discard block |
||
6806 | 6806 | * @author Yannick Warnier for improvements and managment of multiple ranges |
6807 | 6807 | * @todo check for IPv6 support |
6808 | 6808 | */ |
6809 | -function api_check_ip_in_range($ip,$range) |
|
6809 | +function api_check_ip_in_range($ip, $range) |
|
6810 | 6810 | { |
6811 | 6811 | if (empty($ip) or empty($range)) { |
6812 | 6812 | return false; |
6813 | 6813 | } |
6814 | - $ip_ip = ip2long ($ip); |
|
6814 | + $ip_ip = ip2long($ip); |
|
6815 | 6815 | // divide range param into array of elements |
6816 | - if (strpos($range,',')!==false) { |
|
6817 | - $ranges = explode(',',$range); |
|
6816 | + if (strpos($range, ',') !== false) { |
|
6817 | + $ranges = explode(',', $range); |
|
6818 | 6818 | } else { |
6819 | 6819 | $ranges = array($range); |
6820 | 6820 | } |
6821 | 6821 | foreach ($ranges as $range) { |
6822 | 6822 | $range = trim($range); |
6823 | 6823 | if (empty($range)) { continue; } |
6824 | - if (strpos($range,'/')===false) { |
|
6825 | - if (strcmp($ip,$range)===0) { |
|
6824 | + if (strpos($range, '/') === false) { |
|
6825 | + if (strcmp($ip, $range) === 0) { |
|
6826 | 6826 | return true; // there is a direct IP match, return OK |
6827 | 6827 | } |
6828 | 6828 | continue; //otherwise, get to the next range |
@@ -6830,7 +6830,7 @@ discard block |
||
6830 | 6830 | // the range contains a "/", so analyse completely |
6831 | 6831 | list ($net, $mask) = explode("/", $range); |
6832 | 6832 | |
6833 | - $ip_net = ip2long ($net); |
|
6833 | + $ip_net = ip2long($net); |
|
6834 | 6834 | // mask binary magic |
6835 | 6835 | $ip_mask = ~((1 << (32 - $mask)) - 1); |
6836 | 6836 | |
@@ -7190,14 +7190,14 @@ discard block |
||
7190 | 7190 | * @assert (0) === true |
7191 | 7191 | * @assert ('1G') === true |
7192 | 7192 | */ |
7193 | -function api_set_memory_limit($mem){ |
|
7193 | +function api_set_memory_limit($mem) { |
|
7194 | 7194 | //if ini_set() not available, this function is useless |
7195 | 7195 | if (!function_exists('ini_set') || is_null($mem) || $mem == -1) { |
7196 | 7196 | return false; |
7197 | 7197 | } |
7198 | 7198 | |
7199 | 7199 | $memory_limit = ini_get('memory_limit'); |
7200 | - if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)){ |
|
7200 | + if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)) { |
|
7201 | 7201 | ini_set('memory_limit', $mem); |
7202 | 7202 | return true; |
7203 | 7203 | } |
@@ -7214,21 +7214,21 @@ discard block |
||
7214 | 7214 | * @assert ('1m') === 1048576 |
7215 | 7215 | * @assert ('100k') === 102400 |
7216 | 7216 | */ |
7217 | -function api_get_bytes_memory_limit($mem){ |
|
7218 | - $size = strtolower(substr($mem,-1)); |
|
7217 | +function api_get_bytes_memory_limit($mem) { |
|
7218 | + $size = strtolower(substr($mem, -1)); |
|
7219 | 7219 | |
7220 | 7220 | switch ($size) { |
7221 | 7221 | case 't': |
7222 | - $mem = intval(substr($mem,-1))*1024*1024*1024*1024; |
|
7222 | + $mem = intval(substr($mem, -1)) * 1024 * 1024 * 1024 * 1024; |
|
7223 | 7223 | break; |
7224 | 7224 | case 'g': |
7225 | - $mem = intval(substr($mem,0,-1))*1024*1024*1024; |
|
7225 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024 * 1024; |
|
7226 | 7226 | break; |
7227 | 7227 | case 'm': |
7228 | - $mem = intval(substr($mem,0,-1))*1024*1024; |
|
7228 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024; |
|
7229 | 7229 | break; |
7230 | 7230 | case 'k': |
7231 | - $mem = intval(substr($mem,0,-1))*1024; |
|
7231 | + $mem = intval(substr($mem, 0, -1)) * 1024; |
|
7232 | 7232 | break; |
7233 | 7233 | default: |
7234 | 7234 | // we assume it's integer only |
@@ -7283,7 +7283,7 @@ discard block |
||
7283 | 7283 | get_lang('PasswordVeryStrong'), |
7284 | 7284 | ); |
7285 | 7285 | $js = api_get_js('strength/strength.js'); |
7286 | - $js .= "<script> |
|
7286 | + $js .= "<script> |
|
7287 | 7287 | |
7288 | 7288 | var verdicts = ['".implode("','", $verdicts)."']; |
7289 | 7289 | var errorMessages = { |
@@ -7339,7 +7339,7 @@ discard block |
||
7339 | 7339 | return false; |
7340 | 7340 | } |
7341 | 7341 | $minutesToBlock = api_get_setting('captcha_time_to_block'); |
7342 | - $time = time() + $minutesToBlock*60; |
|
7342 | + $time = time() + $minutesToBlock * 60; |
|
7343 | 7343 | UserManager::update_extra_field_value( |
7344 | 7344 | $userInfo['user_id'], |
7345 | 7345 | 'captcha_blocked_until_date', |
@@ -7412,7 +7412,7 @@ discard block |
||
7412 | 7412 | $out_res = str_replace('"', "''", $out_res); |
7413 | 7413 | } |
7414 | 7414 | // avoid text stuck together when tags are removed, adding a space after > |
7415 | - $out_res = str_replace (">", "> ", $out_res); |
|
7415 | + $out_res = str_replace(">", "> ", $out_res); |
|
7416 | 7416 | $out_res = strip_tags($out_res); |
7417 | 7417 | |
7418 | 7418 | return $out_res; |
@@ -7522,12 +7522,12 @@ discard block |
||
7522 | 7522 | { |
7523 | 7523 | // Clean query |
7524 | 7524 | $bt = debug_backtrace(); |
7525 | - $caller = array_shift($bt);; |
|
7525 | + $caller = array_shift($bt); ; |
|
7526 | 7526 | if ($dump == 1) { |
7527 | 7527 | $string = print_r($string, 1); |
7528 | 7528 | } else { |
7529 | 7529 | $string = str_replace(array("\r", "\n", "\t", "\10"), '', $string); |
7530 | - $string = str_replace(' ',' ', $string); |
|
7530 | + $string = str_replace(' ', ' ', $string); |
|
7531 | 7531 | } |
7532 | 7532 | |
7533 | 7533 | error_log("-------------------------------------"); |
@@ -7637,7 +7637,7 @@ discard block |
||
7637 | 7637 | $body = get_lang('PortalName').': '.api_get_path(WEB_PATH)." \n "; |
7638 | 7638 | $body .= get_lang('PortalLimitType').': '.$limitName." \n "; |
7639 | 7639 | if (isset($hostingParams[$limitName])) { |
7640 | - $body .= get_lang('Value') . ': ' . $hostingParams[$limitName]; |
|
7640 | + $body .= get_lang('Value').': '.$hostingParams[$limitName]; |
|
7641 | 7641 | } |
7642 | 7642 | api_mail_html(null, $email, $subject, $body); |
7643 | 7643 | } |
@@ -7765,7 +7765,7 @@ discard block |
||
7765 | 7765 | */ |
7766 | 7766 | function api_set_site_use_cookie_warning_cookie() |
7767 | 7767 | { |
7768 | - setcookie("ChamiloUsesCookies", "ok", time()+31556926); |
|
7768 | + setcookie("ChamiloUsesCookies", "ok", time() + 31556926); |
|
7769 | 7769 | } |
7770 | 7770 | |
7771 | 7771 | /** |
@@ -7813,10 +7813,10 @@ discard block |
||
7813 | 7813 | return false; |
7814 | 7814 | } |
7815 | 7815 | |
7816 | - $fullPath = $parentDirectory . api_replace_dangerous_char($name); |
|
7816 | + $fullPath = $parentDirectory.api_replace_dangerous_char($name); |
|
7817 | 7817 | |
7818 | 7818 | if (mkdir($fullPath, api_get_permissions_for_new_directories(), true)) { |
7819 | - $fp = fopen($fullPath . '/index.html', 'w'); |
|
7819 | + $fp = fopen($fullPath.'/index.html', 'w'); |
|
7820 | 7820 | |
7821 | 7821 | if ($fp) { |
7822 | 7822 | if (fwrite($fp, '<html><head></head><body></body></html>')) { |
@@ -7881,7 +7881,7 @@ discard block |
||
7881 | 7881 | $mail->SMTPSecure = $platform_email['SMTP_SECURE']; |
7882 | 7882 | } |
7883 | 7883 | } |
7884 | - $mail->SMTPDebug = isset($platform_email['SMTP_DEBUG'])?$platform_email['SMTP_DEBUG']:0; |
|
7884 | + $mail->SMTPDebug = isset($platform_email['SMTP_DEBUG']) ? $platform_email['SMTP_DEBUG'] : 0; |
|
7885 | 7885 | |
7886 | 7886 | // 5 = low, 1 = high |
7887 | 7887 | $mail->Priority = 3; |
@@ -8061,13 +8061,13 @@ discard block |
||
8061 | 8061 | * @param int $key key to find to compare |
8062 | 8062 | * |
8063 | 8063 | */ |
8064 | -function api_unique_multidim_array($array, $key){ |
|
8064 | +function api_unique_multidim_array($array, $key) { |
|
8065 | 8065 | $temp_array = array(); |
8066 | 8066 | $i = 0; |
8067 | 8067 | $key_array = array(); |
8068 | 8068 | |
8069 | - foreach($array as $val){ |
|
8070 | - if(!in_array($val[$key],$key_array)){ |
|
8069 | + foreach ($array as $val) { |
|
8070 | + if (!in_array($val[$key], $key_array)) { |
|
8071 | 8071 | $key_array[$i] = $val[$key]; |
8072 | 8072 | $temp_array[$i] = $val; |
8073 | 8073 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * Code |
9 | 9 | */ |
10 | -require_once dirname(__FILE__) . '/IndexableChunk.class.php'; |
|
10 | +require_once dirname(__FILE__).'/IndexableChunk.class.php'; |
|
11 | 11 | require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
12 | 12 | |
13 | 13 | /** |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Get one term html select |
31 | 31 | */ |
32 | -function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr='size="7" class="sf-select-multiple"') { |
|
32 | +function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr = 'size="7" class="sf-select-multiple"') { |
|
33 | 33 | global $charset; |
34 | - $multiple_select = '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">'; |
|
34 | + $multiple_select = '<select '.$extra_select_attr.' title="'.$prefix.'" id="sf-'.$prefix.'" name="sf_'.$prefix.'[]">'; |
|
35 | 35 | |
36 | 36 | $all_selected = ''; |
37 | - if (!empty($_REQUEST['sf_'. $prefix]) ) { |
|
38 | - if (in_array('__all__', $_REQUEST['sf_'. $prefix])) { |
|
37 | + if (!empty($_REQUEST['sf_'.$prefix])) { |
|
38 | + if (in_array('__all__', $_REQUEST['sf_'.$prefix])) { |
|
39 | 39 | $all_selected = 'selected="selected"'; |
40 | 40 | } |
41 | 41 | } |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | } else if ($op == 'or') { |
45 | 45 | $all_selected_name = get_lang('Any'); |
46 | 46 | } |
47 | - $multiple_select .= '<option value="__all__" '. $all_selected .' >-- '. $all_selected_name .' --</option>'; |
|
47 | + $multiple_select .= '<option value="__all__" '.$all_selected.' >-- '.$all_selected_name.' --</option>'; |
|
48 | 48 | |
49 | 49 | foreach ($sf_term_array as $raw_term) { |
50 | 50 | $term = substr($raw_term, 1); |
51 | 51 | if (empty($term)) continue; |
52 | 52 | $html_term = htmlspecialchars($term, ENT_QUOTES, $charset); |
53 | 53 | $selected = ''; |
54 | - if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) { |
|
54 | + if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term, $_REQUEST['sf_'.$prefix])) { |
|
55 | 55 | $selected = 'selected="selected"'; |
56 | 56 | } |
57 | - $multiple_select .= '<option value="'. $html_term .'" '.$selected.'>'. $html_term .'</option>'; |
|
57 | + $multiple_select .= '<option value="'.$html_term.'" '.$selected.'>'.$html_term.'</option>'; |
|
58 | 58 | } |
59 | 59 | $multiple_select .= '</select>'; |
60 | 60 | return $multiple_select; |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * Get terms html selects |
65 | 65 | */ |
66 | -function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix='') { |
|
66 | +function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix = '') { |
|
67 | 67 | // Process each prefix type term |
68 | 68 | $i = 0; |
69 | 69 | $max = count($sf_terms); |
70 | - $multiple_selects =''; |
|
70 | + $multiple_selects = ''; |
|
71 | 71 | foreach ($sf_terms as $prefix => $sf_term_array) { |
72 | 72 | if ($prefix == $prefilter_prefix) continue; |
73 | 73 | $multiple_select = ''; |
74 | - if ($i>0) { |
|
74 | + if ($i > 0) { |
|
75 | 75 | //print "+" image |
76 | 76 | $multiple_select .= '<td><img class="sf-select-splitter" src="../img/search-big-plus.gif" alt="plus-sign-decoration"/></td>'; |
77 | 77 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | |
90 | 90 | $sf_copy = $sf_term_array; |
91 | 91 | // get specific field name |
92 | - $sf_value = get_specific_field_list(array( 'code' => "'$prefix'" )); |
|
92 | + $sf_value = get_specific_field_list(array('code' => "'$prefix'")); |
|
93 | 93 | $sf_value = array_shift($sf_value); |
94 | - $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">' . $sf_value['name'].'</label><br />'; |
|
94 | + $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$sf_value['name'].'</label><br />'; |
|
95 | 95 | $multiple_select .= format_one_specific_field_select($prefix, $sf_term_array, $op, 'multiple="multiple" size="7" class="sf-select-multiple"'); |
96 | 96 | $multiple_select .= '</td>'; |
97 | 97 | $multiple_selects .= $multiple_select; |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op) { |
109 | 109 | $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon')); |
110 | - $advanced_options = '<a id="tags-toggle" href="#">'. get_lang('SearchAdvancedOptions') .'</a>'; |
|
111 | - $display_thesaurus = ($show_thesaurus==true? 'block': 'none'); |
|
112 | - $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment'); |
|
113 | - $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery'); |
|
114 | - $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal'); |
|
110 | + $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>'; |
|
111 | + $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none'); |
|
112 | + $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment'); |
|
113 | + $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery'); |
|
114 | + $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal'); |
|
115 | 115 | |
116 | 116 | /** |
117 | 117 | * POST avoid long urls, but we are using GET because |
@@ -119,36 +119,36 @@ discard block |
||
119 | 119 | * could not send a form in pagination |
120 | 120 | */ |
121 | 121 | |
122 | - if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) { |
|
123 | - $action='index.php'; |
|
122 | + if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) { |
|
123 | + $action = 'index.php'; |
|
124 | 124 | } |
125 | 125 | $navigator_info = api_get_navigator(); |
126 | 126 | |
127 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
128 | - $submit_button1 = '<input type="submit" id="submit" value="'. get_lang('Search') .'" />'; |
|
129 | - $submit_button2 = '<input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />'; |
|
130 | - $reset_button = '<input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'; |
|
127 | + if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') { |
|
128 | + $submit_button1 = '<input type="submit" id="submit" value="'.get_lang('Search').'" />'; |
|
129 | + $submit_button2 = '<input class="lower-submit" type="submit" value="'.get_lang('Search').'" />'; |
|
130 | + $reset_button = '<input type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />'; |
|
131 | 131 | } else { |
132 | - $submit_button1 = '<button class="search" type="submit" id="submit" value="'. get_lang("Search") .'" /> '. get_lang('Search') .'</button>'; |
|
133 | - $submit_button2 = '<button class="search" type="submit" value="'. get_lang('Search') .'" />'. get_lang('Search') .'</button>'; |
|
134 | - $reset_button = '<button class="save" type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'. get_lang('SearchResetKeywords') .'</button> '; |
|
132 | + $submit_button1 = '<button class="search" type="submit" id="submit" value="'.get_lang("Search").'" /> '.get_lang('Search').'</button>'; |
|
133 | + $submit_button2 = '<button class="search" type="submit" value="'.get_lang('Search').'" />'.get_lang('Search').'</button>'; |
|
134 | + $reset_button = '<button class="save" type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />'.get_lang('SearchResetKeywords').'</button> '; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $query = isset($_REQUEST['query']) ? Security::remove_XSS($_REQUEST['query']) : null; |
138 | 138 | |
139 | - $form = '<form id="chamilo_search" action="'. $action .'" method="GET"> |
|
140 | - <input type="text" id="query" name="query" size="40" value="' . $query . '" /> |
|
141 | - <input type="hidden" name="mode" value="'. $mode .'"/> |
|
142 | - <input type="hidden" name="type" value="'. $type .'"/> |
|
139 | + $form = '<form id="chamilo_search" action="'.$action.'" method="GET"> |
|
140 | + <input type="text" id="query" name="query" size="40" value="' . $query.'" /> |
|
141 | + <input type="hidden" name="mode" value="'. $mode.'"/> |
|
142 | + <input type="hidden" name="type" value="'. $type.'"/> |
|
143 | 143 | <input type="hidden" name="tablename_page_nr" value="1" /> |
144 | 144 | '.$submit_button1.' |
145 | 145 | <br /><br />'; |
146 | 146 | $list = get_specific_field_list(); |
147 | 147 | |
148 | - if(!empty($list)) { |
|
149 | - $form .= '<span class="search-links-box">'. $advanced_options .' </span> |
|
150 | - <div id="tags" class="tags" style="display:'. $display_thesaurus .';"> |
|
151 | - <div class="search-help-box">'. $help .'</div> |
|
148 | + if (!empty($list)) { |
|
149 | + $form .= '<span class="search-links-box">'.$advanced_options.' </span> |
|
150 | + <div id="tags" class="tags" style="display:'. $display_thesaurus.';"> |
|
151 | + <div class="search-help-box">'. $help.'</div> |
|
152 | 152 | <table> |
153 | 153 | <tr>'; |
154 | 154 | $form .= format_specific_fields_selects($sf_terms, $op); |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | $form .= '</tr> |
163 | 163 | <tr> |
164 | 164 | <td id="operator-select"> |
165 | - '. get_lang('SearchCombineSearchWith') .':<br /> |
|
166 | - <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input> |
|
167 | - <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input> |
|
165 | + '. get_lang('SearchCombineSearchWith').':<br /> |
|
166 | + <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input> |
|
167 | + <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input> |
|
168 | 168 | </td> |
169 | 169 | <td></td> |
170 | 170 | <td> |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | </table> |
177 | 177 | </div>'; |
178 | 178 | } |
179 | - $form .='</form> |
|
179 | + $form .= '</form> |
|
180 | 180 | <br style="clear: both;"/>'; |
181 | 181 | return $form; |
182 | 182 | } |
@@ -186,36 +186,36 @@ discard block |
||
186 | 186 | * |
187 | 187 | * This type allow filter all other multiple select terms by one term in a dinamic way |
188 | 188 | */ |
189 | -function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix=NULL) { |
|
189 | +function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix = NULL) { |
|
190 | 190 | $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon')); |
191 | - $advanced_options = '<a id="tags-toggle" href="#">'. get_lang('SearchAdvancedOptions') .'</a>'; |
|
192 | - $display_thesaurus = ($show_thesaurus==true? 'block': 'none'); |
|
193 | - $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment'); |
|
194 | - $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery'); |
|
195 | - $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal'); |
|
191 | + $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>'; |
|
192 | + $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none'); |
|
193 | + $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment'); |
|
194 | + $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery'); |
|
195 | + $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal'); |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * POST avoid long urls, but we are using GET because |
199 | 199 | * SortableTableFromArray pagination is done with simple links, so now we |
200 | 200 | * could not send a form in pagination |
201 | 201 | */ |
202 | - if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) { |
|
203 | - $action='index.php'; |
|
202 | + if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) { |
|
203 | + $action = 'index.php'; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | $form = ' |
207 | - <form id="chamilo_search" action="'. $action .'" method="GET"> |
|
207 | + <form id="chamilo_search" action="'. $action.'" method="GET"> |
|
208 | 208 | <input type="text" id="query" name="query" size="40" /> |
209 | - <input type="hidden" name="mode" value="'. $mode .'"/> |
|
210 | - <input type="hidden" name="type" value="'. $type .'"/> |
|
209 | + <input type="hidden" name="mode" value="'. $mode.'"/> |
|
210 | + <input type="hidden" name="type" value="'. $type.'"/> |
|
211 | 211 | <input type="hidden" name="tablename_page_nr" value="1" /> |
212 | - <input type="submit" id="submit" value="'. get_lang("Search") .'" /> |
|
212 | + <input type="submit" id="submit" value="'. get_lang("Search").'" /> |
|
213 | 213 | <br /><br />'; |
214 | 214 | $list = get_specific_field_list(); |
215 | - if(!empty($list)) { |
|
216 | - $form .=' <span class="search-links-box">'. $thesaurus_icon . $advanced_options .' </span> |
|
217 | - <div id="tags" class="tags" style="display:'. $display_thesaurus .';"> |
|
218 | - <div class="search-help-box">'. $help .'</div> |
|
215 | + if (!empty($list)) { |
|
216 | + $form .= ' <span class="search-links-box">'.$thesaurus_icon.$advanced_options.' </span> |
|
217 | + <div id="tags" class="tags" style="display:'. $display_thesaurus.';"> |
|
218 | + <div class="search-help-box">'. $help.'</div> |
|
219 | 219 | <table> |
220 | 220 | <tr>'; |
221 | 221 | if (!is_null($prefilter_prefix)) { |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | $sf_term_array = $temp; |
231 | 231 | |
232 | 232 | // get specific field name |
233 | - $sf_value = get_specific_field_list(array( 'code' => "'$prefilter_prefix'" )); |
|
233 | + $sf_value = get_specific_field_list(array('code' => "'$prefilter_prefix'")); |
|
234 | 234 | $sf_value = array_shift($sf_value); |
235 | - $form .= '<label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />'; |
|
235 | + $form .= '<label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />'; |
|
236 | 236 | |
237 | 237 | $form .= format_one_specific_field_select($prefilter_prefix, $sf_term_array, $op, 'id="prefilter"'); |
238 | 238 | $form .= format_specific_fields_selects($sf_terms, $op, $prefilter_prefix); |
@@ -252,15 +252,15 @@ discard block |
||
252 | 252 | </tr> |
253 | 253 | <tr> |
254 | 254 | <td id="operator-select"> |
255 | - '. get_lang('SearchCombineSearchWith') .':<br /> |
|
256 | - <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input> |
|
257 | - <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input> |
|
255 | + '. get_lang('SearchCombineSearchWith').':<br /> |
|
256 | + <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input> |
|
257 | + <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input> |
|
258 | 258 | </td> |
259 | 259 | <td></td> |
260 | 260 | <td> |
261 | 261 | <br /> |
262 | - <input class="lower-submit" type="submit" value="'. get_lang('Search') .'" /> |
|
263 | - <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" /> |
|
262 | + <input class="lower-submit" type="submit" value="'. get_lang('Search').'" /> |
|
263 | + <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords').'" /> |
|
264 | 264 | </td> |
265 | 265 | </tr> |
266 | 266 | </table> |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * Show search form |
278 | 278 | */ |
279 | 279 | function display_search_form($action, $show_thesaurus, $sf_terms, $op) { |
280 | - $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal'); |
|
280 | + $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal'); |
|
281 | 281 | |
282 | 282 | switch ($type) { |
283 | 283 | case 'prefilter': |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param string $action Just in case your action is not |
305 | 305 | * index.php |
306 | 306 | */ |
307 | -function search_widget_show($action='index.php') |
|
307 | +function search_widget_show($action = 'index.php') |
|
308 | 308 | { |
309 | 309 | require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php'; |
310 | 310 | // TODO: load images dinamically when they're avalaible from specific field ui to add |
@@ -317,14 +317,14 @@ discard block |
||
317 | 317 | if (($cid = api_get_course_id()) != -1) { // with cid |
318 | 318 | |
319 | 319 | // get search engine terms |
320 | - $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid); |
|
320 | + $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid); |
|
321 | 321 | $dkterms = chamilo_query_simple_query('', 0, 1000, array($course_filter)); |
322 | 322 | |
323 | 323 | //prepare specific fields names (and also get possible URL param names) |
324 | 324 | foreach ($specific_fields as $specific_field) { |
325 | 325 | $temp = array(); |
326 | - if (is_array($dkterms) && count($dkterms)>0) { |
|
327 | - foreach($dkterms[1] as $obj) { |
|
326 | + if (is_array($dkterms) && count($dkterms) > 0) { |
|
327 | + foreach ($dkterms[1] as $obj) { |
|
328 | 328 | $temp = array_merge($obj['sf-'.$specific_field['code']], $temp); |
329 | 329 | } |
330 | 330 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | $op = 'or'; |
355 | - if (!empty($_REQUEST['operator']) && in_array($op,array('or','and'))) { |
|
355 | + if (!empty($_REQUEST['operator']) && in_array($op, array('or', 'and'))) { |
|
356 | 356 | $op = $_REQUEST['operator']; |
357 | 357 | } |
358 | 358 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public $feedback_type; |
28 | 28 | public $end_time; |
29 | 29 | public $start_time; |
30 | - public $questionList; // array with the list of this exercise's questions |
|
30 | + public $questionList; // array with the list of this exercise's questions |
|
31 | 31 | public $results_disabled; |
32 | 32 | public $expired_time; |
33 | 33 | public $course; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); |
98 | 98 | $table_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
99 | 99 | |
100 | - $id = intval($id); |
|
100 | + $id = intval($id); |
|
101 | 101 | if (empty($this->course_id)) { |
102 | 102 | return false; |
103 | 103 | } |
@@ -154,17 +154,17 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | if ($object->end_time != '0000-00-00 00:00:00') { |
157 | - $this->end_time = $object->end_time; |
|
157 | + $this->end_time = $object->end_time; |
|
158 | 158 | } |
159 | 159 | if ($object->start_time != '0000-00-00 00:00:00') { |
160 | - $this->start_time = $object->start_time; |
|
160 | + $this->start_time = $object->start_time; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | //control time |
164 | - $this->expired_time = $object->expired_time; |
|
164 | + $this->expired_time = $object->expired_time; |
|
165 | 165 | |
166 | 166 | //Checking if question_order is correctly set |
167 | - $this->questionList = $this->selectQuestionList(true); |
|
167 | + $this->questionList = $this->selectQuestionList(true); |
|
168 | 168 | |
169 | 169 | //overload questions list with recorded questions list |
170 | 170 | //load questions only for exercises of type 'one question per page' |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public function isRandom() |
384 | 384 | { |
385 | - if($this->random > 0 || $this->random == -1) { |
|
385 | + if ($this->random > 0 || $this->random == -1) { |
|
386 | 386 | return true; |
387 | 387 | } else { |
388 | 388 | return false; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | public function selectQuestionList($from_db = false) |
428 | 428 | { |
429 | 429 | if ($from_db && !empty($this->id)) { |
430 | - $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
430 | + $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
431 | 431 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
432 | 432 | |
433 | 433 | $sql = "SELECT DISTINCT e.question_order |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $question_list = array(); |
455 | 455 | |
456 | 456 | while ($new_object = Database::fetch_object($result)) { |
457 | - $question_list[$new_object->question_order]= $new_object->question_id; |
|
457 | + $question_list[$new_object->question_order] = $new_object->question_id; |
|
458 | 458 | $temp_question_list[$counter] = $new_object->question_id; |
459 | 459 | $counter++; |
460 | 460 | } |
@@ -500,16 +500,16 @@ discard block |
||
500 | 500 | */ |
501 | 501 | public function selectRandomList() |
502 | 502 | { |
503 | - $nbQuestions = $this->selectNbrQuestions(); |
|
504 | - $temp_list = $this->questionList; |
|
503 | + $nbQuestions = $this->selectNbrQuestions(); |
|
504 | + $temp_list = $this->questionList; |
|
505 | 505 | |
506 | 506 | //Not a random exercise, or if there are not at least 2 questions |
507 | - if($this->random == 0 || $nbQuestions < 2) { |
|
507 | + if ($this->random == 0 || $nbQuestions < 2) { |
|
508 | 508 | return $this->questionList; |
509 | 509 | } |
510 | 510 | if ($nbQuestions != 0) { |
511 | 511 | shuffle($temp_list); |
512 | - $my_random_list = array_combine(range(1,$nbQuestions),$temp_list); |
|
512 | + $my_random_list = array_combine(range(1, $nbQuestions), $temp_list); |
|
513 | 513 | $my_question_list = array(); |
514 | 514 | // $this->random == -1 if random with all questions |
515 | 515 | if ($this->random > 0) { |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | public function isInList($questionId) |
540 | 540 | { |
541 | 541 | if (is_array($this->questionList)) |
542 | - return in_array($questionId,$this->questionList); |
|
542 | + return in_array($questionId, $this->questionList); |
|
543 | 543 | else |
544 | 544 | return false; |
545 | 545 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | */ |
553 | 553 | public function updateTitle($title) |
554 | 554 | { |
555 | - $this->exercise=$title; |
|
555 | + $this->exercise = $title; |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | */ |
563 | 563 | public function updateAttempts($attempts) |
564 | 564 | { |
565 | - $this->attempts=$attempts; |
|
565 | + $this->attempts = $attempts; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | */ |
573 | 573 | public function updateFeedbackType($feedback_type) |
574 | 574 | { |
575 | - $this->feedback_type=$feedback_type; |
|
575 | + $this->feedback_type = $feedback_type; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | */ |
584 | 584 | public function updateDescription($description) |
585 | 585 | { |
586 | - $this->description=$description; |
|
586 | + $this->description = $description; |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
@@ -628,23 +628,23 @@ discard block |
||
628 | 628 | * @param string $sound - exercise sound file |
629 | 629 | * @param string $delete - ask to delete the file |
630 | 630 | */ |
631 | - public function updateSound($sound,$delete) |
|
631 | + public function updateSound($sound, $delete) |
|
632 | 632 | { |
633 | 633 | global $audioPath, $documentPath; |
634 | 634 | $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
635 | 635 | |
636 | - if ($sound['size'] && (strstr($sound['type'],'audio') || strstr($sound['type'],'video'))) { |
|
637 | - $this->sound=$sound['name']; |
|
636 | + if ($sound['size'] && (strstr($sound['type'], 'audio') || strstr($sound['type'], 'video'))) { |
|
637 | + $this->sound = $sound['name']; |
|
638 | 638 | |
639 | - if (@move_uploaded_file($sound['tmp_name'],$audioPath.'/'.$this->sound)) { |
|
639 | + if (@move_uploaded_file($sound['tmp_name'], $audioPath.'/'.$this->sound)) { |
|
640 | 640 | $query = "SELECT 1 FROM $TBL_DOCUMENT |
641 | - WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath,'',$audioPath).'/'.$this->sound."'"; |
|
642 | - $result=Database::query($query); |
|
641 | + WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath, '', $audioPath).'/'.$this->sound."'"; |
|
642 | + $result = Database::query($query); |
|
643 | 643 | |
644 | 644 | if (!Database::num_rows($result)) { |
645 | 645 | $id = add_document( |
646 | 646 | $this->course, |
647 | - str_replace($documentPath,'',$audioPath).'/'.$this->sound, |
|
647 | + str_replace($documentPath, '', $audioPath).'/'.$this->sound, |
|
648 | 648 | 'file', |
649 | 649 | $sound['size'], |
650 | 650 | $sound['name'] |
@@ -663,8 +663,8 @@ discard block |
||
663 | 663 | ); |
664 | 664 | } |
665 | 665 | } |
666 | - } elseif($delete && is_file($audioPath.'/'.$this->sound)) { |
|
667 | - $this->sound=''; |
|
666 | + } elseif ($delete && is_file($audioPath.'/'.$this->sound)) { |
|
667 | + $this->sound = ''; |
|
668 | 668 | } |
669 | 669 | } |
670 | 670 | |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | */ |
677 | 677 | public function updateType($type) |
678 | 678 | { |
679 | - $this->type=$type; |
|
679 | + $this->type = $type; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | */ |
713 | 713 | public function enable() |
714 | 714 | { |
715 | - $this->active=1; |
|
715 | + $this->active = 1; |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | /** |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | */ |
723 | 723 | public function disable() |
724 | 724 | { |
725 | - $this->active=0; |
|
725 | + $this->active = 0; |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | /** |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | api_get_user_id() |
847 | 847 | ); |
848 | 848 | |
849 | - if (api_get_setting('search_enabled')=='true') { |
|
849 | + if (api_get_setting('search_enabled') == 'true') { |
|
850 | 850 | $this->search_engine_edit(); |
851 | 851 | } |
852 | 852 | } else { |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | public function removeFromList($questionId) |
986 | 986 | { |
987 | 987 | // searches the position of the question ID in the list |
988 | - $pos = array_search($questionId,$this->questionList); |
|
988 | + $pos = array_search($questionId, $this->questionList); |
|
989 | 989 | |
990 | 990 | // question not found |
991 | 991 | if ($pos === false) { |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'QuizDeleted', api_get_user_id()); |
1021 | 1021 | api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'delete', api_get_user_id()); |
1022 | 1022 | |
1023 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian') ) { |
|
1023 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
1024 | 1024 | $this->search_engine_delete(); |
1025 | 1025 | } |
1026 | 1026 | } |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | * Creates the form to create / edit an exercise |
1030 | 1030 | * @param FormValidator $form |
1031 | 1031 | */ |
1032 | - public function createForm($form, $type='full') |
|
1032 | + public function createForm($form, $type = 'full') |
|
1033 | 1033 | { |
1034 | 1034 | if (empty($type)) { |
1035 | 1035 | $type = 'full'; |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | 'Width' => '100%', |
1061 | 1061 | 'Height' => '150', |
1062 | 1062 | ); |
1063 | - if (is_array($type)){ |
|
1063 | + if (is_array($type)) { |
|
1064 | 1064 | $editor_config = array_merge($editor_config, $type); |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1114,13 +1114,13 @@ discard block |
||
1114 | 1114 | '2', |
1115 | 1115 | array('id' => 'exerciseType_2') |
1116 | 1116 | ); |
1117 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')), ''); |
|
1117 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')), ''); |
|
1118 | 1118 | |
1119 | 1119 | // Type of results display on the final page |
1120 | 1120 | $radios_results_disabled = array(); |
1121 | 1121 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
1122 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
1123 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2')); |
|
1122 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
1123 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2')); |
|
1124 | 1124 | //$radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ExamModeWithFinalScoreShowOnlyFinalScoreWithCategoriesIfAvailable'), '3', array('id'=>'result_disabled_3','onclick' => 'check_results_disabled()')); |
1125 | 1125 | |
1126 | 1126 | $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
@@ -1128,8 +1128,8 @@ discard block |
||
1128 | 1128 | // Type of questions disposition on page |
1129 | 1129 | $radios = array(); |
1130 | 1130 | |
1131 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1132 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1131 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1132 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1133 | 1133 | |
1134 | 1134 | $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
1135 | 1135 | |
@@ -1139,33 +1139,33 @@ discard block |
||
1139 | 1139 | |
1140 | 1140 | // feedback type |
1141 | 1141 | $radios_feedback = array(); |
1142 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'),'0',array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
1142 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
1143 | 1143 | |
1144 | 1144 | if (api_get_setting('enable_quiz_scenario') == 'true') { |
1145 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()')); |
|
1145 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1', 'onclick' => 'check_direct_feedback()')); |
|
1146 | 1146 | } |
1147 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2')); |
|
1148 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions'))); |
|
1147 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' =>'exerciseType_2')); |
|
1148 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions'))); |
|
1149 | 1149 | |
1150 | 1150 | //$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"'); |
1151 | 1151 | $radios_results_disabled = array(); |
1152 | 1152 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
1153 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
1154 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
1155 | - $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
1153 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
1154 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
1155 | + $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
1156 | 1156 | |
1157 | 1157 | // Type of questions disposition on page |
1158 | 1158 | $radios = array(); |
1159 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
1160 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2'); |
|
1159 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
1160 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2'); |
|
1161 | 1161 | $form->addGroup($radios, null, get_lang('ExerciseType')); |
1162 | 1162 | |
1163 | 1163 | } else { |
1164 | 1164 | //Show options freeze |
1165 | 1165 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
1166 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
1167 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
1168 | - $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
1166 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
1167 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
1168 | + $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
1169 | 1169 | $result_disable_group->freeze(); |
1170 | 1170 | |
1171 | 1171 | //we force the options to the DirectFeedback exercisetype |
@@ -1173,8 +1173,8 @@ discard block |
||
1173 | 1173 | $form->addElement('hidden', 'exerciseType', ONE_PER_PAGE); |
1174 | 1174 | |
1175 | 1175 | // Type of questions disposition on page |
1176 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1177 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1176 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1177 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1178 | 1178 | |
1179 | 1179 | $type_group = $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
1180 | 1180 | $type_group->freeze(); |
@@ -1183,26 +1183,26 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | // number of random question |
1185 | 1185 | |
1186 | - $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ; |
|
1187 | - $option = range(0,$max); |
|
1186 | + $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10; |
|
1187 | + $option = range(0, $max); |
|
1188 | 1188 | $option[0] = get_lang('No'); |
1189 | 1189 | $option[-1] = get_lang('AllQuestionsShort'); |
1190 | - $form->addElement('select', 'randomQuestions',array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
1190 | + $form->addElement('select', 'randomQuestions', array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
1191 | 1191 | |
1192 | 1192 | // Random answers |
1193 | 1193 | $radios_random_answers = array(); |
1194 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'),'1'); |
|
1195 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'),'0'); |
|
1194 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'), '1'); |
|
1195 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'), '0'); |
|
1196 | 1196 | $form->addGroup($radios_random_answers, null, get_lang('RandomAnswers'), ''); |
1197 | 1197 | |
1198 | 1198 | // Random by category |
1199 | - $form->addElement('html','<div class="clear"> </div>'); |
|
1199 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
1200 | 1200 | $radiocat = array(); |
1201 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'),'1'); |
|
1202 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'),'2'); |
|
1203 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'),'0'); |
|
1201 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'), '1'); |
|
1202 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'), '2'); |
|
1203 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'), '0'); |
|
1204 | 1204 | $radioCatGroup = $form->addGroup($radiocat, null, get_lang('RandomQuestionByCategory'), ''); |
1205 | - $form->addElement('html','<div class="clear"> </div>'); |
|
1205 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
1206 | 1206 | |
1207 | 1207 | // add the radio display the category name for student |
1208 | 1208 | $radio_display_cat_name = array(); |
@@ -1223,36 +1223,36 @@ discard block |
||
1223 | 1223 | ); |
1224 | 1224 | |
1225 | 1225 | // Exercise time limit |
1226 | - $form->addElement('checkbox', 'activate_start_date_check',null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
1226 | + $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
1227 | 1227 | |
1228 | 1228 | $var = Exercise::selectTimeLimit(); |
1229 | 1229 | |
1230 | 1230 | if (($this->start_time != '0000-00-00 00:00:00')) |
1231 | - $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
1231 | + $form->addElement('html', '<div id="start_date_div" style="display:block;">'); |
|
1232 | 1232 | else |
1233 | - $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
1233 | + $form->addElement('html', '<div id="start_date_div" style="display:none;">'); |
|
1234 | 1234 | |
1235 | 1235 | $form->addElement('date_time_picker', 'start_time'); |
1236 | 1236 | |
1237 | - $form->addElement('html','</div>'); |
|
1237 | + $form->addElement('html', '</div>'); |
|
1238 | 1238 | |
1239 | - $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
1239 | + $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
1240 | 1240 | |
1241 | 1241 | if (($this->end_time != '0000-00-00 00:00:00')) |
1242 | - $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
1242 | + $form->addElement('html', '<div id="end_date_div" style="display:block;">'); |
|
1243 | 1243 | else |
1244 | - $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
1244 | + $form->addElement('html', '<div id="end_date_div" style="display:none;">'); |
|
1245 | 1245 | |
1246 | 1246 | $form->addElement('date_time_picker', 'end_time'); |
1247 | - $form->addElement('html','</div>'); |
|
1247 | + $form->addElement('html', '</div>'); |
|
1248 | 1248 | |
1249 | 1249 | //$check_option=$this->selectType(); |
1250 | 1250 | $diplay = 'block'; |
1251 | 1251 | $form->addElement('checkbox', 'propagate_neg', null, get_lang('PropagateNegativeResults')); |
1252 | - $form->addElement('html','<div class="clear"> </div>'); |
|
1252 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
1253 | 1253 | $form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers')); |
1254 | 1254 | |
1255 | - $form->addElement('html','<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
1255 | + $form->addElement('html', '<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
1256 | 1256 | |
1257 | 1257 | //Timer control |
1258 | 1258 | //$time_hours_option = range(0,12); |
@@ -1268,12 +1268,12 @@ discard block |
||
1268 | 1268 | 'onload' => 'check_load_time()', |
1269 | 1269 | ) |
1270 | 1270 | ); |
1271 | - $expired_date = (int)$this->selectExpiredTime(); |
|
1271 | + $expired_date = (int) $this->selectExpiredTime(); |
|
1272 | 1272 | |
1273 | - if (($expired_date!='0')) { |
|
1274 | - $form->addElement('html','<div id="timercontrol" style="display:block;">'); |
|
1273 | + if (($expired_date != '0')) { |
|
1274 | + $form->addElement('html', '<div id="timercontrol" style="display:block;">'); |
|
1275 | 1275 | } else { |
1276 | - $form->addElement('html','<div id="timercontrol" style="display:none;">'); |
|
1276 | + $form->addElement('html', '<div id="timercontrol" style="display:none;">'); |
|
1277 | 1277 | } |
1278 | 1278 | $form->addText( |
1279 | 1279 | 'enabletimercontroltotalminutes', |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | 'cols-size' => [2, 2, 8] |
1285 | 1285 | ] |
1286 | 1286 | ); |
1287 | - $form->addElement('html','</div>'); |
|
1287 | + $form->addElement('html', '</div>'); |
|
1288 | 1288 | |
1289 | 1289 | $form->addElement( |
1290 | 1290 | 'text', |
@@ -1306,23 +1306,23 @@ discard block |
||
1306 | 1306 | $defaults = array(); |
1307 | 1307 | |
1308 | 1308 | if (api_get_setting('search_enabled') === 'true') { |
1309 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
1309 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
1310 | 1310 | |
1311 | - $form->addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument')); |
|
1312 | - $form->addElement ('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
1311 | + $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); |
|
1312 | + $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
1313 | 1313 | |
1314 | 1314 | $specific_fields = get_specific_field_list(); |
1315 | 1315 | |
1316 | 1316 | foreach ($specific_fields as $specific_field) { |
1317 | - $form->addElement ('text', $specific_field['code'], $specific_field['name']); |
|
1317 | + $form->addElement('text', $specific_field['code'], $specific_field['name']); |
|
1318 | 1318 | $filter = array( |
1319 | 1319 | 'c_id' => api_get_course_int_id(), |
1320 | 1320 | 'field_id' => $specific_field['id'], |
1321 | 1321 | 'ref_id' => $this->id, |
1322 | - 'tool_id' => "'" . TOOL_QUIZ . "'" |
|
1322 | + 'tool_id' => "'".TOOL_QUIZ."'" |
|
1323 | 1323 | ); |
1324 | 1324 | $values = get_specific_field_values_list($filter, array('value')); |
1325 | - if ( !empty($values) ) { |
|
1325 | + if (!empty($values)) { |
|
1326 | 1326 | $arr_str_values = array(); |
1327 | 1327 | foreach ($values as $value) { |
1328 | 1328 | $arr_str_values[] = $value['value']; |
@@ -1333,8 +1333,8 @@ discard block |
||
1333 | 1333 | //$form->addElement ('html','</div>'); |
1334 | 1334 | } |
1335 | 1335 | |
1336 | - $form->addElement('html','</div>'); //End advanced setting |
|
1337 | - $form->addElement('html','</div>'); |
|
1336 | + $form->addElement('html', '</div>'); //End advanced setting |
|
1337 | + $form->addElement('html', '</div>'); |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | // submit |
@@ -1354,10 +1354,10 @@ discard block |
||
1354 | 1354 | } |
1355 | 1355 | |
1356 | 1356 | // defaults |
1357 | - if ($type=='full') { |
|
1357 | + if ($type == 'full') { |
|
1358 | 1358 | if ($this->id > 0) { |
1359 | 1359 | if ($this->random > $this->selectNbrQuestions()) { |
1360 | - $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
1360 | + $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
1361 | 1361 | } else { |
1362 | 1362 | $defaults['randomQuestions'] = $this->random; |
1363 | 1363 | } |
@@ -1383,8 +1383,8 @@ discard block |
||
1383 | 1383 | $defaults['activate_end_date_check'] = 1; |
1384 | 1384 | } |
1385 | 1385 | |
1386 | - $defaults['start_time'] = ($this->start_time!='0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
1387 | - $defaults['end_time'] = ($this->end_time!='0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time()+84600); |
|
1386 | + $defaults['start_time'] = ($this->start_time != '0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
1387 | + $defaults['end_time'] = ($this->end_time != '0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time() + 84600); |
|
1388 | 1388 | |
1389 | 1389 | // Get expired time |
1390 | 1390 | if ($this->expired_time != '0') { |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | $defaults['text_when_finished'] = ""; |
1406 | 1406 | $defaults['start_time'] = date('Y-m-d 12:00:00'); |
1407 | 1407 | $defaults['display_category_name'] = 1; |
1408 | - $defaults['end_time'] = date('Y-m-d 12:00:00', time()+84600); |
|
1408 | + $defaults['end_time'] = date('Y-m-d 12:00:00', time() + 84600); |
|
1409 | 1409 | $defaults['pass_percentage'] = ''; |
1410 | 1410 | } |
1411 | 1411 | } else { |
@@ -1472,7 +1472,7 @@ discard block |
||
1472 | 1472 | $end_time = $form->getSubmitValue('end_time'); |
1473 | 1473 | $this->end_time = api_get_utc_datetime($end_time); |
1474 | 1474 | } else { |
1475 | - $this->end_time = '0000-00-00 00:00:00'; |
|
1475 | + $this->end_time = '0000-00-00 00:00:00'; |
|
1476 | 1476 | } |
1477 | 1477 | |
1478 | 1478 | if ($form->getSubmitValue('enabletimercontrol') == 1) { |
@@ -1485,9 +1485,9 @@ discard block |
||
1485 | 1485 | } |
1486 | 1486 | |
1487 | 1487 | if ($form->getSubmitValue('randomAnswers') == 1) { |
1488 | - $this->random_answers=1; |
|
1488 | + $this->random_answers = 1; |
|
1489 | 1489 | } else { |
1490 | - $this->random_answers=0; |
|
1490 | + $this->random_answers = 0; |
|
1491 | 1491 | } |
1492 | 1492 | $this->save($type); |
1493 | 1493 | } |
@@ -1499,9 +1499,9 @@ discard block |
||
1499 | 1499 | } |
1500 | 1500 | $course_id = api_get_course_id(); |
1501 | 1501 | |
1502 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
1503 | - require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; |
|
1504 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
1502 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
1503 | + require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; |
|
1504 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
1505 | 1505 | |
1506 | 1506 | $specific_fields = get_specific_field_list(); |
1507 | 1507 | $ic_slide = new IndexableChunk(); |
@@ -1511,7 +1511,7 @@ discard block |
||
1511 | 1511 | if (isset($_REQUEST[$specific_field['code']])) { |
1512 | 1512 | $sterms = trim($_REQUEST[$specific_field['code']]); |
1513 | 1513 | if (!empty($sterms)) { |
1514 | - $all_specific_terms .= ' '. $sterms; |
|
1514 | + $all_specific_terms .= ' '.$sterms; |
|
1515 | 1515 | $sterms = explode(',', $sterms); |
1516 | 1516 | foreach ($sterms as $sterm) { |
1517 | 1517 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -1528,15 +1528,15 @@ discard block |
||
1528 | 1528 | $xapian_data = array( |
1529 | 1529 | SE_COURSE_ID => $course_id, |
1530 | 1530 | SE_TOOL_ID => TOOL_QUIZ, |
1531 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
1532 | - SE_USER => (int)api_get_user_id(), |
|
1531 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
1532 | + SE_USER => (int) api_get_user_id(), |
|
1533 | 1533 | ); |
1534 | 1534 | $ic_slide->xapian_data = serialize($xapian_data); |
1535 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
1535 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
1536 | 1536 | $ic_slide->addValue("content", $exercise_description); |
1537 | 1537 | |
1538 | 1538 | $di = new ChamiloIndexer(); |
1539 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
1539 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
1540 | 1540 | $di->connectDb(NULL, NULL, $lang); |
1541 | 1541 | $di->addChunk($ic_slide); |
1542 | 1542 | |
@@ -1555,7 +1555,7 @@ discard block |
||
1555 | 1555 | function search_engine_edit() |
1556 | 1556 | { |
1557 | 1557 | // update search enchine and its values table if enabled |
1558 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { |
|
1558 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
1559 | 1559 | $course_id = api_get_course_id(); |
1560 | 1560 | |
1561 | 1561 | // actually, it consists on delete terms from db, |
@@ -1567,9 +1567,9 @@ discard block |
||
1567 | 1567 | $res = Database::query($sql); |
1568 | 1568 | |
1569 | 1569 | if (Database::num_rows($res) > 0) { |
1570 | - require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'); |
|
1571 | - require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'); |
|
1572 | - require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); |
|
1570 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
1571 | + require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'); |
|
1572 | + require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'); |
|
1573 | 1573 | |
1574 | 1574 | $se_ref = Database::fetch_array($res); |
1575 | 1575 | $specific_fields = get_specific_field_list(); |
@@ -1580,7 +1580,7 @@ discard block |
||
1580 | 1580 | delete_all_specific_field_value($course_id, $specific_field['id'], TOOL_QUIZ, $this->id); |
1581 | 1581 | if (isset($_REQUEST[$specific_field['code']])) { |
1582 | 1582 | $sterms = trim($_REQUEST[$specific_field['code']]); |
1583 | - $all_specific_terms .= ' '. $sterms; |
|
1583 | + $all_specific_terms .= ' '.$sterms; |
|
1584 | 1584 | $sterms = explode(',', $sterms); |
1585 | 1585 | foreach ($sterms as $sterm) { |
1586 | 1586 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -1596,17 +1596,17 @@ discard block |
||
1596 | 1596 | $xapian_data = array( |
1597 | 1597 | SE_COURSE_ID => $course_id, |
1598 | 1598 | SE_TOOL_ID => TOOL_QUIZ, |
1599 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
1600 | - SE_USER => (int)api_get_user_id(), |
|
1599 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
1600 | + SE_USER => (int) api_get_user_id(), |
|
1601 | 1601 | ); |
1602 | 1602 | $ic_slide->xapian_data = serialize($xapian_data); |
1603 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
1603 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
1604 | 1604 | $ic_slide->addValue("content", $exercise_description); |
1605 | 1605 | |
1606 | 1606 | $di = new ChamiloIndexer(); |
1607 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
1607 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
1608 | 1608 | $di->connectDb(NULL, NULL, $lang); |
1609 | - $di->remove_document((int)$se_ref['search_did']); |
|
1609 | + $di->remove_document((int) $se_ref['search_did']); |
|
1610 | 1610 | $di->addChunk($ic_slide); |
1611 | 1611 | |
1612 | 1612 | //index and return search engine document id |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | function search_engine_delete() |
1632 | 1632 | { |
1633 | 1633 | // remove from search engine if enabled |
1634 | - if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian') ) { |
|
1634 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
1635 | 1635 | $course_id = api_get_course_id(); |
1636 | 1636 | $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); |
1637 | 1637 | $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level IS NULL LIMIT 1'; |
@@ -1639,19 +1639,19 @@ discard block |
||
1639 | 1639 | $res = Database::query($sql); |
1640 | 1640 | if (Database::num_rows($res) > 0) { |
1641 | 1641 | $row = Database::fetch_array($res); |
1642 | - require_once(api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php'); |
|
1642 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
1643 | 1643 | $di = new ChamiloIndexer(); |
1644 | - $di->remove_document((int)$row['search_did']); |
|
1644 | + $di->remove_document((int) $row['search_did']); |
|
1645 | 1645 | unset($di); |
1646 | 1646 | $tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION); |
1647 | - foreach ( $this->questionList as $question_i) { |
|
1647 | + foreach ($this->questionList as $question_i) { |
|
1648 | 1648 | $sql = 'SELECT type FROM %s WHERE id=%s'; |
1649 | 1649 | $sql = sprintf($sql, $tbl_quiz_question, $question_i); |
1650 | 1650 | $qres = Database::query($sql); |
1651 | 1651 | if (Database::num_rows($qres) > 0) { |
1652 | 1652 | $qrow = Database::fetch_array($qres); |
1653 | 1653 | $objQuestion = Question::getInstance($qrow['type']); |
1654 | - $objQuestion = Question::read((int)$question_i); |
|
1654 | + $objQuestion = Question::read((int) $question_i); |
|
1655 | 1655 | $objQuestion->search_engine_edit($this->id, FALSE, TRUE); |
1656 | 1656 | unset($objQuestion); |
1657 | 1657 | } |
@@ -1662,7 +1662,7 @@ discard block |
||
1662 | 1662 | Database::query($sql); |
1663 | 1663 | |
1664 | 1664 | // remove terms from db |
1665 | - require_once api_get_path(LIBRARY_PATH) .'specific_fields_manager.lib.php'; |
|
1665 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
1666 | 1666 | delete_all_values_for_item($course_id, TOOL_QUIZ, $this->id); |
1667 | 1667 | } |
1668 | 1668 | } |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | */ |
1758 | 1758 | public function copy_exercise() |
1759 | 1759 | { |
1760 | - $exercise_obj= new Exercise(); |
|
1760 | + $exercise_obj = new Exercise(); |
|
1761 | 1761 | $exercise_obj = $this; |
1762 | 1762 | |
1763 | 1763 | // force the creation of a new exercise |
@@ -1829,25 +1829,25 @@ discard block |
||
1829 | 1829 | $lp_id = 0; |
1830 | 1830 | } |
1831 | 1831 | if (empty($lp_item_id)) { |
1832 | - $lp_item_id = 0; |
|
1832 | + $lp_item_id = 0; |
|
1833 | 1833 | } |
1834 | 1834 | if (empty($lp_item_view_id)) { |
1835 | 1835 | $lp_item_view_id = 0; |
1836 | 1836 | } |
1837 | - $condition = ' WHERE exe_exo_id = ' . "'" . $this->id . "'" .' AND |
|
1838 | - exe_user_id = ' . "'" . api_get_user_id() . "'" . ' AND |
|
1839 | - c_id = ' . api_get_course_int_id() . ' AND |
|
1840 | - status = ' . "'" . Database::escape_string($status). "'" . ' AND |
|
1841 | - orig_lp_id = ' . "'" . $lp_id . "'" . ' AND |
|
1842 | - orig_lp_item_id = ' . "'" . $lp_item_id . "'" . ' AND |
|
1843 | - orig_lp_item_view_id = ' . "'" . $lp_item_view_id . "'" . ' AND |
|
1844 | - session_id = ' . "'" . api_get_session_id() . "' LIMIT 1"; //Adding limit 1 just in case |
|
1837 | + $condition = ' WHERE exe_exo_id = '."'".$this->id."'".' AND |
|
1838 | + exe_user_id = ' . "'".api_get_user_id()."'".' AND |
|
1839 | + c_id = ' . api_get_course_int_id().' AND |
|
1840 | + status = ' . "'".Database::escape_string($status)."'".' AND |
|
1841 | + orig_lp_id = ' . "'".$lp_id."'".' AND |
|
1842 | + orig_lp_item_id = ' . "'".$lp_item_id."'".' AND |
|
1843 | + orig_lp_item_view_id = ' . "'".$lp_item_view_id."'".' AND |
|
1844 | + session_id = ' . "'".api_get_session_id()."' LIMIT 1"; //Adding limit 1 just in case |
|
1845 | 1845 | |
1846 | 1846 | $sql_track = 'SELECT * FROM '.$track_exercises.$condition; |
1847 | 1847 | |
1848 | 1848 | $result = Database::query($sql_track); |
1849 | 1849 | $new_array = array(); |
1850 | - if (Database::num_rows($result) > 0 ) { |
|
1850 | + if (Database::num_rows($result) > 0) { |
|
1851 | 1851 | $new_array = Database::fetch_array($result, 'ASSOC'); |
1852 | 1852 | $new_array['num_exe'] = Database::num_rows($result); |
1853 | 1853 | } |
@@ -1890,12 +1890,12 @@ discard block |
||
1890 | 1890 | $questionList = array_map('intval', $questionList); |
1891 | 1891 | |
1892 | 1892 | $params = array( |
1893 | - 'exe_exo_id' => $this->id , |
|
1893 | + 'exe_exo_id' => $this->id, |
|
1894 | 1894 | 'exe_user_id' => api_get_user_id(), |
1895 | 1895 | 'c_id' => api_get_course_int_id(), |
1896 | 1896 | 'status' => 'incomplete', |
1897 | 1897 | 'session_id' => api_get_session_id(), |
1898 | - 'data_tracking' => implode(',', $questionList) , |
|
1898 | + 'data_tracking' => implode(',', $questionList), |
|
1899 | 1899 | 'start_date' => api_get_utc_datetime(), |
1900 | 1900 | 'orig_lp_id' => $safe_lp_id, |
1901 | 1901 | 'orig_lp_item_id' => $safe_lp_item_id, |
@@ -1927,7 +1927,7 @@ discard block |
||
1927 | 1927 | $nbrQuestions = $this->get_count_question_list(); |
1928 | 1928 | |
1929 | 1929 | $all_button = $html = $label = ''; |
1930 | - $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']):null; |
|
1930 | + $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']) : null; |
|
1931 | 1931 | |
1932 | 1932 | if ($this->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT && $this->type == ONE_PER_PAGE) { |
1933 | 1933 | $urlTitle = get_lang('ContinueTest'); |
@@ -1938,7 +1938,7 @@ discard block |
||
1938 | 1938 | |
1939 | 1939 | $html .= Display::url( |
1940 | 1940 | $urlTitle, |
1941 | - 'exercise_submit_modal.php?' . http_build_query([ |
|
1941 | + 'exercise_submit_modal.php?'.http_build_query([ |
|
1942 | 1942 | 'learnpath_id' => $safe_lp_id, |
1943 | 1943 | 'learnpath_item_id' => $safe_lp_item_id, |
1944 | 1944 | 'learnpath_item_view_id' => $safe_lp_item_view_id, |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | 'data-size' => 'md' |
1956 | 1956 | ] |
1957 | 1957 | ); |
1958 | - $html .='<br />'; |
|
1958 | + $html .= '<br />'; |
|
1959 | 1959 | } else { |
1960 | 1960 | // User |
1961 | 1961 | if (api_is_allowed_to_session_edit()) { |
@@ -1980,7 +1980,7 @@ discard block |
||
1980 | 1980 | |
1981 | 1981 | //Next question |
1982 | 1982 | if (!empty($questions_in_media)) { |
1983 | - $questions_in_media = "['".implode("','",$questions_in_media)."']"; |
|
1983 | + $questions_in_media = "['".implode("','", $questions_in_media)."']"; |
|
1984 | 1984 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_question_list('.$questions_in_media.'); ">'.$label.'</a>'; |
1985 | 1985 | } else { |
1986 | 1986 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_now('.$question_id.', \'\', \''.$currentAnswer.'\'); ">'.$label.'</a>'; |
@@ -1998,7 +1998,7 @@ discard block |
||
1998 | 1998 | } |
1999 | 1999 | $class .= ' question-validate-btn'; // used to select it with jquery |
2000 | 2000 | $all_button = ' <a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>'; |
2001 | - $all_button .= ' ' . Display::span(null, ['id' => 'save_all_reponse']); |
|
2001 | + $all_button .= ' '.Display::span(null, ['id' => 'save_all_reponse']); |
|
2002 | 2002 | $html .= $all_button; |
2003 | 2003 | } |
2004 | 2004 | } |
@@ -2240,8 +2240,8 @@ discard block |
||
2240 | 2240 | $params = array(); |
2241 | 2241 | $params['course_id'] = $course_id; |
2242 | 2242 | $params['session_id'] = api_get_session_id(); |
2243 | - $params['user_id'] = isset($exe_info['exe_user_id'])? $exe_info['exe_user_id'] : api_get_user_id(); |
|
2244 | - $params['exercise_id'] = isset($exe_info['exe_exo_id'])? $exe_info['exe_exo_id'] : $this->id; |
|
2243 | + $params['user_id'] = isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id(); |
|
2244 | + $params['exercise_id'] = isset($exe_info['exe_exo_id']) ? $exe_info['exe_exo_id'] : $this->id; |
|
2245 | 2245 | $params['question_id'] = $questionId; |
2246 | 2246 | $params['exe_id'] = isset($exe_info['exe_id']) ? $exe_info['exe_id'] : $exeId; |
2247 | 2247 | |
@@ -2297,10 +2297,10 @@ discard block |
||
2297 | 2297 | $answer = $objAnswerTmp->selectAnswer($answerId); |
2298 | 2298 | $answerComment = $objAnswerTmp->selectComment($answerId); |
2299 | 2299 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
2300 | - $answerWeighting = (float)$objAnswerTmp->selectWeighting($answerId); |
|
2300 | + $answerWeighting = (float) $objAnswerTmp->selectWeighting($answerId); |
|
2301 | 2301 | $answerAutoId = $objAnswerTmp->selectAutoId($answerId); |
2302 | 2302 | |
2303 | - $answer_correct_array[$answerId] = (bool)$answerCorrect; |
|
2303 | + $answer_correct_array[$answerId] = (bool) $answerCorrect; |
|
2304 | 2304 | |
2305 | 2305 | if ($debug) { |
2306 | 2306 | error_log("answer auto id: $answerAutoId "); |
@@ -2309,7 +2309,7 @@ discard block |
||
2309 | 2309 | |
2310 | 2310 | // Delineation |
2311 | 2311 | $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
2312 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
2312 | + $answer_delineation_destination = $objAnswerTmp->selectDestination(1); |
|
2313 | 2313 | |
2314 | 2314 | switch ($answerType) { |
2315 | 2315 | // for unique answer |
@@ -2322,7 +2322,7 @@ discard block |
||
2322 | 2322 | exe_id = '".$exeId."' AND |
2323 | 2323 | question_id= '".$questionId."'"; |
2324 | 2324 | $result = Database::query($sql); |
2325 | - $choice = Database::result($result,0,"answer"); |
|
2325 | + $choice = Database::result($result, 0, "answer"); |
|
2326 | 2326 | |
2327 | 2327 | $studentChoice = $choice == $answerAutoId ? 1 : 0; |
2328 | 2328 | if ($studentChoice) { |
@@ -2373,7 +2373,7 @@ discard block |
||
2373 | 2373 | } else { |
2374 | 2374 | // If no result then the user just hit don't know |
2375 | 2375 | $studentChoice = 3; |
2376 | - $questionScore += $doubt_score; |
|
2376 | + $questionScore += $doubt_score; |
|
2377 | 2377 | } |
2378 | 2378 | $totalScore = $questionScore; |
2379 | 2379 | break; |
@@ -2389,17 +2389,17 @@ discard block |
||
2389 | 2389 | } |
2390 | 2390 | |
2391 | 2391 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2392 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2392 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2393 | 2393 | |
2394 | 2394 | if ($studentChoice) { |
2395 | - $questionScore +=$answerWeighting; |
|
2395 | + $questionScore += $answerWeighting; |
|
2396 | 2396 | } |
2397 | 2397 | } else { |
2398 | 2398 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2399 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2399 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2400 | 2400 | |
2401 | 2401 | if (isset($studentChoice)) { |
2402 | - $questionScore += $answerWeighting; |
|
2402 | + $questionScore += $answerWeighting; |
|
2403 | 2403 | } |
2404 | 2404 | } |
2405 | 2405 | $totalScore += $answerWeighting; |
@@ -2417,16 +2417,16 @@ discard block |
||
2417 | 2417 | $choice[$ind] = 1; |
2418 | 2418 | } |
2419 | 2419 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2420 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2420 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2421 | 2421 | if ($studentChoice) { |
2422 | - $questionScore +=$answerWeighting; |
|
2422 | + $questionScore += $answerWeighting; |
|
2423 | 2423 | } |
2424 | 2424 | } else { |
2425 | 2425 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2426 | 2426 | if (isset($studentChoice)) { |
2427 | 2427 | $questionScore += $answerWeighting; |
2428 | 2428 | } |
2429 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2429 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2430 | 2430 | } |
2431 | 2431 | $totalScore += $answerWeighting; |
2432 | 2432 | if ($debug) error_log("studentChoice: $studentChoice"); |
@@ -2438,7 +2438,7 @@ discard block |
||
2438 | 2438 | $resultans = Database::query($sql); |
2439 | 2439 | while ($row = Database::fetch_array($resultans)) { |
2440 | 2440 | $ind = $row['answer']; |
2441 | - $result = explode(':',$ind); |
|
2441 | + $result = explode(':', $ind); |
|
2442 | 2442 | if (isset($result[0])) { |
2443 | 2443 | $my_answer_id = isset($result[0]) ? $result[0] : ''; |
2444 | 2444 | $option = isset($result[1]) ? $result[1] : ''; |
@@ -2559,10 +2559,10 @@ discard block |
||
2559 | 2559 | } |
2560 | 2560 | // adds the piece of text that is before the blank |
2561 | 2561 | //and ends with '[' into a general storage array |
2562 | - $real_text[] = api_substr($temp, 0, $pos +1); |
|
2563 | - $answer .= api_substr($temp, 0, $pos +1); |
|
2562 | + $real_text[] = api_substr($temp, 0, $pos + 1); |
|
2563 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
2564 | 2564 | //take the string remaining (after the last "[" we found) |
2565 | - $temp = api_substr($temp, $pos +1); |
|
2565 | + $temp = api_substr($temp, $pos + 1); |
|
2566 | 2566 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
2567 | 2567 | if (($pos = api_strpos($temp, ']')) === false) { |
2568 | 2568 | // adds the end of the text |
@@ -2598,7 +2598,7 @@ discard block |
||
2598 | 2598 | //put the contents of the [] answer tag into correct_tags[] |
2599 | 2599 | $correct_tags[] = api_substr($temp, 0, $pos); |
2600 | 2600 | $j++; |
2601 | - $temp = api_substr($temp, $pos +1); |
|
2601 | + $temp = api_substr($temp, $pos + 1); |
|
2602 | 2602 | } |
2603 | 2603 | $answer = ''; |
2604 | 2604 | $real_correct_tags = $correct_tags; |
@@ -2621,7 +2621,7 @@ discard block |
||
2621 | 2621 | } elseif (!empty($user_tags[$i])) { |
2622 | 2622 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
2623 | 2623 | // adds the word in red at the end of the string, and strikes it |
2624 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
2624 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
2625 | 2625 | } else { |
2626 | 2626 | // adds a tabulation if no word has been typed by the student |
2627 | 2627 | $answer .= ''; // remove that causes issue |
@@ -2640,17 +2640,17 @@ discard block |
||
2640 | 2640 | } elseif (!empty ($user_tags[$i])) { |
2641 | 2641 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
2642 | 2642 | // adds the word in red at the end of the string, and strikes it |
2643 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
2643 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
2644 | 2644 | } else { |
2645 | 2645 | // adds a tabulation if no word has been typed by the student |
2646 | - $answer .= ''; // remove that causes issue |
|
2646 | + $answer .= ''; // remove that causes issue |
|
2647 | 2647 | } |
2648 | 2648 | } |
2649 | 2649 | |
2650 | 2650 | // adds the correct word, followed by ] to close the blank |
2651 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
2652 | - if (isset($real_text[$i +1])) { |
|
2653 | - $answer .= $real_text[$i +1]; |
|
2651 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
2652 | + if (isset($real_text[$i + 1])) { |
|
2653 | + $answer .= $real_text[$i + 1]; |
|
2654 | 2654 | } |
2655 | 2655 | } |
2656 | 2656 | } else { |
@@ -2784,10 +2784,10 @@ discard block |
||
2784 | 2784 | } |
2785 | 2785 | // adds the piece of text that is before the blank |
2786 | 2786 | //and ends with '[' into a general storage array |
2787 | - $realText[] = api_substr($temp, 0, $pos +1); |
|
2788 | - $answer .= api_substr($temp, 0, $pos +1); |
|
2787 | + $realText[] = api_substr($temp, 0, $pos + 1); |
|
2788 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
2789 | 2789 | //take the string remaining (after the last "[" we found) |
2790 | - $temp = api_substr($temp, $pos +1); |
|
2790 | + $temp = api_substr($temp, $pos + 1); |
|
2791 | 2791 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
2792 | 2792 | if (($pos = api_strpos($temp, ']')) === false) { |
2793 | 2793 | // adds the end of the text |
@@ -2821,7 +2821,7 @@ discard block |
||
2821 | 2821 | //put the contents of the [] answer tag into correct_tags[] |
2822 | 2822 | $correctTags[] = api_substr($temp, 0, $pos); |
2823 | 2823 | $j++; |
2824 | - $temp = api_substr($temp, $pos +1); |
|
2824 | + $temp = api_substr($temp, $pos + 1); |
|
2825 | 2825 | } |
2826 | 2826 | $answer = ''; |
2827 | 2827 | $realCorrectTags = $correctTags; |
@@ -2841,22 +2841,22 @@ discard block |
||
2841 | 2841 | } elseif (!empty($userTags[$i])) { |
2842 | 2842 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
2843 | 2843 | // adds the word in red at the end of the string, and strikes it |
2844 | - $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>'; |
|
2844 | + $answer .= '<font color="red"><s>'.$userTags[$i].'</s></font>'; |
|
2845 | 2845 | } else { |
2846 | 2846 | // adds a tabulation if no word has been typed by the student |
2847 | 2847 | $answer .= ''; // remove that causes issue |
2848 | 2848 | } |
2849 | 2849 | // adds the correct word, followed by ] to close the blank |
2850 | - $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>]'; |
|
2851 | - if (isset($realText[$i +1])) { |
|
2852 | - $answer .= $realText[$i +1]; |
|
2850 | + $answer .= ' / <font color="green"><b>'.$realCorrectTags[$i].'</b></font>]'; |
|
2851 | + if (isset($realText[$i + 1])) { |
|
2852 | + $answer .= $realText[$i + 1]; |
|
2853 | 2853 | } |
2854 | 2854 | } |
2855 | 2855 | break; |
2856 | 2856 | // for free answer |
2857 | 2857 | case FREE_ANSWER: |
2858 | 2858 | if ($from_database) { |
2859 | - $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
2859 | + $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
2860 | 2860 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
2861 | 2861 | $resq = Database::query($query); |
2862 | 2862 | $data = Database::fetch_array($resq); |
@@ -2867,9 +2867,9 @@ discard block |
||
2867 | 2867 | $questionScore = $data['marks']; |
2868 | 2868 | |
2869 | 2869 | if ($questionScore == -1) { |
2870 | - $totalScore+= 0; |
|
2870 | + $totalScore += 0; |
|
2871 | 2871 | } else { |
2872 | - $totalScore+= $questionScore; |
|
2872 | + $totalScore += $questionScore; |
|
2873 | 2873 | } |
2874 | 2874 | if ($questionScore == '') { |
2875 | 2875 | $questionScore = 0; |
@@ -2890,14 +2890,14 @@ discard block |
||
2890 | 2890 | $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
2891 | 2891 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
2892 | 2892 | $resq = Database::query($query); |
2893 | - $choice = Database::result($resq,0,'answer'); |
|
2893 | + $choice = Database::result($resq, 0, 'answer'); |
|
2894 | 2894 | $choice = str_replace('\r\n', '', $choice); |
2895 | 2895 | $choice = stripslashes($choice); |
2896 | - $questionScore = Database::result($resq,0,"marks"); |
|
2897 | - if ($questionScore==-1) { |
|
2898 | - $totalScore+=0; |
|
2896 | + $questionScore = Database::result($resq, 0, "marks"); |
|
2897 | + if ($questionScore == -1) { |
|
2898 | + $totalScore += 0; |
|
2899 | 2899 | } else { |
2900 | - $totalScore+=$questionScore; |
|
2900 | + $totalScore += $questionScore; |
|
2901 | 2901 | } |
2902 | 2902 | $arrques = $questionName; |
2903 | 2903 | $arrans = $choice; |
@@ -2942,7 +2942,7 @@ discard block |
||
2942 | 2942 | |
2943 | 2943 | while ($a_answers = Database::fetch_array($res_answers)) { |
2944 | 2944 | $i_answer_id = $a_answers['id']; //3 |
2945 | - $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
2945 | + $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
2946 | 2946 | $i_answer_correct_answer = $a_answers['correct']; //1 - 2 |
2947 | 2947 | $i_answer_id_auto = $a_answers['id_auto']; // 3 - 4 |
2948 | 2948 | |
@@ -2994,8 +2994,8 @@ discard block |
||
2994 | 2994 | |
2995 | 2995 | if ($show_result) { |
2996 | 2996 | echo '<tr>'; |
2997 | - echo '<td>' . $s_answer_label . '</td>'; |
|
2998 | - echo '<td>' . $user_answer; |
|
2997 | + echo '<td>'.$s_answer_label.'</td>'; |
|
2998 | + echo '<td>'.$user_answer; |
|
2999 | 2999 | |
3000 | 3000 | if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
3001 | 3001 | if (isset($real_list[$i_answer_correct_answer])) { |
@@ -3104,7 +3104,7 @@ discard block |
||
3104 | 3104 | if ($from_database) { |
3105 | 3105 | // getting the user answer |
3106 | 3106 | $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); |
3107 | - $query = "SELECT hotspot_correct, hotspot_coordinate |
|
3107 | + $query = "SELECT hotspot_correct, hotspot_coordinate |
|
3108 | 3108 | FROM $TBL_TRACK_HOTSPOT |
3109 | 3109 | WHERE |
3110 | 3110 | hotspot_exe_id = '".$exeId."' AND |
@@ -3112,20 +3112,20 @@ discard block |
||
3112 | 3112 | hotspot_answer_id='1'"; |
3113 | 3113 | //by default we take 1 because it's a delineation |
3114 | 3114 | $resq = Database::query($query); |
3115 | - $row = Database::fetch_array($resq,'ASSOC'); |
|
3115 | + $row = Database::fetch_array($resq, 'ASSOC'); |
|
3116 | 3116 | |
3117 | 3117 | $choice = $row['hotspot_correct']; |
3118 | 3118 | $user_answer = $row['hotspot_coordinate']; |
3119 | 3119 | |
3120 | 3120 | // THIS is very important otherwise the poly_compile will throw an error!! |
3121 | 3121 | // round-up the coordinates |
3122 | - $coords = explode('/',$user_answer); |
|
3122 | + $coords = explode('/', $user_answer); |
|
3123 | 3123 | $user_array = ''; |
3124 | 3124 | foreach ($coords as $coord) { |
3125 | - list($x,$y) = explode(';',$coord); |
|
3125 | + list($x, $y) = explode(';', $coord); |
|
3126 | 3126 | $user_array .= round($x).';'.round($y).'/'; |
3127 | 3127 | } |
3128 | - $user_array = substr($user_array,0,-1); |
|
3128 | + $user_array = substr($user_array, 0, -1); |
|
3129 | 3129 | } else { |
3130 | 3130 | if (!empty($studentChoice)) { |
3131 | 3131 | $newquestionList[] = $questionId; |
@@ -3135,13 +3135,13 @@ discard block |
||
3135 | 3135 | $studentChoice = $choice[$answerId]; |
3136 | 3136 | $questionScore += $answerWeighting; |
3137 | 3137 | |
3138 | - if ($hotspot_delineation_result[1]==1) { |
|
3138 | + if ($hotspot_delineation_result[1] == 1) { |
|
3139 | 3139 | $totalScore += $answerWeighting; //adding the total |
3140 | 3140 | } |
3141 | 3141 | } |
3142 | 3142 | } |
3143 | - $_SESSION['hotspot_coord'][1] = $delineation_cord; |
|
3144 | - $_SESSION['hotspot_dest'][1] = $answer_delineation_destination; |
|
3143 | + $_SESSION['hotspot_coord'][1] = $delineation_cord; |
|
3144 | + $_SESSION['hotspot_dest'][1] = $answer_delineation_destination; |
|
3145 | 3145 | break; |
3146 | 3146 | } // end switch Answertype |
3147 | 3147 | |
@@ -3199,7 +3199,7 @@ discard block |
||
3199 | 3199 | $results_disabled |
3200 | 3200 | ); |
3201 | 3201 | //} |
3202 | - } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) { |
|
3202 | + } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
|
3203 | 3203 | // if ($origin!='learnpath') { |
3204 | 3204 | ExerciseShowFunctions::display_multiple_answer_combination_true_false( |
3205 | 3205 | $feedback_type, |
@@ -3216,11 +3216,11 @@ discard block |
||
3216 | 3216 | //} |
3217 | 3217 | } elseif ($answerType == FILL_IN_BLANKS) { |
3218 | 3218 | //if ($origin!='learnpath') { |
3219 | - ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer,0,0, $results_disabled); |
|
3219 | + ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer, 0, 0, $results_disabled); |
|
3220 | 3220 | // } |
3221 | 3221 | } elseif ($answerType == CALCULATED_ANSWER) { |
3222 | 3222 | //if ($origin!='learnpath') { |
3223 | - ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer,0,0); |
|
3223 | + ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer, 0, 0); |
|
3224 | 3224 | // } |
3225 | 3225 | } elseif ($answerType == FREE_ANSWER) { |
3226 | 3226 | //if($origin != 'learnpath') { |
@@ -3274,13 +3274,13 @@ discard block |
||
3274 | 3274 | $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId]; |
3275 | 3275 | |
3276 | 3276 | //round-up the coordinates |
3277 | - $coords = explode('/',$user_answer); |
|
3277 | + $coords = explode('/', $user_answer); |
|
3278 | 3278 | $user_array = ''; |
3279 | 3279 | foreach ($coords as $coord) { |
3280 | - list($x,$y) = explode(';',$coord); |
|
3280 | + list($x, $y) = explode(';', $coord); |
|
3281 | 3281 | $user_array .= round($x).';'.round($y).'/'; |
3282 | 3282 | } |
3283 | - $user_array = substr($user_array,0,-1); |
|
3283 | + $user_array = substr($user_array, 0, -1); |
|
3284 | 3284 | |
3285 | 3285 | if ($next) { |
3286 | 3286 | |
@@ -3307,7 +3307,7 @@ discard block |
||
3307 | 3307 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); |
3308 | 3308 | // //this is an area in pixels |
3309 | 3309 | if ($debug > 0) { |
3310 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
3310 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
3311 | 3311 | } |
3312 | 3312 | |
3313 | 3313 | if ($overlap < 1) { |
@@ -3320,43 +3320,43 @@ discard block |
||
3320 | 3320 | // that is overlapped by the user's polygon |
3321 | 3321 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
3322 | 3322 | if ($debug > 1) { |
3323 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
3323 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
3324 | 3324 | } |
3325 | 3325 | // the final missing area is the percentage of the initial polygon |
3326 | 3326 | // that is not overlapped by the user's polygon |
3327 | 3327 | $final_missing = 100 - $final_overlap; |
3328 | 3328 | if ($debug > 1) { |
3329 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
3329 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
3330 | 3330 | } |
3331 | 3331 | // the final excess area is the percentage of the initial polygon's size |
3332 | 3332 | // that is covered by the user's polygon outside of the initial polygon |
3333 | 3333 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
3334 | 3334 | if ($debug > 1) { |
3335 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
3335 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
3336 | 3336 | } |
3337 | 3337 | } |
3338 | 3338 | |
3339 | 3339 | //checking the destination parameters parsing the "@@" |
3340 | - $destination_items= explode('@@', $answerDestination); |
|
3340 | + $destination_items = explode('@@', $answerDestination); |
|
3341 | 3341 | $threadhold_total = $destination_items[0]; |
3342 | - $threadhold_items=explode(';',$threadhold_total); |
|
3342 | + $threadhold_items = explode(';', $threadhold_total); |
|
3343 | 3343 | $threadhold1 = $threadhold_items[0]; // overlap |
3344 | 3344 | $threadhold2 = $threadhold_items[1]; // excess |
3345 | - $threadhold3 = $threadhold_items[2]; //missing |
|
3345 | + $threadhold3 = $threadhold_items[2]; //missing |
|
3346 | 3346 | |
3347 | 3347 | // if is delineation |
3348 | - if ($answerId===1) { |
|
3348 | + if ($answerId === 1) { |
|
3349 | 3349 | //setting colors |
3350 | - if ($final_overlap>=$threadhold1) { |
|
3351 | - $overlap_color=true; //echo 'a'; |
|
3350 | + if ($final_overlap >= $threadhold1) { |
|
3351 | + $overlap_color = true; //echo 'a'; |
|
3352 | 3352 | } |
3353 | 3353 | //echo $excess.'-'.$threadhold2; |
3354 | - if ($final_excess<=$threadhold2) { |
|
3355 | - $excess_color=true; //echo 'b'; |
|
3354 | + if ($final_excess <= $threadhold2) { |
|
3355 | + $excess_color = true; //echo 'b'; |
|
3356 | 3356 | } |
3357 | 3357 | //echo '--------'.$missing.'-'.$threadhold3; |
3358 | - if ($final_missing<=$threadhold3) { |
|
3359 | - $missing_color=true; //echo 'c'; |
|
3358 | + if ($final_missing <= $threadhold3) { |
|
3359 | + $missing_color = true; //echo 'c'; |
|
3360 | 3360 | } |
3361 | 3361 | |
3362 | 3362 | // if pass |
@@ -3365,67 +3365,67 @@ discard block |
||
3365 | 3365 | $final_missing <= $threadhold3 && |
3366 | 3366 | $final_excess <= $threadhold2 |
3367 | 3367 | ) { |
3368 | - $next=1; //go to the oars |
|
3369 | - $result_comment=get_lang('Acceptable'); |
|
3370 | - $final_answer = 1; // do not update with update_exercise_attempt |
|
3368 | + $next = 1; //go to the oars |
|
3369 | + $result_comment = get_lang('Acceptable'); |
|
3370 | + $final_answer = 1; // do not update with update_exercise_attempt |
|
3371 | 3371 | } else { |
3372 | - $next=0; |
|
3373 | - $result_comment=get_lang('Unacceptable'); |
|
3374 | - $comment=$answerDestination=$objAnswerTmp->selectComment(1); |
|
3375 | - $answerDestination=$objAnswerTmp->selectDestination(1); |
|
3372 | + $next = 0; |
|
3373 | + $result_comment = get_lang('Unacceptable'); |
|
3374 | + $comment = $answerDestination = $objAnswerTmp->selectComment(1); |
|
3375 | + $answerDestination = $objAnswerTmp->selectDestination(1); |
|
3376 | 3376 | //checking the destination parameters parsing the "@@" |
3377 | - $destination_items= explode('@@', $answerDestination); |
|
3377 | + $destination_items = explode('@@', $answerDestination); |
|
3378 | 3378 | } |
3379 | - } elseif($answerId>1) { |
|
3379 | + } elseif ($answerId > 1) { |
|
3380 | 3380 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
3381 | - if ($debug>0) { |
|
3382 | - error_log(__LINE__.' - answerId is of type noerror',0); |
|
3381 | + if ($debug > 0) { |
|
3382 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
3383 | 3383 | } |
3384 | 3384 | //type no error shouldn't be treated |
3385 | 3385 | $next = 1; |
3386 | 3386 | continue; |
3387 | 3387 | } |
3388 | - if ($debug>0) { |
|
3389 | - error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0); |
|
3388 | + if ($debug > 0) { |
|
3389 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
3390 | 3390 | } |
3391 | 3391 | //check the intersection between the oar and the user |
3392 | 3392 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
3393 | 3393 | //echo 'official';print_r($x_list);print_r($y_list); |
3394 | 3394 | //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list); |
3395 | - $inter= $result['success']; |
|
3395 | + $inter = $result['success']; |
|
3396 | 3396 | |
3397 | 3397 | //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
3398 | - $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
|
3398 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); |
|
3399 | 3399 | |
3400 | - $poly_answer = convert_coordinates($delineation_cord,'|'); |
|
3401 | - $max_coord = poly_get_max($poly_user,$poly_answer); |
|
3402 | - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); |
|
3403 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
3400 | + $poly_answer = convert_coordinates($delineation_cord, '|'); |
|
3401 | + $max_coord = poly_get_max($poly_user, $poly_answer); |
|
3402 | + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
|
3403 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
3404 | 3404 | |
3405 | 3405 | if ($overlap == false) { |
3406 | 3406 | //all good, no overlap |
3407 | 3407 | $next = 1; |
3408 | 3408 | continue; |
3409 | 3409 | } else { |
3410 | - if ($debug>0) { |
|
3411 | - error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0); |
|
3410 | + if ($debug > 0) { |
|
3411 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
3412 | 3412 | } |
3413 | 3413 | $organs_at_risk_hit++; |
3414 | 3414 | //show the feedback |
3415 | - $next=0; |
|
3416 | - $comment=$answerDestination=$objAnswerTmp->selectComment($answerId); |
|
3417 | - $answerDestination=$objAnswerTmp->selectDestination($answerId); |
|
3418 | - |
|
3419 | - $destination_items= explode('@@', $answerDestination); |
|
3420 | - $try_hotspot=$destination_items[1]; |
|
3421 | - $lp_hotspot=$destination_items[2]; |
|
3422 | - $select_question_hotspot=$destination_items[3]; |
|
3423 | - $url_hotspot=$destination_items[4]; |
|
3415 | + $next = 0; |
|
3416 | + $comment = $answerDestination = $objAnswerTmp->selectComment($answerId); |
|
3417 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
3418 | + |
|
3419 | + $destination_items = explode('@@', $answerDestination); |
|
3420 | + $try_hotspot = $destination_items[1]; |
|
3421 | + $lp_hotspot = $destination_items[2]; |
|
3422 | + $select_question_hotspot = $destination_items[3]; |
|
3423 | + $url_hotspot = $destination_items[4]; |
|
3424 | 3424 | } |
3425 | 3425 | } |
3426 | 3426 | } else { // the first delineation feedback |
3427 | - if ($debug>0) { |
|
3428 | - error_log(__LINE__.' first',0); |
|
3427 | + if ($debug > 0) { |
|
3428 | + error_log(__LINE__.' first', 0); |
|
3429 | 3429 | } |
3430 | 3430 | } |
3431 | 3431 | } elseif (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
@@ -3433,7 +3433,7 @@ discard block |
||
3433 | 3433 | echo Display::tag('td', $answerMatching[$answerId]); |
3434 | 3434 | echo Display::tag( |
3435 | 3435 | 'td', |
3436 | - "$user_answer / " . Display::tag( |
|
3436 | + "$user_answer / ".Display::tag( |
|
3437 | 3437 | 'strong', |
3438 | 3438 | $answerMatching[$answerCorrect], |
3439 | 3439 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -3573,7 +3573,7 @@ discard block |
||
3573 | 3573 | $exeId, |
3574 | 3574 | $questionId, |
3575 | 3575 | $nano |
3576 | - ) . '</td> |
|
3576 | + ).'</td> |
|
3577 | 3577 | </tr> |
3578 | 3578 | </table>'; |
3579 | 3579 | break; |
@@ -3632,7 +3632,7 @@ discard block |
||
3632 | 3632 | |
3633 | 3633 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels |
3634 | 3634 | if ($debug > 0) { |
3635 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
3635 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
3636 | 3636 | } |
3637 | 3637 | if ($overlap < 1) { |
3638 | 3638 | //shortcut to avoid complicated calculations |
@@ -3643,17 +3643,17 @@ discard block |
||
3643 | 3643 | // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon |
3644 | 3644 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
3645 | 3645 | if ($debug > 1) { |
3646 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
3646 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
3647 | 3647 | } |
3648 | 3648 | // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon |
3649 | 3649 | $final_missing = 100 - $final_overlap; |
3650 | 3650 | if ($debug > 1) { |
3651 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
3651 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
3652 | 3652 | } |
3653 | 3653 | // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon |
3654 | 3654 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
3655 | 3655 | if ($debug > 1) { |
3656 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
3656 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
3657 | 3657 | } |
3658 | 3658 | } |
3659 | 3659 | |
@@ -3663,7 +3663,7 @@ discard block |
||
3663 | 3663 | $threadhold_items = explode(';', $threadhold_total); |
3664 | 3664 | $threadhold1 = $threadhold_items[0]; // overlap |
3665 | 3665 | $threadhold2 = $threadhold_items[1]; // excess |
3666 | - $threadhold3 = $threadhold_items[2]; //missing |
|
3666 | + $threadhold3 = $threadhold_items[2]; //missing |
|
3667 | 3667 | // if is delineation |
3668 | 3668 | if ($answerId === 1) { |
3669 | 3669 | //setting colors |
@@ -3695,14 +3695,14 @@ discard block |
||
3695 | 3695 | } elseif ($answerId > 1) { |
3696 | 3696 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
3697 | 3697 | if ($debug > 0) { |
3698 | - error_log(__LINE__ . ' - answerId is of type noerror', 0); |
|
3698 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
3699 | 3699 | } |
3700 | 3700 | //type no error shouldn't be treated |
3701 | 3701 | $next = 1; |
3702 | 3702 | continue; |
3703 | 3703 | } |
3704 | 3704 | if ($debug > 0) { |
3705 | - error_log(__LINE__ . ' - answerId is >1 so we\'re probably in OAR', 0); |
|
3705 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
3706 | 3706 | } |
3707 | 3707 | //check the intersection between the oar and the user |
3708 | 3708 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
@@ -3716,7 +3716,7 @@ discard block |
||
3716 | 3716 | $poly_answer = convert_coordinates($delineation_cord, '|'); |
3717 | 3717 | $max_coord = poly_get_max($poly_user, $poly_answer); |
3718 | 3718 | $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
3719 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
3719 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
3720 | 3720 | |
3721 | 3721 | if ($overlap == false) { |
3722 | 3722 | //all good, no overlap |
@@ -3724,7 +3724,7 @@ discard block |
||
3724 | 3724 | continue; |
3725 | 3725 | } else { |
3726 | 3726 | if ($debug > 0) { |
3727 | - error_log(__LINE__ . ' - Overlap is ' . $overlap . ': OAR hit', 0); |
|
3727 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
3728 | 3728 | } |
3729 | 3729 | $organs_at_risk_hit++; |
3730 | 3730 | //show the feedback |
@@ -3736,12 +3736,12 @@ discard block |
||
3736 | 3736 | $try_hotspot = $destination_items[1]; |
3737 | 3737 | $lp_hotspot = $destination_items[2]; |
3738 | 3738 | $select_question_hotspot = $destination_items[3]; |
3739 | - $url_hotspot=$destination_items[4]; |
|
3739 | + $url_hotspot = $destination_items[4]; |
|
3740 | 3740 | } |
3741 | 3741 | } |
3742 | 3742 | } else { // the first delineation feedback |
3743 | 3743 | if ($debug > 0) { |
3744 | - error_log(__LINE__ . ' first', 0); |
|
3744 | + error_log(__LINE__.' first', 0); |
|
3745 | 3745 | } |
3746 | 3746 | } |
3747 | 3747 | break; |
@@ -3763,7 +3763,7 @@ discard block |
||
3763 | 3763 | echo Display::tag('td', $answerMatching[$answerId]); |
3764 | 3764 | echo Display::tag( |
3765 | 3765 | 'td', |
3766 | - "$user_answer / " . Display::tag( |
|
3766 | + "$user_answer / ".Display::tag( |
|
3767 | 3767 | 'strong', |
3768 | 3768 | $answerMatching[$answerCorrect], |
3769 | 3769 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -3849,7 +3849,7 @@ discard block |
||
3849 | 3849 | // we use the results from the session (from_db=0) |
3850 | 3850 | // TODO Change this, because it is wrong to show the user |
3851 | 3851 | // some results that haven't been stored in the database yet |
3852 | - if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
|
3852 | + if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION) { |
|
3853 | 3853 | |
3854 | 3854 | if ($debug) error_log('$from AND this is a hotspot kind of question '); |
3855 | 3855 | |
@@ -3858,19 +3858,19 @@ discard block |
||
3858 | 3858 | if ($answerType == HOT_SPOT_DELINEATION) { |
3859 | 3859 | if (0) { |
3860 | 3860 | if ($overlap_color) { |
3861 | - $overlap_color='green'; |
|
3861 | + $overlap_color = 'green'; |
|
3862 | 3862 | } else { |
3863 | - $overlap_color='red'; |
|
3863 | + $overlap_color = 'red'; |
|
3864 | 3864 | } |
3865 | 3865 | if ($missing_color) { |
3866 | - $missing_color='green'; |
|
3866 | + $missing_color = 'green'; |
|
3867 | 3867 | } else { |
3868 | - $missing_color='red'; |
|
3868 | + $missing_color = 'red'; |
|
3869 | 3869 | } |
3870 | 3870 | if ($excess_color) { |
3871 | - $excess_color='green'; |
|
3871 | + $excess_color = 'green'; |
|
3872 | 3872 | } else { |
3873 | - $excess_color='red'; |
|
3873 | + $excess_color = 'red'; |
|
3874 | 3874 | } |
3875 | 3875 | if (!is_numeric($final_overlap)) { |
3876 | 3876 | $final_overlap = 0; |
@@ -3882,33 +3882,33 @@ discard block |
||
3882 | 3882 | $final_excess = 0; |
3883 | 3883 | } |
3884 | 3884 | |
3885 | - if ($final_overlap>100) { |
|
3885 | + if ($final_overlap > 100) { |
|
3886 | 3886 | $final_overlap = 100; |
3887 | 3887 | } |
3888 | 3888 | |
3889 | - $table_resume='<table class="data_table"> |
|
3889 | + $table_resume = '<table class="data_table"> |
|
3890 | 3890 | <tr class="row_odd" > |
3891 | 3891 | <td></td> |
3892 | - <td ><b>' . get_lang('Requirements') . '</b></td> |
|
3893 | - <td><b>' . get_lang('YourAnswer') . '</b></td> |
|
3892 | + <td ><b>' . get_lang('Requirements').'</b></td> |
|
3893 | + <td><b>' . get_lang('YourAnswer').'</b></td> |
|
3894 | 3894 | </tr> |
3895 | 3895 | <tr class="row_even"> |
3896 | - <td><b>' . get_lang('Overlap') . '</b></td> |
|
3897 | - <td>' . get_lang('Min') . ' ' . $threadhold1 . '</td> |
|
3898 | - <td><div style="color:' . $overlap_color . '">' |
|
3899 | - . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '</div></td> |
|
3896 | + <td><b>' . get_lang('Overlap').'</b></td> |
|
3897 | + <td>' . get_lang('Min').' '.$threadhold1.'</td> |
|
3898 | + <td><div style="color:' . $overlap_color.'">' |
|
3899 | + . (($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
3900 | 3900 | </tr> |
3901 | 3901 | <tr> |
3902 | - <td><b>' . get_lang('Excess') . '</b></td> |
|
3903 | - <td>' . get_lang('Max') . ' ' . $threadhold2 . '</td> |
|
3904 | - <td><div style="color:' . $excess_color . '">' |
|
3905 | - . (($final_excess < 0) ? 0 : intval($final_excess)) . '</div></td> |
|
3902 | + <td><b>' . get_lang('Excess').'</b></td> |
|
3903 | + <td>' . get_lang('Max').' '.$threadhold2.'</td> |
|
3904 | + <td><div style="color:' . $excess_color.'">' |
|
3905 | + . (($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
3906 | 3906 | </tr> |
3907 | 3907 | <tr class="row_even"> |
3908 | - <td><b>' . get_lang('Missing') . '</b></td> |
|
3909 | - <td>' . get_lang('Max') . ' ' . $threadhold3 . '</td> |
|
3910 | - <td><div style="color:' . $missing_color . '">' |
|
3911 | - . (($final_missing < 0) ? 0 : intval($final_missing)) . '</div></td> |
|
3908 | + <td><b>' . get_lang('Missing').'</b></td> |
|
3909 | + <td>' . get_lang('Max').' '.$threadhold3.'</td> |
|
3910 | + <td><div style="color:' . $missing_color.'">' |
|
3911 | + . (($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
3912 | 3912 | </tr> |
3913 | 3913 | </table>'; |
3914 | 3914 | if ($next == 0) { |
@@ -3923,20 +3923,20 @@ discard block |
||
3923 | 3923 | $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
3924 | 3924 | } |
3925 | 3925 | |
3926 | - echo '<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1> |
|
3926 | + echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1> |
|
3927 | 3927 | <p style="text-align:center">'; |
3928 | 3928 | |
3929 | - $message = '<p>' . get_lang('YourDelineation') . '</p>'; |
|
3929 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
3930 | 3930 | $message .= $table_resume; |
3931 | - $message .= '<br />' . get_lang('ResultIs') . ' ' . $result_comment . '<br />'; |
|
3931 | + $message .= '<br />'.get_lang('ResultIs').' '.$result_comment.'<br />'; |
|
3932 | 3932 | if ($organs_at_risk_hit > 0) { |
3933 | - $message .= '<p><b>' . get_lang('OARHit') . '</b></p>'; |
|
3933 | + $message .= '<p><b>'.get_lang('OARHit').'</b></p>'; |
|
3934 | 3934 | } |
3935 | - $message .='<p>' . $comment . '</p>'; |
|
3935 | + $message .= '<p>'.$comment.'</p>'; |
|
3936 | 3936 | echo $message; |
3937 | 3937 | } else { |
3938 | 3938 | echo $hotspot_delineation_result[0]; //prints message |
3939 | - $from_database = 1; // the hotspot_solution.swf needs this variable |
|
3939 | + $from_database = 1; // the hotspot_solution.swf needs this variable |
|
3940 | 3940 | } |
3941 | 3941 | |
3942 | 3942 | //save the score attempts |
@@ -3958,20 +3958,20 @@ discard block |
||
3958 | 3958 | $exerciseResultCoordinates[$quesId] |
3959 | 3959 | ); |
3960 | 3960 | } else { |
3961 | - if ($final_answer==0) { |
|
3961 | + if ($final_answer == 0) { |
|
3962 | 3962 | $questionScore = 0; |
3963 | - $answer=0; |
|
3963 | + $answer = 0; |
|
3964 | 3964 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
3965 | 3965 | if (is_array($exerciseResultCoordinates[$quesId])) { |
3966 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
3967 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,0,$val); |
|
3966 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
3967 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, 0, $val); |
|
3968 | 3968 | } |
3969 | 3969 | } |
3970 | 3970 | } else { |
3971 | 3971 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
3972 | 3972 | if (is_array($exerciseResultCoordinates[$quesId])) { |
3973 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
3974 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,$choice[$idx],$val); |
|
3973 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
3974 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, $choice[$idx], $val); |
|
3975 | 3975 | } |
3976 | 3976 | } |
3977 | 3977 | } |
@@ -3990,7 +3990,7 @@ discard block |
||
3990 | 3990 | echo " |
3991 | 3991 | <tr> |
3992 | 3992 | <td colspan=\"2\"> |
3993 | - <p><em>" . get_lang('HotSpot') . "</em></p> |
|
3993 | + <p><em>" . get_lang('HotSpot')."</em></p> |
|
3994 | 3994 | |
3995 | 3995 | <div id=\"hotspot-solution-$questionId\"></div> |
3996 | 3996 | |
@@ -4028,7 +4028,7 @@ discard block |
||
4028 | 4028 | |
4029 | 4029 | if ($saved_results) { |
4030 | 4030 | if ($debug) error_log("Save question results $saved_results"); |
4031 | - if ($debug) error_log(print_r($choice ,1 )); |
|
4031 | + if ($debug) error_log(print_r($choice, 1)); |
|
4032 | 4032 | |
4033 | 4033 | if (empty($choice)) { |
4034 | 4034 | $choice = 0; |
@@ -4040,14 +4040,14 @@ discard block |
||
4040 | 4040 | $ans = $reply[$i]; |
4041 | 4041 | Event::saveQuestionAttempt( |
4042 | 4042 | $questionScore, |
4043 | - $ans . ':' . $choice[$ans], |
|
4043 | + $ans.':'.$choice[$ans], |
|
4044 | 4044 | $quesId, |
4045 | 4045 | $exeId, |
4046 | 4046 | $i, |
4047 | 4047 | $this->id |
4048 | 4048 | ); |
4049 | 4049 | if ($debug) { |
4050 | - error_log('result =>' . $questionScore . ' ' . $ans . ':' . $choice[$ans]); |
|
4050 | + error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]); |
|
4051 | 4051 | } |
4052 | 4052 | } |
4053 | 4053 | } else { |
@@ -4058,7 +4058,7 @@ discard block |
||
4058 | 4058 | $reply = array_keys($choice); |
4059 | 4059 | |
4060 | 4060 | if ($debug) { |
4061 | - error_log("reply " . print_r($reply, 1) . ""); |
|
4061 | + error_log("reply ".print_r($reply, 1).""); |
|
4062 | 4062 | } |
4063 | 4063 | for ($i = 0; $i < sizeof($reply); $i++) { |
4064 | 4064 | $ans = $reply[$i]; |
@@ -4117,7 +4117,7 @@ discard block |
||
4117 | 4117 | |
4118 | 4118 | Event::saveQuestionAttempt($questionScore, implode('|', $answer), $quesId, $exeId, 0, $this->id); |
4119 | 4119 | } else { |
4120 | - Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0,$this->id); |
|
4120 | + Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
4121 | 4121 | } |
4122 | 4122 | } |
4123 | 4123 | |
@@ -4127,8 +4127,8 @@ discard block |
||
4127 | 4127 | |
4128 | 4128 | if ($saved_results) { |
4129 | 4129 | $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
4130 | - $sql = 'UPDATE ' . $stat_table . ' SET |
|
4131 | - exe_result = exe_result + ' . floatval($questionScore) . ' |
|
4130 | + $sql = 'UPDATE '.$stat_table.' SET |
|
4131 | + exe_result = exe_result + ' . floatval($questionScore).' |
|
4132 | 4132 | WHERE exe_id = ' . $exeId; |
4133 | 4133 | if ($debug) error_log($sql); |
4134 | 4134 | Database::query($sql); |
@@ -4152,7 +4152,7 @@ discard block |
||
4152 | 4152 | */ |
4153 | 4153 | public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id) |
4154 | 4154 | { |
4155 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
4155 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
4156 | 4156 | return null; |
4157 | 4157 | } |
4158 | 4158 | // Email configuration settings |
@@ -4203,7 +4203,7 @@ discard block |
||
4203 | 4203 | $msg = str_replace("#course#", $courseInfo['name'], $msg1); |
4204 | 4204 | |
4205 | 4205 | if ($origin != 'learnpath') { |
4206 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4206 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4207 | 4207 | } |
4208 | 4208 | $msg1 = str_replace("#url#", $url_email, $msg); |
4209 | 4209 | $mail_content = $msg1; |
@@ -4232,7 +4232,7 @@ discard block |
||
4232 | 4232 | */ |
4233 | 4233 | function send_notification_for_open_questions($question_list_answers, $origin, $exe_id) |
4234 | 4234 | { |
4235 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
4235 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
4236 | 4236 | return null; |
4237 | 4237 | } |
4238 | 4238 | // Email configuration settings |
@@ -4295,11 +4295,11 @@ discard block |
||
4295 | 4295 | $msg .= '</table><br />'; |
4296 | 4296 | |
4297 | 4297 | |
4298 | - $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
4299 | - $msg = str_replace("#firstName#", $user_info['firstname'],$msg1); |
|
4300 | - $msg1 = str_replace("#lastName#", $user_info['lastname'],$msg); |
|
4301 | - $msg = str_replace("#mail#", $user_info['email'],$msg1); |
|
4302 | - $msg = str_replace("#course#", $course_info['name'],$msg1); |
|
4298 | + $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
4299 | + $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
|
4300 | + $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
|
4301 | + $msg = str_replace("#mail#", $user_info['email'], $msg1); |
|
4302 | + $msg = str_replace("#course#", $course_info['name'], $msg1); |
|
4303 | 4303 | |
4304 | 4304 | if ($origin != 'learnpath') { |
4305 | 4305 | $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
@@ -4328,7 +4328,7 @@ discard block |
||
4328 | 4328 | |
4329 | 4329 | function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id) |
4330 | 4330 | { |
4331 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
4331 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
4332 | 4332 | return null; |
4333 | 4333 | } |
4334 | 4334 | // Email configuration settings |
@@ -4352,7 +4352,7 @@ discard block |
||
4352 | 4352 | $answer_type = $item['answer_type']; |
4353 | 4353 | |
4354 | 4354 | if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) { |
4355 | - $oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
4355 | + $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
4356 | 4356 | .'<tr>' |
4357 | 4357 | .'<td width="220" valign="top" bgcolor="#E5EDF8"> '.get_lang('Question').'</td>' |
4358 | 4358 | .'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>' |
@@ -4385,7 +4385,7 @@ discard block |
||
4385 | 4385 | .'<td> #mail#</td>' |
4386 | 4386 | .'</tr>' |
4387 | 4387 | .'</table>'; |
4388 | - $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />'; |
|
4388 | + $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list).'<br />'; |
|
4389 | 4389 | $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
4390 | 4390 | $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
4391 | 4391 | $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
@@ -4393,7 +4393,7 @@ discard block |
||
4393 | 4393 | $msg = str_replace("#course#", $course_info['name'], $msg1); |
4394 | 4394 | |
4395 | 4395 | if ($origin != 'learnpath') { |
4396 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4396 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4397 | 4397 | } |
4398 | 4398 | $msg1 = str_replace("#url#", $url_email, $msg); |
4399 | 4399 | $mail_content = $msg1; |
@@ -4459,10 +4459,10 @@ discard block |
||
4459 | 4459 | } |
4460 | 4460 | $html = '<div class="question-result">'; |
4461 | 4461 | $html .= Display::page_header( |
4462 | - Display::return_icon('test-quiz.png', get_lang('Result'),null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
4462 | + Display::return_icon('test-quiz.png', get_lang('Result'), null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
4463 | 4463 | ); |
4464 | 4464 | $html .= Display::description($array); |
4465 | - $html .="</div>"; |
|
4465 | + $html .= "</div>"; |
|
4466 | 4466 | return $html; |
4467 | 4467 | } |
4468 | 4468 | |
@@ -4579,7 +4579,7 @@ discard block |
||
4579 | 4579 | false, |
4580 | 4580 | $objExercise->selectPropagateNeg() |
4581 | 4581 | ); |
4582 | - $totalScore += $question_result['score']; |
|
4582 | + $totalScore += $question_result['score']; |
|
4583 | 4583 | } |
4584 | 4584 | |
4585 | 4585 | if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) { |
@@ -4723,7 +4723,7 @@ discard block |
||
4723 | 4723 | } |
4724 | 4724 | } |
4725 | 4725 | |
4726 | - if (!empty($message)){ |
|
4726 | + if (!empty($message)) { |
|
4727 | 4727 | $message = Display::return_message($message, 'warning', false); |
4728 | 4728 | } |
4729 | 4729 | |
@@ -4737,7 +4737,7 @@ discard block |
||
4737 | 4737 | { |
4738 | 4738 | $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); |
4739 | 4739 | $sql = "SELECT max_score FROM $TBL_LP_ITEM |
4740 | - WHERE c_id = {$this->course_id} AND item_type = '" . TOOL_QUIZ . "' AND path = '{$this->id}'"; |
|
4740 | + WHERE c_id = {$this->course_id} AND item_type = '".TOOL_QUIZ."' AND path = '{$this->id}'"; |
|
4741 | 4741 | $result = Database::query($sql); |
4742 | 4742 | if (Database::num_rows($result) > 0) { |
4743 | 4743 | return true; |
@@ -4903,7 +4903,7 @@ discard block |
||
4903 | 4903 | $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id "; |
4904 | 4904 | $result = Database::query($sql_track); |
4905 | 4905 | $new_array = array(); |
4906 | - if (Database::num_rows($result) > 0 ) { |
|
4906 | + if (Database::num_rows($result) > 0) { |
|
4907 | 4907 | $new_array = Database::fetch_array($result, 'ASSOC'); |
4908 | 4908 | |
4909 | 4909 | $new_array['duration'] = null; |
@@ -4915,11 +4915,11 @@ discard block |
||
4915 | 4915 | $start_date = api_strtotime($start_date, 'UTC'); |
4916 | 4916 | $end_date = api_strtotime($end_date, 'UTC'); |
4917 | 4917 | if ($start_date && $end_date) { |
4918 | - $mytime = $end_date- $start_date; |
|
4918 | + $mytime = $end_date - $start_date; |
|
4919 | 4919 | $new_learnpath_item = new learnpathItem(null); |
4920 | 4920 | $time_attemp = $new_learnpath_item->get_scorm_time('js', $mytime); |
4921 | 4921 | $h = get_lang('h'); |
4922 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
4922 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
4923 | 4923 | $new_array['duration'] = $time_attemp; |
4924 | 4924 | } |
4925 | 4925 | } |
@@ -4941,7 +4941,7 @@ discard block |
||
4941 | 4941 | $result = Database::query($sql); |
4942 | 4942 | } |
4943 | 4943 | } else { |
4944 | - $remind_list = explode(',',$exercise_info['questions_to_check']); |
|
4944 | + $remind_list = explode(',', $exercise_info['questions_to_check']); |
|
4945 | 4945 | |
4946 | 4946 | $remind_list_string = ''; |
4947 | 4947 | if ($action == 'add') { |
@@ -4953,7 +4953,7 @@ discard block |
||
4953 | 4953 | } |
4954 | 4954 | $remind_list_string = implode(',', $remind_list); |
4955 | 4955 | } |
4956 | - } elseif ($action == 'delete') { |
|
4956 | + } elseif ($action == 'delete') { |
|
4957 | 4957 | if (!empty($remind_list)) { |
4958 | 4958 | if (in_array($question_id, $remind_list)) { |
4959 | 4959 | $remind_list = array_flip($remind_list); |
@@ -5054,7 +5054,7 @@ discard block |
||
5054 | 5054 | public function get_max_score() |
5055 | 5055 | { |
5056 | 5056 | $out_max_score = 0; |
5057 | - $tab_question_list = $this->selectQuestionList(true); // list of question's id !!! the array key start at 1 !!! |
|
5057 | + $tab_question_list = $this->selectQuestionList(true); // list of question's id !!! the array key start at 1 !!! |
|
5058 | 5058 | // test is randomQuestions - see field random of test |
5059 | 5059 | if ($this->random > 0 && $this->randomByCat == 0) { |
5060 | 5060 | $nb_random_questions = $this->random; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | if (empty($document_data)) { |
71 | - $document_id = $parent_id = 0; |
|
71 | + $document_id = $parent_id = 0; |
|
72 | 72 | $path = '/'; |
73 | 73 | } else { |
74 | 74 | $document_id = $document_data['id']; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | // Link back to the documents overview |
203 | 203 | if ($is_certificate_mode) { |
204 | - $actions = '<a href="document.php?id='.$document_id.'&selectcat=' . $selectcat.'&'.api_get_cidreq().'">'. |
|
204 | + $actions = '<a href="document.php?id='.$document_id.'&selectcat='.$selectcat.'&'.api_get_cidreq().'">'. |
|
205 | 205 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
206 | 206 | } else { |
207 | 207 | $actions = '<a href="document.php?id='.$document_id.'&'.api_get_cidreq().'">'. |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | // Link to create a folder |
212 | -echo $toolbar = Display::toolbarAction('toolbar-upload', array( 0 => $actions), 1); |
|
212 | +echo $toolbar = Display::toolbarAction('toolbar-upload', array(0 => $actions), 1); |
|
213 | 213 | // Form to select directory |
214 | 214 | $folders = DocumentManager::get_all_document_folders($_course, $groupId, $is_allowed_to_edit); |
215 | 215 | if (!$is_certificate_mode) { |