|
|
|
@ -131,8 +131,8 @@ class CatForm extends FormValidator { |
|
|
|
|
|
|
|
|
|
private function build_basic_form() { |
|
|
|
|
$this->addElement('hidden', 'zero', 0); |
|
|
|
|
$this->add_textfield('name', get_lang('CategoryName'),true,array('size'=>'54','maxlength'=>'50')); |
|
|
|
|
|
|
|
|
|
$this->add_textfield('name', get_lang('CategoryName'), true,array('size'=>'54','maxlength'=>'50')); |
|
|
|
|
$this->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); |
|
|
|
|
$models = api_get_settings_options('grading_model'); |
|
|
|
|
$course_grading_model_id = api_get_course_setting('course_grading_model'); |
|
|
|
|
$grading_model = ''; |
|
|
|
@ -145,6 +145,7 @@ class CatForm extends FormValidator { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$grading_contents = api_grading_model_functions($grading_model, 'to_array'); |
|
|
|
|
|
|
|
|
|
if (!empty($grading_contents)) { |
|
|
|
|
|
|
|
|
|
$course_code = api_get_course_id(); |
|
|
|
@ -153,15 +154,23 @@ class CatForm extends FormValidator { |
|
|
|
|
///direct access to one evaluation |
|
|
|
|
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init |
|
|
|
|
$count = count($cats) - 1; |
|
|
|
|
$value = intval($grading_contents['items'][$count]['percentage']); |
|
|
|
|
$this->add_textfield('weight', get_lang('TotalWeight'),true,array('value'=>$value,'size'=>'4','maxlength'=>'5')); |
|
|
|
|
$value = intval($grading_contents['items'][$count]['percentage']); |
|
|
|
|
|
|
|
|
|
$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'); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$this->add_textfield('weight', get_lang('TotalWeight'),true,array('value'=>$value,'size'=>'4','maxlength'=>'5')); |
|
|
|
|
$this->addRule('weight',get_lang('ThisFieldIsRequired'),'required'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->addElement('static', null, null, '<i>'.get_lang('TotalSumOfWeights').'</i>'); |
|
|
|
|
|
|
|
|
|
$this->add_textfield('certif_min_score', get_lang('CertificateMinScore'),false,array('size'=>'4','maxlength'=>'5')); |
|
|
|
|
$this->addRule('certif_min_score', get_lang('ThisFieldIsRequired'), 'required'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->addElement('hidden','hid_user_id'); |
|
|
|
|
$this->addElement('hidden','hid_parent_id'); |
|
|
|
|
$this->addElement('textarea', 'description', get_lang('Description'),array('rows'=>'3','cols' => '34')); |
|
|
|
|