";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
$fields_options.="";
return $fields_options;
}
protected function get_form_name() {
return "bannette_tpl_form";
}
protected function get_content_form() {
global $charset;
global $bannette_tpl_content_form;
$content_form=$bannette_tpl_content_form;
$fields_options="";
$content_form=str_replace('!!fields_options!!', $fields_options, $content_form);
$content_form=str_replace('!!content!!', htmlentities($this->content,ENT_QUOTES, $charset), $content_form);
return $content_form;
}
public function save() {
global $msg;
global $include_path;
if(!$this->name) return false;
$query = "SET ";
$query .= "bannettetpl_name='".addslashes($this->name)."', ";
$query .= "bannettetpl_comment='".addslashes($this->comment)."', ";
$query .= "bannettetpl_tpl='".addslashes($this->content)."' ";
if($this->id) {
// update
$query = "UPDATE ".static::$table_name." $query WHERE ".static::$field_name."=".$this->id." ";
if(!pmb_mysql_query($query)) {
require_once("$include_path/user_error.inc.php");
warning($msg["template_modifier"], $msg["template_modifier_erreur"]);
return false;
}
} else {
// creation
$query = "INSERT INTO ".static::$table_name." ".$query;
if(pmb_mysql_query($query)) {
$this->id=pmb_mysql_insert_id();
} else {
require_once("$include_path/user_error.inc.php");
warning($msg["template_ajouter"], $msg["template_ajouter_erreur"]);
return false;
}
}
return true;
}
public static function get_base_url() {
global $base_path;
if(!isset(static::$base_url)) {
static::$base_url = $base_path.'/edit.php?categ=tpl&sub=bannette';
}
return static::$base_url;
}
public static function gen_tpl_select($select_name="form_bannette_tpl", $selected_id=0, $onchange="", $invisible_default=0) {
global $msg;
$requete = "SELECT bannettetpl_id, concat(bannettetpl_name,'. ',bannettetpl_comment) as nom FROM bannette_tpl ORDER BY bannettetpl_name ";
if($invisible_default) {
return gen_liste ($requete, "bannettetpl_id", "nom", $select_name, $onchange, $selected_id, 0, $msg["bannette_tpl_list_default"], "","", 0) ;
} else {
return gen_liste ($requete, "bannettetpl_id", "nom", $select_name, $onchange, $selected_id, 0, $msg["bannette_tpl_list_default"], 0,$msg["bannette_tpl_list_default"], 0) ;
}
}
} // fin class