$style = 'style="' . get_value($field, 'style') . '"'; $maxlength = 'maxlength="' . get_value($field, 'maxlength') . '"'; $masks = 'alt="' . get_value($field, 'masks') . '"'; $options_sql = get_value($field, 'options_sql'); $options_json = get_value($field, 'options_json'); $description = get_value($field, 'description'); $value = htmlentities(get_value($field, 'value')); // adjust label $label .= stristr(get_value($field, 'validations'), 'required') ? '*' : ''; switch ($type) { default: case 'text': case 'file': case 'password': // Ajusta valor caso tipo seja data if (is_date_format_db($value)) { $date = strtotime($value); $value = date('d/m/Y', $date); } $value = 'value="' . $value . '"'; $html_field = "<input type=\"{$type}\" {$name} {$id} {$class} {$maxlength} {$masks} {$style} {$javascript} {$value} />"; break; case 'textarea': $html_field = "<textarea {$name} {$id} {$class} {$masks} {$style} {$javascript}>{$value}</textarea>"; break; case 'select': case 'radio': // Build html options adding first sql options then json options after $sql = $options_sql != '' ? $CI->db->query($options_sql)->result_array() : array(); $json = $options_json != '' ? json_decode($options_json) : array(); $options = array_merge($sql, $json);
/** * Update one record or more according with given parameters. * * @param string table * @param array data * @param mixed where (it can be array('id' => $id)... or string "id = 1") * @return mixed result */ public function update($table = '', $data = array(), $where = array()) { // Adjusts columns according with values foreach ($data as $column => $value) { if ($value == '') { $value = 'NULL'; $escape = false; } else { $escape = true; // Adjust date values for Oracle driver if (is_date_format_db($value) && strtolower(DB_DRIVER) == 'oci8') { $escape = false; $value = "TO_DATE('" . $value . "', 'yyyy-mm-dd')"; } } $this->db->set($column, $value, $escape); } $this->db->where($where); return $this->db->update($table); }