Minor - format code.

pull/2487/head
jmontoyaa 8 years ago
parent 541ab3c36c
commit 9ab8413429
  1. 13
      main/gradebook/gradebook.php
  2. 2
      main/gradebook/gradebook_add_link_select_course.php
  3. 2
      main/gradebook/gradebook_add_result.php
  4. 23
      main/gradebook/gradebook_edit_all.php
  5. 6
      main/gradebook/gradebook_edit_eval.php
  6. 1
      main/gradebook/gradebook_flatview.php
  7. 6
      main/gradebook/gradebook_scoring_system.php
  8. 11
      main/gradebook/gradebook_showlog_eval.php
  9. 2
      main/gradebook/gradebook_showlog_link.php
  10. 27
      main/gradebook/gradebook_view_result.php
  11. 8
      main/gradebook/lib/GradebookUtils.php
  12. 27
      main/gradebook/lib/gradebook_data_generator.class.php
  13. 8
      main/gradebook/lib/gradebook_result.class.php
  14. 32
      main/gradebook/user_stats.php
  15. 2
      main/survey/survey.lib.php
  16. 2
      main/work/work.lib.php

@ -68,15 +68,15 @@ if (isset($_GET['createallcategories'])) {
header('Location: '.$_SESSION['gradebook_dest'].'?addallcat=&selectcat=0');
exit;
}
//move a category
//move a category
if (isset($_GET['movecat'])) {
$move_cat = (int) $_GET['movecat'];
GradebookUtils::block_students();
$cats = Category :: load($move_cat);
if (!isset($_GET['targetcat'])) {
$move_form = new CatForm(
CatForm :: TYPE_MOVE,
CatForm::TYPE_MOVE,
$cats[0],
'move_cat_form',
null,
@ -108,8 +108,9 @@ if (isset($_GET['moveeval'])) {
GradebookUtils::block_students();
$get_move_eval = Security::remove_XSS($_GET['moveeval']);
$evals = Evaluation :: load($get_move_eval);
if (!isset ($_GET['targetcat'])) {
$move_form = new EvalForm(EvalForm :: TYPE_MOVE,
if (!isset($_GET['targetcat'])) {
$move_form = new EvalForm(
EvalForm::TYPE_MOVE,
$evals[0],
null,
'move_eval_form',
@ -142,9 +143,9 @@ if (isset($_GET['moveeval'])) {
if (isset($_GET['movelink'])) {
GradebookUtils::block_students();
$get_move_link = Security::remove_XSS($_GET['movelink']);
$link = LinkFactory :: load($get_move_link);
$link = LinkFactory::load($get_move_link);
$move_form = new LinkForm(
LinkForm :: TYPE_MOVE,
LinkForm::TYPE_MOVE,
null,
$link[0],
'move_link_form',

@ -32,7 +32,7 @@ if ($form->validate()) {
$cat = new Category();
$cat->set_course_code($values['select_course']);
$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;
}

@ -41,7 +41,7 @@ if ($add_result_form->validate()) {
$res->set_evaluation_id($values['evaluation_id']);
$res->set_user_id(key($scores));
//if no scores are given, don't set the score
if ((!empty ($row)) || ($row == '0')) {
if ((!empty($row)) || ($row == '0')) {
$res->set_score($row);
}
$res->add();

@ -128,7 +128,8 @@ foreach ($links as &$row) {
}
$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],
'info'
).' </td>';
@ -224,27 +225,21 @@ if ($form->validate()) {
// DISPLAY HEADERS AND MESSAGES
if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
if (isset ($_GET['studentoverview'])) {
if (isset($_GET['studentoverview'])) {
$interbreadcrumb[] = array(
'url' => Security::remove_XSS(
$_SESSION['gradebook_dest']
).'?selectcat='.$my_selectcat,
'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$my_selectcat,
'name' => get_lang('Gradebook'),
);
Display:: display_header(get_lang('FlatView'));
} elseif (isset ($_GET['search'])) {
} elseif (isset($_GET['search'])) {
$interbreadcrumb[] = array(
'url' => Security::remove_XSS(
$_SESSION['gradebook_dest']
).'?selectcat='.$my_selectcat,
'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$my_selectcat,
'name' => get_lang('Gradebook'),
);
Display:: display_header(get_lang('SearchResults'));
} else {
$interbreadcrumb[] = array(
'url' => Security::remove_XSS(
$_SESSION['gradebook_dest']
).'?selectcat=1',
'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=1',
'name' => get_lang('Gradebook'),
);
$interbreadcrumb[] = array(
@ -256,9 +251,7 @@ if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
}
?>
<div class="actions">
<a href="<?php echo Security::remove_XSS(
$_SESSION['gradebook_dest']
).'?'.$my_api_cidreq ?>&selectcat=<?php echo $my_selectcat ?>">
<a href="<?php echo Security::remove_XSS($_SESSION['gradebook_dest']).'?'.$my_api_cidreq ?>&selectcat=<?php echo $my_selectcat ?>">
<?php echo Display::return_icon(
'back.png',
get_lang('FolderView'),

@ -15,7 +15,7 @@ if ($evaledit[0]->is_locked() && !api_is_platform_admin()) {
api_not_allowed();
}
$form = new EvalForm(
EvalForm :: TYPE_EDIT,
EvalForm::TYPE_EDIT,
$evaledit[0],
null,
'edit_eval_form',
@ -72,6 +72,6 @@ $(document).ready( function() {
});
</script>';
Display :: display_header(get_lang('EditEvaluation'));
Display::display_header(get_lang('EditEvaluation'));
$form->display();
Display :: display_footer();
Display::display_footer();

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

@ -100,16 +100,16 @@ if ($scoreform->validate()) {
}
$this_section = SECTION_COURSES;
Display :: display_header(get_lang('ScoreEdit'));
Display::display_header(get_lang('ScoreEdit'));
if (((isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'false') ||
(isset($_GET['selectcat']) && ($_SESSION['studentview'] == 'teacherview')))
) {
if (isset ($_GET['scoringupdated'])) {
if (isset($_GET['scoringupdated'])) {
echo Display::return_message(get_lang('ScoringUpdated'), 'confirm', false);
}
if (isset ($_GET['nouniqueranges'])) {
if (isset($_GET['nouniqueranges'])) {
echo Display::return_message(get_lang('NoUniqueScoreRanges'), 'error', false);
}
$scoreform->display();

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

@ -26,7 +26,7 @@ $interbreadcrumb[] = array(
'name' => get_lang('GradebookQualifyLog')
);
$this_section = SECTION_COURSES;
Display :: display_header('');
Display::display_header('');
echo '<div class="actions">';
api_display_tool_title(get_lang('GradebookQualifyLog'));
echo '</div>';

@ -29,15 +29,15 @@ if (empty($select_eval)) {
api_not_allowed();
}
$displayscore = ScoreDisplay :: instance();
$displayscore = ScoreDisplay::instance();
$eval = Evaluation :: load($select_eval);
$overwritescore = 0;
if ($eval[0]->get_category_id() < 0) {
// if category id is negative, then the evaluation's origin is a link
$link = LinkFactory :: get_evaluation_link($eval[0]->get_id());
$currentcat = Category :: load($link->get_category_id());
$link = LinkFactory::get_evaluation_link($eval[0]->get_id());
$currentcat = Category::load($link->get_category_id());
} else {
$currentcat = Category:: load($eval[0]->get_category_id());
$currentcat = Category::load($eval[0]->get_category_id());
}
//load the result with the evaluation id
@ -57,7 +57,7 @@ if (isset($_GET['editres'])) {
$edit_res_xml = Security::remove_XSS($_GET['editres']);
$resultedit = Result :: load($edit_res_xml);
$edit_res_form = new EvalForm(
EvalForm :: TYPE_RESULT_EDIT,
EvalForm::TYPE_RESULT_EDIT,
$eval[0],
$resultedit[0],
'edit_result_form',
@ -75,7 +75,12 @@ if (isset($_GET['editres'])) {
$result->set_evaluation_id($select_eval);
$row_value = isset($values['score']) ? $values['score'] : 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();
unset($result);
@ -185,7 +190,6 @@ if (isset($_GET['import'])) {
)
);
header('Location: '.api_get_self().'?import=&selecteval='.$select_eval.'&importnofile=');
exit;
}
if ($overwritescore != 0) {
@ -326,7 +330,6 @@ if (isset($_GET['export'])) {
);
}
$data_table = array();
foreach ($data_array as $data) {
$result = array();
$user_info = api_get_user_info($data['id']);
@ -406,7 +409,13 @@ if (isset($_GET['resultdelete'])) {
if (isset($_POST['action'])) {
$number_of_selected_items = count($_POST['id']);
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 {
switch ($_POST['action']) {
case 'delete':

@ -73,7 +73,7 @@ class GradebookUtils
* @param float
* @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);
if (!empty($link_id)) {
@ -1299,8 +1299,10 @@ class GradebookUtils
* @param bool $includeNonPublicCertificates Whether include the non-plublic certificates
* @return array
*/
public static function getUserCertificatesInCourses($userId, $includeNonPublicCertificates = true)
{
public static function getUserCertificatesInCourses(
$userId,
$includeNonPublicCertificates = true
) {
$userId = intval($userId);
$courseList = [];
$courses = CourseManager::get_courses_list_by_user_id($userId);

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

@ -74,7 +74,7 @@ class GradeBookResult
/**
* Exports the complete report as an XLS file
* @param array $data
* @return boolean|null False on error
* @return boolean|null False on error
*/
public function exportCompleteReportXLS($data)
{
@ -89,7 +89,11 @@ class GradeBookResult
//headers
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++;
}
$line++;

@ -18,10 +18,10 @@ if (!$isDrhOfCourse) {
}
$interbreadcrumb[] = array(
'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']);
$allevals = $category[0]->get_evaluations($my_user_id, true);
$alllinks = $category[0]->get_links($my_user_id, true);
@ -40,9 +40,14 @@ if ($_GET['selectcat'] != null) {
$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);
$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();
$displayscore = ScoreDisplay :: instance();
foreach ($data_array as $data) {
@ -95,15 +100,18 @@ if (isset ($_GET['exportpdf'])) {
$actions = '<div class="actions">';
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>';
}
if (isset ($_GET['selecteval'])) {
if (isset($_GET['selecteval'])) {
$interbreadcrumb[] = array(
'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']).'>
'.Display::return_icon('back.png', get_lang('BackToEvaluation'), '', ICON_SIZE_MEDIUM).'</a>';
}
@ -113,8 +121,8 @@ $actions .= '<a href="'.api_get_self().'?exportpdf=&userid='.Security::remove_XS
$actions .= '</div>';
Display :: display_header(get_lang('ResultsPerUser'));
Display::display_header(get_lang('ResultsPerUser'));
echo $actions;
DisplayGradebook :: display_header_user($_GET['userid'], $category[0]->get_id());
DisplayGradebook::display_header_user($_GET['userid'], $category[0]->get_id());
$user_table->display();
Display :: display_footer();
Display::display_footer();

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

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

Loading…
Cancel
Save