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="

".$msg["serial_simple_circ_edit_title"]."

!!contents_to_print!!
".gen_plus("circ_edit_format",$msg["serial_simple_circ_edit_format"],aff_choix_quoi_impr_cote())."

".$msg["serial_simple_circ_edit_list_title"]."

".$msg["serial_simple_circ_edit_list_table_perio"]." ".$msg["serial_simple_circ_edit_list_table_abt"]."
"; $simple_circ_day_tpl="

!!date_sortie!!

!!abt_list!!
"; $simple_circ_abt_tpl="

!!diff_list!!
"; $simple_circ_diff_group_tpl="
!!name!!
"; $display=""; $display_day_list=""; /* plus demandé ... foreach ($this->data_tri_day as $date_sortie => $index_list){ $day_tpl=$simple_circ_day_tpl; $day_tpl=str_replace("!!date_sortie!!", formatDate($date_sortie), $day_tpl); $display_abt_list=""; foreach ($index_list as $index){ $abt=$this->data[$index]; //printr($abt); $abt_tpl=$simple_circ_abt_tpl; $abt_tpl=str_replace("!!tit1!!", $abt["tit1"], $abt_tpl); $abt_tpl=str_replace("!!abt_name!!", $abt["abt_name"], $abt_tpl); $abt_tpl=str_replace("!!date_sortie!!", formatDate($date_sortie), $abt_tpl); $display_diff_list=""; foreach($abt["diff"] as $diff){ if($diff["is_group"]){ $diff_group_tpl=$simple_circ_diff_group_tpl; $diff_group_tpl=str_replace("!!name!!", $diff["group_name"], $diff_group_tpl); $display_diff_list.=$diff_group_tpl; }else{ } } $abt_tpl=str_replace("!!diff_list!!", $display_diff_list, $abt_tpl); $display_abt_list.=$abt_tpl; } $day_tpl=str_replace("!!abt_list!!", $display_abt_list, $day_tpl); $display_day_list.=$day_tpl; } */ $display_day_list=""; $form_tpl=$simple_circ_form_tpl; $form_tpl=str_replace("!!contents_to_print!!", $display_day_list, $form_tpl); $form_tpl=str_replace("!!day!!", date("Ymd"), $form_tpl); $form_tpl=str_replace("!!start_date!!", $this->start_date, $form_tpl); $form_tpl=str_replace("!!form_start_date!!", formatDate($this->start_date), $form_tpl); $form_tpl=str_replace("!!end_date!!", $this->end_date, $form_tpl); $form_tpl=str_replace("!!form_end_date!!", formatDate($this->end_date), $form_tpl); $display.=$form_tpl; return $display; } }// class end