Improvements in work tool - allow modify the weight of the work into gradebook

skala
iflores 15 years ago
parent d59386cc83
commit 2689900048
  1. 3
      main/inc/lib/add_course.lib.inc.php
  2. 3
      main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql
  3. 26
      main/work/work.lib.php
  4. 1
      main/work/work.php

@ -813,6 +813,7 @@ function update_Db_course($courseDbName)
date_of_qualification datetime NOT NULL default '0000-00-00 00:00:00',
parent_id INT UNSIGNED NOT NULL DEFAULT 0,
qualificator_id INT UNSIGNED NOT NULL DEFAULT 0,
weight float(6,2) UNSIGNED NOT NULL default 0,
session_id INT UNSIGNED NOT NULL default 0,
PRIMARY KEY (id)
)";
@ -830,7 +831,7 @@ function update_Db_course($courseDbName)
")";
Database::query($sql, __FILE__, __LINE__);
$sql = "ALTER TABLE `".$TABLETOOLWORKS . "` ADD INDEX ( session_id )" ;
Database::query($sql, __FILE__, __LINE__);
/*
-----------------------------------------------------------
Links tool

@ -58,4 +58,5 @@ ALTER TABLE item_property ADD id_session INT NOT NULL DEFAULT 0;
ALTER TABLE item_property DROP INDEX idx_item_property_toolref, ADD INDEX idx_item_property_toolref (tool, ref, id_session);
ALTER TABLE quiz ADD COLUMN expired_time int NOT NULL DEFAULT '0' AFTER feedback_type;
ALTER TABLE group_info ADD COLUMN chat_state TINYINT DEFAULT 1, ADD INDEX (chat_state);
ALTER TABLE group_category ADD COLUMN chat_state TINYINT DEFAULT 1, ADD INDEX (chat_state);
ALTER TABLE group_category ADD COLUMN chat_state TINYINT DEFAULT 1, ADD INDEX (chat_state);
ALTER TABLE student_publication ADD COLUMN weight float(6,2) UNSIGNED NOT NULL DEFAULT 0;

@ -381,7 +381,7 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
$mydir_temp = '/'.$my_sub_dir.$dir;
}
$sql_select_directory= "SELECT prop.lastedit_date, id, author, has_properties, view_properties, description, qualification,id FROM ".$iprop_table." prop INNER JOIN ".$work_table." work ON (prop.ref=work.id) WHERE ";
$sql_select_directory= "SELECT prop.lastedit_date, id, author, has_properties, view_properties, description, qualification,weight,id FROM ".$iprop_table." prop INNER JOIN ".$work_table." work ON (prop.ref=work.id) WHERE ";
if (!empty($_SESSION['toolgroup'])) {
$sql_select_directory.=" work.post_group_id = '".$_SESSION['toolgroup']."' "; // set to select only messages posted by the user's group
} else {
@ -421,8 +421,14 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
$defaults = array('my_group[dir_name]'=>html_entity_decode($dir),'description'=>html_entity_decode($row['description']));
$form_folder-> addElement('textarea','description',get_lang('Description'),array('rows'=>5,'cols'=>50));
$qualification_input[] = FormValidator :: createElement('text','qualification');
$form_folder -> addGroup($qualification_input,'qualification',get_lang('QualificationNumberOver'),'size="10"');
if ($row['weight'] > 0) {
$weight_input[] = FormValidator :: createElement('text','weight');
$form_folder -> addGroup($weight_input,'weight',get_lang('WeightInTheGradebook'),'size="10"');
}
$there_is_a_end_date =false;
if($row['view_properties']=='1') {
if($homework['expires_on']!='0000-00-00 00:00:00'){
@ -450,7 +456,13 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
$parts = split(' ',$default);
list($d_year,$d_month,$d_day) = split('-',$parts[0]);
list($d_hour,$d_minute) = split(':',$parts[1]);
if ((int)$row['weight'] == 0) {
$form_folder -> addElement('checkbox', 'make_calification', null, get_lang('MakeQualifiable'),'onclick="javascript:if(this.checked==true){document.getElementById(\'option3\').style.display = \'block\';}else{document.getElementById(\'option3\').style.display = \'none\';}"');
$form_folder -> addElement('html','<div id=\'option3\' style="display:none">');
$weight_input2[] = FormValidator :: createElement('text','weight');
$form_folder -> addGroup($weight_input2,'weight',get_lang('WeightInTheGradebook'),'size="10"');
$form_folder -> addElement('html','</div>');
}
if($homework['expires_on']='0000-00-00 00:00:00') {
$homework['expires_on']=date("Y-m-d H:i:s");
$there_is_a_expire_date = true;
@ -467,6 +479,7 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
$form_folder -> addGroup(create_group_date_select(),'ends',get_lang('EndsAt'));
$form_folder -> addElement('html','</div>');
}
$form_folder -> addRule (array('expires','ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
$form_folder -> addElement('html','</div>');
@ -485,6 +498,9 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
if(!empty($row['qualification'])) {
$defaults = array_merge($defaults,array('qualification[qualification]'=>$row['qualification']));
}
if(!empty($row['weight'])) {
$defaults = array_merge($defaults,array('weight[weight]'=>$row['weight']));
}
$form_folder -> setDefaults($defaults);
$display_edit_form=true;
@ -516,8 +532,8 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
}
//if($_POST['qualification']['qualification']!='')
Database::query('UPDATE '.$work_table.' SET description = '."'".Database::escape_string(Security::remove_XSS($_POST['description']))."'".', qualification = '."'".Database::escape_string($_POST['qualification']['qualification'])."'".' WHERE id = '."'".$row['id']."'",__FILE__,__LINE__);
//Database::query('UPDATE '.Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK).' SET weight = '."'".Database::escape_string($_POST['qualification']['qualification'])."'".' WHERE course_code = '."'".api_get_course_id()."'".' AND ref_id = '."'".$row['id']."'".'',__FILE__,__LINE__);
Database::query('UPDATE '.$work_table.' SET description = '."'".Database::escape_string(Security::remove_XSS($_POST['description']))."'".', qualification = '."'".Database::escape_string($_POST['qualification']['qualification'])."'".',weight = '."'".Database::escape_string($_POST['weight']['weight'])."'".' WHERE id = '."'".$row['id']."'",__FILE__,__LINE__);
Database::query('UPDATE '.Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK).' SET weight = '."'".Database::escape_string($_POST['weight']['weight'])."'".' WHERE course_code = '."'".api_get_course_id()."'".' AND ref_id = '."'".$row['id']."'".'',__FILE__,__LINE__);
Display::display_confirmation_message(get_lang('FolderEdited'));

@ -583,6 +583,7 @@ if (api_is_allowed_to_edit(null,true)) {
parent_id = '',
qualificator_id = '',
date_of_qualification = '0000-00-00 00:00:00',
weight = '".Database::escape_string(Security::remove_XSS($_POST['weight']))."',
session_id = ".intval($id_session);
Database::query($sql_add_publication, __FILE__, __LINE__);

Loading…
Cancel
Save