48 $a_user_id, $a_rating)
52 if ($a_user_id == ANONYMOUS_USER_ID)
57 $q =
"REPLACE INTO il_rating (user_id, obj_id, obj_type,".
58 "sub_obj_id, sub_obj_type, rating) VALUES (".
59 $ilDB->quote($a_user_id).
",".
60 $ilDB->quote($a_obj_id).
",".
61 $ilDB->quote($a_obj_type).
",".
62 $ilDB->quote($a_sub_obj_id).
",".
63 $ilDB->quote($a_sub_obj_type).
",".
64 $ilDB->quote($a_rating).
")";
82 $q =
"SELECT * FROM il_rating WHERE ".
83 "user_id = ".$ilDB->quote($a_user_id).
" AND ".
84 "obj_id = ".$ilDB->quote($a_obj_id).
" AND ".
85 "obj_type = ".$ilDB->quote($a_obj_type).
" AND ".
86 "sub_obj_id = ".$ilDB->quote($a_sub_obj_id).
" AND ".
87 "sub_obj_type = ".$ilDB->quote($a_sub_obj_type);
88 $set = $ilDB->query($q);
90 return $rec[
"rating"];
105 $q =
"SELECT count(*) as cnt, AVG(rating) as av FROM il_rating WHERE ".
106 "obj_id = ".$ilDB->quote($a_obj_id).
" AND ".
107 "obj_type = ".$ilDB->quote($a_obj_type).
" AND ".
108 "sub_obj_id = ".$ilDB->quote($a_sub_obj_id).
" AND ".
109 "sub_obj_type = ".$ilDB->quote($a_sub_obj_type);
110 $set = $ilDB->query($q);
112 return array(
"cnt" => $rec[
"cnt"],
"avg" => $rec[
"av"]);