[svn r18532] logic changes - allow show historical data in gradebook tool - (partial FS#3620)

skala
Isaac Flores 16 years ago
parent 07305a2200
commit b8810f58f4
  1. 4
      main/gradebook/gradebook_edit_all.php
  2. 7
      main/gradebook/lib/be/evaluation.class.php

@ -128,10 +128,10 @@ $result = api_sql_query($sql,__FILE__,__LINE__);
while($row = Database ::fetch_array($result)){
//update only if value changed
if(isset($_POST['link'][$row['id']]) && $_POST['link'][$row['id']] != $row['weight']) {
AbstractLink::add_link_log($row['id']);
api_sql_query('UPDATE '.$table_link.' SET weight = '."'".trim($_POST['link'][$row['id']])."'".' WHERE id = '.$row['id'],__FILE__,__LINE__);
$sql='UPDATE '.$table_forum_thread.' SET thread_weight='.$_POST['link'][$row['id']].' WHERE thread_id='.$row['ref_id'];
api_sql_query($sql);
AbstractLink::add_link_log($row['id']);
$row['weight'] = trim($_POST['link'][$row['id']]);
}
@ -145,8 +145,8 @@ $result = api_sql_query($sql,__FILE__,__LINE__);
//update only if value changed
if(isset($_POST['evaluation'][$row['id']]) && $_POST['evaluation'][$row['id']] != $row['weight']) {
Evaluation::add_evaluation_log($row['id']);
api_sql_query('UPDATE '.$table_evaluation.' SET weight = '."'".trim($_POST['evaluation'][$row['id']])."'".' WHERE id = '.$row['id'],__FILE__,__LINE__);
AbstractLink::add_link_log($row['id']);
$row['weight'] = trim($_POST['evaluation'][$row['id']]);
}
$type_evaluated = isset($row['type']) ? $table_evaluated[$type_evaluated][3] : null;

@ -249,13 +249,16 @@ class Evaluation implements GradebookItem
}
public function add_evaluation_log($idevaluation){
$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$tbl_grade_linkeval_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$eval=new Evaluation();
$dateobject=$eval->load ($idevaluation,null,null,null,null);
$arreval=get_object_vars($dateobject[0]);
$sql_eval='SELECT weight from '.$tbl_grade_evaluations.' WHERE id='.$arreval['id'];
$rs=api_sql_query($sql_eval,__FILE__,__LINE__);
$row_old_weight=Database::fetch_array($rs,'ASSOC');
$current_date=strtotime(date('Y-m-d H:i:s',time()));
$sql="INSERT INTO ".$tbl_grade_linkeval_log."(id_linkeval_log,name,description,date_log,weight,visible,type,user_id_log)VALUES('".$arreval['id']."','".$arreval['name']."','".$arreval['description']."','".$current_date."','".$arreval['weight']."','".$arreval['visible']."','evaluation',".api_get_user_id().")";
$sql="INSERT INTO ".$tbl_grade_linkeval_log."(id_linkeval_log,name,description,date_log,weight,visible,type,user_id_log)VALUES('".$arreval['id']."','".$arreval['name']."','".$arreval['description']."','".$current_date."','".$row_old_weight['weight']."','".$arreval['visible']."','evaluation',".api_get_user_id().")";
api_sql_query($sql,__FILE__,__LINE__);
}
/**

Loading…
Cancel
Save