Adds id_session in gradebook links.

1.9.x
Julio Montoya 11 years ago
parent 94ff182d7f
commit c303f2392d
  1. 13
      main/gradebook/gradebook_edit_cat.php
  2. 40
      main/gradebook/gradebook_edit_link.php
  3. 31
      main/gradebook/lib/be/evaluation.class.php
  4. 8
      main/gradebook/lib/fe/displaygradebook.php
  5. 13
      main/gradebook/lib/fe/gradebooktable.class.php
  6. 36
      main/gradebook/lib/gradebook_functions.inc.php

@ -21,7 +21,7 @@ $edit_cat = isset($_REQUEST['editcat']) ? intval($_REQUEST['editcat']) : '';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
$htmlHeadXtra[] = '<script type="text/javascript">
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$("#skills").fcbkcomplete({
json_url: "'.api_get_path(WEB_AJAX_PATH).'skill.ajax.php?a=find_skills",
@ -72,7 +72,7 @@ function check_skills() {
}
});
}
},
}
});
}
});
@ -99,7 +99,7 @@ if ($form->validate()) {
if (empty ($values['course_code'])) {
$cat->set_course_code(null);
}else {
} else {
$cat->set_course_code($values['course_code']);
}
@ -122,11 +122,14 @@ if ($form->validate()) {
$cat->set_visible($visible);
$cat->save();
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat=' . $cat->get_parent_id());
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat=' . $cat->get_parent_id().'&'.api_get_cidreq());
exit;
}
$selectcat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : '';
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectcat,'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array(
'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $selectcat . '&' . api_get_cidreq(),
'name' => get_lang('Gradebook')
);
$this_section = SECTION_COURSES;
Display :: display_header(get_lang('EditCategory'));
$form->display();

