if (strpos($this->type,'date') !== false) return 'date';
}
+# NB 14.09.18 public function sqlValue($value) {
+# NB 14.09.18 if (strpos($this->type,'bool') !== false) return preg_match('/^(f.*|no|0)?\s*$/i',$value) ? false : true;
+# NB 14.09.18 return $value;
+# NB 14.09.18 }
+
public function htmlValue($value,&$mime=null) {
+ #if (strpos($this->type,'bool') !== false) re
if (strpos($this->type,'bool') !== false) {
return preg_match('/^(1|yes|on|true)/i',$value) ? 'Yes' : 'No';
public function quote($value,$force_quote=false) {
if ($value === null) return 'NULL';
+
if ($force_quote or $this->string()) {
+
if ($value === '') {
if (strpos($this->type,'time') !== false) return 'NULL';
if (strpos($this->type,'date') !== false) return 'NULL';
if (!($db = $this->db())) return "'".str_replace("'","''",$value)."'";
- if ($fct=$db->conf_type('quote_field')) return $fct($value);
+ if ($fct = $db->conf_type('quote_field')) return $fct($value);
+
return $db->quote($value);
- } else {
+ } else { # Not a string
+
+ # NB 14.09.18: Ok with all databases types ?
+ if (strpos($this->type,'bool') !== false) $value = preg_match('/^(f.*|no|0)?\s*$/i',$value) ? 'false' : 'true';
if (strcmp($value,'') == 0) $value = 'NULL';
}
echo ''
.'<div class="db buttons">'
- .( empty($_SERVER['HTTP_REFERER']) ? '' : '<input type="button btn btn-danger" onclick="document.location=document.referrer" value="Cancel" />')
+ .( empty($_SERVER['HTTP_REFERER']) ? '' : '<input type="button" class="btn btn-danger" onclick="document.location=document.referrer" value="Cancel" />')
.'<input class="btn btn-warning" type="reset" />'
.'<input class="btn btn-success" type="submit" />'
.'</div>'.NB_EOL