Skip to content

Commit ce1d208

Browse files
committed
Minor - format code
1 parent c55bd1d commit ce1d208

File tree

2 files changed

+37
-27
lines changed

2 files changed

+37
-27
lines changed

main/gradebook/index.php

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@
1414
require_once __DIR__.'/../inc/global.inc.php';
1515
$current_course_tool = TOOL_GRADEBOOK;
1616

17-
ob_start();
18-
17+
api_block_anonymous_users();
1918
api_protect_course_script(true);
2019

20+
ob_start();
21+
2122
$course_code = api_get_course_id();
2223
$stud_id = api_get_user_id();
2324
$session_id = api_get_session_id();
25+
$course_id = api_get_course_int_id();
2426

25-
//make sure the destination for scripts is index.php instead of gradebook.php
27+
// Make sure the destination for scripts is index.php instead of gradebook.php
2628
Category::setUrl('index.php');
2729

2830
$this_section = SECTION_COURSES;
@@ -31,6 +33,14 @@
3133
var show_icon = "'.Display::returnIconPath('view_more_stats.gif').'";
3234
var hide_icon = "'.Display::returnIconPath('view_less_stats.gif').'";
3335
36+
function confirmation() {
37+
if (confirm("'.get_lang('DeleteAll').'?")) {
38+
return true;
39+
} else {
40+
return false;
41+
}
42+
}
43+
3444
$(document).ready(function() {
3545
$("body").on("click", ".view_children", function() {
3646
var id = $(this).attr("data-cat-id");
@@ -55,16 +65,6 @@
5565
}
5666
});
5767
</script>';
58-
api_block_anonymous_users();
59-
$htmlHeadXtra[] = '<script type="text/javascript">
60-
function confirmation() {
61-
if (confirm("'.get_lang('DeleteAll').'?")) {
62-
return true;
63-
} else {
64-
return false;
65-
}
66-
}
67-
</script>';
6868

6969
$tbl_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
7070
$tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
@@ -220,13 +220,12 @@ function confirmation() {
220220
if ($move_form->validate()) {
221221
$targetcat = Category::load($move_form->exportValue('move_cat'));
222222
$link[0]->move_to_cat($targetcat[0]);
223-
unset($link);
224223
header('Location: '.api_get_self().'?linkmoved=&selectcat='.$selectCat.'&'.api_get_cidreq());
225224
exit;
226225
}
227226
}
228227

229-
//parameters for categories
228+
// Parameters for categories.
230229
if (isset($_GET['visiblecat'])) {
231230
GradebookUtils::block_students();
232231

@@ -248,6 +247,7 @@ function confirmation() {
248247
$filter_confirm_msg = false;
249248
}
250249
}
250+
251251
if (isset($_GET['deletecat'])) {
252252
GradebookUtils::block_students();
253253
$cats = Category::load($_GET['deletecat']);
@@ -264,7 +264,7 @@ function confirmation() {
264264
$filter_confirm_msg = false;
265265
}
266266

267-
//parameters for evaluations
267+
// Parameters for evaluations.
268268
if (isset($_GET['visibleeval'])) {
269269
GradebookUtils::block_students();
270270
if (isset($_GET['set_visible'])) {
@@ -285,7 +285,7 @@ function confirmation() {
285285
}
286286
}
287287

288-
//parameters for evaluations
288+
// Parameters for evaluations.
289289
if (isset($_GET['lockedeval'])) {
290290
GradebookUtils::block_students();
291291
$locked = Security::remove_XSS($_GET['lockedeval']);
@@ -314,7 +314,7 @@ function confirmation() {
314314
$filter_confirm_msg = false;
315315
}
316316

317-
//parameters for links
317+
// Parameters for links.
318318
if (isset($_GET['visiblelink'])) {
319319
GradebookUtils::block_students();
320320
if (isset($_GET['set_visible'])) {
@@ -337,8 +337,6 @@ function confirmation() {
337337
}
338338
}
339339

340-
$course_id = api_get_course_int_id();
341-
342340
if (isset($_GET['deletelink'])) {
343341
GradebookUtils::block_students();
344342
$get_delete_link = intval($_GET['deletelink']);
@@ -380,7 +378,7 @@ function confirmation() {
380378
}
381379
$button = '<form name="confirm" method="post" action="'.api_get_self().'?confirm='
382380
.(isset($_GET['movecat']) ? '&movecat='.intval($_GET['movecat'])
383-
: '&moveeval='.Security::remove_XSS($_GET['moveeval'])).'&selectcat='.$selectCat.'&targetcat='.Security::remove_XSS($_GET['targetcat']).'">
381+
: '&moveeval='.intval($_GET['moveeval'])).'&selectcat='.$selectCat.'&targetcat='.intval($_GET['targetcat']).'">
384382
<input type="submit" value="'.get_lang('Ok').'">
385383
</form>';
386384
$warning_message = get_lang('MoveWarning').'<br><br>'.$button;
@@ -408,7 +406,7 @@ function confirmation() {
408406
break;
409407
}
410408

411-
//actions on the sortabletable
409+
// Actions on the sortabletable.
412410
if (isset($_POST['action'])) {
413411
GradebookUtils::block_students();
414412
$number_of_selected_items = count($_POST['id']);
@@ -450,7 +448,12 @@ function confirmation() {
450448
}
451449
}
452450
}
453-
$confirmation_message = get_lang('DeletedCategories').' : <b>'.$number_of_deleted_categories.'</b><br />'.get_lang('DeletedEvaluations').' : <b>'.$number_of_deleted_evaluations.'</b><br />'.get_lang('DeletedLinks').' : <b>'.$number_of_deleted_links.'</b><br /><br />'.get_lang('TotalItems').' : <b>'.$number_of_selected_items.'</b>';
451+
452+
$confirmation_message =
453+
get_lang('DeletedCategories').' : <b>'.$number_of_deleted_categories.'</b><br />'.
454+
get_lang('DeletedEvaluations').' : <b>'.$number_of_deleted_evaluations.'</b><br />'.
455+
get_lang('DeletedLinks').' : <b>'.$number_of_deleted_links.'</b><br /><br />'.
456+
get_lang('TotalItems').' : <b>'.$number_of_selected_items.'</b>';
454457
$filter_confirm_msg = false;
455458
break;
456459
case 'setvisible':
@@ -576,7 +579,6 @@ function confirmation() {
576579
}
577580

578581
// LOAD DATA & DISPLAY TABLE
579-
580582
$is_platform_admin = api_is_platform_admin();
581583
$is_course_admin = api_is_allowed_to_edit(null, true);
582584
$simple_search_form = '';
@@ -611,7 +613,14 @@ function confirmation() {
611613
$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
612614
$pdf->ezSetMargins(30, 30, 50, 30);
613615
$pdf->ezSetY(810);
614-
$pdf->ezText(get_lang('FlatView').' ('.api_convert_and_format_date(null, DATE_FORMAT_SHORT).' '.api_convert_and_format_date(null, TIME_NO_SEC_FORMAT).')', 12, ['justification' => 'center']);
616+
$pdf->ezText(
617+
get_lang('FlatView').' ('.api_convert_and_format_date(
618+
null,
619+
DATE_FORMAT_SHORT
620+
).' '.api_convert_and_format_date(null, TIME_NO_SEC_FORMAT).')',
621+
12,
622+
['justification' => 'center']
623+
);
615624
$pdf->line(50, 790, 550, 790);
616625
$pdf->line(50, 40, 550, 40);
617626
$pdf->ezSetY(750);
@@ -631,7 +640,7 @@ function confirmation() {
631640
exit;
632641
}
633642
} else {
634-
//Student view
643+
// Student view
635644

636645
//in any other case (no search, no pdf), print the available gradebooks
637646
// Important note: loading a category will actually load the *contents* of

main/inc/lib/events.lib.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ public static function updateEventExercise(
377377
$endDate = null
378378
) {
379379
if (empty($exeId)) {
380-
381380
return false;
382381
}
383382

@@ -690,6 +689,7 @@ public static function saveExerciseAttemptHotspot(
690689
if ($debug) {
691690
error_log('exe id is empty');
692691
}
692+
693693
return false;
694694
}
695695

@@ -718,6 +718,7 @@ public static function saveExerciseAttemptHotspot(
718718
if ($debug) {
719719
error_log("Insert hotspot results: exeId: $exeId correct: $correct");
720720
}
721+
721722
return Database::insert(
722723
$table,
723724
[

0 commit comments

Comments
 (0)