Add api_get_cidreq() in URLs

pull/2487/head
jmontoyaa 7 years ago
parent 35761b5c12
commit 3e970ef9b8
  1. 10
      main/gradebook/gradebook_edit_all.php
  2. 8
      main/gradebook/gradebook_view_result.php
  3. 6
      main/gradebook/index.php
  4. 13
      main/gradebook/lib/fe/displaygradebook.php
  5. 2
      main/gradebook/lib/fe/usertable.class.php
  6. 43
      main/gradebook/user_stats.php

@ -7,7 +7,6 @@
* @author Julio Montoya - fixes in order to use gradebook models + some code cleaning
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_GRADEBOOK;
@ -16,7 +15,7 @@ api_protect_course_script(true);
api_block_anonymous_users();
GradebookUtils::block_students();
$my_selectcat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : '';
$my_selectcat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : 0;
if (empty($my_selectcat)) {
api_not_allowed(true);
@ -168,7 +167,6 @@ foreach ($evaluations as $evaluationRow) {
</td></tr>';
}
$my_api_cidreq = api_get_cidreq();
$currentUrl = api_get_self().'?'.api_get_cidreq().'&selectcat='.$my_selectcat;
$form = new FormValidator('auto_weight', 'post', $currentUrl);
@ -219,8 +217,9 @@ if ($form->validate()) {
$weightToApply
);
}
Display::addFlash(Display::return_message(get_lang('GradebookWeightUpdated')));
header('Location:'.$currentUrl);
header('Location: '.$currentUrl);
exit;
}
@ -274,8 +273,7 @@ $warning_message = sprintf(get_lang('TotalWeightMustBeX'), $original_total);
echo Display::return_message($warning_message, 'warning', false);
?>
<form method="post"
action="gradebook_edit_all.php?<?php echo $my_api_cidreq ?>&selectcat=<?php echo $my_selectcat ?>">
<form method="post" action="<?php echo $currentUrl; ?>">
<table class="data_table">
<tr class="row_odd">
<th style="width: 35px;"><?php echo get_lang('Type'); ?></th>

