@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | /** |
1155 | 1155 | * Returns an array containing the list of options used to populate the gradebook_number_decimals variable |
1156 | 1156 | * This function is called through a call_user_func() in the generate_settings_form function. |
1157 | - * @return array List of gradebook_number_decimals options |
|
1157 | + * @return string[] List of gradebook_number_decimals options |
|
1158 | 1158 | * |
1159 | 1159 | * @author Guillaume Viguier <[email protected]> |
1160 | 1160 | */ |
@@ -1575,8 +1575,9 @@ discard block |
||
1575 | 1575 | } |
1576 | 1576 | /** |
1577 | 1577 | * Helper function to generates a form elements group |
1578 | - * @param object $form The form where the elements group has to be added |
|
1578 | + * @param FormValidator $form The form where the elements group has to be added |
|
1579 | 1579 | * @param array $values Values to browse through |
1580 | + * @param string $elementName |
|
1580 | 1581 | * @return array |
1581 | 1582 | */ |
1582 | 1583 | function formGenerateElementsGroup($form, $values = array(), $elementName) |
@@ -1592,7 +1593,7 @@ discard block |
||
1592 | 1593 | } |
1593 | 1594 | /** |
1594 | 1595 | * Helper function with allowed file types for CSS |
1595 | - * @return array Array of file types (no indexes) |
|
1596 | + * @return string[] Array of file types (no indexes) |
|
1596 | 1597 | */ |
1597 | 1598 | function getAllowedFileTypes() |
1598 | 1599 | { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | // Plugins NOT installed |
140 | 140 | echo Display::page_subheader(get_lang('Plugins')); |
141 | - echo '<form class="form-horizontal" name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'&sec_token=' . $token . '">'; |
|
141 | + echo '<form class="form-horizontal" name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'&sec_token='.$token.'">'; |
|
142 | 142 | echo '<table class="data_table">'; |
143 | 143 | echo '<tr>'; |
144 | 144 | echo '<th width="20px">'; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | if (file_exists(api_get_path(SYS_PLUGIN_PATH).$pluginName.'/readme.txt')) { |
188 | 188 | echo Display::url( |
189 | 189 | "<em class='fa fa-file-text-o'></em> readme.txt", |
190 | - api_get_path(WEB_PLUGIN_PATH) . $pluginName . "/readme.txt", |
|
190 | + api_get_path(WEB_PLUGIN_PATH).$pluginName."/readme.txt", |
|
191 | 191 | [ |
192 | 192 | 'class' => 'btn btn-default ajax', |
193 | 193 | 'data-title' => $plugin_info['title'], |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $form->addElement('file', 'new_stylesheet', get_lang('UploadNewStylesheet')); |
251 | 251 | $allowed_file_types = getAllowedFileTypes(); |
252 | 252 | |
253 | - $form->addRule('new_stylesheet', get_lang('InvalidExtension') . ' (' . implode(',', $allowed_file_types) . ')', |
|
253 | + $form->addRule('new_stylesheet', get_lang('InvalidExtension').' ('.implode(',', $allowed_file_types).')', |
|
254 | 254 | 'filetype', $allowed_file_types); |
255 | 255 | $form->addRule('new_stylesheet', get_lang('ThisFieldIsRequired'), 'required'); |
256 | 256 | $form->addButtonUpload(get_lang('Upload'), 'stylesheet_upload'); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $show_name = ucwords(str_replace('_', ' ', $style_dir)); |
338 | 338 | |
339 | 339 | if ($is_style_changeable) { |
340 | - $list_of_names[$style_dir] = $show_name; |
|
340 | + $list_of_names[$style_dir] = $show_name; |
|
341 | 341 | } |
342 | 342 | $counter++; |
343 | 343 | } |
@@ -377,16 +377,16 @@ discard block |
||
377 | 377 | Display::return_message(sprintf(get_lang('TheLogoMustBeSizeXAndFormatY'), '250 x 70', 'PNG'), 'info') |
378 | 378 | ); |
379 | 379 | |
380 | - $dir = api_get_path(SYS_PUBLIC_PATH).'css/themes/' . $selected . '/images/'; |
|
381 | - $url = api_get_path(WEB_CSS_PATH).'themes/' . $selected . '/images/'; |
|
380 | + $dir = api_get_path(SYS_PUBLIC_PATH).'css/themes/'.$selected.'/images/'; |
|
381 | + $url = api_get_path(WEB_CSS_PATH).'themes/'.$selected.'/images/'; |
|
382 | 382 | $logoFileName = 'header-logo.png'; |
383 | - $newLogoFileName = 'header-logo-custom' . api_get_current_access_url_id() . '.png'; |
|
383 | + $newLogoFileName = 'header-logo-custom'.api_get_current_access_url_id().'.png'; |
|
384 | 384 | $webPlatformLogoPath = ChamiloApi::getWebPlatformLogoPath(); |
385 | 385 | |
386 | 386 | if ($webPlatformLogoPath !== null) { |
387 | 387 | $logoForm->addLabel( |
388 | 388 | get_lang('CurrentLogo'), |
389 | - '<img id="header-logo-custom" src="' . $webPlatformLogoPath . '?' . time() . '">' |
|
389 | + '<img id="header-logo-custom" src="'.$webPlatformLogoPath.'?'.time().'">' |
|
390 | 390 | ); |
391 | 391 | } |
392 | 392 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | }); |
454 | 454 | </script>'; |
455 | 455 | echo Display::tabs( |
456 | - array(get_lang('Update'),get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')), |
|
456 | + array(get_lang('Update'), get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')), |
|
457 | 457 | array($form_change->return_form(), $logoForm->returnForm(), $form->returnForm()) |
458 | 458 | ); |
459 | 459 | } else { |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | if (!empty($areas_to_installed)) { |
619 | 619 | $plugin_obj->remove_all_regions($plugin); |
620 | 620 | foreach ($areas_to_installed as $region) { |
621 | - if (!empty($region) && $region != '-1' ) { |
|
621 | + if (!empty($region) && $region != '-1') { |
|
622 | 622 | $plugin_obj->add_to_region($plugin, $region); |
623 | 623 | } |
624 | 624 | } |
@@ -729,14 +729,14 @@ discard block |
||
729 | 729 | $values = api_get_settings_options('search_show_unlinked_results'); |
730 | 730 | |
731 | 731 | $group = formGenerateElementsGroup($form, $values, 'search_show_unlinked_results'); |
732 | - $form->addGroup($group, 'search_show_unlinked_results', array(get_lang('SearchShowUnlinkedResultsTitle'),get_lang('SearchShowUnlinkedResultsComment')), null, false); |
|
732 | + $form->addGroup($group, 'search_show_unlinked_results', array(get_lang('SearchShowUnlinkedResultsTitle'), get_lang('SearchShowUnlinkedResultsComment')), null, false); |
|
733 | 733 | $default_values['search_show_unlinked_results'] = api_get_setting('search_show_unlinked_results'); |
734 | 734 | |
735 | 735 | $sf_values = array(); |
736 | 736 | foreach ($specific_fields as $sf) { |
737 | 737 | $sf_values[$sf['code']] = $sf['name']; |
738 | 738 | } |
739 | - $url = Display::div(Display::url(get_lang('AddSpecificSearchField'), 'specific_fields.php'), array('class'=>'sectioncomment')); |
|
739 | + $url = Display::div(Display::url(get_lang('AddSpecificSearchField'), 'specific_fields.php'), array('class'=>'sectioncomment')); |
|
740 | 740 | if (empty($sf_values)) { |
741 | 741 | $form->addElement('label', [get_lang('SearchPrefilterPrefix'), $url]); |
742 | 742 | } else { |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | if ($action != 'add') { |
832 | 832 | echo '<div class="actions" style="margin-left: 1px;">'; |
833 | 833 | echo '<a href="settings.php?category=Templates&action=add">'. |
834 | - Display::return_icon('new_template.png', get_lang('AddTemplate'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
834 | + Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
835 | 835 | echo '</div>'; |
836 | 836 | } |
837 | 837 | |
@@ -952,8 +952,8 @@ discard block |
||
952 | 952 | * @since v1.8.6 |
953 | 953 | */ |
954 | 954 | function actionsFilter($id) { |
955 | - $return = '<a href="settings.php?category=Templates&action=edit&id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'; |
|
956 | - $return .= '<a href="settings.php?category=Templates&action=delete&id='.Security::remove_XSS($id).'" onClick="javascript:if(!confirm('."'".get_lang('ConfirmYourChoice')."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
955 | + $return = '<a href="settings.php?category=Templates&action=edit&id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'; |
|
956 | + $return .= '<a href="settings.php?category=Templates&action=delete&id='.Security::remove_XSS($id).'" onClick="javascript:if(!confirm('."'".get_lang('ConfirmYourChoice')."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
957 | 957 | return $return; |
958 | 958 | } |
959 | 959 | |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | $form->addElement('html_editor', 'template_text', get_lang('Text'), null, array('ToolbarSet' => 'AdminTemplates', 'Width' => '100%', 'Height' => '400')); |
1006 | 1006 | |
1007 | 1007 | // Setting the form elements: the form to upload an image to be used with the template. |
1008 | - $form->addElement('file','template_image',get_lang('Image'),''); |
|
1008 | + $form->addElement('file', 'template_image', get_lang('Image'), ''); |
|
1009 | 1009 | |
1010 | 1010 | // Setting the form elements: a little bit information about the template image. |
1011 | 1011 | $form->addElement('static', 'file_comment', '', get_lang('TemplateImageComment100x70')); |
@@ -1029,10 +1029,10 @@ discard block |
||
1029 | 1029 | // Adding an extra field: a preview of the image that is currently used. |
1030 | 1030 | if (!empty($row['image'])) { |
1031 | 1031 | $form->addElement('static', 'template_image_preview', '', |
1032 | - '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/' . $row['image'] . '" alt="' . get_lang('TemplatePreview') . '"/>'); |
|
1032 | + '<img src="'.api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/'.$row['image'].'" alt="'.get_lang('TemplatePreview').'"/>'); |
|
1033 | 1033 | } else { |
1034 | 1034 | $form->addElement('static', 'template_image_preview', '', |
1035 | - '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/noimage.gif" alt="' . get_lang('NoTemplatePreview') . '"/>'); |
|
1035 | + '<img src="'.api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/noimage.gif" alt="'.get_lang('NoTemplatePreview').'"/>'); |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | // Setting the information of the template that we are editing. |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | // Store the information in the database (as insert or as update). |
1086 | 1086 | $table_system_template = Database :: get_main_table('system_template'); |
1087 | 1087 | if ($_GET['action'] == 'add') { |
1088 | - $content_template = Security::remove_XSS($values['template_text'], COURSEMANAGERLOWSECURITY); |
|
1088 | + $content_template = Security::remove_XSS($values['template_text'], COURSEMANAGERLOWSECURITY); |
|
1089 | 1089 | $params = [ |
1090 | 1090 | 'title' => $values['title'], |
1091 | 1091 | 'content' => $content_template, |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | // Display a feedback message. |
1097 | 1097 | Display::display_confirmation_message(get_lang('TemplateAdded')); |
1098 | - echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png', get_lang('AddTemplate'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
1098 | + echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1099 | 1099 | } else { |
1100 | 1100 | $content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>'.Database::escape_string($values['template_text']).'</body>'; |
1101 | 1101 | $sql = "UPDATE $table_system_template set title = '".Database::escape_string($values['title'])."', content = '".$content_template."'"; |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | displayTemplates(); |
1114 | 1114 | } else { |
1115 | 1115 | $token = Security::get_token(); |
1116 | - $form->addElement('hidden','sec_token'); |
|
1116 | + $form->addElement('hidden', 'sec_token'); |
|
1117 | 1117 | $form->setConstants(array('sec_token' => $token)); |
1118 | 1118 | // Display the form. |
1119 | 1119 | $form->display(); |
@@ -1248,13 +1248,13 @@ discard block |
||
1248 | 1248 | $form->addElement( |
1249 | 1249 | 'html', |
1250 | 1250 | '<div class="pull-right"><a class="share_this_setting" data_status = "0" data_to_send = "'.$row['variable'].'" href="javascript:void(0);">'. |
1251 | - Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting') , null, ICON_SIZE_MEDIUM).'</a></div>' |
|
1251 | + Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting'), null, ICON_SIZE_MEDIUM).'</a></div>' |
|
1252 | 1252 | ); |
1253 | 1253 | } else { |
1254 | 1254 | $form->addElement( |
1255 | 1255 | 'html', |
1256 | 1256 | '<div class="pull-right"><a class="share_this_setting" data_status = "1" data_to_send = "'.$row['variable'].'" href="javascript:void(0);">'. |
1257 | - Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting'), null, ICON_SIZE_MEDIUM ).'</a></div>' |
|
1257 | + Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting'), null, ICON_SIZE_MEDIUM).'</a></div>' |
|
1258 | 1258 | ); |
1259 | 1259 | } |
1260 | 1260 | } else { |
@@ -1262,13 +1262,13 @@ discard block |
||
1262 | 1262 | $form->addElement( |
1263 | 1263 | 'html', |
1264 | 1264 | '<div class="pull-right">'. |
1265 | - Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting'), null, ICON_SIZE_MEDIUM ).'</div>' |
|
1265 | + Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting'), null, ICON_SIZE_MEDIUM).'</div>' |
|
1266 | 1266 | ); |
1267 | 1267 | } else { |
1268 | 1268 | $form->addElement( |
1269 | 1269 | 'html', |
1270 | 1270 | '<div class="pull-right">'. |
1271 | - Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting'), null, ICON_SIZE_MEDIUM ).'</div>' |
|
1271 | + Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting'), null, ICON_SIZE_MEDIUM).'</div>' |
|
1272 | 1272 | ); |
1273 | 1273 | } |
1274 | 1274 | } |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | array('maxlength' => '8') |
1321 | 1321 | ); |
1322 | 1322 | $form->applyFilter($row['variable'], 'html_filter'); |
1323 | - $default_values[$row['variable']] = round($row['selected_value']/1024/1024, 1); |
|
1323 | + $default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1); |
|
1324 | 1324 | } elseif ($row['variable'] == 'account_valid_duration') { |
1325 | 1325 | $form->addElement( |
1326 | 1326 | 'text', |
@@ -1348,7 +1348,7 @@ discard block |
||
1348 | 1348 | ), |
1349 | 1349 | $hideme |
1350 | 1350 | ); |
1351 | - $form->applyFilter($row['variable'],'html_filter'); |
|
1351 | + $form->applyFilter($row['variable'], 'html_filter'); |
|
1352 | 1352 | $default_values[$row['variable']] = $row['selected_value']; |
1353 | 1353 | } |
1354 | 1354 | break; |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | if (file_exists($file)) { |
1360 | 1360 | $value = file_get_contents($file); |
1361 | 1361 | } |
1362 | - $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme); |
|
1362 | + $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme); |
|
1363 | 1363 | $default_values[$row['variable']] = $value; |
1364 | 1364 | } elseif ($row['variable'] == 'footer_extra_content') { |
1365 | 1365 | $file = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt'; |
@@ -1367,16 +1367,16 @@ discard block |
||
1367 | 1367 | if (file_exists($file)) { |
1368 | 1368 | $value = file_get_contents($file); |
1369 | 1369 | } |
1370 | - $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme); |
|
1370 | + $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme); |
|
1371 | 1371 | $default_values[$row['variable']] = $value; |
1372 | 1372 | } else { |
1373 | - $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme); |
|
1373 | + $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme); |
|
1374 | 1374 | $default_values[$row['variable']] = $row['selected_value']; |
1375 | 1375 | } |
1376 | 1376 | break; |
1377 | 1377 | case 'radio': |
1378 | 1378 | $values = api_get_settings_options($row['variable']); |
1379 | - $group = array (); |
|
1379 | + $group = array(); |
|
1380 | 1380 | if (is_array($values)) { |
1381 | 1381 | foreach ($values as $key => $value) { |
1382 | 1382 | $element = &$form->createElement( |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | WHERE variable='".$row['variable']."' AND access_url = 1"; |
1408 | 1408 | |
1409 | 1409 | $result = Database::query($sql); |
1410 | - $group = array (); |
|
1410 | + $group = array(); |
|
1411 | 1411 | while ($rowkeys = Database::fetch_array($result)) { |
1412 | 1412 | // Profile tab option should be hidden when the social tool is enabled. |
1413 | 1413 | if (api_get_setting('allow_social_tool') == 'true') { |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | break; |
1465 | 1465 | case 'link': |
1466 | 1466 | $form->addElement('static', null, array(get_lang($row['title']), get_lang($row['comment'])), |
1467 | - get_lang('CurrentValue') . ' : ' . $row['selected_value'], $hideme); |
|
1467 | + get_lang('CurrentValue').' : '.$row['selected_value'], $hideme); |
|
1468 | 1468 | break; |
1469 | 1469 | case 'select': |
1470 | 1470 | /* |
@@ -1496,7 +1496,7 @@ discard block |
||
1496 | 1496 | $row['variable'], |
1497 | 1497 | [get_lang($row['title']), get_lang($row['comment'])], |
1498 | 1498 | $courseSelectOptions, |
1499 | - ['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_course'] |
|
1499 | + ['url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course'] |
|
1500 | 1500 | ); |
1501 | 1501 | $default_values[$row['variable']] = $row['selected_value']; |
1502 | 1502 | break; |
@@ -1504,10 +1504,10 @@ discard block |
||
1504 | 1504 | |
1505 | 1505 | switch ($row['variable']) { |
1506 | 1506 | case 'pdf_export_watermark_enable': |
1507 | - $url = PDF::get_watermark(null); |
|
1507 | + $url = PDF::get_watermark(null); |
|
1508 | 1508 | |
1509 | 1509 | if ($url != false) { |
1510 | - $delete_url = '<a href="?delete_watermark">'.get_lang('DelImage').' '.Display::return_icon('delete.png',get_lang('DelImage')).'</a>'; |
|
1510 | + $delete_url = '<a href="?delete_watermark">'.get_lang('DelImage').' '.Display::return_icon('delete.png', get_lang('DelImage')).'</a>'; |
|
1511 | 1511 | $form->addElement('html', '<div style="max-height:100px; max-width:100px; margin-left:162px; margin-bottom:10px; clear:both;"><img src="'.$url.'" style="margin-bottom:10px;" />'.$delete_url.'</div>'); |
1512 | 1512 | } |
1513 | 1513 | |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | if (api_is_windows_os() == false) { |
1662 | 1662 | $list_of_programs = array('pdftotext', 'ps2pdf', 'catdoc', 'html2text', 'unrtf', 'catppt', 'xls2csv'); |
1663 | 1663 | |
1664 | - foreach($list_of_programs as $program) { |
|
1664 | + foreach ($list_of_programs as $program) { |
|
1665 | 1665 | $output = []; |
1666 | 1666 | $ret_val = null; |
1667 | 1667 | exec("which $program", $output, $ret_val); |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | if (!empty($output[0])) { |
1675 | 1675 | $icon = Display::return_icon('bullet_green.png', get_lang('Installed')); |
1676 | 1676 | } |
1677 | - $data2[]= array($program, $output[0], $icon); |
|
1677 | + $data2[] = array($program, $output[0], $icon); |
|
1678 | 1678 | } |
1679 | 1679 | echo Display::tag('h3', get_lang('ProgramsNeededToConvertFiles')); |
1680 | 1680 | $table = new SortableTableFromArray($data2); |
@@ -1700,9 +1700,9 @@ discard block |
||
1700 | 1700 | if (is_dir($dir)) { |
1701 | 1701 | $zip = new PclZip($arch); |
1702 | 1702 | // Remove path prefix except the style name and put file on disk |
1703 | - $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir,0,-strlen($style))); |
|
1703 | + $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir, 0, -strlen($style))); |
|
1704 | 1704 | //@TODO: use more generic script to download. |
1705 | - $str = '<a class="btn btn-primary btn-large" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/download.php?archive=' . str_replace(api_get_path(SYS_ARCHIVE_PATH), '', $arch) . '">'.get_lang('ClickHereToDownloadTheFile').'</a>'; |
|
1705 | + $str = '<a class="btn btn-primary btn-large" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.str_replace(api_get_path(SYS_ARCHIVE_PATH), '', $arch).'">'.get_lang('ClickHereToDownloadTheFile').'</a>'; |
|
1706 | 1706 | Display::display_normal_message($str, false); |
1707 | 1707 | } else { |
1708 | 1708 | Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning')); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * Add attendances sheet inside table. This is the *list of* dates, not |
278 | 278 | * a specific date in itself. |
279 | 279 | * @param bool true for adding link in gradebook or false otherwise (optional) |
280 | - * @return int last attendance id |
|
280 | + * @return false|string last attendance id |
|
281 | 281 | */ |
282 | 282 | public function attendance_add($link_to_gradebook = false) |
283 | 283 | { |
@@ -354,6 +354,7 @@ discard block |
||
354 | 354 | * edit attendances inside table |
355 | 355 | * @param int attendance id |
356 | 356 | * @param bool true for adding link in gradebook or false otherwise (optional) |
357 | + * @param integer $attendance_id |
|
357 | 358 | * @return int last id |
358 | 359 | */ |
359 | 360 | public function attendance_edit($attendance_id, $link_to_gradebook = false) |
@@ -429,6 +430,7 @@ discard block |
||
429 | 430 | /** |
430 | 431 | * Restore attendance |
431 | 432 | * @param int|array one or many attendances id |
433 | + * @param integer $attendance_id |
|
432 | 434 | * @return int affected rows |
433 | 435 | */ |
434 | 436 | public function attendance_restore($attendance_id) |
@@ -530,7 +532,7 @@ discard block |
||
530 | 532 | |
531 | 533 | /** |
532 | 534 | * Changes visibility |
533 | - * @param int|array $attendanceId one or many attendances id |
|
535 | + * @param integer $attendanceId one or many attendances id |
|
534 | 536 | * @param int status |
535 | 537 | * |
536 | 538 | * @return int affected rows |
@@ -585,6 +587,7 @@ discard block |
||
585 | 587 | * Lock or unlock an attendance |
586 | 588 | * @param int attendance id |
587 | 589 | * @param bool True to lock or false otherwise |
590 | + * @param integer $attendance_id |
|
588 | 591 | */ |
589 | 592 | public function lock_attendance($attendance_id, $lock = true) |
590 | 593 | { |
@@ -917,7 +920,11 @@ discard block |
||
917 | 920 | * @param string Event type ('locked_attendance', 'done_attendance_sheet' ...) |
918 | 921 | * @param int Last edit user id |
919 | 922 | * @param string Calendar datetime value (optional, when event type is 'done_attendance_sheet') |
920 | - * @return int Affected rows |
|
923 | + * @param integer $attendance_id |
|
924 | + * @param string $lastedit_date |
|
925 | + * @param string $lastedit_type |
|
926 | + * @param integer $lastedit_user_id |
|
927 | + * @return false|string Affected rows |
|
921 | 928 | */ |
922 | 929 | public function save_attendance_sheet_log( |
923 | 930 | $attendance_id, |
@@ -962,6 +969,7 @@ discard block |
||
962 | 969 | /** |
963 | 970 | * Get number of done attendances inside current sheet |
964 | 971 | * @param int attendance id |
972 | + * @param integer $attendance_id |
|
965 | 973 | * @return int number of done attendances |
966 | 974 | */ |
967 | 975 | public static function get_done_attendance_calendar($attendance_id) |
@@ -1197,6 +1205,7 @@ discard block |
||
1197 | 1205 | /** |
1198 | 1206 | * Get next attendance calendar without presences (done attendances) |
1199 | 1207 | * @param int attendance id |
1208 | + * @param integer $attendance_id |
|
1200 | 1209 | * @return int attendance calendar id |
1201 | 1210 | */ |
1202 | 1211 | public function get_next_attendance_calendar_id($attendance_id) |
@@ -1225,6 +1234,7 @@ discard block |
||
1225 | 1234 | /** |
1226 | 1235 | * Get next attendance calendar datetime without presences (done attendances) |
1227 | 1236 | * @param int attendance id |
1237 | + * @param integer $attendance_id |
|
1228 | 1238 | * @return int UNIX time format datetime |
1229 | 1239 | */ |
1230 | 1240 | public function get_next_attendance_calendar_datetime($attendance_id) |
@@ -1253,6 +1263,7 @@ discard block |
||
1253 | 1263 | * Get user' score from current attendance |
1254 | 1264 | * @param int $user_id |
1255 | 1265 | * @param int $attendance_id |
1266 | + * @param integer $groupId |
|
1256 | 1267 | * @return int score |
1257 | 1268 | */ |
1258 | 1269 | public function get_user_score($user_id, $attendance_id, $groupId = null) |
@@ -1300,6 +1311,7 @@ discard block |
||
1300 | 1311 | /** |
1301 | 1312 | * Get attendance calendar data by id |
1302 | 1313 | * @param int attendance calendar id |
1314 | + * @param integer $calendar_id |
|
1303 | 1315 | * @return array attendance calendar data |
1304 | 1316 | */ |
1305 | 1317 | public function get_attendance_calendar_by_id($calendar_id) |
@@ -1422,6 +1434,7 @@ discard block |
||
1422 | 1434 | * Get number of attendance calendar inside current attendance |
1423 | 1435 | * @param int $attendance_id |
1424 | 1436 | * @param int $groupId |
1437 | + * @param boolean $done_attendance |
|
1425 | 1438 | * @return int number of dates in attendance calendar |
1426 | 1439 | */ |
1427 | 1440 | public static function get_number_of_attendance_calendar($attendance_id, $groupId = 0, $done_attendance = NULL, $userId = 0) |
@@ -1647,7 +1660,6 @@ discard block |
||
1647 | 1660 | /** |
1648 | 1661 | * @param int $calendarId |
1649 | 1662 | * @param int $courseId |
1650 | - * @param int $groupId |
|
1651 | 1663 | * @return array |
1652 | 1664 | */ |
1653 | 1665 | public function getGroupListByAttendanceCalendar($calendarId, $courseId) |
@@ -1687,7 +1699,6 @@ discard block |
||
1687 | 1699 | /** |
1688 | 1700 | * @param int $calendarId |
1689 | 1701 | * @param int $courseId |
1690 | - * @param int $groupId |
|
1691 | 1702 | * |
1692 | 1703 | * @return array |
1693 | 1704 | */ |
@@ -1788,6 +1799,8 @@ discard block |
||
1788 | 1799 | * edit a datetime inside attendance calendar table |
1789 | 1800 | * @param int attendance calendar id |
1790 | 1801 | * @param int attendance id |
1802 | + * @param integer $calendar_id |
|
1803 | + * @param integer $attendance_id |
|
1791 | 1804 | * @return int affected rows |
1792 | 1805 | */ |
1793 | 1806 | public function attendance_calendar_edit($calendar_id, $attendance_id) |
@@ -1827,6 +1840,8 @@ discard block |
||
1827 | 1840 | * @param int attendance calendar id |
1828 | 1841 | * @param int attendance id |
1829 | 1842 | * @param bool true for removing all calendar inside current attendance, false for removing by calendar id |
1843 | + * @param integer $calendar_id |
|
1844 | + * @param integer $attendance_id |
|
1830 | 1845 | * @return int affected rows |
1831 | 1846 | */ |
1832 | 1847 | public function attendance_calendar_delete($calendar_id, $attendance_id , $all_delete = false) |
@@ -1889,6 +1904,9 @@ discard block |
||
1889 | 1904 | $this->course_id = $course_id; |
1890 | 1905 | } |
1891 | 1906 | |
1907 | + /** |
|
1908 | + * @param string $datetime |
|
1909 | + */ |
|
1892 | 1910 | public function set_date_time($datetime) |
1893 | 1911 | { |
1894 | 1912 | $this->date_time = $datetime; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $course_id = intval($course_id); |
74 | 74 | } |
75 | 75 | |
76 | - $session_id = isset($session_id)?intval($session_id):api_get_session_id(); |
|
76 | + $session_id = isset($session_id) ? intval($session_id) : api_get_session_id(); |
|
77 | 77 | $condition_session = api_get_session_condition($session_id); |
78 | 78 | |
79 | 79 | // Get attendance data |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $from = intval($from); |
109 | 109 | $number_of_items = intval($number_of_items); |
110 | 110 | |
111 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
111 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
112 | 112 | $direction = 'ASC'; |
113 | 113 | } |
114 | 114 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | LIMIT $from,$number_of_items "; |
136 | 136 | |
137 | 137 | $res = Database::query($sql); |
138 | - $attendances = array (); |
|
138 | + $attendances = array(); |
|
139 | 139 | $user_info = api_get_user_info(); |
140 | 140 | $allowDelete = api_get_setting('allow_delete_attendance'); |
141 | 141 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | $attendance[2] = '<span class="muted">'.$attendance[2].'</span>'; |
191 | 191 | } |
192 | 192 | if ($allowDelete === 'true') { |
193 | - $actions .= '<a href="index.php?' . api_get_cidreq() . '&action=attendance_delete&attendance_id=' . $attendance[0]. '">' . |
|
194 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
193 | + $actions .= '<a href="index.php?'.api_get_cidreq().'&action=attendance_delete&attendance_id='.$attendance[0].'">'. |
|
194 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
195 | 195 | } |
196 | 196 | } else { |
197 | 197 | $is_locked_attendance = self::is_locked_attendance($attendance[0]); |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | $attendance[2] = '<span class="muted">'.$attendance[2].'</span>'; |
212 | 212 | } |
213 | 213 | if ($allowDelete === 'true') { |
214 | - $actions .= ' <a href="index.php?' . api_get_cidreq() . '&action=attendance_delete&attendance_id=' . $attendance[0].'">' . |
|
215 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
214 | + $actions .= ' <a href="index.php?'.api_get_cidreq().'&action=attendance_delete&attendance_id='.$attendance[0].'">'. |
|
215 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $is_done_all_calendar = self::is_all_attendance_calendar_done($attendance[0]); |
222 | 222 | |
223 | 223 | if ($is_done_all_calendar) { |
224 | - $locked = $attendance[4]; |
|
224 | + $locked = $attendance[4]; |
|
225 | 225 | if ($locked == 0) { |
226 | 226 | if (api_is_platform_admin()) { |
227 | 227 | $message_alert = get_lang('AreYouSureToLockTheAttendance'); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | } |
242 | 242 | $actions .= '</center>'; |
243 | 243 | |
244 | - $attendances[] = array($attendance[0], $attendance[1], $attendance[2], $attendance[3],$actions); |
|
244 | + $attendances[] = array($attendance[0], $attendance[1], $attendance[2], $attendance[3], $actions); |
|
245 | 245 | } else { |
246 | 246 | $attendance[0] = ' '; |
247 | 247 | $attendances[] = array($attendance[0], $attendance[1], $attendance[2], $attendance[3]); |
@@ -282,13 +282,13 @@ discard block |
||
282 | 282 | public function attendance_add($link_to_gradebook = false) |
283 | 283 | { |
284 | 284 | $_course = api_get_course_info(); |
285 | - $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
285 | + $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
286 | 286 | $table_link = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
287 | 287 | $session_id = api_get_session_id(); |
288 | 288 | $user_id = api_get_user_id(); |
289 | 289 | $course_code = $_course['code']; |
290 | 290 | $course_id = $_course['real_id']; |
291 | - $title_gradebook= $this->attendance_qualify_title; |
|
291 | + $title_gradebook = $this->attendance_qualify_title; |
|
292 | 292 | $value_calification = 0; |
293 | 293 | $weight_calification = floatval($this->attendance_weight); |
294 | 294 | |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | public function attendance_restore($attendance_id) |
435 | 435 | { |
436 | 436 | $_course = api_get_course_info(); |
437 | - $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
437 | + $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
438 | 438 | $user_id = api_get_user_id(); |
439 | 439 | $course_id = $_course['real_id']; |
440 | 440 | if (is_array($attendance_id)) { |
441 | 441 | foreach ($attendance_id as $id) { |
442 | - $id = intval($id); |
|
442 | + $id = intval($id); |
|
443 | 443 | $sql = "UPDATE $tbl_attendance SET active = 1 |
444 | 444 | WHERE c_id = $course_id AND id = '$id'"; |
445 | 445 | $result = Database::query($sql); |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | ); |
456 | 456 | } |
457 | 457 | } |
458 | - } else { |
|
459 | - $attendance_id = intval($attendance_id); |
|
458 | + } else { |
|
459 | + $attendance_id = intval($attendance_id); |
|
460 | 460 | $sql = "UPDATE $tbl_attendance SET active = 1 |
461 | 461 | WHERE c_id = $course_id AND id = '$attendance_id'"; |
462 | 462 | $result = Database::query($sql); |
@@ -484,13 +484,13 @@ discard block |
||
484 | 484 | public function attendance_delete($attendance_id) |
485 | 485 | { |
486 | 486 | $_course = api_get_course_info(); |
487 | - $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
487 | + $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
488 | 488 | $user_id = api_get_user_id(); |
489 | 489 | $course_id = $_course['real_id']; |
490 | 490 | |
491 | 491 | if (is_array($attendance_id)) { |
492 | 492 | foreach ($attendance_id as $id) { |
493 | - $id = intval($id); |
|
493 | + $id = intval($id); |
|
494 | 494 | $sql = "UPDATE $tbl_attendance SET active = 2 |
495 | 495 | WHERE c_id = $course_id AND id = '$id'"; |
496 | 496 | $result = Database::query($sql); |
@@ -506,8 +506,8 @@ discard block |
||
506 | 506 | ); |
507 | 507 | } |
508 | 508 | } |
509 | - } else { |
|
510 | - $attendance_id= intval($attendance_id); |
|
509 | + } else { |
|
510 | + $attendance_id = intval($attendance_id); |
|
511 | 511 | $sql = "UPDATE $tbl_attendance SET active = 2 |
512 | 512 | WHERE c_id = $course_id AND id = '$attendance_id'"; |
513 | 513 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | public function changeVisibility($attendanceId, $status = 1) |
539 | 539 | { |
540 | 540 | $_course = api_get_course_info(); |
541 | - $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
541 | + $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
542 | 542 | $user_id = api_get_user_id(); |
543 | 543 | $course_id = $_course['real_id']; |
544 | 544 | $status = intval($status); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | |
551 | 551 | if (is_array($attendanceId)) { |
552 | 552 | foreach ($attendanceId as $id) { |
553 | - $id = intval($id); |
|
553 | + $id = intval($id); |
|
554 | 554 | $sql = "UPDATE $tbl_attendance SET active = $status |
555 | 555 | WHERE c_id = $course_id AND id = '$id'"; |
556 | 556 | $result = Database::query($sql); |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | api_item_property_update($_course, TOOL_ATTENDANCE, $id, $action, $user_id); |
561 | 561 | } |
562 | 562 | } |
563 | - } else { |
|
564 | - $attendanceId = intval($attendanceId); |
|
563 | + } else { |
|
564 | + $attendanceId = intval($attendanceId); |
|
565 | 565 | $sql = "UPDATE $tbl_attendance SET active = $status |
566 | 566 | WHERE c_id = $course_id AND id = '$attendanceId'"; |
567 | 567 | $result = Database::query($sql); |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE); |
592 | 592 | $course_id = api_get_course_int_id(); |
593 | 593 | $attendance_id = intval($attendance_id); |
594 | - $locked = ($lock)?1:0; |
|
594 | + $locked = ($lock) ? 1 : 0; |
|
595 | 595 | $upd = "UPDATE $tbl_attendance SET locked = $locked |
596 | 596 | WHERE c_id = $course_id AND id = $attendance_id"; |
597 | 597 | $result = Database::query($upd); |
@@ -720,8 +720,8 @@ discard block |
||
720 | 720 | */ |
721 | 721 | public function attendance_sheet_add($calendar_id, $users_present, $attendance_id) |
722 | 722 | { |
723 | - $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
|
724 | - $tbl_attendance_calendar= Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
|
723 | + $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
|
724 | + $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
|
725 | 725 | |
726 | 726 | $calendar_id = intval($calendar_id); |
727 | 727 | $attendance_id = intval($attendance_id); |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | $course_id = api_get_course_int_id(); |
730 | 730 | |
731 | 731 | $user_ids = array_keys($users); |
732 | - $users_absent = array_diff($user_ids,$users_present); |
|
732 | + $users_absent = array_diff($user_ids, $users_present); |
|
733 | 733 | $affected_rows = 0; |
734 | 734 | |
735 | 735 | // get last edit type |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | $faults = $faults > 0 ? $faults : 0; |
1015 | - $faults_porcent = $calendar_count > 0 ?round(($faults*100)/$calendar_count,0):0; |
|
1015 | + $faults_porcent = $calendar_count > 0 ? round(($faults * 100) / $calendar_count, 0) : 0; |
|
1016 | 1016 | $results['faults'] = $faults; |
1017 | 1017 | $results['total'] = $calendar_count; |
1018 | 1018 | $results['faults_porcent'] = $faults_porcent; |
@@ -1046,13 +1046,13 @@ discard block |
||
1046 | 1046 | //$course_code = $course['code']; |
1047 | 1047 | //$course_info = api_get_course_info($course_code); |
1048 | 1048 | $course_id = $course['real_id']; |
1049 | - $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1049 | + $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1050 | 1050 | |
1051 | 1051 | $attendances_by_course = $this->get_attendances_list($course_id); |
1052 | 1052 | |
1053 | 1053 | foreach ($attendances_by_course as $attendance) { |
1054 | 1054 | // get total faults and total weight |
1055 | - $total_done_attendance = $attendance['attendance_qualify_max']; |
|
1055 | + $total_done_attendance = $attendance['attendance_qualify_max']; |
|
1056 | 1056 | $sql = "SELECT score |
1057 | 1057 | FROM $tbl_attendance_result |
1058 | 1058 | WHERE |
@@ -1065,16 +1065,16 @@ discard block |
||
1065 | 1065 | $row = Database::fetch_array($rs); |
1066 | 1066 | $score = $row['score']; |
1067 | 1067 | } |
1068 | - $faults = $total_done_attendance-$score; |
|
1069 | - $faults = $faults > 0 ? $faults:0; |
|
1068 | + $faults = $total_done_attendance - $score; |
|
1069 | + $faults = $faults > 0 ? $faults : 0; |
|
1070 | 1070 | $total_faults += $faults; |
1071 | 1071 | $total_weight += $total_done_attendance; |
1072 | 1072 | } |
1073 | 1073 | } |
1074 | 1074 | |
1075 | - $porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0; |
|
1075 | + $porcent = $total_weight > 0 ? round(($total_faults * 100) / $total_weight, 0) : 0; |
|
1076 | 1076 | $results['faults'] = $total_faults; |
1077 | - $results['total'] = $total_weight; |
|
1077 | + $results['total'] = $total_weight; |
|
1078 | 1078 | $results['porcent'] = $porcent; |
1079 | 1079 | |
1080 | 1080 | return $results; |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | { |
1093 | 1093 | // Database tables and variables |
1094 | 1094 | $course_info = api_get_course_info($course_code); |
1095 | - $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1095 | + $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1096 | 1096 | $user_id = intval($user_id); |
1097 | 1097 | $results = array(); |
1098 | 1098 | $total_faults = $total_weight = $porcent = 0; |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | |
1101 | 1101 | foreach ($attendances_by_course as $attendance) { |
1102 | 1102 | // Get total faults and total weight |
1103 | - $total_done_attendance = $attendance['attendance_qualify_max']; |
|
1103 | + $total_done_attendance = $attendance['attendance_qualify_max']; |
|
1104 | 1104 | $sql = "SELECT score FROM $tbl_attendance_result |
1105 | 1105 | WHERE |
1106 | 1106 | c_id = {$course_info['real_id']} AND |
@@ -1112,15 +1112,15 @@ discard block |
||
1112 | 1112 | $row = Database::fetch_array($rs); |
1113 | 1113 | $score = $row['score']; |
1114 | 1114 | } |
1115 | - $faults = $total_done_attendance-$score; |
|
1116 | - $faults = $faults > 0 ? $faults:0; |
|
1115 | + $faults = $total_done_attendance - $score; |
|
1116 | + $faults = $faults > 0 ? $faults : 0; |
|
1117 | 1117 | $total_faults += $faults; |
1118 | 1118 | $total_weight += $total_done_attendance; |
1119 | 1119 | } |
1120 | 1120 | |
1121 | - $porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0; |
|
1121 | + $porcent = $total_weight > 0 ? round(($total_faults * 100) / $total_weight, 0) : 0; |
|
1122 | 1122 | $results['faults'] = $total_faults; |
1123 | - $results['total'] = $total_weight; |
|
1123 | + $results['total'] = $total_weight; |
|
1124 | 1124 | $results['porcent'] = $porcent; |
1125 | 1125 | |
1126 | 1126 | return $results; |
@@ -1134,8 +1134,8 @@ discard block |
||
1134 | 1134 | */ |
1135 | 1135 | public function get_users_attendance_sheet($attendance_id, $user_id = 0, $groupId = null) |
1136 | 1136 | { |
1137 | - $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
|
1138 | - $tbl_attendance_calendar= Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
|
1137 | + $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
|
1138 | + $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
|
1139 | 1139 | |
1140 | 1140 | $attendance_calendar = $this->get_attendance_calendar($attendance_id, 'all', null, $groupId); |
1141 | 1141 | $calendar_ids = array(); |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | WHERE |
1158 | 1158 | c_id = $course_id AND |
1159 | 1159 | user_id = '$uid' AND |
1160 | - attendance_calendar_id IN(".implode(',',$calendar_ids).") |
|
1160 | + attendance_calendar_id IN(".implode(',', $calendar_ids).") |
|
1161 | 1161 | "; |
1162 | 1162 | $res = Database::query($sql); |
1163 | 1163 | if (Database::num_rows($res) > 0) { |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | att.c_id = $course_id AND |
1180 | 1180 | cal.c_id = $course_id AND |
1181 | 1181 | att.user_id = '$user_id' AND |
1182 | - att.attendance_calendar_id IN (".implode(',',$calendar_ids).") |
|
1182 | + att.attendance_calendar_id IN (".implode(',', $calendar_ids).") |
|
1183 | 1183 | ORDER BY date_time"; |
1184 | 1184 | $res = Database::query($sql); |
1185 | 1185 | if (Database::num_rows($res) > 0) { |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | */ |
1258 | 1258 | public function get_user_score($user_id, $attendance_id, $groupId = null) |
1259 | 1259 | { |
1260 | - $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1260 | + $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1261 | 1261 | $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
1262 | 1262 | $tbl_attendance_cal_rel_group = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR_REL_GROUP); |
1263 | 1263 | $tbl_attendance_cal = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | "; |
1371 | 1371 | } |
1372 | 1372 | |
1373 | - if (!in_array($type, array('today', 'all', 'all_done', 'all_not_done','calendar_id'))) { |
|
1373 | + if (!in_array($type, array('today', 'all', 'all_done', 'all_not_done', 'calendar_id'))) { |
|
1374 | 1374 | $type = 'all'; |
1375 | 1375 | } |
1376 | 1376 | |
@@ -1378,7 +1378,7 @@ discard block |
||
1378 | 1378 | case 'calendar_id': |
1379 | 1379 | $calendar_id = intval($calendar_id); |
1380 | 1380 | if (!empty($calendar_id)) { |
1381 | - $sql.= " AND c.id = $calendar_id"; |
|
1381 | + $sql .= " AND c.id = $calendar_id"; |
|
1382 | 1382 | } |
1383 | 1383 | break; |
1384 | 1384 | case 'today': |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | $rs = Database::query($sql); |
1400 | 1400 | $data = array(); |
1401 | 1401 | if (Database::num_rows($rs) > 0) { |
1402 | - while ($row = Database::fetch_array($rs,'ASSOC')) { |
|
1402 | + while ($row = Database::fetch_array($rs, 'ASSOC')) { |
|
1403 | 1403 | $row['db_date_time'] = $row['date_time']; |
1404 | 1404 | $row['date_time'] = api_get_local_time($row['date_time']); |
1405 | 1405 | $row['date'] = api_format_date($row['date_time'], DATE_FORMAT_SHORT); |
@@ -1764,14 +1764,14 @@ discard block |
||
1764 | 1764 | * @param int The number of years to add |
1765 | 1765 | * @return int The new timestamp |
1766 | 1766 | */ |
1767 | - private function add_month($timestamp, $num=1) |
|
1767 | + private function add_month($timestamp, $num = 1) |
|
1768 | 1768 | { |
1769 | 1769 | $values = api_get_utc_datetime($timestamp); |
1770 | - $values = str_replace(array(':','-',' '), '/', $values); |
|
1771 | - list($y, $m, $d, $h, $n, $s) = split('/',$values); |
|
1772 | - if($m+$num>12) { |
|
1773 | - $y += floor($num/12); |
|
1774 | - $m += $num%12; |
|
1770 | + $values = str_replace(array(':', '-', ' '), '/', $values); |
|
1771 | + list($y, $m, $d, $h, $n, $s) = split('/', $values); |
|
1772 | + if ($m + $num > 12) { |
|
1773 | + $y += floor($num / 12); |
|
1774 | + $m += $num % 12; |
|
1775 | 1775 | } else { |
1776 | 1776 | $m += $num; |
1777 | 1777 | } |
@@ -1829,7 +1829,7 @@ discard block |
||
1829 | 1829 | * @param bool true for removing all calendar inside current attendance, false for removing by calendar id |
1830 | 1830 | * @return int affected rows |
1831 | 1831 | */ |
1832 | - public function attendance_calendar_delete($calendar_id, $attendance_id , $all_delete = false) |
|
1832 | + public function attendance_calendar_delete($calendar_id, $attendance_id, $all_delete = false) |
|
1833 | 1833 | { |
1834 | 1834 | $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
1835 | 1835 | $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
@@ -1986,7 +1986,7 @@ discard block |
||
1986 | 1986 | |
1987 | 1987 | $dateTimeStartOriginal = new DateTime($startDate); |
1988 | 1988 | $dateTimeStart = new DateTime($startDate); |
1989 | - $dateTimeEnd= new DateTime($endDate); |
|
1989 | + $dateTimeEnd = new DateTime($endDate); |
|
1990 | 1990 | $interval = $dateTimeStart->diff($dateTimeEnd); |
1991 | 1991 | $days = intval($interval->format('%a')); |
1992 | 1992 | |
@@ -2059,7 +2059,7 @@ discard block |
||
2059 | 2059 | 0, |
2060 | 2060 | $user['lastname'].' '.$user['firstname'].' ('.$user['username'].')' |
2061 | 2061 | ); |
2062 | - $row ++; |
|
2062 | + $row++; |
|
2063 | 2063 | } |
2064 | 2064 | |
2065 | 2065 | $column = 1; |
@@ -2136,7 +2136,7 @@ discard block |
||
2136 | 2136 | $tableToString = $table->toHtml(); |
2137 | 2137 | |
2138 | 2138 | $params = array( |
2139 | - 'filename' => get_lang('Attendance') . '_' . api_get_utc_datetime(), |
|
2139 | + 'filename' => get_lang('Attendance').'_'.api_get_utc_datetime(), |
|
2140 | 2140 | 'pdf_title' => get_lang('Attendance'), |
2141 | 2141 | 'course_code' => api_get_course_id(), |
2142 | 2142 | 'show_real_course_teachers' => true |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * Gets an array of options for a specific field |
413 | 413 | * @param int $field_id The field ID |
414 | 414 | * @param bool $add_id_in_array Whether to add the row ID in the result |
415 | - * @param null $ordered_by Extra ordering query bit |
|
415 | + * @param null|string $ordered_by Extra ordering query bit |
|
416 | 416 | * @return array The options if they exists. Otherwise return false |
417 | 417 | */ |
418 | 418 | public function get_field_options_by_field($field_id, $add_id_in_array = false, $ordered_by = null) |
@@ -782,8 +782,8 @@ discard block |
||
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
785 | - * @param $defaultDisplayText |
|
786 | - * @return mixed|string |
|
785 | + * @param string $defaultDisplayText |
|
786 | + * @return string |
|
787 | 787 | */ |
788 | 788 | public static function getLanguageVariable($defaultDisplayText) |
789 | 789 | { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | foreach ($sub_options as $sub_option) { |
218 | 218 | if (!empty($sub_option)) { |
219 | - $new_params = array( |
|
219 | + $new_params = array( |
|
220 | 220 | 'field_id' => $field_id, |
221 | 221 | 'option_value' => $sub_id, |
222 | 222 | 'display_text' => $sub_option, |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | $form->addElement('hidden', 'field_id', $this->field_id); |
661 | 661 | |
662 | 662 | if ($action == 'edit') { |
663 | - $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([ |
|
663 | + $translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([ |
|
664 | 664 | 'extra_field_option' => $id |
665 | 665 | ]); |
666 | 666 | $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link'); |
@@ -954,7 +954,7 @@ |
||
954 | 954 | /** |
955 | 955 | * This function has been created for avoiding changes directly within QuickForm class. |
956 | 956 | * When we use it, the element is threated as 'required' to be dealt during validation. |
957 | - * @param array $element The array of elements |
|
957 | + * @param array $elements The array of elements |
|
958 | 958 | * @param string $message The message displayed |
959 | 959 | */ |
960 | 960 | public function add_multiple_required_rule($elements, $message) |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $renderer->setHeaderTemplate('<legend>{header}</legend>'); |
100 | 100 | |
101 | 101 | //Set required field template |
102 | - $this->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>'); |
|
102 | + $this->setRequiredNote('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>'); |
|
103 | 103 | $noteTemplate = <<<EOT |
104 | 104 | <div class="form-group"> |
105 | 105 | <div class="col-sm-offset-2 col-sm-10">{requiredNote}</div> |
@@ -902,8 +902,8 @@ discard block |
||
902 | 902 | $this->with_progress_bar = true; |
903 | 903 | $id = $this->getAttribute('id'); |
904 | 904 | |
905 | - $this->updateAttributes("onsubmit=\"javascript: addProgress('" . $id . "')\""); |
|
906 | - $this->addHtml('<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>'); |
|
905 | + $this->updateAttributes("onsubmit=\"javascript: addProgress('".$id."')\""); |
|
906 | + $this->addHtml('<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>'); |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | /** |
@@ -1402,7 +1402,7 @@ discard block |
||
1402 | 1402 | .prop('href', file.url); |
1403 | 1403 | $(data.context.children()[index]).parent().wrap(link); |
1404 | 1404 | |
1405 | - var successMessage = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded')) . "')); |
|
1405 | + var successMessage = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded'))."')); |
|
1406 | 1406 | $(data.context.children()[index]).parent().append(successMessage); |
1407 | 1407 | } else if (file.error) { |
1408 | 1408 | var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(file.error)); |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | }); |
1412 | 1412 | }).on('fileuploadfail', function (e, data) { |
1413 | 1413 | $.each(data.files, function (index) { |
1414 | - var failedMessage = '" . addslashes(get_lang('UplUploadFailed')) . "'; |
|
1414 | + var failedMessage = '" . addslashes(get_lang('UplUploadFailed'))."'; |
|
1415 | 1415 | var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(failedMessage)); |
1416 | 1416 | $(data.context.children()[index]).parent().append(error); |
1417 | 1417 | }); |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | $this_section = SECTION_COURSES; |
11 | 11 | |
12 | 12 | if (isset($_GET['session']) && $_GET['session']) { |
13 | - $archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/'; |
|
14 | - $_cid = true; |
|
15 | - $is_courseAdmin = true; |
|
13 | + $archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/'; |
|
14 | + $_cid = true; |
|
15 | + $is_courseAdmin = true; |
|
16 | 16 | } else { |
17 | - $archive_path = api_get_path(SYS_ARCHIVE_PATH); |
|
17 | + $archive_path = api_get_path(SYS_ARCHIVE_PATH); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | $archive_file = isset($_GET['archive']) ? $_GET['archive'] : null; |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | list($extension) = getextension($archive_file); |
24 | 24 | |
25 | 25 | if (empty($extension) || !file_exists($archive_path.$archive_file)) { |
26 | - exit; |
|
26 | + exit; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $extension = strtolower($extension); |
30 | 30 | $content_type = ''; |
31 | 31 | |
32 | 32 | if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) { |
33 | - $content_type = 'application/force-download'; |
|
33 | + $content_type = 'application/force-download'; |
|
34 | 34 | } elseif ($extension === 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) { |
35 | - $content_type = 'application/force-download'; |
|
35 | + $content_type = 'application/force-download'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | if (empty($content_type)) { |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | "</td>\n". |
127 | 127 | "<td>\n". |
128 | 128 | "<select name=\"image\">\n". |
129 | - "<option selected>". $image. "</option>\n"; |
|
129 | + "<option selected>".$image."</option>\n"; |
|
130 | 130 | |
131 | 131 | if ($dir = @opendir($chemin)) { |
132 | 132 | while ($file = readdir($dir)) { |
133 | 133 | if ($file == '..' || $file == '.') { |
134 | 134 | unset($file); |
135 | 135 | } |
136 | - $content .= "<option>". $file. "</option>\n"; |
|
136 | + $content .= "<option>".$file."</option>\n"; |
|
137 | 137 | } |
138 | 138 | closedir($dir); |
139 | 139 | } |
@@ -142,15 +142,15 @@ discard block |
||
142 | 142 | "</td>\n". |
143 | 143 | "</tr>\n". |
144 | 144 | "<tr>\n". |
145 | - "<td>". get_lang('NameOfTheLink'). " : </td>\n". |
|
146 | - "<td><input type=\"text\" name=\"name\" value=\"". $name. "\"></td>\n". |
|
145 | + "<td>".get_lang('NameOfTheLink')." : </td>\n". |
|
146 | + "<td><input type=\"text\" name=\"name\" value=\"".$name."\"></td>\n". |
|
147 | 147 | "</tr>\n". |
148 | 148 | "<tr>\n". |
149 | 149 | "<td>Lien :</td>\n". |
150 | - "<td><input type=\"text\" name=\"link\" value=\"". $link. "\"></td>\n". |
|
150 | + "<td><input type=\"text\" name=\"link\" value=\"".$link."\"></td>\n". |
|
151 | 151 | "</tr>\n". |
152 | 152 | "<tr>\n". |
153 | - "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"". get_lang('Ok'). "\"></td>\n". |
|
153 | + "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"".get_lang('Ok')."\"></td>\n". |
|
154 | 154 | "</tr>\n". |
155 | 155 | "</form>\n". |
156 | 156 | "</table>\n". |
@@ -203,21 +203,21 @@ discard block |
||
203 | 203 | "<tr><td colspan=\"6\"><font color=\"#F66105\">\n".get_lang('CourseAdminOnly')."</font> |
204 | 204 | </td></tr>\n"; |
205 | 205 | $content .= "<tr>\n<td colspan=\"6\">"; |
206 | - $content .=CourseHome::show_tool_3column('courseAdmin'); |
|
206 | + $content .= CourseHome::show_tool_3column('courseAdmin'); |
|
207 | 207 | $content .= "</td>\n</tr>\n"; |
208 | 208 | } |
209 | 209 | |
210 | 210 | /* TOOLS FOR PLATFORM ADMIN ONLY */ |
211 | 211 | if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) { |
212 | - $content .= "<tr>"."<td colspan=\"6\">". |
|
212 | + $content .= "<tr>"."<td colspan=\"6\">". |
|
213 | 213 | "<hr noshade size=\"1\" />". |
214 | 214 | "</td>"."</tr>\n". |
215 | 215 | "<tr>\n"."<td colspan=\"6\">\n". |
216 | - "<font color=\"#F66105\" >". get_lang('PlatformAdminOnly'). "</font>\n". |
|
216 | + "<font color=\"#F66105\" >".get_lang('PlatformAdminOnly')."</font>\n". |
|
217 | 217 | "</td>\n"."</tr>\n"; |
218 | - $content .= "<tr>\n<td colspan=\"6\">"; |
|
218 | + $content .= "<tr>\n<td colspan=\"6\">"; |
|
219 | 219 | $content .= CourseHome::show_tool_3column('platformAdmin'); |
220 | - $content .= "</td>\n</tr>\n"; |
|
220 | + $content .= "</td>\n</tr>\n"; |
|
221 | 221 | } |
222 | 222 | |
223 | -$content .= "</table>\n"; |
|
223 | +$content .= "</table>\n"; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | // Show message to confirm that a tool it to be hidden from available tools |
57 | 57 | // visibility 0,1->2 |
58 | 58 | if (!empty($_GET['askDelete'])) { |
59 | - $content .='<div id="toolhide">'.get_lang('DelLk').'<br /> |
|
59 | + $content .= '<div id="toolhide">'.get_lang('DelLk').'<br /> |
|
60 | 60 | <a href="'.api_get_self().'">'.get_lang('No').'</a> | |
61 | 61 | <a href="'.api_get_self().'?delete=yes&id='.intval($_GET['id']).'">'.get_lang('Yes').'</a> |
62 | 62 | </div>'; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | /* INACTIVE TOOLS - HIDDEN (GREY) LINKS */ |
94 | 94 | |
95 | - $content .= "<tr><td colspan=\"4\"><hr style='color:\"#4171B5\"' noshade=\"noshade\" size=\"1\" /></td></tr>\n". |
|
95 | + $content .= "<tr><td colspan=\"4\"><hr style='color:\"#4171B5\"' noshade=\"noshade\" size=\"1\" /></td></tr>\n". |
|
96 | 96 | "<tr>\n". |
97 | 97 | "<td colspan=\"4\">\n". |
98 | 98 | "<div style=\"margin-bottom: 10px;\"><font color=\"#808080\">\n".get_lang('InLnk')."</font></div>". |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | |
102 | 102 | $content .= CourseHome::show_tool_2column(TOOL_PUBLIC_BUT_HIDDEN); |
103 | 103 | |
104 | - $content .= "</table>"; |
|
105 | - $content .= "</div> "; |
|
104 | + $content .= "</table>"; |
|
105 | + $content .= "</div> "; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /* Tools for platform admin only */ |
109 | 109 | |
110 | 110 | if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) { |
111 | - $content .='<div class="platformadminview"> |
|
111 | + $content .= '<div class="platformadminview"> |
|
112 | 112 | <span class="viewcaption">'.get_lang('PlatformAdminOnly').'</span> |
113 | 113 | <table width="100%"> |
114 | 114 | '.CourseHome::show_tool_2column(TOOL_PLATFORM_ADMIN).' |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param string tool name (optional) |
17 | 17 | * @param string $template_path |
18 | 18 | */ |
19 | - public function __construct($toolname = '', $template_path=null) |
|
19 | + public function __construct($toolname = '', $template_path = null) |
|
20 | 20 | { |
21 | 21 | if (!empty($toolname)) { |
22 | 22 | if (isset($template_path)) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | if (is_dir($path)) { |
28 | 28 | $this->tool_path = $path; |
29 | 29 | } else { |
30 | - throw new Exception('View::__construct() $path directory does not exist ' . $path); |
|
30 | + throw new Exception('View::__construct() $path directory does not exist '.$path); |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public function set_data($data) |
40 | 40 | { |
41 | 41 | if (!is_array($data)) { |
42 | - throw new Exception('View::set_data() $data must to be an array, you have sent a' . gettype( $data )); |
|
42 | + throw new Exception('View::set_data() $data must to be an array, you have sent a'.gettype($data)); |
|
43 | 43 | } |
44 | 44 | $this->data = $data; |
45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param string layout view |
50 | 50 | * @param string $layout |
51 | 51 | */ |
52 | - public function set_layout( $layout ) |
|
52 | + public function set_layout($layout) |
|
53 | 53 | { |
54 | 54 | $this->layout = $layout; |
55 | 55 | } |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | $special_course_list = array(); |
49 | 49 | if (Database::num_rows($result) > 0) { |
50 | 50 | while ($result_row = Database::fetch_array($result)) { |
51 | - $special_course_list[] = '"' . $result_row['item_id'] . '"'; |
|
51 | + $special_course_list[] = '"'.$result_row['item_id'].'"'; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | $without_special_courses = ''; |
55 | 55 | if (!empty($special_course_list)) { |
56 | - $without_special_courses = ' AND course.id NOT IN (' . implode(',', $special_course_list) . ')'; |
|
56 | + $without_special_courses = ' AND course.id NOT IN ('.implode(',', $special_course_list).')'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Secondly we select the courses that are in a category (user_course_cat<>0) and sort these according to the sort of the category |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | FROM $TABLECOURS course, $TABLECOURSUSER course_rel_user |
74 | 74 | WHERE |
75 | 75 | course.id = course_rel_user.c_id AND |
76 | - course_rel_user.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND |
|
77 | - course_rel_user.user_id = '" . $user_id . "' $without_special_courses |
|
76 | + course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND |
|
77 | + course_rel_user.user_id = '" . $user_id."' $without_special_courses |
|
78 | 78 | ORDER BY course_rel_user.sort ASC"; |
79 | 79 | $result = Database::query($sql); |
80 | 80 | $courses = array(); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $user_id = api_get_user_id(); |
108 | 108 | $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
109 | - $sql = "SELECT * FROM " . $table_category . " |
|
109 | + $sql = "SELECT * FROM ".$table_category." |
|
110 | 110 | WHERE user_id=$user_id |
111 | 111 | ORDER BY sort ASC"; |
112 | 112 | $result = Database::query($sql); |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | $special_course_list = array(); |
149 | 149 | if (Database::num_rows($result) > 0) { |
150 | 150 | while ($result_row = Database::fetch_array($result)) { |
151 | - $special_course_list[] = '"' . $result_row['item_id'] . '"'; |
|
151 | + $special_course_list[] = '"'.$result_row['item_id'].'"'; |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | 155 | $without_special_courses = ''; |
156 | 156 | if (!empty($special_course_list)) { |
157 | - $without_special_courses = ' AND course.id NOT IN (' . implode(',', $special_course_list) . ')'; |
|
157 | + $without_special_courses = ' AND course.id NOT IN ('.implode(',', $special_course_list).')'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $sql = "SELECT |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | $TABLECOURSUSER course_rel_user |
166 | 166 | WHERE |
167 | 167 | course.id = course_rel_user.c_id AND |
168 | - course_rel_user.user_id = '" . $user_id . "' AND |
|
169 | - course_rel_user.relation_type <> " . COURSE_RELATION_TYPE_RRHH . " |
|
168 | + course_rel_user.user_id = '".$user_id."' AND |
|
169 | + course_rel_user.relation_type <> " . COURSE_RELATION_TYPE_RRHH." |
|
170 | 170 | $without_special_courses |
171 | 171 | ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC"; |
172 | 172 | $result = Database::query($sql); |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
195 | 195 | $max_sort_value = api_max_sort_value($newcategory, $current_user); |
196 | 196 | $sql = "UPDATE $TABLECOURSUSER SET |
197 | - user_course_cat='" . $newcategory . "', |
|
198 | - sort='" . ($max_sort_value + 1) . "' |
|
197 | + user_course_cat='".$newcategory."', |
|
198 | + sort='" . ($max_sort_value + 1)."' |
|
199 | 199 | WHERE |
200 | - c_id ='" . $courseId . "' AND |
|
201 | - user_id='" . $current_user . "' AND |
|
200 | + c_id ='" . $courseId."' AND |
|
201 | + user_id='" . $current_user."' AND |
|
202 | 202 | relation_type<>" . COURSE_RELATION_TYPE_RRHH; |
203 | 203 | $resultQuery = Database::query($sql); |
204 | 204 | |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | $targetCourseId = $targetCourseInfo['real_id']; |
258 | 258 | |
259 | 259 | $sql = "UPDATE $table |
260 | - SET sort='" . $target_course['sort'] . "' |
|
260 | + SET sort='".$target_course['sort']."' |
|
261 | 261 | WHERE |
262 | - c_id = '" . $courseId . "' AND |
|
263 | - user_id = '" . $current_user_id . "' AND |
|
262 | + c_id = '" . $courseId."' AND |
|
263 | + user_id = '" . $current_user_id."' AND |
|
264 | 264 | relation_type<>" . COURSE_RELATION_TYPE_RRHH; |
265 | 265 | |
266 | 266 | $result1 = Database::query($sql); |
267 | 267 | |
268 | - $sql = "UPDATE $table SET sort='" . $source_course['sort'] . "' |
|
268 | + $sql = "UPDATE $table SET sort='".$source_course['sort']."' |
|
269 | 269 | WHERE |
270 | - c_id ='" . $targetCourseId . "' AND |
|
271 | - user_id='" . $current_user_id . "' AND |
|
270 | + c_id ='" . $targetCourseId."' AND |
|
271 | + user_id='" . $current_user_id."' AND |
|
272 | 272 | relation_type<>" . COURSE_RELATION_TYPE_RRHH; |
273 | 273 | |
274 | 274 | $result2 = Database::query($sql); |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | } |
313 | 313 | |
314 | 314 | if (count($target_category) > 0 && count($source_category) > 0) { |
315 | - $sql_update1 = "UPDATE $table_user_defined_category SET sort='" . Database::escape_string($target_category['sort']) . "' |
|
316 | - WHERE id='" . intval($source_category['id']) . "' AND user_id='" . $current_user_id . "'"; |
|
317 | - $sql_update2 = "UPDATE $table_user_defined_category SET sort='" . Database::escape_string($source_category['sort']) . "' |
|
318 | - WHERE id='" . intval($target_category['id']) . "' AND user_id='" . $current_user_id . "'"; |
|
315 | + $sql_update1 = "UPDATE $table_user_defined_category SET sort='".Database::escape_string($target_category['sort'])."' |
|
316 | + WHERE id='" . intval($source_category['id'])."' AND user_id='".$current_user_id."'"; |
|
317 | + $sql_update2 = "UPDATE $table_user_defined_category SET sort='".Database::escape_string($source_category['sort'])."' |
|
318 | + WHERE id='" . intval($target_category['id'])."' AND user_id='".$current_user_id."'"; |
|
319 | 319 | |
320 | 320 | $result1 = Database::query($sql_update2); |
321 | 321 | $result2 = Database::query($sql_update1); |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | { |
335 | 335 | $current_user_id = api_get_user_id(); |
336 | 336 | $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
337 | - $sql = "SELECT * FROM " . $table_category . " |
|
338 | - WHERE user_id='" . $current_user_id . "' |
|
337 | + $sql = "SELECT * FROM ".$table_category." |
|
338 | + WHERE user_id='" . $current_user_id."' |
|
339 | 339 | ORDER BY sort ASC"; |
340 | 340 | $result = Database::query($sql); |
341 | 341 | while ($row = Database::fetch_array($result)) { |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | $result = false; |
359 | 359 | $tucc = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
360 | 360 | $sql = "UPDATE $tucc |
361 | - SET title='" . api_htmlentities($title, ENT_QUOTES, api_get_system_encoding()) . "' |
|
362 | - WHERE id='" . $category_id . "'"; |
|
361 | + SET title='".api_htmlentities($title, ENT_QUOTES, api_get_system_encoding())."' |
|
362 | + WHERE id='" . $category_id."'"; |
|
363 | 363 | $resultQuery = Database::query($sql); |
364 | 364 | if (Database::affected_rows($resultQuery)) { |
365 | 365 | $result = true; |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | $result = false; |
382 | 382 | $sql = "DELETE FROM $tucc |
383 | 383 | WHERE |
384 | - id='" . $category_id . "' AND |
|
385 | - user_id='" . $current_user_id . "'"; |
|
384 | + id='".$category_id."' AND |
|
385 | + user_id='" . $current_user_id."'"; |
|
386 | 386 | $resultQuery = Database::query($sql); |
387 | 387 | if (Database::affected_rows($resultQuery)) { |
388 | 388 | $result = true; |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | $sql = "UPDATE $TABLECOURSUSER |
391 | 391 | SET user_course_cat='0' |
392 | 392 | WHERE |
393 | - user_course_cat='" . $category_id . "' AND |
|
394 | - user_id='" . $current_user_id . "' AND |
|
395 | - relation_type<>" . COURSE_RELATION_TYPE_RRHH . " "; |
|
393 | + user_course_cat='".$category_id."' AND |
|
394 | + user_id='" . $current_user_id."' AND |
|
395 | + relation_type<>" . COURSE_RELATION_TYPE_RRHH." "; |
|
396 | 396 | Database::query($sql); |
397 | 397 | |
398 | 398 | return $result; |
@@ -425,20 +425,20 @@ discard block |
||
425 | 425 | if (Database::num_rows($special_course_result) > 0) { |
426 | 426 | $special_course_list = array(); |
427 | 427 | while ($result_row = Database::fetch_array($special_course_result)) { |
428 | - $special_course_list[] = '"' . $result_row['item_id'] . '"'; |
|
428 | + $special_course_list[] = '"'.$result_row['item_id'].'"'; |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | $without_special_courses = ''; |
432 | 432 | if (!empty($special_course_list)) { |
433 | - $without_special_courses = ' AND course.code NOT IN (' . implode(',', $special_course_list) . ')'; |
|
433 | + $without_special_courses = ' AND course.code NOT IN ('.implode(',', $special_course_list).')'; |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | $search_term_safe = Database::escape_string($search_term); |
437 | 437 | $sql_find = "SELECT * FROM $courseTable |
438 | 438 | WHERE ( |
439 | - code LIKE '%" . $search_term_safe . "%' OR |
|
440 | - title LIKE '%" . $search_term_safe . "%' OR |
|
441 | - tutor_name LIKE '%" . $search_term_safe . "%' |
|
439 | + code LIKE '%".$search_term_safe."%' OR |
|
440 | + title LIKE '%" . $search_term_safe."%' OR |
|
441 | + tutor_name LIKE '%" . $search_term_safe."%' |
|
442 | 442 | ) |
443 | 443 | $without_special_courses |
444 | 444 | ORDER BY title, visual_code ASC |
@@ -455,9 +455,9 @@ discard block |
||
455 | 455 | ON (url_rel_course.c_id = course.id) |
456 | 456 | WHERE |
457 | 457 | access_url_id = $url_access_id AND ( |
458 | - code LIKE '%" . $search_term_safe . "%' OR |
|
459 | - title LIKE '%" . $search_term_safe . "%' OR |
|
460 | - tutor_name LIKE '%" . $search_term_safe . "%' |
|
458 | + code LIKE '%".$search_term_safe."%' OR |
|
459 | + title LIKE '%" . $search_term_safe."%' OR |
|
460 | + tutor_name LIKE '%" . $search_term_safe."%' |
|
461 | 461 | ) |
462 | 462 | $without_special_courses |
463 | 463 | ORDER BY title, visual_code ASC |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | // (s)he can only delete the course |
519 | 519 | $sql = "SELECT * FROM $tbl_course_user |
520 | 520 | WHERE |
521 | - user_id='" . $current_user_id . "' AND |
|
522 | - c_id ='" . $courseId . "' AND |
|
521 | + user_id='".$current_user_id."' AND |
|
522 | + c_id ='" . $courseId."' AND |
|
523 | 523 | status='1' "; |
524 | 524 | $result_check = Database::query($sql); |
525 | 525 | $number_of_rows = Database::num_rows($result_check); |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | |
549 | 549 | // step 1: we determine the max value of the user defined course categories |
550 | 550 | $sql = "SELECT sort FROM $tucc |
551 | - WHERE user_id='" . $current_user_id . "' |
|
551 | + WHERE user_id='".$current_user_id."' |
|
552 | 552 | ORDER BY sort DESC"; |
553 | 553 | $rs_sort = Database::query($sql); |
554 | 554 | $maxsort = Database::fetch_array($rs_sort); |
@@ -557,13 +557,13 @@ discard block |
||
557 | 557 | // step 2: we check if there is already a category with this name, if not we store it, else we give an error. |
558 | 558 | $sql = "SELECT * FROM $tucc |
559 | 559 | WHERE |
560 | - user_id='" . $current_user_id . "' AND |
|
561 | - title='" . $category_title . "' |
|
560 | + user_id='".$current_user_id."' AND |
|
561 | + title='" . $category_title."' |
|
562 | 562 | ORDER BY sort DESC"; |
563 | 563 | $rs = Database::query($sql); |
564 | 564 | if (Database::num_rows($rs) == 0) { |
565 | 565 | $sql = "INSERT INTO $tucc (user_id, title,sort) |
566 | - VALUES ('" . $current_user_id . "', '" . api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding()) . "', '" . $nextsort . "')"; |
|
566 | + VALUES ('".$current_user_id."', '".api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding())."', '".$nextsort."')"; |
|
567 | 567 | $resultQuery = Database::query($sql); |
568 | 568 | if (Database::affected_rows($resultQuery)) { |
569 | 569 | $result = true; |
@@ -647,10 +647,10 @@ discard block |
||
647 | 647 | if (isset($_POST['course_registration_code']) && $_POST['course_registration_code'] != $all_course_information['registration_code']) { |
648 | 648 | return false; |
649 | 649 | } |
650 | - $message = get_lang('CourseRequiresPassword') . '<br />'; |
|
650 | + $message = get_lang('CourseRequiresPassword').'<br />'; |
|
651 | 651 | $message .= $all_course_information['title'].' ('.$all_course_information['visual_code'].') '; |
652 | 652 | |
653 | - $action = api_get_path(WEB_CODE_PATH) . "auth/courses.php?action=subscribe_user_with_password&sec_token=" . $_SESSION['sec_token']; |
|
653 | + $action = api_get_path(WEB_CODE_PATH)."auth/courses.php?action=subscribe_user_with_password&sec_token=".$_SESSION['sec_token']; |
|
654 | 654 | $form = new FormValidator('subscribe_user_with_password', 'post', $action); |
655 | 655 | $form->addElement('hidden', 'sec_token', $_SESSION['sec_token']); |
656 | 656 | $form->addElement('hidden', 'subscribe_user_with_password', $all_course_information['code']); |
@@ -183,6 +183,7 @@ discard block |
||
183 | 183 | * (moving a course to a different course category) |
184 | 184 | * @param int $courseId |
185 | 185 | * @param int Category id |
186 | + * @param integer $newcategory |
|
186 | 187 | * @return bool True if it success |
187 | 188 | */ |
188 | 189 | public function updateCourseCategory($courseId, $newcategory) |
@@ -215,6 +216,9 @@ discard block |
||
215 | 216 | * @param string Direction (up/down) |
216 | 217 | * @param string Course code |
217 | 218 | * @param int Category id |
219 | + * @param string $direction |
|
220 | + * @param string $course2move |
|
221 | + * @param integer $category |
|
218 | 222 | * @return bool True if it success |
219 | 223 | */ |
220 | 224 | public function move_course($direction, $course2move, $category) |
@@ -285,6 +289,8 @@ discard block |
||
285 | 289 | * Moves the course one place up or down |
286 | 290 | * @param string Direction up/down |
287 | 291 | * @param string Category id |
292 | + * @param string $direction |
|
293 | + * @param integer $category2move |
|
288 | 294 | * @return bool True If it success |
289 | 295 | */ |
290 | 296 | public function move_category($direction, $category2move) |
@@ -348,6 +354,8 @@ discard block |
||
348 | 354 | * Updates the user course category in the chamilo_user database |
349 | 355 | * @param string Category title |
350 | 356 | * @param int Category id |
357 | + * @param string $title |
|
358 | + * @param integer $category_id |
|
351 | 359 | * @return bool True if it success |
352 | 360 | */ |
353 | 361 | public function store_edit_course_category($title, $category_id) |