Minor - format code.

pull/2487/head
jmontoyaa 8 years ago
parent 541ab3c36c
commit 9ab8413429
  1. 5
      main/gradebook/gradebook.php
  2. 2
      main/gradebook/gradebook_add_link_select_course.php
  3. 19
      main/gradebook/gradebook_edit_all.php
  4. 1
      main/gradebook/gradebook_flatview.php
  5. 9
      main/gradebook/gradebook_showlog_eval.php
  6. 17
      main/gradebook/gradebook_view_result.php
  7. 8
      main/gradebook/lib/GradebookUtils.php
  8. 27
      main/gradebook/lib/gradebook_data_generator.class.php
  9. 6
      main/gradebook/lib/gradebook_result.class.php
  10. 20
      main/gradebook/user_stats.php
  11. 2
      main/survey/survey.lib.php
  12. 2
      main/work/work.lib.php

@ -68,8 +68,8 @@ if (isset($_GET['createallcategories'])) {
header('Location: '.$_SESSION['gradebook_dest'].'?addallcat=&selectcat=0'); header('Location: '.$_SESSION['gradebook_dest'].'?addallcat=&selectcat=0');
exit; exit;
} }
//move a category
//move a category
if (isset($_GET['movecat'])) { if (isset($_GET['movecat'])) {
$move_cat = (int) $_GET['movecat']; $move_cat = (int) $_GET['movecat'];
GradebookUtils::block_students(); GradebookUtils::block_students();
@ -109,7 +109,8 @@ if (isset($_GET['moveeval'])) {
$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,
'move_eval_form', 'move_eval_form',

@ -32,7 +32,7 @@ if ($form->validate()) {
$cat = new Category(); $cat = new Category();
$cat->set_course_code($values['select_course']); $cat->set_course_code($values['select_course']);
$cat->set_name($values['name']); $cat->set_name($values['name']);
header('location: gradebook_add_link.php?selectcat='.$selectCat.'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq()); header('Location: gradebook_add_link.php?selectcat='.$selectCat.'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
exit; exit;
} }

@ -128,7 +128,8 @@ foreach ($links as &$row) {
} }
$output .= '<tr><td>'.GradebookUtils::build_type_icon_tag($row['type']).'</td> $output .= '<tr><td>'.GradebookUtils::build_type_icon_tag($row['type']).'</td>
<td> '.$resource_name.' '.Display::label( <td> '.$resource_name.' '.
Display::label(
$table_evaluated[$row['type']][3], $table_evaluated[$row['type']][3],
'info' 'info'
).' </td>'; ).' </td>';
@ -226,25 +227,19 @@ if ($form->validate()) {
if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) { if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
if (isset($_GET['studentoverview'])) { if (isset($_GET['studentoverview'])) {
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => Security::remove_XSS( 'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$my_selectcat,
$_SESSION['gradebook_dest']
).'?selectcat='.$my_selectcat,
'name' => get_lang('Gradebook'), 'name' => get_lang('Gradebook'),
); );
Display:: display_header(get_lang('FlatView')); Display:: display_header(get_lang('FlatView'));
} elseif (isset($_GET['search'])) { } elseif (isset($_GET['search'])) {
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => Security::remove_XSS( 'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$my_selectcat,
$_SESSION['gradebook_dest']
).'?selectcat='.$my_selectcat,
'name' => get_lang('Gradebook'), 'name' => get_lang('Gradebook'),
); );
Display:: display_header(get_lang('SearchResults')); Display:: display_header(get_lang('SearchResults'));
} else { } else {
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => Security::remove_XSS( 'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=1',
$_SESSION['gradebook_dest']
).'?selectcat=1',
'name' => get_lang('Gradebook'), 'name' => get_lang('Gradebook'),
); );
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
@ -256,9 +251,7 @@ if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
} }
?> ?>
<div class="actions"> <div class="actions">
<a href="<?php echo Security::remove_XSS( <a href="<?php echo Security::remove_XSS($_SESSION['gradebook_dest']).'?'.$my_api_cidreq ?>&selectcat=<?php echo $my_selectcat ?>">
$_SESSION['gradebook_dest']
).'?'.$my_api_cidreq ?>&selectcat=<?php echo $my_selectcat ?>">
<?php echo Display::return_icon( <?php echo Display::return_icon(
'back.png', 'back.png',
get_lang('FolderView'), get_lang('FolderView'),

@ -189,7 +189,6 @@ if (isset($_GET['exportpdf'])) {
$params, $params,
$mainCourseCategory[0] $mainCourseCategory[0]
); );
} else { } else {
Display :: display_header(get_lang('ExportPDF')); Display :: display_header(get_lang('ExportPDF'));
} }

