Minor - format code.

pull/2487/head
jmontoyaa 8 years ago
parent c52512b624
commit dcb3f5be3b
  1. 48
      main/gradebook/gradebook.php
  2. 62
      main/gradebook/index.php

@ -48,7 +48,7 @@ $filter_warning_msg = true;
// ACTIONS // ACTIONS
//this is called when there is no data for the course admin //this is called when there is no data for the course admin
if (isset ($_GET['createallcategories'])) { if (isset($_GET['createallcategories'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
$coursecat= Category :: get_not_created_course_categories(api_get_user_id()); $coursecat= Category :: get_not_created_course_categories(api_get_user_id());
if (!count($coursecat) == 0) { if (!count($coursecat) == 0) {
@ -74,12 +74,13 @@ if (isset($_GET['movecat'])) {
$move_cat = (int) $_GET['movecat']; $move_cat = (int) $_GET['movecat'];
GradebookUtils::block_students(); GradebookUtils::block_students();
$cats = Category :: load($move_cat); $cats = Category :: load($move_cat);
if (!isset ($_GET['targetcat'])) { if (!isset($_GET['targetcat'])) {
$move_form= new CatForm(CatForm :: TYPE_MOVE, $move_form = new CatForm(
CatForm :: TYPE_MOVE,
$cats[0], $cats[0],
'move_cat_form', 'move_cat_form',
null, null,
api_get_self() . '?movecat=' . $move_cat. '&selectcat=' . $selectcat api_get_self().'?movecat='.$move_cat.'&selectcat='.$selectcat
); );
if ($move_form->validate()) { if ($move_form->validate()) {
header('Location: ' . api_get_self() . '?selectcat=' . $selectcat header('Location: ' . api_get_self() . '?selectcat=' . $selectcat
@ -103,12 +104,11 @@ if (isset($_GET['movecat'])) {
} }
//move an evaluation //move an evaluation
if (isset ($_GET['moveeval'])) { if (isset($_GET['moveeval'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
$get_move_eval=Security::remove_XSS($_GET['moveeval']); $get_move_eval=Security::remove_XSS($_GET['moveeval']);
$evals= Evaluation :: load($get_move_eval); $evals= Evaluation :: load($get_move_eval);
if (!isset ($_GET['targetcat'])) { if (!isset ($_GET['targetcat'])) {
$move_form = new EvalForm(EvalForm :: TYPE_MOVE, $move_form = new EvalForm(EvalForm :: TYPE_MOVE,
$evals[0], $evals[0],
null, null,
@ -138,8 +138,8 @@ if (isset ($_GET['moveeval'])) {
unset($evals); unset($evals);
} }
//move a link // Move a link
if (isset ($_GET['movelink'])) { if (isset($_GET['movelink'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
$get_move_link=Security::remove_XSS($_GET['movelink']); $get_move_link=Security::remove_XSS($_GET['movelink']);
$link= LinkFactory :: load($get_move_link); $link= LinkFactory :: load($get_move_link);
@ -161,9 +161,9 @@ if (isset ($_GET['movelink'])) {
} }
//parameters for categories //parameters for categories
if (isset ($_GET['visiblecat'])) { if (isset($_GET['visiblecat'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
if (isset ($_GET['set_visible'])) { if (isset($_GET['set_visible'])) {
$visibility_command= 1; $visibility_command= 1;
} else { } else {
$visibility_command= 0; $visibility_command= 0;
@ -181,7 +181,7 @@ if (isset ($_GET['visiblecat'])) {
$filter_confirm_msg = false; $filter_confirm_msg = false;
} }
} }
if (isset ($_GET['deletecat'])) { if (isset($_GET['deletecat'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
$cats= Category :: load($_GET['deletecat']); $cats= Category :: load($_GET['deletecat']);
//delete all categories,subcategories and results //delete all categories,subcategories and results
@ -194,10 +194,11 @@ if (isset ($_GET['deletecat'])) {
$confirmation_message = get_lang('CategoryDeleted'); $confirmation_message = get_lang('CategoryDeleted');
$filter_confirm_msg = false; $filter_confirm_msg = false;
} }
//parameters for evaluations //parameters for evaluations
if (isset ($_GET['visibleeval'])) { if (isset($_GET['visibleeval'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
if (isset ($_GET['set_visible'])) { if (isset($_GET['set_visible'])) {
$visibility_command= 1; $visibility_command= 1;
} else { } else {
$visibility_command= 0; $visibility_command= 0;
@ -215,7 +216,8 @@ if (isset ($_GET['visibleeval'])) {
$filter_confirm_msg = false; $filter_confirm_msg = false;
} }
} }
if (isset ($_GET['deleteeval'])) {
if (isset($_GET['deleteeval'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
$eval= Evaluation :: load($_GET['deleteeval']); $eval= Evaluation :: load($_GET['deleteeval']);
if ($eval[0] != null) { if ($eval[0] != null) {
@ -225,12 +227,12 @@ if (isset ($_GET['deleteeval'])) {
$filter_confirm_msg = false; $filter_confirm_msg = false;
} }
//parameters for links //parameters for links
if (isset ($_GET['visiblelink'])) { if (isset($_GET['visiblelink'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
if (isset ($_GET['set_visible'])) { if (isset ($_GET['set_visible'])) {
$visibility_command= 1; $visibility_command = 1;
}else { } else {
$visibility_command= 0; $visibility_command = 0;
} }
$link= LinkFactory :: load($_GET['visiblelink']); $link= LinkFactory :: load($_GET['visiblelink']);
$link[0]->set_visible($visibility_command); $link[0]->set_visible($visibility_command);
@ -248,7 +250,7 @@ if (isset ($_GET['deletelink'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
//fixing #5229 //fixing #5229
if (!empty($_GET['deletelink'])) { if (!empty($_GET['deletelink'])) {
$link= LinkFactory :: load($_GET['deletelink']); $link = LinkFactory:: load($_GET['deletelink']);
if ($link[0] != null) { if ($link[0] != null) {
$link[0]->delete(); $link[0]->delete();
} }
@ -274,17 +276,17 @@ if ($course_to_crsind && !isset($_GET['confirm'])) {
$warning_message = get_lang('MoveWarning').'<br><br>'.$button; $warning_message = get_lang('MoveWarning').'<br><br>'.$button;
$filter_warning_msg = false; $filter_warning_msg = false;
} }
//actions on the sortabletable //actions on the sortabletable
if (isset ($_POST['action'])) { if (isset($_POST['action'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
$number_of_selected_items= count($_POST['id']); $number_of_selected_items= count($_POST['id']);
if ($number_of_selected_items == '0') { if ($number_of_selected_items == '0') {
$warning_message = get_lang('NoItemsSelected'); $warning_message = get_lang('NoItemsSelected');
$filter_warning_msg = false; $filter_warning_msg = false;
} } else {
else {
switch ($_POST['action']) { switch ($_POST['action']) {
case 'deleted' : case 'deleted':
$number_of_deleted_categories= 0; $number_of_deleted_categories= 0;
$number_of_deleted_evaluations= 0; $number_of_deleted_evaluations= 0;
$number_of_deleted_links= 0; $number_of_deleted_links= 0;

@ -92,12 +92,28 @@ $filter_confirm_msg = true;
$filter_warning_msg = true; $filter_warning_msg = true;
$courseInfo = api_get_course_info(); $courseInfo = api_get_course_info();
$cats = Category :: load(null, null, $course_code, null, null, $session_id, 'ORDER By id'); $cats = Category:: load(
null,
null,
$course_code,
null,
null,
$session_id,
'ORDER By id'
);
$first_time = null; $first_time = null;
if (empty($cats)) { if (empty($cats)) {
//first time // first time
$cats = Category :: load(0, null, $course_code, null, null, $session_id, 'ORDER By id'); $cats = Category:: load(
0,
null,
$course_code,
null,
null,
$session_id,
'ORDER By id'
);
$first_time = 1; $first_time = 1;
} }
@ -117,10 +133,10 @@ if (isset($_GET['isStudentView'])) {
//this is called when there is no data for the course admin //this is called when there is no data for the course admin
if (isset($_GET['createallcategories'])) { if (isset($_GET['createallcategories'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
$coursecat= Category :: get_not_created_course_categories($stud_id); $coursecat= Category::get_not_created_course_categories($stud_id);
if (!count($coursecat) == 0) { if (!count($coursecat) == 0) {
foreach ($coursecat as $row) { foreach ($coursecat as $row) {
$cat= new Category(); $cat = new Category();
$cat->set_name($row[1]); $cat->set_name($row[1]);
$cat->set_course_code($row[0]); $cat->set_course_code($row[0]);
$cat->set_description(null); $cat->set_description(null);
@ -178,8 +194,7 @@ if (isset($_GET['movecat'])) {
if (isset($_GET['moveeval'])) { if (isset($_GET['moveeval'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
$evals= Evaluation :: load($_GET['moveeval']); $evals= Evaluation :: load($_GET['moveeval']);
if (!isset ($_GET['targetcat'])) { if (!isset($_GET['targetcat'])) {
$move_form= new EvalForm( $move_form= new EvalForm(
EvalForm :: TYPE_MOVE, EvalForm :: TYPE_MOVE,
$evals[0], $evals[0],
@ -236,9 +251,9 @@ if (isset($_GET['visiblecat'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
if (isset($_GET['set_visible'])) { if (isset($_GET['set_visible'])) {
$visibility_command= 1; $visibility_command = 1;
} else { } else {
$visibility_command= 0; $visibility_command = 0;
} }
$cats = Category :: load($_GET['visiblecat']); $cats = Category :: load($_GET['visiblecat']);
$cats[0]->set_visible($visibility_command); $cats[0]->set_visible($visibility_command);
@ -272,7 +287,7 @@ if (isset($_GET['deletecat'])) {
//parameters for evaluations //parameters for evaluations
if (isset($_GET['visibleeval'])) { if (isset($_GET['visibleeval'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
if (isset ($_GET['set_visible'])) { if (isset($_GET['set_visible'])) {
$visibility_command= 1; $visibility_command= 1;
} else { } else {
$visibility_command= 0; $visibility_command= 0;
@ -294,7 +309,7 @@ if (isset($_GET['visibleeval'])) {
if (isset($_GET['lockedeval'])) { if (isset($_GET['lockedeval'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
$locked = Security::remove_XSS($_GET['lockedeval']); $locked = Security::remove_XSS($_GET['lockedeval']);
if (isset($_GET['typelocked']) && api_is_platform_admin()){ if (isset($_GET['typelocked']) && api_is_platform_admin()) {
$type_locked = 0; $type_locked = 0;
$confirmation_message = get_lang('EvaluationHasBeenUnLocked'); $confirmation_message = get_lang('EvaluationHasBeenUnLocked');
} else { } else {
@ -322,12 +337,12 @@ if (isset($_GET['deleteeval'])) {
//parameters for links //parameters for links
if (isset($_GET['visiblelink'])) { if (isset($_GET['visiblelink'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
if (isset ($_GET['set_visible'])) { if (isset($_GET['set_visible'])) {
$visibility_command= 1; $visibility_command = 1;
} else { } else {
$visibility_command= 0; $visibility_command = 0;
} }
$link= LinkFactory :: load($_GET['visiblelink']); $link = LinkFactory :: load($_GET['visiblelink']);
if (isset($link) && isset($link[0])) { if (isset($link) && isset($link[0])) {
$link[0]->set_visible($visibility_command); $link[0]->set_visible($visibility_command);
$link[0]->save(); $link[0]->save();
@ -349,7 +364,7 @@ if (isset($_GET['deletelink'])) {
$get_delete_link = intval($_GET['deletelink']); $get_delete_link = intval($_GET['deletelink']);
//fixing #5229 //fixing #5229
if (!empty($get_delete_link)) { if (!empty($get_delete_link)) {
$link= LinkFactory :: load($get_delete_link); $link = LinkFactory :: load($get_delete_link);
if ($link[0] != null) { if ($link[0] != null) {
// Clean forum qualify // Clean forum qualify
$sql = 'UPDATE '.$tbl_forum_thread.' SET $sql = 'UPDATE '.$tbl_forum_thread.' SET
@ -380,7 +395,6 @@ if (isset($_GET['deletelink'])) {
if (!empty($course_to_crsind) && !isset($_GET['confirm'])) { if (!empty($course_to_crsind) && !isset($_GET['confirm'])) {
GradebookUtils::block_students(); GradebookUtils::block_students();
if (!isset($_GET['movecat']) && !isset($_GET['moveeval'])) { if (!isset($_GET['movecat']) && !isset($_GET['moveeval'])) {
die ('Error: movecat or moveeval not defined'); die ('Error: movecat or moveeval not defined');
} }
@ -663,7 +677,15 @@ if (isset($_GET['studentoverview'])) {
} }
//end hack*/ //end hack*/
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false); $cats = Category:: load(
null,
null,
$course_code,
null,
null,
$session_id,
false
);
if (empty($cats)) { if (empty($cats)) {
// There is no category for this course+session, so create one // There is no category for this course+session, so create one
$cat = new Category(); $cat = new Category();
@ -737,8 +759,8 @@ if (!empty($selectCat)) {
); );
if (isset($certificate['pdf_url']) && $hideCertificateExport !== 'true') { if (isset($certificate['pdf_url']) && $hideCertificateExport !== 'true') {
$actionsLeft .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o') . $actionsLeft .= Display::url(
get_lang('DownloadCertificatePdf'), Display::returnFontAwesomeIcon('file-pdf-o').get_lang('DownloadCertificatePdf'),
$certificate['pdf_url'], $certificate['pdf_url'],
['class' => 'btn btn-default'] ['class' => 'btn btn-default']
); );

Loading…
Cancel
Save