start_date=$start_date; $this->end_date=$end_date; $this->circ_cb_list=array(); if(is_array($circ_cb_list)){ foreach ($circ_cb_list as $circ_cb){ $this->circ_cb_list[]=$circ_cb+0; } }elseif($circ_cb_list){ $this->circ_cb_list[]=$circ_cb_list+0; } $this->fetch_data(); } private function fetch_data() { if(!count($this->circ_cb_list)) $req="select *, g.date_parution as date_sortie from serialcirc,abts_grille_abt as g, abts_abts, notices where serialcirc_simple=1 and num_serialcirc_abt=num_abt and abt_id=num_abt and num_notice=notice_id and g.date_parution >= '".$this->start_date."' and g.date_parution <= '".$this->end_date."' order by g.date_parution"; else $req="select * from serialcirc, abts_abts, notices where num_serialcirc_abt=abt_id and num_notice=notice_id and abt_id in(".implode(",", $this->circ_cb_list).")"; //print $req; $this->data=array(); $this->data_tri_day=array(); $data=array(); $i=0; $resultat=pmb_mysql_query($req); if (pmb_mysql_num_rows($resultat)) { while($r=pmb_mysql_fetch_object($resultat)){ //printr($r); $data[$i]["abt_name"]=$r->abt_name; $data[$i]["abt_id"]=$r->abt_id; $data[$i]["tit1"]=$r->tit1; $data[$i]["date_parution"]=$r->date_sortie; $this->data_tri_day[$r->date_sortie][]=$i; $req_diff="select * from serialcirc_diff where num_serialcirc_diff_serialcirc=".$r->id_serialcirc." order by serialcirc_diff_order"; //print $req_diff; $resultat_diff=pmb_mysql_query($req_diff); $count_diff=0; if (pmb_mysql_num_rows($resultat_diff)) { while($r_diff=pmb_mysql_fetch_object($resultat_diff)){ //printr($r_diff); if($r_diff->serialcirc_diff_empr_type){ // un groupe de lecteur avec un responsable $data[$i]["diff"][$count_diff]["is_group"]=$r_diff->serialcirc_diff_empr_type; $data[$i]["diff"][$count_diff]["group_name"]=$r_diff->serialcirc_diff_group_name; $req_group="select * from serialcirc_group where num_serialcirc_group_diff=".$r_diff->id_serialcirc_diff." order by serialcirc_group_order"; $resultat_group=pmb_mysql_query($req_group); $count_group=0; if (pmb_mysql_num_rows($resultat_group)) { while($r_group=pmb_mysql_fetch_object($resultat_group)){ //printr($r_group); $id_empr=$r_group->num_serialcirc_group_empr; $data[$i]["diff"][$count_diff]["group"][$count_group]=$this->empr_info($id_empr); $data[$i]["diff"][$count_diff]["group"][$count_group]["is_responsable"]=$r_group->serialcirc_group_responsable; $count_group++; } } }else{ // un simple lecteur $id_empr=$r_diff->num_serialcirc_diff_empr; $data[$i]["diff"][$count_diff]=$this->empr_info($id_empr); $data[$i]["diff"][$count_diff]["is_group"]=0; } $count_diff++; } } $i++; } } $this->data=$data; //printr($data); } private function empr_info($id){ $info=array(); // $req="select empr_cb, empr_nom , empr_prenom, empr_mail, empr_statut from empr where id_empr=".$id; $requete = "SELECT e.*, c.libelle AS code1, s.libelle AS code2, es.statut_libelle AS empr_statut_libelle, allow_loan, allow_book, allow_opac, allow_dsi, allow_dsi_priv, allow_sugg, allow_prol, d.location_libelle as localisation, date_format(empr_date_adhesion, '".$msg["format_date"]."') as aff_empr_date_adhesion, date_format(empr_date_expiration, '".$msg["format_date"]."') as aff_empr_date_expiration,date_format(last_loan_date, '".$msg["format_date"]."') as aff_last_loan_date FROM empr e left join docs_location as d on e.empr_location=d.idlocation, empr_categ c, empr_codestat s, empr_statut es "; $requete .= " WHERE e.id_empr='".$id."' " ; $requete .= " AND c.id_categ_empr=e.empr_categ"; $requete .= " AND s.idcode=e.empr_codestat"; $requete .= " AND es.idstatut=e.empr_statut"; $requete .= " LIMIT 1"; $res_empr=pmb_mysql_query($requete); if ($empr=pmb_mysql_fetch_object($res_empr)) { $info['cb'] = $empr->empr_cb; $info['nom'] = $empr->empr_nom; $info['prenom'] = $empr->empr_prenom; $info['mail'] = $empr->empr_mail; $info['statut_libelle'] = $empr->empr_statut_libelle; $info['categ_libelle'] = $empr->code1; $info['codestat_libelle'] = $empr->code2; $info['id_empr']=$id; $info['view_link']='./circ.php?categ=pret&form_cb='.$empr->empr_cb; $info['empr_libelle']=$info['nom']." ".$info['prenom']." ( ".$info['cb'] ." ) "; } return $info; } public function get_data(){ return $this->data; } public function get_display(){ global $msg,$base_path; global $current_module; $simple_circ_form_tpl="
"; $simple_circ_day_tpl="