@ -226,7 +226,7 @@ if (isset($_GET['import'])) {
if (isset($_GET['export'])) {
$interbreadcrumb[] = array(
'url' => 'gradebook_view_result.php?selecteval='.$select_eval,
'url' => 'gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq(),
'name' => get_lang('ViewResult'),
);
$locked_status = $eval[0]->get_locked();
@ -234,12 +234,12 @@ if (isset($_GET['export'])) {
DataForm :: TYPE_EXPORT,
'export_result_form',
null,
api_get_self().'?export=&selecteval='.$select_eval,
api_get_self().'?export=&selecteval='.$select_eval.'&'.api_get_cidreq(),
'_blank',
$locked_status
);
if (!$export_result_form->validate()) {
Display :: display_header(get_lang('Export'));
Display::display_header(get_lang('Export'));
}
if ($export_result_form->validate()) {
@ -399,7 +399,7 @@ if (isset($_GET['export'])) {
}
if (isset($_GET['resultdelete'])) {
$result = Result :: load($_GET['resultdelete']);
$result = Result::load($_GET['resultdelete']);
$result[0]->delete();
Display::addFlash(Display::return_message(get_lang('ResultDeleted')));
header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq());

@ -213,7 +213,7 @@ if (isset($_GET['moveeval'])) {
}
} else {
$targetcat = Category::load($_GET['targetcat']);
$course_to_crsind = ($evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
$course_to_crsind = $evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null;
if (!($course_to_crsind && !isset($_GET['confirm']))) {
$evals[0]->move_to_cat($targetcat[0]);
@ -235,14 +235,14 @@ if (isset($_GET['movelink'])) {
$link[0],
'move_link_form',
null,
api_get_self().'?movelink='.$_GET['movelink'].'&selectcat='.$selectCat
api_get_self().'?movelink='.$_GET['movelink'].'&selectcat='.$selectCat.'&'.api_get_cidreq()
);
if ($move_form->validate()) {
$targetcat = Category::load($move_form->exportValue('move_cat'));
$link[0]->move_to_cat($targetcat[0]);
unset($link);
header('Location: '.api_get_self().'?linkmoved=&selectcat='.$selectCat);
header('Location: '.api_get_self().'?linkmoved=&selectcat='.$selectCat.'&'.api_get_cidreq());
exit;
}
}

@ -459,13 +459,13 @@ class DisplayGradebook
}
// Right icons
$actionsRight = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&amp;cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.
$actionsRight = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.
Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsRight .= '<a href="../document/document.php?curdirpath=/certificates&'.$my_api_cidreq.'&origin=gradebook&selectcat='.$catobj->get_id().'">'.
Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM).'</a>';
if (empty($categories)) {
$actionsRight .= '<a href="gradebook_edit_all.php?id_session='.api_get_session_id().'&amp;'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
$actionsRight .= '<a href="gradebook_edit_all.php?id_session='.api_get_session_id().'&'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM).'</a>';
}
$score_display_custom = api_get_setting('gradebook_score_display_custom');
@ -508,7 +508,7 @@ class DisplayGradebook
$min_certification = intval($catobj->getCertificateMinScore() > 0) ? $catobj->getCertificateMinScore() : 0;
$min_certification = get_lang('CertificateMinScore').' : '.$min_certification;
$edit_icon = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&amp;cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.
$edit_icon = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.
Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
$msg = $weight.' - '.$min_certification.$edit_icon;
@ -571,8 +571,8 @@ class DisplayGradebook
}
/**
* @param $userId
* @param $categoryId
* @param int $userId
* @param int $categoryId
* @return string
*/
public static function display_header_user($userId, $categoryId)
@ -614,8 +614,7 @@ class DisplayGradebook
$info .= '<div class="thumbnail"><img src="'.$user['avatar'].'" /></div>';
$info .= '</div>';
$info .= '<div class="col-md-6">';
$info .= get_lang('Name').' : <a target="_blank" href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userId.'"> '.
$user['complete_name'].'</a><br />';
$info .= get_lang('Name').' : '.$user['complete_name_with_message_link'].'<br />';
if (api_get_setting('show_email_addresses') == 'true') {
$info .= get_lang('Email').' : <a href="mailto:'.$user['email'].'">'.$user['email'].'</a><br />';

@ -124,7 +124,7 @@ class UserTable extends SortableTable
// evaluation
case 'E':
return '&nbsp;'
. '<a href="gradebook_view_result.php?selecteval='.$item->get_id().'">'
. '<a href="gradebook_view_result.php?selecteval='.$item->get_id().'&'.api_get_cidreq().'">'
. $item->get_name()
. '</a>';
// link

@ -21,27 +21,30 @@ $interbreadcrumb[] = array(
'name' => get_lang('Gradebook')
);
$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);
$categoryId = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
$evaluationId = isset($_GET['selecteval']) ? (int) $_GET['selecteval'] : 0;
if ($_GET['selectcat'] != null) {
$category = Category::load($categoryId);
$userId = Security::remove_XSS($_GET['userid']);
$allevals = $category[0]->get_evaluations($userId, true);
$alllinks = $category[0]->get_links($userId, true);
if (!empty($categoryId)) {
$addparams = array(
'userid' => $my_user_id,
'selectcat' => Security::remove_XSS($_GET['selectcat'])
'userid' => $userId,
'selectcat' => $categoryId
);
} else {
$addparams = array(
'userid' => $my_user_id,
'selecteval' => Security::remove_XSS($_GET['selecteval'])
'userid' => $userId,
'selecteval' => $evaluationId
);
}
$user_table = new UserTable($my_user_id, $allevals, $alllinks, $addparams);
$user_table = new UserTable($userId, $allevals, $alllinks, $addparams);
if (isset($_GET['exportpdf'])) {
$datagen = new UserDataGenerator($my_user_id, $allevals, $alllinks);
$datagen = new UserDataGenerator($userId, $allevals, $alllinks);
$data_array = $datagen->get_data(
UserDataGenerator::UDG_SORT_NAME,
0,
@ -53,8 +56,8 @@ if (isset($_GET['exportpdf'])) {
foreach ($data_array as $data) {
$newarray[] = array_slice($data, 1);
}
$userInfo = api_get_user_info($my_user_id);
$html .= get_lang('Results').' : '.$userInfo['complete_name'].' ('.api_convert_and_format_date(null, DATE_FORMAT_SHORT).' '.api_convert_and_format_date(null, TIME_NO_SEC_FORMAT).')';
$userInfo = api_get_user_info($userId);
$html .= get_lang('Results').' : '.$userInfo['complete_name_with_username'].' ('.api_get_local_time().')';
if ($displayscore->is_custom()) {
$header_names = array(
@ -99,12 +102,12 @@ if (isset($_GET['exportpdf'])) {
}
$actions = '<div class="actions">';
if (isset($_GET['selectcat'])) {
if (!empty($categoryId)) {
$interbreadcrumb[] = array(
'url' => 'gradebook_flatview.php?selectcat='.Security::remove_XSS($_GET['selectcat']),
'url' => 'gradebook_flatview.php?selectcat='.$categoryId.'&'.api_get_cidreq(),
'name' => get_lang('FlatView')
);
$actions .= '<a href=gradebook_flatview.php?selectcat='.Security::remove_XSS($_GET['selectcat']).'>'.
$actions .= '<a href=gradebook_flatview.php?selectcat='.$categoryId.'&'.api_get_cidreq().'>'.
Display::return_icon(
'back.png',
get_lang('BackTo').' '.get_lang('FlatView'),
@ -114,16 +117,16 @@ if (isset($_GET['selectcat'])) {
'</a>';
}
if (isset($_GET['selecteval'])) {
if (!empty($evaluationId)) {
$interbreadcrumb[] = array(
'url' => 'gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']),
'url' => 'gradebook_view_result.php?selecteval='.$evaluationId.'&'.api_get_cidreq(),
'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='.$evaluationId.'&'.api_get_cidreq().'">
'.Display::return_icon('back.png', get_lang('BackToEvaluation'), '', ICON_SIZE_MEDIUM).'</a>';
}
$actions .= '<a href="'.api_get_self().'?exportpdf=&userid='.Security::remove_XSS($_GET['userid']).'&selectcat='.$category[0]->get_id().'" target="_blank">
$actions .= '<a href="'.api_get_self().'?exportpdf=&userid='.$userId.'&selectcat='.$category[0]->get_id().'&'.api_get_cidreq().'" target="_blank">
' . Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM).'</a>';
$actions .= '</div>';

Loading…
Cancel
Save