empr_fields)) { return false; } pmb_mysql_query("TRUNCATE TABLE empr_renewal_form_fields"); $values = array(); foreach ($this->empr_fields as $empr_field_code => $options) { $values[] = "('".addslashes($empr_field_code)."', ".$options['display'].", ".$options['mandatory'].", ".$options['alterable'].", '".addslashes($options['explanation'])."')"; } $query = "INSERT INTO empr_renewal_form_fields (empr_renewal_form_field_code, empr_renewal_form_field_display, empr_renewal_form_field_mandatory, empr_renewal_form_field_alterable, empr_renewal_form_field_explanation) VALUES ".implode(',', $values); pmb_mysql_query($query); $query = "UPDATE parametres SET valeur_param=" . $this->active . " WHERE type_param='empr' and sstype_param='renewal_activate' "; pmb_mysql_query($query); $empr_renewal_activate = $this->active; return true; } protected function get_empr_fields_query() { $query = "SELECT empr_renewal_form_field_code, empr_renewal_form_field_display, empr_renewal_form_field_mandatory, empr_renewal_form_field_alterable, empr_renewal_form_field_explanation FROM empr_renewal_form_fields"; return $query; } public function get_form() { global $empr_renewal_activate; $html = parent::get_form(); $checked = ''; $this->active = $empr_renewal_activate; if ($this->active) { $checked = 'checked="checked"'; } $html = str_replace('!!renewal_activate_checked!!', $checked, $html); return $html; } }