";
return $display;
}
protected function pagination() {
global $montrerquoi, $nb_per_page, $page;
$pagination = '';
if($this->nbr_lignes) {
$url_base = "./catalog.php?categ=avis&montrerquoi=$montrerquoi";
$pagination = aff_pagination ($url_base, $this->nbr_lignes, $nb_per_page, $page, 10, false, true);
}
return $pagination;
}
public function get_display_list_form() {
global $msg;
global $current_module;
$form = "
";
return $form;
}
public static function validate($id) {
$query = "update avis set valide=1 where id_avis='".$id."' ";
pmb_mysql_query($query);
}
public static function unvalidate($id) {
$query = "update avis set valide=0 where id_avis='".$id."' ";
pmb_mysql_query($query);
}
public static function delete($id) {
$query = "delete from avis where id_avis='".$id."' ";
pmb_mysql_query($query);
}
public static function delete_from_object($id) {
}
public function get_data() {
global $msg, $charset;
$memo_avis = array();
$query = "SELECT id_avis,note,sujet,commentaire,DATE_FORMAT(dateajout,'".$msg['format_date']."') as ladate,empr_login,empr_nom, empr_prenom, valide
from avis left join empr on id_empr=num_empr
where num_notice='".$this->object_id."' and type_object='".$this->object_type."' and valide=1 order by avis_rank, dateajout desc";
$result = pmb_mysql_query($query);
if ($result) {
while ($avis = pmb_mysql_fetch_object($result)) {
$avis->note_textuelle = $msg['avis_detail_note_'.$avis->note];
if($charset != "utf-8") $avis->commentaire=cp1252Toiso88591($avis->commentaire);
$avis->commentaire = do_bbcode($avis->commentaire);
$memo_avis[]=$avis;
}
}
return $memo_avis;
}
public function get_notes_avg() {
$query = "SELECT avg(note) as moyenne, count(*) as combien FROM avis WHERE avis_private = 0 and num_notice = '".$this->object_id."' and type_object = '".$this->object_type."'";
$result = pmb_mysql_query($query);
$row=pmb_mysql_fetch_object($result);
return $row->combien."|".$row->moyenne;
}
}