@ -13,19 +13,18 @@ $selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => $_SESSION['gradebook_dest'].'?', 'url' => $_SESSION['gradebook_dest'].'?',
'name' => get_lang('Gradebook' 'name' => get_lang('Gradebook')
)); );
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectCat, 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectCat,
'name' => get_lang('Details' 'name' => get_lang('Details')
)); );
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&amp;selectcat='.$selectCat, 'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&amp;selectcat='.$selectCat,
'name' => get_lang('GradebookQualifyLog') 'name' => get_lang('GradebookQualifyLog')
); );
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
Display::display_header(''); Display::display_header('');
echo Display::page_header(get_lang('GradebookQualifyLog')); echo Display::page_header(get_lang('GradebookQualifyLog'));
$t_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); $t_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);

@ -75,7 +75,12 @@ if (isset($_GET['editres'])) {
$result->set_evaluation_id($select_eval); $result->set_evaluation_id($select_eval);
$row_value = isset($values['score']) ? $values['score'] : 0; $row_value = isset($values['score']) ? $values['score'] : 0;
if (!empty($row_value) || $row_value == 0) { if (!empty($row_value) || $row_value == 0) {
$result->set_score(api_number_format($row_value, api_get_setting('gradebook_number_decimals'))); $result->set_score(
api_number_format(
$row_value,
api_get_setting('gradebook_number_decimals')
)
);
} }
$result->save(); $result->save();
unset($result); unset($result);
@ -185,7 +190,6 @@ if (isset($_GET['import'])) {
) )
); );
header('Location: '.api_get_self().'?import=&selecteval='.$select_eval.'&importnofile='); header('Location: '.api_get_self().'?import=&selecteval='.$select_eval.'&importnofile=');
exit; exit;
} }
if ($overwritescore != 0) { if ($overwritescore != 0) {
@ -326,7 +330,6 @@ if (isset($_GET['export'])) {
); );
} }
$data_table = array(); $data_table = array();
foreach ($data_array as $data) { foreach ($data_array as $data) {
$result = array(); $result = array();
$user_info = api_get_user_info($data['id']); $user_info = api_get_user_info($data['id']);
@ -406,7 +409,13 @@ if (isset($_GET['resultdelete'])) {
if (isset($_POST['action'])) { if (isset($_POST['action'])) {
$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') {
Display::addFlash(Display::return_message(get_lang('NoItemsSelected'), 'warning', false)); Display::addFlash(
Display::return_message(
get_lang('NoItemsSelected'),
'warning',
false
)
);
} else { } else {
switch ($_POST['action']) { switch ($_POST['action']) {
case 'delete': case 'delete':

@ -73,7 +73,7 @@ class GradebookUtils
* @param float * @param float
* @return bool false on error, true on success * @return bool false on error, true on success
*/ */
public static function update_resource_from_course_gradebook($link_id, $course_code, $weight) public static function updateResourceFromCourseGradebook($link_id, $course_code, $weight)
{ {
$course_code = Database::escape_string($course_code); $course_code = Database::escape_string($course_code);
if (!empty($link_id)) { if (!empty($link_id)) {
@ -1299,8 +1299,10 @@ class GradebookUtils
* @param bool $includeNonPublicCertificates Whether include the non-plublic certificates * @param bool $includeNonPublicCertificates Whether include the non-plublic certificates
* @return array * @return array
*/ */
public static function getUserCertificatesInCourses($userId, $includeNonPublicCertificates = true) public static function getUserCertificatesInCourses(
{ $userId,
$includeNonPublicCertificates = true
) {
$userId = intval($userId); $userId = intval($userId);
$courseList = []; $courseList = [];
$courses = CourseManager::get_courses_list_by_user_id($userId); $courses = CourseManager::get_courses_list_by_user_id($userId);

@ -193,7 +193,12 @@ class GradebookDataGenerator
$scoreDisplay = ScoreDisplay::instance(); $scoreDisplay = ScoreDisplay::instance();
$score = AbstractLink::getCurrentUserRanking($userId, $rankingStudentList); $score = AbstractLink::getCurrentUserRanking($userId, $rankingStudentList);
$row['ranking'] = $scoreDisplay->display_score($score, SCORE_DIV, SCORE_BOTH, true); $row['ranking'] = $scoreDisplay->display_score(
$score,
SCORE_DIV,
SCORE_BOTH,
true
);
if ($invalidateResults) { if ($invalidateResults) {
$row['ranking'] = null; $row['ranking'] = null;
} }
@ -219,7 +224,12 @@ class GradebookDataGenerator
); );
$scoreDisplay = ScoreDisplay::instance(); $scoreDisplay = ScoreDisplay::instance();
$display = $scoreDisplay->display_score($score, SCORE_DIV_PERCENT_WITH_CUSTOM, SCORE_BOTH, true); $display = $scoreDisplay->display_score(
$score,
SCORE_DIV_PERCENT_WITH_CUSTOM,
SCORE_BOTH,
true
);
$type = $item->get_item_type(); $type = $item->get_item_type();
if ($type == 'L' && get_class($item) == 'ExerciseLink') { if ($type == 'L' && get_class($item) == 'ExerciseLink') {
$display = ExerciseLib::show_score($score[0], $score[1], false); $display = ExerciseLib::show_score($score[0], $score[1], false);
@ -240,7 +250,12 @@ class GradebookDataGenerator
{ {
$score = $item->calc_score(null, 'average'); $score = $item->calc_score(null, 'average');
$scoreDisplay = ScoreDisplay::instance(); $scoreDisplay = ScoreDisplay::instance();
$display = $scoreDisplay->display_score($score, SCORE_DIV_PERCENT_WITH_CUSTOM, SCORE_BOTH, true); $display = $scoreDisplay->display_score(
$score,
SCORE_DIV_PERCENT_WITH_CUSTOM,
SCORE_BOTH,
true
);
$type = $item->get_item_type(); $type = $item->get_item_type();
if ($type == 'L' && get_class($item) == 'ExerciseLink') { if ($type == 'L' && get_class($item) == 'ExerciseLink') {
@ -268,7 +283,11 @@ class GradebookDataGenerator
$scoreDisplay = null; $scoreDisplay = null;
if (isset($score[0])) { if (isset($score[0])) {
$scoreDisplay = ScoreDisplay::instance(); $scoreDisplay = ScoreDisplay::instance();
$scoreDisplay = $scoreDisplay->display_score($score, SCORE_DIV, SCORE_BOTH); $scoreDisplay = $scoreDisplay->display_score(
$score,
SCORE_DIV,
SCORE_BOTH
);
} }
return array( return array(

@ -89,7 +89,11 @@ class GradeBookResult
//headers //headers
foreach ($data[0] as $header_col) { foreach ($data[0] as $header_col) {
$worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($header_col))); $worksheet->SetCellValueByColumnAndRow(
$line,
$column,
html_entity_decode(strip_tags($header_col))
);
$column++; $column++;
} }
$line++; $line++;

@ -18,8 +18,8 @@ if (!$isDrhOfCourse) {
} }
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => $_SESSION['gradebook_dest'], 'url' => $_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook' 'name' => get_lang('Gradebook')
)); );
$category = Category::load($_GET['selectcat']); $category = Category::load($_GET['selectcat']);
$my_user_id = Security::remove_XSS($_GET['userid']); $my_user_id = Security::remove_XSS($_GET['userid']);
@ -42,7 +42,12 @@ $user_table = new UserTable($my_user_id, $allevals, $alllinks, $addparams);
if (isset($_GET['exportpdf'])) { if (isset($_GET['exportpdf'])) {
$datagen = new UserDataGenerator($my_user_id, $allevals, $alllinks); $datagen = new UserDataGenerator($my_user_id, $allevals, $alllinks);
$data_array = $datagen->get_data(UserDataGenerator :: UDG_SORT_NAME, 0, null, true); $data_array = $datagen->get_data(
UserDataGenerator::UDG_SORT_NAME,
0,
null,
true
);
$newarray = array(); $newarray = array();
$displayscore = ScoreDisplay :: instance(); $displayscore = ScoreDisplay :: instance();
foreach ($data_array as $data) { foreach ($data_array as $data) {
@ -95,15 +100,18 @@ if (isset ($_GET['exportpdf'])) {
$actions = '<div class="actions">'; $actions = '<div class="actions">';
if (isset($_GET['selectcat'])) { if (isset($_GET['selectcat'])) {
$interbreadcrumb[] = array('url' => 'gradebook_flatview.php?selectcat='.Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('FlatView')); $interbreadcrumb[] = array(
'url' => 'gradebook_flatview.php?selectcat='.Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('FlatView')
);
$actions .= '<a href=gradebook_flatview.php?selectcat='.Security::remove_XSS($_GET['selectcat']).'>'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>'; $actions .= '<a href=gradebook_flatview.php?selectcat='.Security::remove_XSS($_GET['selectcat']).'>'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
} }
if (isset($_GET['selecteval'])) { if (isset($_GET['selecteval'])) {
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => 'gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']), 'url' => 'gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']),
'name' => get_lang('ViewResult' 'name' => get_lang('ViewResult')
)); );
$actions .= '<a href=gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'> $actions .= '<a href=gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'>
'.Display::return_icon('back.png', get_lang('BackToEvaluation'), '', ICON_SIZE_MEDIUM).'</a>'; '.Display::return_icon('back.png', get_lang('BackToEvaluation'), '', ICON_SIZE_MEDIUM).'</a>';
} }

@ -505,7 +505,7 @@ class SurveyManager
$session_id $session_id
); );
} else { } else {
GradebookUtils::update_resource_from_course_gradebook( GradebookUtils::updateResourceFromCourseGradebook(
$gradebook_link_id, $gradebook_link_id,
$courseCode, $courseCode,
$survey_weight $survey_weight

@ -4422,7 +4422,7 @@ function updatePublicationAssignment($workId, $params, $courseInfo, $groupId)
api_get_session_id() api_get_session_id()
); );
} else { } else {
GradebookUtils::update_resource_from_course_gradebook( GradebookUtils::updateResourceFromCourseGradebook(
$linkId, $linkId,
$courseInfo['code'], $courseInfo['code'],
$params['weight'] $params['weight']

Loading…
Cancel
Save