<?php
// +-------------------------------------------------+
// | 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: selectors_controller.class.php,v 1.3 2025/11/19 11:23:13 dgoron Exp $

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

global $class_path;
require_once($class_path."/selectors/selector_model.class.php");

class selectors_controller extends lists_controller {
	
	protected static $model_class_name = 'selector_model';
	
	protected static $list_ui_class_name = 'list_selectors_ui';
	
	public static function proceed($id=0) {
		global $action;
		global $name;
		
		$id = intval($id);
		switch($action){
			case 'edit':
				if(isset($name) && $name) {
					$model_instance = new selector_model($name);
					print $model_instance->get_form();
				}
				break;
			default :
				parent::proceed($id);
				break;
		}
	}
	
	public static function proceed_save($id=0) {
	    global $name;
	    
	    $model_instance = new selector_model($name);
	    $model_instance->set_properties_from_form();
	    $model_instance->save();
	}
	
	public static function proceed_delete($id=0) {
	    global $name;
	    
	    $model_class_name = static::$model_class_name;
	    $model_class_name::delete($name);
	}
}