name = $name; } public function get_display_field_text($label, $value) { global $charset; $display = "
".htmlentities($value, ENT_QUOTES, $charset)."
"; return $display; } public function get_display_field_url($label, $value) { global $charset; $display = "
".htmlentities($value, ENT_QUOTES, $charset)."
"; return $display; } protected function get_action_cancel_label() { global $msg; return $msg['76']; } protected function get_action_save_label() { global $msg; return $msg['77']; } protected function get_action_delete_label() { global $msg; return $msg['63']; } protected function get_action_duplicate_label() { global $msg; return $msg["duplicate"]; } protected function get_display_actions() { $display = "
".$this->get_display_cancel_action()." ".$this->get_display_submit_action()." ".($this->object_id && !empty($this->duplicable) ? $this->get_display_duplicate_action() : "")." ".($this->object_id && !empty($this->actions_extension) ? $this->get_display_actions_extension() : "")."
".($this->object_id ? $this->get_display_delete_action() : "")."
"; return $display; } protected function get_cancel_action() { return $this->get_url_base(); } protected function get_display_cancel_action() { $where_are_we = substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], "/")+1); //inutile d'afficher le bouton si l'action sera au même endroit if($where_are_we != substr($this->get_cancel_action(), strrpos($this->get_cancel_action(), "/")+1)) { return "get_cancel_action()."'\" />"; } return ""; } protected function get_submit_action() { return $this->get_url_base()."&action=save".(!empty($this->object_id) ? "&id=".$this->object_id : ""); } protected function get_display_submit_action() { if(isset($this->field_focus) && $this->field_focus) { return ""; } else { return ""; } } protected function get_duplicate_action() { return $this->get_url_base()."&action=duplicate&id=".$this->object_id; } protected function get_display_duplicate_action() { global $charset; return "get_duplicate_action()."';\" />"; } protected function get_delete_action() { return $this->get_url_base()."&action=delete&id=".$this->object_id; } protected function get_display_delete_action() { global $charset; return "confirm_delete_msg), ENT_QUOTES, $charset)."')){document.location='".$this->get_delete_action()."';}\" />"; } protected function get_display_actions_extension() { $display = ""; foreach ($this->actions_extension as $action_extension) { $display .= ""; } return $display; } protected function get_js_script_error_label() { global $msg; $error_label = ''; switch ($this->table_name) { case 'arch_emplacement': case 'arch_type': case 'lenders': case 'users_groups': $error_label = $msg[559]; break; case 'harvest_profil': $error_label = $msg['admin_harvest_build_name_error']; break; case 'harvest_profil_import': $error_label = $msg['admin_harvest_profil_name_error']; break; case 'bannette_tpl': case 'serialcirc_tpl': $error_label = $msg['template_nom_erreur']; break; case 'notice_tpl': $error_label = $msg['notice_tpl_nom_erreur']; break; case 'transactype': $error_label = $msg['transactype_form_name_no']; break; case 'transaction_payment_methods': $error_label = $msg['transaction_payment_method_form_name_no']; break; case 'connectors_out_setcategs': $error_label = $msg['admin_connecteurs_setcateg_emptyfield']; break; case 'connectors_out_sets': $error_label = $msg['admin_connecteurs_set_emptyfield']; break; case 'cashdesk': $error_label = $msg["cashdesk_form_name_no"]; break; case 'groupexpl': $error_label = $msg['groupexpl_form_name_error']; break; case 'classements': $error_label = $msg['dsi_clas_nom_oblig']; break; case 'bannettes': case 'equations': $error_label = $msg['dsi_ban_nom_oblig']; break; case 'rss_flux': $error_label = $msg['dsi_flux_nom_oblig']; break; case 'pclassement': $error_label = $msg['pclassement_libelle_manquant']; break; case 'etagere': $error_label = $msg['etagere_name_oblig']; break; case 'coordonnees': $error_label = $msg['acquisition_raison_soc_vide']; break; case 'contact_form_objects': $error_label = $msg["admin_opac_contact_form_object_form_label_error"]; break; case 'demandes_notes': $error_label = $msg['demandes_note_create_ko']; break; default : $error_label = $msg[98]; break; } return $error_label; } protected function get_js_script() { if(isset($this->field_focus) && $this->field_focus) { return " "; } return ""; } protected function get_display_label() { global $charset; return "

".htmlentities($this->label, ENT_QUOTES, $charset)."

"; } public function get_display($ajax = false) { global $current_module; $display = "
get_submit_action()."\" ".(!empty($this->enctype) ? "enctype='".$this->enctype."'" : "")."> ".$this->get_display_label()."
".$this->content_form."
".$this->get_display_actions()."
"; if(isset($this->table_name) && $this->table_name) { $translation = new translation($this->object_id, $this->table_name); $display .= $translation->connect($this->name); } if(isset($this->field_focus) && $this->field_focus) { $display .= ""; } $display .= $this->get_js_script(); return $display; } public function get_display_ajax() { global $charset; global $current_module; $display = "
get_url_base()."&action=save&id=".$this->object_id."\" > ".$this->get_display_label()."
".$this->content_form."
".($this->object_id ? "" : "")."
"; if(isset($this->table_name) && $this->table_name) { $translation = new translation($this->object_id, $this->table_name); $display .= $translation->connect($this->name); } if(isset($this->field_focus) && $this->field_focus) { $display .= ""; } return $display; } public function branch_translations($table_name) { $translation = new translation($this->object_id, $table_name); return $translation->connect($this->name); } public function get_name() { return $this->name; } public function get_object_id() { return $this->object_id; } public function get_label() { return $this->label; } public function get_url_base() { global $base_path, $current_module, $categ, $sub; if(empty($this->url_base)) { $this->url_base = $base_path.'/'.$current_module.'.php?categ='.$categ.'&sub='.$sub; } return $this->url_base; } public function add_url_base($url_extra) { $this->get_url_base(); $this->url_base .= $url_extra; } public function get_confirm_delete_msg() { global $msg; if(!isset($this->confirm_delete_msg)) { if(isset($msg[$this->name.'_confirm_delete'])) { $this->confirm_delete_msg = $msg[$this->name.'_confirm_delete']; } } return $this->confirm_delete_msg; } public function set_name($name) { $this->name = $name; return $this; } public function set_object_id($object_id) { $this->object_id = intval($object_id); return $this; } public function set_label($label) { $this->label = $label; return $this; } public function set_url_base($url_base) { $this->url_base = $url_base; return $this; } public function set_confirm_delete_msg($confirm_delete_msg) { $this->confirm_delete_msg = $confirm_delete_msg; return $this; } public function set_content_form($content_form) { $this->content_form = $content_form; return $this; } public function set_table_name($table_name) { $this->table_name = $table_name; return $this; } public function set_field_focus($field_focus) { $this->field_focus = $field_focus; return $this; } public function set_duplicable($duplicable) { $this->duplicable = intval($duplicable); return $this; } public function add_action_extension($name, $value, $destination) { if(empty($this->actions_extension)) { $this->actions_extension = array(); } $this->actions_extension[] = array( 'name' => $name, 'value' => $value, 'destination' => $destination ); return $this; } public function set_enctype($enctype) { $this->enctype = $enctype; return $this; } }