|
|
|
@ -7,7 +7,7 @@ |
|
|
|
|
/** |
|
|
|
|
* Init |
|
|
|
|
*/ |
|
|
|
|
$language_file = array('gradebook','link'); |
|
|
|
|
$language_file = array('gradebook', 'exercice', 'link'); |
|
|
|
|
//$cidReset = true; |
|
|
|
|
require_once '../inc/global.inc.php'; |
|
|
|
|
require_once 'lib/be.inc.php'; |
|
|
|
@ -42,9 +42,9 @@ if ($session_id == 0) { |
|
|
|
|
|
|
|
|
|
$form = new LinkAddEditForm(LinkAddEditForm :: TYPE_EDIT, $cats, null, $link, 'edit_link_form', api_get_self() . '?selectcat=' . $linkcat. '&editlink=' . $linkedit); |
|
|
|
|
if ($form->validate()) { |
|
|
|
|
$values = $form->exportValues(); |
|
|
|
|
$parent_cat = Category :: load($values['select_gradebook']); |
|
|
|
|
|
|
|
|
|
$values = $form->exportValues(); |
|
|
|
|
$parent_cat = Category :: load($values['select_gradebook']); |
|
|
|
|
|
|
|
|
|
$final_weight = null; |
|
|
|
|
/* |
|
|
|
|
if ($parent_cat[0]->get_parent_id() == 0) { |
|
|
|
@ -52,13 +52,13 @@ if ($form->validate()) { |
|
|
|
|
} else { |
|
|
|
|
$cat = Category :: load($parent_cat[0]->get_parent_id()); |
|
|
|
|
$global_weight = $cat[0]->get_weight(); |
|
|
|
|
$final_weight = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight(); |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
$final_weight = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight(); |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
$final_weight = $values['weight_mask']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$link->set_weight($final_weight); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($values['select_gradebook'])) { |
|
|
|
|
$link->set_category_id($values['select_gradebook']); |
|
|
|
|
} |
|
|
|
@ -76,15 +76,15 @@ if ($form->validate()) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Update weight into forum thread |
|
|
|
|
$sql_t = 'UPDATE '.$tbl_forum_thread.' SET thread_weight='.$final_weight.' |
|
|
|
|
$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) '; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database::query($sql_t); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Update weight into student publication(work) |
|
|
|
|
$sql_t = 'UPDATE '.$tbl_work.' SET weight='.$final_weight.' |
|
|
|
|
$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()); |
|
|
|
|
exit; |
|
|
|
@ -94,18 +94,18 @@ $interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_d |
|
|
|
|
$htmlHeadXtra[] = '<script type="text/javascript"> |
|
|
|
|
$(document).ready( function() { |
|
|
|
|
|
|
|
|
|
$("#hide_category_id").change(function(){ |
|
|
|
|
$("#hide_category_id").change(function(){ |
|
|
|
|
$("#hide_category_id option:selected").each(function () { |
|
|
|
|
var cat_id = $(this).val(); |
|
|
|
|
$.ajax({ |
|
|
|
|
url: "'.api_get_path(WEB_AJAX_PATH).'gradebook.ajax.php?a=get_gradebook_weight", |
|
|
|
|
$.ajax({ |
|
|
|
|
url: "'.api_get_path(WEB_AJAX_PATH).'gradebook.ajax.php?a=get_gradebook_weight", |
|
|
|
|
data: "cat_id="+cat_id, |
|
|
|
|
success: function(return_value) { |
|
|
|
|
if (return_value != 0 ) { |
|
|
|
|
$("#max_weight").html(return_value); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
$("#max_weight").html(return_value); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
@ -113,4 +113,4 @@ $(document).ready( function() { |
|
|
|
|
|
|
|
|
|
Display :: display_header(get_lang('EditLink')); |
|
|
|
|
$form->display(); |
|
|
|
|
Display :: display_footer(); |
|
|
|
|
Display :: display_footer(); |
|
|
|
|