@ -39,7 +39,14 @@ if ($session_id == 0) {
$cats = Category :: load_session_categories(null, $session_id);
}
$form = new LinkAddEditForm(LinkAddEditForm :: TYPE_EDIT, $cats, null, $link, 'edit_link_form', api_get_self() . '?selectcat=' . $linkcat. '&editlink=' . $linkedit);
$form = new LinkAddEditForm(
LinkAddEditForm :: TYPE_EDIT,
$cats,
null,
$link,
'edit_link_form',
api_get_self() . '?selectcat=' . $linkcat. '&editlink=' . $linkedit.'&'.api_get_cidreq()
);
if ($form->validate()) {
$values = $form->exportValues();
$parent_cat = Category :: load($values['select_gradebook']);
@ -65,31 +72,44 @@ if ($form->validate()) {
$link->save();
//Update weight for attendance
$sql = 'SELECT ref_id FROM '.$tbl_grade_links.' WHERE id = '.intval($_GET['editlink']).' AND type='.LINK_ATTENDANCE;
$sql = 'SELECT ref_id FROM '.$tbl_grade_links.'
WHERE id = '.intval($_GET['editlink']).' AND type='.LINK_ATTENDANCE;
$rs_attendance = Database::query($sql);
if (Database::num_rows($rs_attendance) > 0) {
$row_attendance = Database::fetch_array($rs_attendance);
$attendance_id = $row_attendance['ref_id'];
$upd_attendance = 'UPDATE '.$tbl_attendance.' SET attendance_weight ='.floatval($final_weight).' WHERE c_id = '.$course_id.' AND id = '.intval($attendance_id);
Database::query($upd_attendance);
$sql = 'UPDATE '.$tbl_attendance.' SET
attendance_weight ='.floatval($final_weight).'
WHERE c_id = '.$course_id.' AND id = '.intval($attendance_id);
Database::query($sql);
}
//Update weight into forum thread
$sql_t = 'UPDATE '.$tbl_forum_thread.' SET thread_weight='.$final_weight.'
WHERE c_id = '.$course_id.' AND thread_id=(SELECT ref_id FROM '.$tbl_grade_links.' WHERE id='.intval($_GET['editlink']).' and type=5) ';
WHERE c_id = '.$course_id.' AND thread_id=(
SELECT ref_id FROM '.$tbl_grade_links.'
WHERE id='.intval($_GET['editlink']).' and type=5
) ';
Database::query($sql_t);
//Update weight into student publication(work)
$sql_t = 'UPDATE '.$tbl_work.' SET weight='.$final_weight.'
WHERE c_id = '.$course_id.' AND id = (SELECT ref_id FROM '.$tbl_grade_links.' WHERE id='.intval($_GET['editlink'] ).' AND type=3 )';
$sql_t = 'UPDATE '.$tbl_work.' SET
weight='.$final_weight.'
WHERE c_id = '.$course_id.' AND id = (
SELECT ref_id FROM '.$tbl_grade_links.'
WHERE id='.intval($_GET['editlink'] ).' AND type=3
)';
Database::query($sql_t);
header('Location: '.$_SESSION['gradebook_dest'].'?linkedited=&selectcat=' . $link->get_category_id());
header('Location: '.$_SESSION['gradebook_dest'].'?linkedited=&selectcat=' . $link->get_category_id().'&'.api_get_cidreq());
exit;
}
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$linkcat,'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array(
'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$linkcat,
'name' => get_lang('Gradebook')
);
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready( function() {
$("#hide_category_id").change(function() {

@ -17,16 +17,23 @@ class Evaluation implements GradebookItem
private $weight;
private $eval_max;
private $visible;
private $sessionId;
public function __construct()
{
}
/**
* @return int
*/
public function get_id()
{
return $this->id;
}
/**
* @return string
*/
public function get_name()
{
return $this->name;
@ -47,6 +54,22 @@ class Evaluation implements GradebookItem
return $this->course_code;
}
/**
* @return int
*/
public function getSessionId()
{
return $this->sessionId;
}
/**
* @param int $sessionId
*/
public function setSessionId($sessionId)
{
$this->sessionId = intval($sessionId);
}
public function get_category_id()
{
return $this->category;
@ -206,6 +229,10 @@ class Evaluation implements GradebookItem
return $alleval;
}
/**
* @param array $result
* @return array
*/
private static function create_evaluation_objects_from_sql_result($result)
{
$alleval=array();
@ -224,10 +251,12 @@ class Evaluation implements GradebookItem
$eval->set_visible($data['visible']);
$eval->set_type($data['type']);
$eval->set_locked($data['locked']);
$eval->setSessionId(api_get_session_id());
$alleval[]=$eval;
$alleval[] = $eval;
}
}
return $alleval;
}

@ -348,7 +348,7 @@ class DisplayGradebook
$visibility_command = ($catobj->is_visible() == 0) ? 'set_visible' : 'set_invisible';
//Right icons
$modify_icons = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&cidReq=' . $catobj->get_course_code() . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>';
$modify_icons = '<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>';
//$modify_icons .= '<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>';
//hide or delete are not options available
@ -368,7 +368,7 @@ class DisplayGradebook
/**
* Displays the header for the gradebook containing the navigation tree and links
* @param Category $currentcat
* @param Category $catobj
* @param int $showtree '1' will show the browse tree and naviation buttons
* @param boolean $is_course_admin
* @param boolean $is_platform_admin
@ -553,7 +553,7 @@ class DisplayGradebook
$header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?' . $my_api_cidreq . '&amp;cat_id=' . (int) $_GET['selectcat'] . '">' .
Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '</a>';
// Right icons
$modify_icons = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&amp;cidReq=' . $catobj->get_course_code() . '">' .
$modify_icons = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&amp;cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' .
Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>';
$modify_icons .= '<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>';
@ -596,7 +596,7 @@ class DisplayGradebook
$min_certification = (intval($catobj->get_certificate_min_score() > 0) ? $catobj->get_certificate_min_score() : 0);
$min_certification = get_lang('CertificateMinScore') . ' : ' . $min_certification;
$edit_icon = '<a class="right_link" href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&amp;cidReq=' . $catobj->get_course_code() . '">' .
$edit_icon = '<a class="right_link" href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&amp;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 = Display::tag('h3', $weight.' - '.$min_certification);
$msg = Display::tag('h4', $weight . ' - ' . $min_certification . $edit_icon);

@ -407,13 +407,17 @@ class GradebookTable extends SortableTable
$weight_total_links > $weight_category
) {
$warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category);
$modify_icons = '<a class="right_link" href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'">'.
$modify_icons = '<a class="right_link" href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'.
Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'</a>';
$warning_message .= $modify_icons;
Display::display_warning_message($warning_message, false);
}
$content_html = DocumentManager::replace_user_info_into_html(api_get_user_id(), $course_code);
$content_html = DocumentManager::replace_user_info_into_html(
api_get_user_id(),
$course_code
);
if (!empty($content_html)) {
$new_content = explode('</head>',$content_html['content']);
}
@ -422,11 +426,6 @@ class GradebookTable extends SortableTable
// Set default certificate
$courseData = api_get_course_info($course_code);
DocumentManager::generateDefaultCertificate($courseData);
//$warning_message = get_lang('ThereIsNotACertificateAvailableByDefault');
//$cert_icon = '<a class="right_link" href="../document/document.php?curdirpath=/certificates&'.$course_code.'&origin=gradebook&selectcat=' . $id_cat . '">'.Display::return_icon('certificate.png', get_lang('AttachCertificate'), array(), ICON_SIZE_SMALL).'</a>';
//Display::display_warning_message($warning_message.$cert_icon,false);
}
}

@ -241,7 +241,7 @@ function build_edit_icons_cat($cat, $selectcat)
if ($cat->is_locked() && !api_is_platform_admin()) {
$modify_icons .= Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
} else {
$modify_icons .= '<a href="gradebook_edit_cat.php?' .'editcat=' . $cat->get_id() . '&cidReq=' .$cat->get_course_code() . '">' .
$modify_icons .= '<a href="gradebook_edit_cat.php?' .'editcat=' . $cat->get_id() . '&cidReq=' .$cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' .
Display::return_icon(
'edit.png',
get_lang('Modify'),
@ -251,21 +251,21 @@ function build_edit_icons_cat($cat, $selectcat)
}
}
$modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '">' .
$modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' .
Display::return_icon(
'percentage.png',
get_lang('EditAllWeights'),
'',
ICON_SIZE_SMALL
) . '</a>';
$modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '">' .
$modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' .
Display::return_icon(
'stats.png',
get_lang('FlatView'),
'',
ICON_SIZE_SMALL
) . '</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() .'?visiblecat=' . $cat->get_id() . '&' .$visibility_command . '=&selectcat=' . $selectcat .'&cidReq=' . $cat->get_course_code() . '">' .
$modify_icons .= '&nbsp;<a href="' . api_get_self() .'?visiblecat=' . $cat->get_id() . '&' .$visibility_command . '=&selectcat=' . $selectcat .'&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' .
Display::return_icon(
$visibility_icon . '.png',
get_lang('Visible'),
@ -283,7 +283,7 @@ function build_edit_icons_cat($cat, $selectcat)
if ($cat->is_locked() && !api_is_platform_admin()) {
$modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL);
} else {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&amp;selectcat=' . $selectcat . '&amp;cidReq=' . $cat->get_course_code() . '" onclick="return confirmation();">' .
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&amp;selectcat=' . $selectcat . '&amp;cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '" onclick="return confirmation();">' .
Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>';
}
}
@ -294,7 +294,7 @@ function build_edit_icons_cat($cat, $selectcat)
/**
* Builds the course or platform admin icons to edit an evaluation
* @param object $eval evaluation object
* @param Evaluation $eval evaluation object
* @param int $selectcat id of selected category
*/
function build_edit_icons_eval($eval, $selectcat)
@ -311,12 +311,15 @@ function build_edit_icons_eval($eval, $selectcat)
if ($is_locked && !api_is_platform_admin()) {
$modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
} else {
$modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . ' &amp;cidReq=' . $eval->get_course_code() . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . ' &amp;cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
}
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&amp;' . $visibility_command . '=&amp;selectcat=' . $selectcat . ' ">' . Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&amp;' . $visibility_command . '=&amp;selectcat=' . $selectcat . '&id_session='.$eval->getSessionId(). ' ">' .
Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
if (api_is_allowed_to_edit(null, true)) {
$modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&amp;selectcat=' . $selectcat . ' &amp;cidReq=' . $eval->get_course_code() . '">' . Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&amp;selectcat=' . $selectcat . ' &amp;cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' .
Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
}
/*
@ -332,7 +335,7 @@ function build_edit_icons_eval($eval, $selectcat)
if ($is_locked && !api_is_platform_admin()) {
$modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
} else {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &amp;cidReq=' . $eval->get_course_code() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &amp;cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
}
return $modify_icons;
}
@ -340,7 +343,7 @@ function build_edit_icons_eval($eval, $selectcat)
/**
* Builds the course or platform admin icons to edit a link
* @param object $linkobject
* @param AbstractLink $link
* @param int $selectcat id of selected category
*/
function build_edit_icons_link($link, $selectcat)
@ -362,20 +365,23 @@ function build_edit_icons_link($link, $selectcat)
if ($is_locked && !api_is_platform_admin()) {
$modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
} else {
$modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&amp;cidReq=' . $link->get_course_code() . '">' .
$modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&amp;cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id().'">' .
Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
}
//$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?movelink=' . $link->get_id() . '&selectcat=' . $selectcat . '"><img src="../img/deplacer_fichier.gif" border="0" title="' . get_lang('Move') . '" alt="" /></a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&amp;' . $visibility_command . '=&amp;selectcat=' . $selectcat . ' ">' . Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&amp;selectcat=' . $selectcat . '&amp;cidReq=' . $link->get_course_code() . '">' . Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&amp;' . $visibility_command . '=&amp;selectcat=' . $selectcat . '&id_session='.$link->get_session_id(). ' ">' .
Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&amp;selectcat=' . $selectcat . '&amp;cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '">' .
Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
//If a work is added in a gradebook you can only delete the link in the work tool
if ($is_locked && !api_is_platform_admin()) {
$modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
} else {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletelink=' . $link->get_id() . '&selectcat=' . $selectcat . ' &amp;cidReq=' . $link->get_course_code() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletelink=' . $link->get_id() . '&selectcat=' . $selectcat . ' &amp;cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '" onclick="return confirmation();">' .
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
}
return $modify_icons;
}

Loading…
Cancel
Save