Fixing Grade model creation

skala
Julio Montoya 14 years ago
parent 09b5a6d00f
commit 048af1fdc9
  1. 5
      main/admin/grade_models.php
  2. 3
      main/admin/index.php
  3. 7
      main/gradebook/index.php
  4. 19
      main/inc/lib/grade_model.lib.php

@ -37,8 +37,8 @@ if ($action == 'add') {
$interbreadcrumb[]=array('url' => '#','name' => get_lang('GradeModel'));
}
$htmlHeadXtra[]= '
<script>
$htmlHeadXtra[]= '<script>
function plusItem(item) {
if (item != 1) {
document.getElementById(item).style.display = "inline";
@ -50,6 +50,7 @@ $htmlHeadXtra[]= '
//document.getElementById("txta-"+(item-1)).value = "";
}
}
function minItem(item) {
if (item != 1) {
document.getElementById(item).style.display = "none";

@ -120,8 +120,7 @@ if (api_is_platform_admin()) {
$items[] = array('url'=>'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
$items[] = array('url'=>'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
$items[] = array('url'=>'grade_models.php', 'label' => get_lang('GradeModel'));
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url'=>'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));

@ -852,7 +852,7 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init
if (!empty($cats)) {
$items = $grading_contents['items'];
//$items = $grading_contents['items'];
$i = 0;
foreach ($cats as $cat) {
@ -879,8 +879,7 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
foreach ($grade_models as $item) {
$options[$item['id']] = $item['name'];
}
//$grade_model_id = $cat->get_grade_model_id();
//
//No children
if (empty($allcat)) {
$form = new FormValidator('grade_model_settings');
@ -911,8 +910,6 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
$params['grade_model_id'] = api_get_session_id();
$gradebook->save($params);
}
}
}

@ -70,11 +70,22 @@ class GradeModel extends Model {
$form->addElement('label', get_lang('Components'));
//Get components
$nr_items = 10;
$nr_items = 2;
$max = 10;
// Setting the defaults
$defaults = $this->get($id);
$components = $this->get_components($defaults['grade_model_id']);
if ($action == 'edit') {
if (!empty($components)) {
$nr_items = count($components) -1;
}
}
$renderer = & $form->defaultRenderer();
for ($i = 0; $i <= $nr_items; $i++) {
for ($i = 0; $i <= $max; $i++) {
$counter = $i;
$form->addElement('text', 'components['.$i.'][percentage]', null, array('class' => 'span1'));
$form->addElement('text', 'components['.$i.'][acronym]', null, array('class' => 'span1'));
@ -114,10 +125,6 @@ class GradeModel extends Model {
$form->addElement('style_submit_button', 'submit', get_lang('Add'), 'class="save"');
}
// Setting the defaults
$defaults = $this->get($id);
$components = $this->get_components($defaults['grade_model_id']);
if (!empty($components)) {
$counter = 0;
foreach ($components as $component) {

Loading…
Cancel
Save