";
		break;
	case "TABLEAUCSV":
		// header ("Content-Type: text/html; charset=".$charset);
		header("Content-Type: application/download\n");
		header("Content-Disposition: atachement; filename=\"tableau.csv\"");
		break;
	case "EXPORT_NOTI":
		// header ("Content-Type: text/html; charset=".$charset);
		header("Content-Type: application/download\n");
		header("Content-Disposition: atachement; filename=\"notices.doc\"");
		break;
	case "PLUGIN_FILE": // utiliser pour les plugins
		break;
	default:
        header ("Content-Type: text/html; charset=".$charset);
		print $std_header."";
		print "";
		echo window_title($database_window_title.$msg["1100"].$msg["1003"].$msg["1001"]);
		print $menu_bar;
		print $extra;
		print $extra2;
		if($use_shortcuts) {
			include("$include_path/shortcuts/circ.sht");
			}
		print $edit_layout;
		break;
	}
switch($categ) {
//------------------------------LLIUREX CONVOCATORIA------------------
	case "books":
		case "convocatoria":
			$titre_page = $msg["notices_list"].": ".$msg["informe_ayudas"];  
			include("./edit/books_ayudas.inc.php");
			break;
		break;	
	
	// EDITIONS LIEES AUX NOTICES
	case "notices":
		switch($sub) {
			case "resa" :
			default :
				include("./edit/notices.inc.php");
				break;
			}
		break;	
	case "serialcirc_diff":
		switch($sub) {
			case "export_empr" :
			default :
				$serialcirc_diff = new serialcirc_diff($id_serialcirc,$num_abt);
				$gen_tpl = new serialcirc_print_fields($serialcirc_diff->id);
				$worksheet = new spreadsheetPMB();
				$worksheet->write(0,0,$serialcirc_diff->serial_info['serial_name']);
				$worksheet->write(0,1,$serialcirc_diff->serial_info['abt_name']);
				$i = 2;
				$j = 0;
				// On récupère les noms de colonnes
				$header_list = $gen_tpl->get_header_list();
				foreach ($header_list as $header) {
					$worksheet->write($i, $j, $header);
					$j++;
				}
				$i++;
				$j = 0;
				foreach($serialcirc_diff->diffusion as $diff){
					if($diff['empr_type'] == SERIALCIRC_EMPR_TYPE_empr){
						$data['empr_id'] = $diff['empr']['id_empr'];
						$data_fields = $gen_tpl->get_line($data);
						foreach ($data_fields as $field) {
							$worksheet->write($i, $j, $field);
							$j++;
						}
						$i++;
						$j = 0;
					}else{
						$group_name= $diff['empr_name'];
						if(count($diff['group'])){
							foreach($diff['group'] as $empr){
								$data['empr_id'] = $empr['num_empr'];
								$data_fields = $gen_tpl->get_line($data);
								$data_fields[] = $group_name;
								if($empr['responsable']){
									$data_fields[] = $msg["serialcirc_group_responsable"];
								}
								foreach ($data_fields as $field) {
									$worksheet->write($i, $j, $field);
									$j++;
								}
								$i++;
								$j = 0;
							}
						}
					}
				}		
				$worksheet->download('Circulation.xls');	
			break;
		}
	break;
	// EDITIONS LIEES AUX EMPRUNTEURS
	case "empr":
		$restrict="";
		switch($sub) {
			case "limite" :
				$titre_page = $msg["1120"].": ".$msg["edit_titre_empr_abo_limite"];  
				$restrict = " ((to_days(empr_date_expiration) - to_days(now()) ) <=  $pmb_relance_adhesion ) and empr_date_expiration >= now() ";
				include("./edit/empr_list.inc.php");
				break;
			case "depasse" :
				$titre_page = $msg["1120"].": ".$msg["edit_titre_empr_abo_depasse"];  
				$restrict = " empr_date_expiration < now() ";
				include("./edit/empr_list.inc.php");
				break;
			case "cashdesk" :
				$titre_page = $msg["1120"].": ".$msg["cashdesk_edition_menu"];  
				include("./edit/cashdesk.inc.php");
				break;
			case "categ_change" :
				$titre_page = $msg["1120"].": ".$msg["edit_titre_empr_categ_change"];
				if (isset($categ_action) && $categ_action=="change_categ_empr") {
					if(isset($readers_edition_ui_selected_objects)) {
						for ($i=0; $i 0) || (age_max <> 0)) && (age_max >= age_min)) && (((DATE_FORMAT( curdate() , '%Y' )-empr_year) < age_min) || ((DATE_FORMAT( curdate() , '%Y' )-empr_year) > age_max))) ";
				include("./edit/empr_list.inc.php");
				break;
// ---------------------- LLIUREX 21/02/2018 ----------------------
			case "no_migrados":
		        $titre_page = $msg["1120"].": ".$msg["informe_no_migrados_cab"]; 
				include("./edit/empr_no_migrados.inc.php");
				break;
 			case "duplicados":
				$titre_page = $msg["1120"].": ".$msg["informe_duplicados"];  
				include("./edit/empr_duplicados.inc.php");
				break;
// -------------------- FIN LLIUREX 21/02/2018 ------------------				
			default :
			case "encours" :
				$sub = "encours" ;
				$titre_page = $msg["1120"].": ".$msg["1121"];  
				$restrict = " empr_date_expiration >= now() ";
				include("./edit/empr_list.inc.php");
				break;
		}
			
		if (($sub=="limite")||($sub=="depasse")) {
			if (($action)&&($action=="print_all")) {
				print "";	
				if ($empr_relance_adhesion==1) print "";
			} 	
		}
		break ;
	// EDITIONS LIEES AUX PERIODIQUES
	case "serials":
		switch($sub) {
			/* en attente d'une gestion correcte du bulletinage, actuellement absente de la base de données. 
			case "manquant" :
				echo "".$msg["1150"]." : ".$msg["1154"]."
";
				include("./edit/serials_manq.inc.php");
				break;
			*/
			case "circ_state" :
				if (!$dest) {
					echo "".$msg["1150"]." : ".$msg["serial_circ_state_edit"]."
";
				}
				include("./edit/serials_circ_state.inc.php");
				break;
			case "simple_circ" :
				echo "".$msg["1150"]." : ".$msg["serial_simple_circ_edit"]."
";
				include("./edit/serials_simple_circ.inc.php");
				break;
			case "collect" :
			default :
				$sub = "collect" ;
				echo "".$msg["1150"]." : ".$msg["1151"]."
";
				include("./edit/serials_coll.inc.php");
				break;
			}
		break;
	// EDITIONS DES STATISTIQUES
	case "procs":
		switch($dest) {
			case "TABLEAUCSV":
			default:
				include_once("./edit/procs.inc.php");
				break;
			}
		break;
	// CODES A BARRES
	case "cbgen":
		switch($sub) {
			default :
			case "libre" :
				$sub = "libre" ;
				echo "".$msg["1140"]." : ".$msg["1141"]."
";  
				include("./edit/cbgenlibre.inc.php");
				break;
			}
		break;
	//LES TRANSFERTS
	case "transferts" :
		require_once ("./edit/transferts.inc.php");
	break;
	
	//STATISTIQUES DE L'OPAC
	case "stat_opac" :
		//echo "".$msg["opac_admin_menu"]." : ".$msg["stat_opac_menu"]."
