<?php
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: fiches_controller.class.php,v 1.3.10.1 2025/12/03 07:33:11 dgoron Exp $

if (stristr($_SERVER['REQUEST_URI'], ".class.php")) die("no access");

global $class_path;
require_once($class_path."/search.class.php");
require_once($class_path."/parametres_perso.class.php");

class fiches_controller extends lists_controller {

    protected static $model_class_name = 'fiche';
    
    protected static $list_ui_class_name = 'list_fiches_ui';
	
	public static function proceed($id=0) {
		global $include_path;
		global $action;
		
		$sc = new search(false,"search_fields",$include_path."/fichier/");
		$sc->isfichier=true;
		
	    $sc->limited_search = true;
		switch ($action) {
	        case 'view':
	            $fiche = new fiche($id);
	            print $fiche->show_fiche_form();
	            break;
	        case 'edit':
	            $fiche = new fiche($id);
	            print $fiche->get_form();
	            break;
	        case 'update':
	            $fiche = new fiche($id);
	            $fiche->save();
	            print $fiche->show_fiche_form();
	            break;
	        case 'delete':
	            $fiche = new fiche($id);
	            $fiche->delete();
	            $list_ui_instance = static::get_list_ui_instance();
	            print $list_ui_instance->get_display_list();
	            break;
	        default:
	            parent::proceed($id);
	            break;
		}
	}
}