Removing old grading model tool

skala
Julio Montoya 14 years ago
parent 94e4176c5d
commit 4b26e9aa08
  1. 5
      main/admin/settings.lib.php
  2. 97
      main/admin/settings.php
  3. 7
      main/course_info/infocours.php
  4. 9
      main/gradebook/gradebook_add_cat.php
  5. 4
      main/gradebook/index.php
  6. 10
      main/gradebook/lib/fe/catform.class.php
  7. 2
      main/inc/lib/add_course.lib.inc.php

@ -1219,10 +1219,9 @@ function generate_settings_form($settings, $settings_by_access_list) {
$form->addElement('select', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), call_user_func('select_'.$row['variable']), $hideme);
$default_values[$row['variable']] = $row['selected_value'];
break;
case 'custom_gradebook':
case 'custom':
$values = api_get_settings_options($row['variable']);
/*$values = api_get_settings_options($row['variable']);
//$renderer = & $form->defaultRenderer();
//$renderer->setElementTemplate('{label} - {element}<!-- BEGIN label_2 --><span class="help-block">{label_2}</span><!-- END label_2 -->');
@ -1279,7 +1278,7 @@ function generate_settings_form($settings, $settings_by_access_list) {
$form->addGroup($group, '', get_lang('AddNewModel'), "&nbsp;&nbsp;".get_lang('NumberOfSubEvaluations')."&nbsp;");
$form->addElement('style_submit_button', null, get_lang('Add'), 'class="add"');
*/
break;
/*

@ -78,28 +78,6 @@ if (isset($_GET['delete_watermark'])) {
$watermark_deleted = PDF::delete_watermark();
}
if (isset($_POST['new_model']) && isset($_POST['number_evaluations']) && !empty($_POST['new_model'])) {
$count = intval($_POST['number_evaluations']);
$string_to_save = '';
for ($i = 1; $i<=$count;$i++) {
$sum = "+";
if ($i == $count) {
$sum = "";
}
//Note: We use rand here because there is a unique index in the settings_options table. The 'variable' and 'value' fields must be unique
$string_to_save .= rand(1, 3).'*X'.$sum;
}
$string_to_save .= "/".$count;
$array_to_save = array();
$array_to_save['variable'] = 'grading_model';
$array_to_save['display_text'] = $_POST['new_model'];
$array_to_save['value'] = $string_to_save;
$result = api_set_setting_option($array_to_save);
$_POST['new_model'] = null;
}
if (isset($_GET['action']) && $_GET['action'] == 'delete_grading') {
$id = intval($_GET['id']);
api_delete_setting_option($id);
@ -243,38 +221,21 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
}
if ($old_value != $value) $keys[] = $key;
$result = api_set_setting($key, $value, null, null, $_configuration['access_url']);
} else {
if ($key == 'grading_model') {
foreach ($value as $my_key => $option) {
$array_to_save = array();
//build this: 1*X+2*X+3*X/4
$string_to_save = '';
foreach ($option['items'] as $item) {
$string_to_save .= $item.'*X+';
}
$string_to_save = substr($string_to_save, 0, strlen($string_to_save)- 1) . '/'.$option['denominator'];
$array_to_save['display_text'] = $option['display_text'];
$array_to_save['value'] = $string_to_save;
$array_to_save['id'] = $my_key;
$result = api_set_setting_option($array_to_save);
}
} else {
$sql = "SELECT subkey FROM $table_settings_current WHERE variable = '$key'";
$res = Database::query($sql);
while ($row_subkeys = Database::fetch_array($res)) {
// If subkey is changed:
if ((isset($value[$row_subkeys['subkey']]) && api_get_setting($key, $row_subkeys['subkey']) == 'false') ||
(!isset($value[$row_subkeys['subkey']]) && api_get_setting($key, $row_subkeys['subkey']) == 'true')) {
$keys[] = $key;
break;
}
}
foreach ($value as $subkey => $subvalue) {
$result = api_set_setting($key, 'true', $subkey, null, $_configuration['access_url']);
}
}
} else {
$sql = "SELECT subkey FROM $table_settings_current WHERE variable = '$key'";
$res = Database::query($sql);
while ($row_subkeys = Database::fetch_array($res)) {
// If subkey is changed:
if ((isset($value[$row_subkeys['subkey']]) && api_get_setting($key, $row_subkeys['subkey']) == 'false') ||
(!isset($value[$row_subkeys['subkey']]) && api_get_setting($key, $row_subkeys['subkey']) == 'true')) {
$keys[] = $key;
break;
}
}
foreach ($value as $subkey => $subvalue) {
$result = api_set_setting($key, 'true', $subkey, null, $_configuration['access_url']);
}
}
}
@ -292,38 +253,10 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
}
}
}
$htmlHeadXtra[] = '<script language="javascript">
function delete_grading_model(id) {
window.location = "settings.php?category=Gradebook&action=delete_grading&id=" + id;
}
$(document).ready(function() {
var elements = ["B","C","D","E","F","G","H","I", "J", "K", "L","M","N","O","P","Q","R"];
var i = 0;
$(".controls").each(function(index) {
$(this).find("*").each(function(index2) {
if ($(this).hasClass("first_number")) {
$(this).before("<b>( A * </b>");
}
if ($(this).hasClass("denominator")) {
$(this).before("<b> \) / </b>");
}
if ($(this).hasClass("number")) {
$(this).before("<b> + " + elements[i] + " * </b>");
i++;
}
});
i = 0;
});
});
</script>';
// Including the header (banner).
Display :: display_header($tool_name);
// The action images.
$action_images['platform'] = 'platform.png';
$action_images['course'] = 'course.png';

@ -248,7 +248,7 @@ $form->addElement('html', '</div></div>');
// Gradebook SETTINGS
$form->addElement('html', '<div><h3>'.Display::return_icon('gradebook.png', Security::remove_XSS(get_lang('Gradebook')),'',ICON_SIZE_SMALL).' '.Security::remove_XSS(get_lang('Gradebook')).'</h3><div>');
$group = array();
/*$group = array();
$models = api_get_settings_options('grading_model');
if (!empty($models )) {
foreach ($models as $option) {
@ -261,11 +261,10 @@ if (!empty($models )) {
$element = $form->createElement('radio', 'course_grading_model', '', get_lang('None'), 0);
$group[] = $element;
$form->addGroup($group, '', array(get_lang('GradingModelTitle')), '', 'li', false);
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
$form->addElement('html', '</div></div>');
$form->addElement('html', '</div></div>');*/
// USER RIGHTS
$form->addElement('html', '<div> <h3>'.Display::return_icon('user.png', Security::remove_XSS(get_lang('UserRights')),'',ICON_SIZE_SMALL).' '.Security::remove_XSS(get_lang('UserRights')).'</h3><div>');
@ -409,7 +408,7 @@ $values['enable_lp_auto_launch'] = api_get_course_setting('en
$values['pdf_export_watermark_text'] = api_get_course_setting('pdf_export_watermark_text');
$values['course_grading_model'] = api_get_course_setting('course_grading_model');
//$values['course_grading_model'] = api_get_course_setting('course_grading_model');
$form->setDefaults($values);

@ -97,7 +97,7 @@ if ($_in_course) {
}
$catadd->set_course_code(api_get_course_id());
/*
$models = api_get_settings_options('grading_model');
$course_grading_model_id = api_get_course_setting('course_grading_model');
$grading_model = '';
@ -110,8 +110,7 @@ if (!empty($course_grading_model_id)) {
}
$grading_contents = api_grading_model_functions($grading_model, 'to_array');
*/
$form = new CatForm(CatForm :: TYPE_ADD, $catadd, 'add_cat_form', null, api_get_self() . '?selectcat='.$get_select_cat);
@ -160,7 +159,7 @@ Display :: display_header(get_lang('NewCategory'));
$display_form = true;
if (!empty($grading_contents)) {
/*if (!empty($grading_contents)) {
$count_items = count($grading_contents['items']);
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init
$cats_count = count($cats) - 1 ;
@ -169,7 +168,7 @@ if (!empty($grading_contents)) {
Display::display_warning_message(get_lang('CheckYourGradingModelValues'));
$display_form = false;
}
}
}*/
if ($display_form)
$form->display();

@ -833,7 +833,7 @@ if (api_is_allowed_to_edit(null, true)) {
if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
echo '<meta http-equiv="refresh" content="0;url='.api_get_self().'?cidReq='.$course_code.'" />';
} else {
$models = api_get_settings_options('grading_model');
/*$models = api_get_settings_options('grading_model');
$course_grading_model_id = api_get_course_setting('course_grading_model');
$grading_model = '';
if (!empty($course_grading_model_id)) {
@ -847,7 +847,7 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
}
$grading_contents = api_grading_model_functions($grading_model, 'to_array');
$grading_string = api_grading_model_functions($grading_model, 'decorate');
$grading_string = api_grading_model_functions($grading_model, 'decorate');*/
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init

@ -144,7 +144,7 @@ class CatForm extends FormValidator {
$this->freeze('name');
}
$models = api_get_settings_options('grading_model');
/*$models = api_get_settings_options('grading_model');
$course_grading_model_id = api_get_course_setting('course_grading_model');
$grading_model = '';
if (!empty($course_grading_model_id)) {
@ -156,10 +156,10 @@ class CatForm extends FormValidator {
}
$grading_contents = api_grading_model_functions($grading_model, 'to_array');
if (!empty($grading_contents)) {
*/
if (0) {
$course_code = api_get_course_id();
/*$course_code = api_get_course_id();
$session_id = api_get_session_id();
///direct access to one evaluation
@ -172,7 +172,7 @@ class CatForm extends FormValidator {
$this->add_textfield('weight', get_lang('TotalWeight'), true, array('value'=> $value,'size'=>'4','maxlength'=>'5'));
//$this->addRule('weight',get_lang('ThisFieldIsRequired'),'required');
$this->freeze('weight');
$this->freeze('weight'); */
} else {
$this->add_textfield('weight', array(get_lang('TotalWeight'), get_lang('TotalSumOfWeights')), true, array('value'=>$value,'size'=>'4','maxlength'=>'5'));
$this->addRule('weight',get_lang('ThisFieldIsRequired'),'required');

@ -2353,8 +2353,6 @@ function fill_Db_course($course_id, $course_repository, $language, $default_docu
Database::query("INSERT INTO $TABLESETTING (c_id, variable,value,category) VALUES ($course_id, 'email_alert_students_on_new_homework',0,'work')");
Database::query("INSERT INTO $TABLESETTING (c_id, variable,value,category) VALUES ($course_id, 'enable_lp_auto_launch',0,'learning_path')");
Database::query("INSERT INTO $TABLESETTING (c_id, variable,value,category) VALUES ($course_id, 'pdf_export_watermark_text','','learning_path')");
Database::query("INSERT INTO $TABLESETTING (c_id, variable,value,category) VALUES ($course_id, 'course_grading_model','0','gradebook')");
/* Course homepage tools for platform admin only */

Loading…
Cancel
Save