";
		include("./edit/stat_opac.inc.php");
		break;
	
	//OPAC
	case "opac" :
		switch($sub) {
			case "campaigns" :
				campaigns_controller::proceed($id);
				break;
		}
		break;
		
	// Edition Template de notices
	case "tpl" :
		switch($sub) {
			case "serialcirc" :
				echo "".$msg["edit_tpl_menu"]." : ".$msg["edit_serialcirc_tpl_menu"]."
";
				include("./edit/serialcirc_tpl.inc.php");
				break;
			case "notice" :
			default :
				echo "".$msg["edit_tpl_menu"]." : ".$msg["edit_notice_tpl_menu"]."
";
				include("./edit/notice_tpl.inc.php");
			break;
			case "bannette" :
				echo "".$msg["edit_tpl_menu"]." : ".$msg["edit_bannette_tpl_menu"]."
";
				include("./edit/bannette_tpl.inc.php");
				break;
			case "print_cart_tpl" :
			    echo "".$msg["edit_tpl_menu"]." : ".$msg["admin_print_cart_tpl_title"]."
";
			    include("./edit/print_cart_tpl.inc.php");
			    break;
		}
	break;
	case "state" :
		include($base_path."/edit/editions_state/main.inc.php");
		break;
	case "pnb" :
		include($base_path."/edit/pnb.inc.php");
		break;
	case 'contribution_area':
	    lists_controller::set_list_ui_class_name("list_contributions_ui");
	    lists_controller::proceed();
	    break;
	// EDITIONS LIEES AUX EXEMPLAIRES
	default:
	case "expl":
		$categ = "expl" ;
		switch($sub) {
				case "ppargroupe" :
					include("./edit/expl_groupe.inc.php");
					break;
				case "rpargroupe" :
					include("./edit/expl_groupe.inc.php");
					break;	
				case "retard" :
					$titre_page = $msg[1110]." : ".$msg[1112];
					include("./edit/expl.inc.php");
					break;
				case "retard_par_date" :
					$titre_page = $msg[1110]." : ".$msg['edit_expl_retard_par_date'];
					include("./edit/expl.inc.php");
					break;
				case "owner" :
					$critere_requete=" order by idlender, expl_cote, expl_cb ";
					include("./edit/expl_owner.inc.php");
					break;
				case "relance" :
					include("./edit/relance.inc.php");
					break;					
				case 'short_loans' :
					$titre_page = $msg['current_short_loans'];
					include("./edit/expl.inc.php");
					break;
				case 'unreturned_short_loans' :
					$titre_page = $msg['unreturned_short_loans'];
					include("./edit/expl.inc.php");
					break;
				case 'overdue_short_loans' :
					$titre_page = $msg['overdue_short_loans'];
					include("./edit/expl.inc.php");
					break;
				case 'archives' :
					$titre_page = $msg[1110]." : ".$msg['loans_archives'];
					include("./edit/expl.inc.php");
					break;
				default :
				case "encours" :
					$sub = "encours" ;
					$titre_page = $msg[1110]." : ".$msg[1111];
					include("./edit/expl.inc.php");
					break;
				}
			break;
		case 'sticks_sheet' :
			echo "".$msg["sticks_sheet"]." : ".$msg["sticks_sheet_models"]."
";
			switch($sub) {
				case 'models' :
					include("./edit/sticks_sheet_models.inc.php");
					break;
			}
			break;
		case 'plugin' :
			$plugins = plugins::get_instance();
			$file = $plugins->proceed("edit",$plugin,$sub);
			if($file){
				include $file;
			}
			break;
	}
	switch($dest) {
		case "TABLEAU":
		case "TABLEAUCSV":
		case "EXPORT_NOTI":
		case "PLUGIN_FILE":
			break;
		case "TABLEAUHTML":
			print $footer;
			break;
		default:
			print $edit_layout_end;
			print $footer;
			print "" ;
			break;
	}
	
pmb_mysql_close($dbh);