$upd_attendance = 'UPDATE '.$tbl_attendance.' SET attendance_weight ='.floatval($_POST['link'][$row['id']]).' WHERE id = '.intval($row_attendance['ref_id']);
$sql_t='UPDATE '.$tbl_forum_thread.' SET thread_weight='.floatval($_POST['link'][$row['id']]).' WHERE thread_id= (SELECT ref_id FROM '.$table_link.' WHERE id='.intval($row['id']).' AND type='.LINK_FORUM_THREAD.');';
Database::query('UPDATE '.$table_evaluation.' SET weight = '."'".trim($_POST['evaluation'][$row['id']])."'".' WHERE id = '.$row['id'],__FILE__,__LINE__);
Database::query('UPDATE '.$table_evaluation.' SET weight = '."'".trim($_POST['evaluation'][$row['id']])."'".' WHERE id = '.$row['id']);
$sql_t='UPDATE '.$tbl_work.' SET weight='.$values['weight'].' WHERE id=(SELECT ref_id FROM '.$tbl_grade_links.' where id='.Security::remove_XSS($_GET['editlink']).' and type=3);';
@ -340,10 +340,10 @@ if (isset ($_GET['deletelink'])) {
if ($link[0] != null) {
// clean forum qualify
$sql='UPDATE '.$tbl_forum_thread.' SET thread_qualify_max=0,thread_weight=0,thread_title_qualify="" WHERE thread_id=(SELECT ref_id FROM '.$tbl_grade_links.' WHERE id='.$get_delete_link.' AND type = '.LINK_FORUM_THREAD.');';
Database::query($sql, __FILE__, __LINE__);
// clean attendance
Database::query($sql);
// clean attendance
$sql='UPDATE '.$tbl_attendance.' SET attendance_qualify_max=0, attendance_weight = 0, attendance_qualify_title="" WHERE id=(SELECT ref_id FROM '.$tbl_grade_links.' WHERE id='.$get_delete_link.' AND type = '.LINK_ATTENDANCE.');';
Database::query($sql, __FILE__, __LINE__);
Database::query($sql);
$link[0]->delete();
}
unset ($link);
@ -622,7 +622,7 @@ if (isset ($_GET['studentoverview'])) {
}
$category = Category :: load($category); //hack replace $category = Category :: load ($_GET['cat_id']); to get de course name in certificates
if ($category[0]->is_certificate_available($user_id)) {
$user= get_user_info_from_id($user_id);
$scoredisplay = ScoreDisplay :: instance();
@ -678,15 +678,15 @@ if (isset ($_GET['studentoverview'])) {
if ($_in_course === true) {
// When *inside* a course, we want to make sure there is one (and only
// one) category for this course or for this session.
$sql_testing="select count(*) from ".$tbl_grade_links." where ref_id=".$this->get_ref_id()." AND category_id = ".$this->category." AND type = ".$this->type." ;";
@ -240,7 +240,7 @@ abstract class AbstractLink implements GradebookItem
.','.$this->is_visible();
if (isset($this->link_date)) {$sql .= ','.'"'.$date_current=strtotime(date('Y-m-d H:i:s',time())).'"';}
$sql .= ")";
Database::query($sql, __FILE__, __LINE__);
Database::query($sql);
$this->set_id(Database::insert_id());
}
} else {
@ -271,7 +271,7 @@ abstract class AbstractLink implements GradebookItem
.', visible = '.$this->is_visible()
.' WHERE id = '.$this->id;
AbstractLink::add_link_log($this->id);
Database::query($sql, __FILE__, __LINE__);
Database::query($sql);
}
public function add_link_log($idevaluation) {
@ -290,7 +290,7 @@ abstract class AbstractLink implements GradebookItem
}
//error_log($name_log);
$sql="INSERT INTO ".$tbl_grade_linkeval_log."(id_linkeval_log,name,description,date_log,weight,visible,type,user_id_log)VALUES('".Database::escape_string($arreval['id'])."','".Database::escape_string($name_log)."','".Database::escape_string($description_log)."','".Database::escape_string($current_date_server)."','".Database::escape_string($arreval['weight'])."','".Database::escape_string($arreval['visible'])."','Link',".api_get_user_id().")";
Database::query($sql,__FILE__,__LINE__);
Database::query($sql);
}
/**
@ -302,7 +302,7 @@ abstract class AbstractLink implements GradebookItem
$sql = 'SELECT att.attendance_qualify_max FROM '.$this->get_attendance_table().' att WHERE att.id = '.$this->get_ref_id().' AND att.session_id='.$session_id.'';
$query = Database::query($sql,__FILE__,__LINE__);
$query = Database::query($sql);
$attendance = Database::fetch_array($query);
// get results
$sql = 'SELECT * FROM '.$tbl_attendance_result.' WHERE attendance_id = '.$this->get_ref_id();
$sql='SELECT name,description,user_id,course_code,parent_id,weight,visible,certif_min_score,session_id FROM '.$tbl_category.' c WHERE c.id='.$selectcat;
$result=Database::query($sql,__FILE__,__LINE__);
$result=Database::query($sql);
$row=Database::fetch_array($result,'ASSOC');
return $row;
}
@ -418,7 +418,7 @@ class Category implements GradebookItem
$sql="INSERT INTO ".$tbl_grade_linkeval_log."(id_linkeval_log,name,description,date_log,weight,visible,type,user_id_log)VALUES('".Database::escape_string($arreval['id'])."','".Database::escape_string($arreval['name'])."','".Database::escape_string($arreval['description'])."','".Database::escape_string($current_date)."','".Database::escape_string($row_old_weight['weight'])."','".Database::escape_string($arreval['visible'])."','evaluation',".api_get_user_id().")";
Database::query($sql,__FILE__,__LINE__);
Database::query($sql);
}
}
}
@ -304,7 +304,7 @@ class Evaluation implements GradebookItem
//recorded history
$eval_log=new Evaluation();
$eval_log->add_evaluation_log($this->id);
Database::query($sql, __FILE__, __LINE__);
Database::query($sql);
}
@ -314,7 +314,7 @@ class Evaluation implements GradebookItem
$sql = 'SELECT tl.thread_id,tl.thread_title,tl.thread_title_qualify FROM '.$tbl_grade_links.' tl ,'.$tbl_item_property.' ip WHERE tl.thread_id=ip.ref AND ip.tool="forum_thread" AND ip.visibility<>2 AND tl.session_id='.api_get_session_id().' GROUP BY ip.ref ';
$sql = 'SELECT thread_qualify_max FROM '.Database :: get_course_table(TABLE_FORUM_THREAD, $database_name)." WHERE thread_id = '".$this->get_ref_id()."' AND session_id=".api_get_session_id()."";
$query = Database::query($sql,__FILE__,__LINE__);
$query = Database::query($sql);
$assignment = Database::fetch_array($query);
$sql = 'SELECT * FROM '.$thread_qualify.' WHERE thread_id = '.$this->get_ref_id();
@ -140,7 +140,7 @@ class ForumThreadLink extends AbstractLink
// order by id, that way the student's first attempt is accessed first
if (is_null($id ) && is_null($user_id) && !is_null($evaluation_id)) {
$sql_verified_if_exist_evaluation='SELECT COUNT(*) AS count FROM '.$tbl_grade_results.' WHERE evaluation_id="'.Database::escape_string($evaluation_id).'";';
$sql_course_rel_user = 'SELECT course_code,id_user,status FROM '.$tbl_session_rel_course_user.' WHERE status=0 AND course_code="'.api_get_course_id().' AND id_session='.api_get_session_id().'"';
$sql_course_rel_user = 'SELECT course_code,id_user,status FROM '.$tbl_session_rel_course_user.' WHERE status=0 AND course_code="'.api_get_course_id().' AND id_session='.api_get_session_id().'"';
} else {
$sql_course_rel_user = 'SELECT course_code,user_id,status FROM '.$tbl_course_rel_course.' WHERE status="5" AND course_code="'.api_get_course_id().'"; ';
$sql_course_rel_user = 'SELECT course_code,user_id,status FROM '.$tbl_course_rel_course.' WHERE status="5" AND course_code="'.api_get_course_id().'"; ';
while ($row_course_rel_user=Database::fetch_array($res_course_rel_user)) {
@ -123,11 +123,11 @@ class Result
for ($i=0;$i<count($list_user_course_list);$i++){
$sql_verified='SELECT COUNT(*) AS count FROM '.$tbl_grade_results.' WHERE user_id="'.(int)($list_user_course_list[$i]['user_id']).'" AND evaluation_id="'.Database::escape_string($evaluation_id).'";';
$sql_insert='INSERT INTO '.$tbl_grade_results.'(user_id,evaluation_id,date,score) values ("'.Database::escape_string($list_user_course_list[$i]['user_id']).'","'.Database::escape_string($evaluation_id).'","'.$current_date.'",0);';