Include Datamapper ORM

This commit is contained in:
Karsten Heiken
2011-05-29 14:57:33 +02:00
parent 58317382f4
commit 98434eddbb
19 changed files with 10091 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ $autoload['packages'] = array(APPPATH.'third_party');
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/
$autoload['libraries'] = array('lang_detect', 'database', 'session', 'access');
$autoload['libraries'] = array('lang_detect', 'database', 'session', 'access', 'datamapper');
/*

View File

@@ -0,0 +1,33 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Data Mapper Configuration
*
* Global configuration settings that apply to all DataMapped models.
*/
$config['prefix'] = '';
$config['join_prefix'] = '';
$config['error_prefix'] = '<p>';
$config['error_suffix'] = '</p>';
$config['created_field'] = 'created';
$config['updated_field'] = 'updated';
$config['local_time'] = FALSE;
$config['unix_timestamp'] = FALSE;
$config['timestamp_format'] = '';
$config['lang_file_format'] = 'model_${model}';
$config['field_label_lang_format'] = '${model}_${field}';
$config['auto_transaction'] = FALSE;
$config['auto_populate_has_many'] = FALSE;
$config['auto_populate_has_one'] = FALSE;
$config['all_array_uses_ids'] = FALSE;
// set to FALSE to use the same DB instance across the board (breaks subqueries)
// Set to any acceptable parameters to $CI->database() to override the default.
$config['db_params'] = '';
// Uncomment to enable the production cache
// $config['production_cache'] = 'datamapper/cache';
$config['extensions_path'] = 'datamapper';
$config['extensions'] = array();
/* End of file datamapper.php */
/* Location: ./application/config/datamapper.php */

View File

@@ -0,0 +1,194 @@
<?php
/**
* Array Extension for DataMapper classes.
*
* Quickly convert DataMapper models to-and-from PHP arrays.
*
* @license MIT License
* @package DMZ-Included-Extensions
* @category DMZ
* @author Phil DeJarnett
* @link http://www.overzealous.com/dmz/pages/extensions/array.html
* @version 1.0
*/
// --------------------------------------------------------------------------
/**
* DMZ_Array Class
*
* @package DMZ-Included-Extensions
*/
class DMZ_Array {
/**
* Convert a DataMapper model into an associative array.
* If the specified fields includes a related object, the ids from the
* objects are collected into an array and stored on that key.
* This method does not recursively add objects.
*
* @param DataMapper $object The DataMapper Object to convert
* @param array $fields Array of fields to include. If empty, includes all database columns.
* @return array An associative array of the requested fields and related object ids.
*/
function to_array($object, $fields = '')
{
// assume all database columns if $fields is not provided.
if(empty($fields))
{
$fields = $object->fields;
}
$result = array();
foreach($fields as $f)
{
// handle related fields
if(array_key_exists($f, $object->has_one) || array_key_exists($f, $object->has_many))
{
// each related item is stored as an array of ids
// Note: this method will NOT get() the related object.
$rels = array();
foreach($object->{$f} as $item)
{
$rels[] = $item->id;
}
$result[$f] = $rels;
}
else
{
// just the field.
$result[$f] = $object->{$f};
}
}
return $result;
}
/**
* Convert the entire $object->all array result set into an array of
* associative arrays.
*
* @see to_array
* @param DataMapper $object The DataMapper Object to convert
* @param array $fields Array of fields to include. If empty, includes all database columns.
* @return array An array of associative arrays.
*/
function all_to_array($object, $fields = '')
{
// loop through each object in the $all array, convert them to
// an array, and add them to a new array.
$result = array();
foreach($object as $o)
{
$result[] = $o->to_array($fields);
}
return $result;
}
/**
* Convert an associative array back into a DataMapper model.
*
* If $fields is provided, missing fields are assumed to be empty checkboxes.
*
* @param DataMapper $object The DataMapper Object to save to.
* @param array $data A an associative array of fields to convert.
* @param array $fields Array of 'safe' fields. If empty, only includes the database columns.
* @param bool $save If TRUE, then attempt to save the object automatically.
* @return array|bool A list of newly related objects, or the result of the save if $save is TRUE
*/
function from_array($object, $data, $fields = '', $save = FALSE)
{
// keep track of newly related objects
$new_related_objects = array();
// Assume all database columns.
// In this case, simply store $fields that are in the $data array.
if(empty($fields))
{
$fields = $object->fields;
foreach($data as $k => $v) {
if(in_array($k, $fields))
{
$object->{$k} = $v;
}
}
}
else
{
// If $fields is provided, assume all $fields should exist.
foreach($fields as $f)
{
if(array_key_exists($f, $object->has_one))
{
// Store $has_one relationships
$c = get_class($object->{$f});
$rel = new $c();
$id = isset($data[$f]) ? $data[$f] : 0;
$rel->get_by_id($id);
if($rel->exists())
{
// The new relationship exists, save it.
$new_related_objects[$f] = $rel;
}
else
{
// The new relationship does not exist, delete the old one.
$object->delete($object->{$f}->get());
}
}
else if(array_key_exists($f, $object->has_many))
{
// Store $has_many relationships
$c = get_class($object->{$f});
$rels = new $c();
$ids = isset($data[$f]) ? $data[$f] : FALSE;
if(empty($ids))
{
// if no IDs were provided, delete all old relationships.
$object->delete($object->{$f}->select('id')->get()->all);
}
else
{
// Otherwise, get the new ones...
$rels->where_in('id', $ids)->select('id')->get();
// Store them...
$new_related_objects[$f] = $rels->all;
// And delete any old ones that do not exist.
$old_rels = $object->{$f}->where_not_in('id', $ids)->select('id')->get();
$object->delete($old_rels->all);
}
}
else
{
// Otherwise, if the $data was set, store it...
if(isset($data[$f]))
{
$v = $data[$f];
}
else
{
// Or assume it was an unchecked checkbox, and clear it.
$v = FALSE;
}
$object->{$f} = $v;
}
}
}
if($save)
{
// Auto save
return $object->save($new_related_objects);
}
else
{
// return new objects
return $new_related_objects;
}
}
}
/* End of file array.php */
/* Location: ./application/datamapper/array.php */

View File

@@ -0,0 +1,225 @@
<?php
/**
* CSV Extension for DataMapper classes.
*
* Quickly import and export a set of DataMapper models to-and-from CSV files.
*
* @license MIT License
* @package DMZ-Included-Extensions
* @category DMZ
* @author Phil DeJarnett
* @link http://www.overzealous.com/dmz/pages/extensions/csv.html
* @version 1.0
*/
// --------------------------------------------------------------------------
/**
* DMZ_CSV Class
*
* @package DMZ-Included-Extensions
*/
class DMZ_CSV {
/**
* Convert a DataMapper model into an associative array.
*
* @param DataMapper $object The DataMapper Object to export
* @param mixed filename The filename to export to, or a file pointer. If this is a file pointer, it will not be closed.
* @param array $fields Array of fields to include. If empty, includes all database columns.
* @param bool $include_header If FALSE the header is not exported with the CSV. Not recommended if planning to import this data.
* @return bool TRUE on success, or FALSE on failure.
*/
function csv_export($object, $filename, $fields = '', $include_header = TRUE)
{
// determine the correct field set.
if(empty($fields))
{
$fields = $object->fields;
}
$success = TRUE;
// determine if we need to open the file or not.
if(is_string($filename))
{
// open the file, if possible.
$fp = fopen($filename, 'w');
if($fp === FALSE)
{
log_message('error', 'CSV Extension: Unable to open file ' . $filename);
return FALSE;
}
}
else
{
// assume file pointer.
$fp = $filename;
}
if($include_header)
{
// Print out header line
$success = fputcsv($fp, $fields);
}
if($success)
{
foreach($object as $o)
{
// convert each object into an array
$result = array();
foreach($fields as $f)
{
$result[] = $o->{$f};
}
// output CSV-formatted line
$success = fputcsv($fp, $result);
if(!$success)
{
// stop on first failure.
break;
}
}
}
if(is_string($filename))
{
fclose($fp);
}
return $success;
}
/**
* Import objects from a CSV file.
*
* Completely empty rows are automatically skipped, as are rows that
* start with a # sign (assumed to be comments).
*
* @param DataMapper $object The type of DataMapper Object to import
* @param mixed $filename Name of CSV file, or a file pointer.
* @param array $fields If empty, the database fields are used. Otherwise used to limit what fields are saved.
* @param boolean $header_row If true, the first line is assumed to be a header row. Defaults to true.
* @param mixed $callback A callback method for each row. Can return FALSE on failure to save, or 'stop' to stop the import.
* @return array Array of imported objects, or FALSE if unable to import.
*/
function csv_import($object, $filename, $fields = '', $header_row = TRUE, $callback = NULL)
{
$class = get_class($object);
if(empty($fields))
{
$fields = $object->fields;
}
// determine if we need to open the file or not.
if(is_string($filename))
{
// open the file, if possible.
$fp = fopen($filename, 'r');
if($fp === FALSE)
{
log_message('error', 'CSV Extension: Unable to open file ' . $filename);
return FALSE;
}
}
else
{
// assume file pointer.
$fp = $filename;
}
if(empty($callback))
{
$result = array();
}
else
{
$result = 0;
}
$columns = NULL;
while(($data = fgetcsv($fp)) !== FALSE)
{
// get column names
if(is_null($columns))
{
if($header_row)
{
// store header row for column names
$columns = $data;
// only include columns in $fields
foreach($columns as $index => $name)
{
if( ! in_array($name, $fields))
{
// mark column as false to skip
$columns[$index] = FALSE;
}
}
continue;
}
else
{
$columns = $fields;
}
}
// skip on comments and empty rows
if(empty($data) || $data[0][0] == '#' || implode('', $data) == '')
{
continue;
}
// create the object to save
$o = new $class();
foreach($columns as $index => $key)
{
if(count($data) <= $index)
{
// more header columns than data columns
break;
}
// skip columns that were determined to not be needed above.
if($key === FALSE)
{
continue;
}
// finally, it's OK to save the data column.
$o->{$key} = $data[$index];
}
if( empty($callback))
{
$result[] = $o;
}
else
{
$test = call_user_func($callback, $o);
if($test === 'stop')
{
break;
}
if($test !== FALSE)
{
$result++;
}
}
}
if(is_string($filename))
{
fclose($fp);
}
return $result;
}
}
/* End of file csv.php */
/* Location: ./application/datamapper/csv.php */

View File

@@ -0,0 +1,793 @@
<?php
/**
* HTMLForm Extension for DataMapper classes.
*
* A powerful extension that allows one to quickly
* generate standardized forms off a DMZ object.
*
* @license MIT License
* @package DMZ-Included-Extensions
* @category DMZ
* @author Phil DeJarnett
* @link http://www.overzealous.com/dmz/pages/extensions/htmlform.html
* @version 1.0
*/
// --------------------------------------------------------------------------
/**
* DMZ_HTMLForm Class
*
* @package DMZ-Included-Extensions
*/
class DMZ_HTMLForm {
// this is the default template (view) to use for the overall form
var $form_template = 'dmz_htmlform/form';
// this is the default template (view) to use for the individual rows
var $row_template = 'dmz_htmlform/row';
// this is the default template (view) to use for the individual rows
var $section_template = 'dmz_htmlform/section';
var $auto_rule_classes = array(
'integer' => 'integer',
'numeric' => 'numeric',
'is_natural' => 'natural',
'is_natural_no_zero' => 'positive_int',
'valid_email' => 'email',
'valid_ip' => 'ip',
'valid_base64' => 'base64',
'valid_date' => 'date',
'alpha_dash_dot' => 'alpha_dash_dot',
'alpha_slash_dot' => 'alpha_slash_dot',
'alpha' => 'alpha',
'alpha_numeric' => 'alpha_numeric',
'alpha_dash' => 'alpha_dash',
'required' => 'required'
);
function __construct($options = array()) {
foreach($options as $k => $v)
{
$this->{$k} = $v;
}
$this->CI =& get_instance();
$this->load = $this->CI->load;
}
// --------------------------------------------------------------------------
/**
* Render a single field. Can be used to chain together multiple fields in a column.
*
* @param object $object The DataMapper Object to use.
* @param string $field The field to render.
* @param string $type The type of field to render.
* @param array $options Various options to modify the output.
* @return Rendered String.
*/
function render_field($object, $field, $type = NULL, $options = NULL)
{
$value = '';
if(array_key_exists($field, $object->has_one) || array_key_exists($field, $object->has_many))
{
// Create a relationship field
$one = array_key_exists($field, $object->has_one);
// attempt to look up the current value(s)
if( ! isset($options['value']))
{
if($this->CI->input->post($field))
{
$value = $this->CI->input->post($field);
}
else
{
// load the related object(s)
$sel = $object->{$field}->select('id')->get();
if($one)
{
// only a single value is allowed
$value = $sel->id;
}
else
{
// save what might be multiple values
$value = array();
foreach($sel as $s)
{
$value[] = $s->id;
}
}
}
}
else
{
// value was already set in the options
$value = $options['value'];
unset($options['value']);
}
// Attempt to get a list of possible values
if( ! isset($options['list']) || is_object($options['list']))
{
if( ! isset($options['list']))
{
// look up all of the related values
$c = get_class($object->{$field});
$total_items = new $c;
// See if the custom method is defined
if(method_exists($total_items, 'get_htmlform_list'))
{
// Get customized list
$total_items->get_htmlform_list($object, $field);
}
else
{
// Get all items
$total_items->get_iterated();
}
}
else
{
// process a passed-in DataMapper object
$total_items = $options['list'];
}
$list = array();
foreach($total_items as $item)
{
// use the __toString value of the item for the label
$list[$item->id] = (string)$item;
}
$options['list'] = $list;
}
// By if there can be multiple items, use a dropdown for large lists,
// and a set of checkboxes for a small one.
if($one || count($options['list']) > 6)
{
$default_type = 'dropdown';
if( ! $one && ! isset($options['size']))
{
// limit to no more than 8 items high.
$options['size'] = min(count($options['list']), 8);
}
}
else
{
$default_type = 'checkbox';
}
}
else
{
// attempt to look up the current value(s)
if( ! isset($options['value']))
{
if($this->CI->input->post($field))
{
$value = $this->CI->input->post($field);
// clear default if set
unset($options['default_value']);
}
else
{
if(isset($options['default_value']))
{
$value = $options['default_value'];
unset($options['default_value']);
}
else
{
// the field IS the value.
$value = $object->{$field};
}
}
}
else
{
// value was already set in the options
$value = $options['value'];
unset($options['value']);
}
// default to text
$default_type = ($field == 'id') ? 'hidden' : 'text';
// determine default attributes
$a = array();
// such as the size of the field.
$max = $this->_get_validation_rule($object, $field, 'max_length');
if($max === FALSE)
{
$max = $this->_get_validation_rule($object, $field, 'exact_length');
}
if($max !== FALSE)
{
$a['maxlength'] = $max;
$a['size'] = min($max, 30);
}
$list = $this->_get_validation_info($object, $field, 'values', FALSE);
if($list !== FALSE)
{
$a['list'] = $list;
}
$options = $options + $a;
$extra_class = array();
// Add any of the known rules as classes (for JS processing)
foreach($this->auto_rule_classes as $rule => $c)
{
if($this->_get_validation_rule($object, $field, $rule) !== FALSE)
{
$extra_class[] = $c;
}
}
// add or set the class on the field.
if( ! empty($extra_class))
{
$extra_class = implode(' ', $extra_class);
if(isset($options['class']))
{
$options['class'] .= ' ' . $extra_class;
}
else
{
$options['class'] = $extra_class;
}
}
}
// determine the renderer type
$type = $this->_get_type($object, $field, $type);
if(empty($type))
{
$type = $default_type;
}
// attempt to find the renderer function
if(method_exists($this, '_input_' . $type))
{
return $this->{'_input_' . $type}($object, $field, $value, $options);
}
else if(function_exists('input_' . $type))
{
return call_user_func('input_' . $type, $object, $field, $value, $options);
}
else
{
log_message('error', 'FormMaker: Unable to find a renderer for '.$type);
return '<span style="color: Maroon; background-color: White; font-weight: bold">FormMaker: UNABLE TO FIND A RENDERER FOR '.$type.'</span>';
}
}
// --------------------------------------------------------------------------
/**
* Render a row with a single field. If $field does not exist on
* $object->validation, then $field is output as-is.
*
* @param object $object The DataMapper Object to use.
* @param string $field The field to render (or content)
* @param string $type The type of field to render.
* @param array $options Various options to modify the output.
* @param string $row_template The template to use, or NULL to use the default.
* @return Rendered String.
*/
function render_row($object, $field, $type = NULL, $options = array(), $row_template = NULL)
{
// try to determine type automatically
$type = $this->_get_type($object, $field, $type);
if( ! isset($object->validation[$field]) && (empty($type) || $type == 'section' || $type == 'none'))
{
// this could be a multiple-field row, or just some text.
// if $type is 'section, it will be rendered using the section template.
$error = '';
$label = '';
$content = $field;
$id = NULL;
}
else
{
// use validation information to render the field.
$content = $this->render_field($object, $field, $type, $options);
if(empty($row_template))
{
if($type == 'hidden' || $field == 'id')
{
$row_template = 'none';
}
else
{
$row_template = $this->row_template;
}
}
// determine if there is an existing error
$error = isset($object->error->{$field}) ? $object->error->{$field} : '';
// determine if there is a pre-defined label
$label = $this->_get_validation_info($object, $field, 'label', $field);
// the field IS the id
$id = $field;
}
$required = $this->_get_validation_rule($object, $field, 'required');
// Append these items. Values in $options have priority
$view_data = $options + array(
'object' => $object,
'content' => $content,
'field' => $field,
'label' => $label,
'error' => $error,
'id' => $id,
'required' => $required
);
if(is_null($row_template))
{
if(empty($type))
{
$row_template = 'none';
}
else if($type == 'section')
{
$row_template = $this->section_template;
}
else
{
$row_template = $this->row_template;
}
}
if($row_template == 'none')
{
return $content;
}
else
{
return $this->load->view($row_template, $view_data, TRUE);
}
}
// --------------------------------------------------------------------------
/**
* Renders an entire form.
*
* @param object $object The DataMapper Object to use.
* @param string $fields An associative array that defines the form.
* @param string $template The template to use.
* @param string $row_template The template to use for rows.
* @param array $template_options The template to use for rows.
* @return Rendered String.
*/
function render_form($object, $fields, $url = '', $options = array(), $template = NULL, $row_template = NULL)
{
if(empty($url))
{
// set url to current url
$url =$this->CI->uri->uri_string();
}
if(is_null($template))
{
$template = $this->form_template;
}
$rows = '';
foreach($fields as $field => $field_options)
{
$rows .= $this->_render_row_from_form($object, $field, $field_options, $row_template);
}
$view_data = $options + array(
'object' => $object,
'fields' => $fields,
'url' => $url,
'rows' => $rows
);
return $this->load->view($template, $view_data, TRUE);
}
// --------------------------------------------------------------------------
// Private Methods
// --------------------------------------------------------------------------
// Converts information from render_form into a row of objects.
function _render_row_from_form($object, $field, $options, $row_template, $row = TRUE)
{
if(is_int($field))
{
// simple form, or HTML-content
$field = $options;
$options = NULL;
}
if(is_null($options))
{
// always have an array for options
$options = array();
}
$type = '';
if( ! is_array($options))
{
// if options is a single string, assume it is the type.
$type = $options;
$options = array();
}
if(isset($options['type']))
{
// type was set in options
$type = $options['type'];
unset($options['type']);
}
// see if a different row_template was in the options
$rt = $row_template;
if(isset($options['template']))
{
$rt = $options['template'];
unset($options['template']);
}
// Multiple fields, render them all as one.
if(is_array($field))
{
if(isset($field['row_options']))
{
$options = $field['row_options'];
unset($field['row_options']);
}
$ret = '';
$sep = ' ';
if(isset($field['input_separator']))
{
$sep = $field['input_separator'];
unset($field['input_separator']);
}
foreach($field as $f => $fo)
{
// add each field to a list
if( ! empty($ret))
{
$ret .= $sep;
}
$ret .= $this->_render_row_from_form($object, $f, $fo, $row_template, FALSE);
}
// renders into a row or field below.
$field = $ret;
}
if($row)
{
// if row is set, render the whole row.
return $this->render_row($object, $field, $type, $options, $rt);
}
else
{
// render just the field.
return $this->render_field($object, $field, $type, $options);
}
}
// --------------------------------------------------------------------------
// Attempts to look up the field's type
function _get_type($object, $field, $type)
{
if(empty($type))
{
$type = $this->_get_validation_info($object, $field, 'type', NULL);
}
return $type;
}
// --------------------------------------------------------------------------
// Returns a field from the validation array
function _get_validation_info($object, $field, $val, $default = '')
{
if(isset($object->validation[$field][$val]))
{
return $object->validation[$field][$val];
}
return $default;
}
// --------------------------------------------------------------------------
// Returns the value (or TRUE) of the validation rule, or FALSE if it does not exist.
function _get_validation_rule($object, $field, $rule)
{
$r = $this->_get_validation_info($object, $field, 'rules', FALSE);
if($r !== FALSE)
{
if(isset($r[$rule]))
{
return $r[$rule];
}
else if(in_array($rule, $r, TRUE))
{
return TRUE;
}
}
return FALSE;
}
// --------------------------------------------------------------------------
// Input Types
// --------------------------------------------------------------------------
// Render a hidden input
function _input_hidden($object, $id, $value, $options)
{
return $this->_render_simple_input('hidden', $id, $value, $options);
}
// render a single-line text input
function _input_text($object, $id, $value, $options)
{
return $this->_render_simple_input('text', $id, $value, $options);
}
// render a password input
function _input_password($object, $id, $value, $options)
{
if(isset($options['send_value']))
{
unset($options['send_value']);
}
else
{
$value = '';
}
return $this->_render_simple_input('password', $id, $value, $options);
}
// render a multiline text input
function _input_textarea($object, $id, $value, $options)
{
if(isset($options['value']))
{
$value = $options['value'];
unset($options['value']);
}
$a = $options + array(
'name' => $id,
'id' => $id
);
return $this->_render_node('textarea', $a, htmlspecialchars($value));
}
// render a dropdown
function _input_dropdown($object, $id, $value, $options)
{
$list = $options['list'];
unset($options['list']);
$selected = $value;
if(isset($options['value']))
{
$selected = $options['value'];
unset($options['value']);
}
if( ! is_array($selected))
{
$selected = array($selected);
}
else
{
// force multiple
$options['multiple'] = 'multiple';
}
$l = $this->_options($list, $selected);
$name = $id;
if(isset($options['multiple']))
{
$name .= '[]';
}
$a = $options + array(
'name' => $name,
'id' => $id
);
return $this->_render_node('select', $a, $l);
}
// used to render an options list.
function _options($list, $sel)
{
$l = '';
foreach($list as $opt => $label)
{
if(is_array($label))
{
$l .= '<optgroup label="' . htmlspecialchars($key) . '">';
$l .= $this->_options($label, $sel);
$l .= '</optgroup>';
}
else
{
$a = array('value' => $opt);
if(in_array($opt, $sel))
{
$a['selected'] = 'selected';
}
$l .= $this->_render_node('option', $a, htmlspecialchars($label));
}
}
return $l;
}
// render a checkbox or series of checkboxes
function _input_checkbox($object, $id, $value, $options)
{
return $this->_checkbox('checkbox', $id, $value, $options);
}
// render a series of radio buttons
function _input_radio($object, $id, $value, $options)
{
return $this->_checkbox('radio', $id, $value, $options);
}
// renders one or more checkboxes or radio buttons
function _checkbox($type, $id, $value, $options, $sub_id = '', $label = '')
{
if(isset($options['value']))
{
$value = $options['value'];
unset($options['value']);
}
// if there is a list in options, render our multiple checkboxes.
if(isset($options['list']))
{
$list = $options['list'];
unset($options['list']);
$ret = '';
if( ! is_array($value))
{
if(is_null($value) || $value === FALSE || $value === '')
{
$value = array();
}
else
{
$value = array($value);
}
}
$sep = '<br/>';
if(isset($options['input_separator']))
{
$sep = $options['input_separator'];
unset($options['input_separator']);
}
foreach($list as $k => $v)
{
if( ! empty($ret))
{
// put each node on one line.
$ret .= $sep;
}
$ret .= $this->_checkbox($type, $id, $value, $options, $k, $v);
}
return $ret;
}
else
{
// just render the single checkbox.
$node_id = $id;
if( ! empty($sub_id))
{
// there are multiple nodes with this id, append the sub_id
$node_id .= '_' . $sub_id;
$field_value = $sub_id;
}
else
{
// sub_id is the same as the node's id
$sub_id = $id;
$field_value = '1';
}
$name = $id;
if(is_array($value))
{
// allow for multiple results
$name .= '[]';
}
// node attributes
$a = $options + array(
'type' => $type,
'id' => $node_id,
'name' => $name,
'value' => $field_value
);
// if checked wasn't overridden
if( ! isset($a['checked']))
{
// determine if this is a multiple checkbox or not.
$checked = $value;
if(is_array($checked))
{
$checked = in_array($sub_id, $value);
}
if($checked)
{
$a['checked'] = 'checked';
}
}
$ret = $this->_render_node('input', $a);
if( ! empty($label))
{
$ret .= ' ' . $this->_render_node('label', array('for' => $node_id), $label);
}
return $ret;
}
}
// render a file upload input
function _input_file($object, $id, $value, $options)
{
$a = $options + array(
'type' => 'file',
'name' => $id,
'id' => $id
);
return $this->_render_node('input', $a);
}
// Utility method to render a normal <input>
function _render_simple_input($type, $id, $value, $options)
{
$a = $options + array(
'type' => $type,
'name' => $id,
'id' => $id,
'value' => $value
);
return $this->_render_node('input', $a);
}
// Utility method to render a node.
function _render_node($type, $attributes, $content = FALSE)
{
// generate node
$res = '<' . $type;
foreach($attributes as $att => $v)
{
// the special attribute '_' is rendered directly.
if($att == '_')
{
$res .= ' ' . $v;
}
else
{
if($att != 'label')
{
$res .= ' ' . $att . '="' . htmlspecialchars((string)$v) . '"';
}
}
}
// allow for content-containing nodes
if($content !== FALSE)
{
$res .= '>' . $content . '</' . $type .'>';
}
else
{
$res .= ' />';
}
return $res;
}
}
/* End of file htmlform.php */
/* Location: ./application/datamapper/htmlform.php */

View File

@@ -0,0 +1,220 @@
<?php
/**
* Json Extension for DataMapper classes.
*
* Quickly convert DataMapper models to-and-from JSON syntax.
*
* @license MIT License
* @package DMZ-Included-Extensions
* @category DMZ
* @author Phil DeJarnett
* @link http://www.overzealous.com/dmz/pages/extensions/json.html
* @version 1.1
*/
// --------------------------------------------------------------------------
/**
* DMZ_Json Class
*
* @package DMZ-Included-Extensions
*/
class DMZ_Json {
/**
* Convert a DataMapper model into JSON code.
*
* @param DataMapper $object The DataMapper Object to convert
* @param array $fields Array of fields to include. If empty, includes all database columns.
* @param boolean $pretty_print Format the JSON code for legibility.
* @return string A JSON formatted String, or FALSE if an error occurs.
*/
public function to_json($object, $fields = '', $pretty_print = FALSE)
{
if(empty($fields))
{
$fields = $object->fields;
}
$result = array();
foreach($fields as $f)
{
$result[$f] = $object->{$f};
}
$json = json_encode($result);
if($json === FALSE)
{
return FALSE;
}
if($pretty_print)
{
$json = $this->_json_format($json);
}
return $json;
}
/**
* Convert the entire $object->all array result set into JSON code.
*
* @param DataMapper $object The DataMapper Object to convert
* @param array $fields Array of fields to include. If empty, includes all database columns.
* @param boolean $pretty_print Format the JSON code for legibility.
* @return string A JSON formatted String, or FALSE if an error occurs.
*/
public function all_to_json($object, $fields = '', $pretty_print = FALSE)
{
if(empty($fields))
{
$fields = $object->fields;
}
$result = array();
foreach($object as $o)
{
$temp = array();
foreach($fields as $f)
{
$temp[$f] = $o->{$f};
}
$result[] = $temp;
}
$json = json_encode($result);
if($json === FALSE)
{
return FALSE;
}
if($pretty_print)
{
$json = $this->_json_format($json);
}
return $json;
}
/**
* Convert a JSON object back into a DataMapper model.
*
* @param DataMapper $object The DataMapper Object to save to.
* @param string $json_code A string that contains JSON code.
* @param array $fields Array of 'safe' fields. If empty, only include the database columns.
* @return bool TRUE or FALSE on success or failure of converting the JSON string.
*/
public function from_json($object, $json_code, $fields = '')
{
if(empty($fields))
{
$fields = $object->fields;
}
$data = json_decode($json_code);
if($data === FALSE)
{
return FALSE;
}
foreach($data as $k => $v) {
if(in_array($k, $fields))
{
$object->{$k} = $v;
}
}
return TRUE;
}
/**
* Sets the HTTP Content-Type header to application/json
*
* @param DataMapper $object
*/
public function set_json_content_type($object)
{
$CI =& get_instance();
$CI->output->set_header('Content-Type: application/json');
}
/**
* Formats a JSON string for readability.
*
* From @link http://php.net/manual/en/function.json-encode.php
*
* @param string $json Unformatted JSON
* @return string Formatted JSON
*/
private function _json_format($json)
{
$tab = " ";
$new_json = "";
$indent_level = 0;
$in_string = false;
$json_obj = json_decode($json);
if($json_obj === false)
return false;
$json = json_encode($json_obj);
$len = strlen($json);
for($c = 0; $c < $len; $c++)
{
$char = $json[$c];
switch($char)
{
case '{':
case '[':
if(!$in_string)
{
$new_json .= $char . "\n" . str_repeat($tab, $indent_level+1);
$indent_level++;
}
else
{
$new_json .= $char;
}
break;
case '}':
case ']':
if(!$in_string)
{
$indent_level--;
$new_json .= "\n" . str_repeat($tab, $indent_level) . $char;
}
else
{
$new_json .= $char;
}
break;
case ',':
if(!$in_string)
{
$new_json .= ",\n" . str_repeat($tab, $indent_level);
}
else
{
$new_json .= $char;
}
break;
case ':':
if(!$in_string)
{
$new_json .= ": ";
}
else
{
$new_json .= $char;
}
break;
case '"':
if($c > 0 && $json[$c-1] != '\\')
{
$in_string = !$in_string;
}
default:
$new_json .= $char;
break;
}
}
return $new_json;
}
}
/* End of file json.php */
/* Location: ./application/datamapper/json.php */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,211 @@
<?php
/**
* Row Index Extension for DataMapper classes.
*
* Determine the row index for a given ID based on a query.
*
* @license MIT License
* @package DMZ-Included-Extensions
* @category DMZ
* @author Phil DeJarnett
* @link http://www.overzealous.com/dmz/pages/extensions/worindex.html
* @version 1.0
*/
// --------------------------------------------------------------------------
/**
* DMZ_RowIndex Class
*
* @package DMZ-Included-Extensions
*/
class DMZ_RowIndex {
private $first_only = FALSE;
/**
* Given an already-built query and an object's ID, determine what row
* that object has in the query.
*
* @param DataMapper $object THe DataMapper object.
* @param DataMapper|int $id The ID or object to look for.
* @param array $leave_select A list of items to leave in the selection array, overriding the automatic removal.
* @param <type> $distinct_on If TRUE, use DISTINCT ON (not all DBs support this)
* @return bool|int Returns the index of the item, or FALSE if none are found.
*/
public function row_index($object, $id, $leave_select = array(), $distinct_on = FALSE) {
$this->first_only = TRUE;
$result = $this->get_rowindices($object, $id, $leave_select, $distinct_on);
$this->first_only = FALSE;
if(empty($result)) {
return FALSE;
} else {
reset($result);
return key($result);
}
}
/**
* Given an already-built query and an object's ID, determine what row
* that object has in the query.
*
* @param DataMapper $object THe DataMapper object.
* @param DataMapper|array|int $id The ID or object to look for.
* @param array $leave_select A list of items to leave in the selection array, overriding the automatic removal.
* @param bool $distinct_on If TRUE, use DISTINCT ON (not all DBs support this)
* @return array Returns an array of row indices.
*/
public function row_indices($object, $ids, $leave_select = array(), $distinct_on = FALSE) {
$row_indices = array();
if(!is_array($ids)) {
$ids = array($ids);
}
$new_ids = array();
foreach($ids as $id) {
if(is_object($id)) {
$new_ids[] = $id->id;
} else {
$new_ids[] = intval($id);
}
}
if(!is_array($leave_select)) {
$leave_select = array();
}
// duplicate to ensure the query isn't wiped out
$object = $object->get_clone(TRUE);
// remove the unecessary columns
$sort_columns = $this->_orderlist($object->db->ar_orderby);
$ar_select = array();
if(empty($sort_columns) && empty($leave_select)) {
// no sort columns, so just wipe it out.
$object->db->ar_select = NULL;
} else {
// loop through the ar_select, and remove columns that
// are not specified by sorting
$select = $this->_splitselect(implode(', ', $object->db->ar_select));
// find all aliases (they are all we care about)
foreach($select as $alias => $sel) {
if(in_array($alias, $sort_columns) || in_array($alias, $leave_select)) {
$ar_select[] = $sel;
}
}
$object->db->ar_select = NULL;
}
if($distinct_on) {
// to ensure unique items we must DISTINCT ON the same list as the ORDER BY list.
$distinct = 'DISTINCT ON (' . preg_replace("/\s+(asc|desc)/i", "", implode(",", $object->db->ar_orderby)) . ') ';
// add in the DISTINCT ON and the $table.id column. The FALSE prevents the items from being escaped
$object->select($distinct . $object->table.'.id', FALSE);
} else {
$object->select('id');
}
// this ensures that the DISTINCT ON is first, since it must be
$object->db->ar_select = array_merge($object->db->ar_select, $ar_select);
// run the query
$query = $object->get_raw();
foreach($query->result() as $index => $row) {
$id = intval($row->id);
if(in_array($id, $new_ids)) {
$row_indices[$index] = $id;
if($this->first_only) {
break;
}
}
}
// in case the user wants to know
$object->rowindex_total_rows = $query->num_rows();
// return results
return $row_indices;
}
/**
* Processes the order_by array, and converts it into a list
* of non-fully-qualified columns. These might be aliases.
*
* @param array $order_by Original order_by array
* @return array Modified array.
*/
private function _orderlist($order_by) {
$list = array();
$impt_parts_regex = '/([\w]+)([^\(]|$)/';
foreach($order_by as $order_by_string) {
$parts = explode(',', $order_by_string);
foreach($parts as $part) {
// remove optional order marker
$part = preg_replace('/\s+(ASC|DESC)$/i', '', $part);
// remove all functions (might not work well on recursive)
$replacements = 1;
while($replacements > 0) {
$part = preg_replace('/[a-z][\w]*\((.*)\)/i', '$1', $part, -1, $replacements);
}
// now remove all fully-qualified elements (those with tables)
$part = preg_replace('/("[a-z][\w]*"|[a-z][\w]*)\.("[a-z][\w]*"|[a-z][\w]*)/i', '', $part);
// finally, match all whole words left behind
preg_match_all('/([a-z][\w]*)/i', $part, $result, PREG_SET_ORDER);
foreach($result as $column) {
$list[] = $column[0];
}
}
}
return $list;
}
/**
* Splits the select query up into parts.
*
* @param string $select Original select string
* @return array Individual select components.
*/
private function _splitselect($select) {
// splits a select into parameters, then stores them as
// $select[<alias>] = $select_part
$list = array();
$last_pos = 0;
$pos = -1;
while($pos < strlen($select)) {
$pos++;
if($pos == strlen($select) || $select[$pos] == ',') {
// we found an item, process it
$sel = substr($select, $last_pos, $pos-$last_pos);
if(preg_match('/\sAS\s+"?([a-z]\w*)"?\s*$/i', $sel, $matches) != 0) {
$list[$matches[1]] = trim($sel);
}
$last_pos = $pos+1;
} else if($select[$pos] == '(') {
// skip past parenthesized sections
$pos = $this->_splitselect_parens($select, $pos);
}
}
return $list;
}
/**
* Recursively processes parentheses in the select string.
*
* @param string $select Select string.
* @param int $pos current location in the string.
* @return int final position after all recursing is complete.
*/
private function _splitselect_parens($select, $pos) {
while($pos < strlen($select)) {
$pos++;
if($select[$pos] == '(') {
// skip past recursive parenthesized sections
$pos = $this->_splitselect_parens($select, $pos);
} else if($select[$pos] == ')') {
break;
}
}
return $pos;
}
}
/* End of file rowindex.php */
/* Location: ./application/datamapper/rowindex.php */

View File

@@ -0,0 +1,70 @@
<?php
/**
* SimpleCache Extension for DataMapper classes.
*
* Allows the usage of CodeIgniter query caching on DataMapper queries.
*
* @license MIT License
* @package DMZ-Included-Extensions
* @category DMZ
* @author Phil DeJarnett
* @link http://www.overzealous.com/dmz/pages/extensions/simplecache.html
* @version 1.0
*/
// --------------------------------------------------------------------------
/**
* DMZ_SimpleCache Class
*
* @package DMZ-Included-Extensions
*/
class DMZ_SimpleCache {
/**
* Allows CodeIgniter's caching method to cache large result sets.
* Call it exactly as get();
*
* @param DataMapper $object The DataMapper Object.
* @return DataMapper The DataMapper object for chaining.
*/
function get_cached($object)
{
if( ! empty($object->_should_delete_cache) )
{
$object->db->cache_delete();
$object->_should_delete_cache = FALSE;
}
$object->db->cache_on();
// get the arguments, but pop the object.
$args = func_get_args();
array_shift($args);
call_user_func_array(array($object, 'get'), $args);
$object->db->cache_off();
return $object;
}
/**
* Clears the cached query the next time get_cached is called.
*
* @param DataMapper $object The DataMapper Object.
* @return DataMapper The DataMapper $object for chaining.
*/
function clear_cache($object)
{
$args = func_get_args();
array_shift($args);
if( ! empty($args)) {
call_user_func_array(array($object->db, 'cache_delete'), $args);
} else {
$object->_should_delete_cache = TRUE;
}
return $object;
}
}
/* End of file simplecache.php */
/* Location: ./application/datamapper/simplecache.php */

View File

@@ -0,0 +1,76 @@
<?php
/**
* Translate Extension for DataMapper classes.
*
* Translate DataMapper model fields containing language strings
*
* @license MIT License
* @package DMZ-Included-Extensions
* @category DMZ
* @author WanWizard
* @version 1.0
*/
// --------------------------------------------------------------------------
/**
* DMZ_Translate Class
*
* @package DMZ-Included-Extensions
*/
class DMZ_Translate {
/**
* do language translations of the field list.
*
* @param DataMapper $object The DataMapper Object to convert
* @param array $fields Array of fields to include. If empty, includes all database columns.
* @return object, the Datamapper object
*/
function translate( $object, $fields = array() )
{
// make sure $fields is an array
$fields = (array) $fields;
// assume all database columns if $fields is not provided.
if(empty($fields))
{
$fields = $object->fields;
}
// loop through the fields
foreach($fields as $f)
{
// first, deal with the loaded fields
if ( isset($object->{$f}) )
{
$line = lang($object->{$f});
if ( $line )
{
$object->{$f};
}
}
// then, loop through the all array
foreach($object->all as $key => $all_object)
{
if ( isset($all_object->{$f}) )
{
$line = lang($all_object->{$f});
if ( $line )
{
$object->all[$key]->{$f} = $line;
}
}
}
}
// return the Datamapper object
return $object;
}
}
/* End of file translate.php */
/* Location: ./application/datamapper/translate.php */

View File

@@ -0,0 +1,236 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// ------------------------------------------------------------------------
/**
* CodeIgniter Inflector Helpers
*
* Customised singular and plural helpers.
*
* @package CodeIgniter
* @subpackage Helpers
* @category Helpers
* @author ExpressionEngine Dev Team, stensi
* @link http://codeigniter.com/user_guide/helpers/inflector_helper.html
*/
// --------------------------------------------------------------------
/**
* Singular
*
* Takes a plural word and makes it singular (improved by stensi)
*
* @access public
* @param string
* @return str
*/
if ( ! function_exists('singular'))
{
function singular($str)
{
$str = strtolower(trim($str));
$end5 = substr($str, -5);
$end4 = substr($str, -4);
$end3 = substr($str, -3);
$end2 = substr($str, -2);
$end1 = substr($str, -1);
if ($end5 == 'eives')
{
$str = substr($str, 0, -3).'f';
}
elseif ($end4 == 'eaux')
{
$str = substr($str, 0, -1);
}
elseif ($end4 == 'ives')
{
$str = substr($str, 0, -3).'fe';
}
elseif ($end3 == 'ves')
{
$str = substr($str, 0, -3).'f';
}
elseif ($end3 == 'ies')
{
$str = substr($str, 0, -3).'y';
}
elseif ($end3 == 'men')
{
$str = substr($str, 0, -2).'an';
}
elseif ($end3 == 'xes' && strlen($str) > 4 OR in_array($end3, array('ses', 'hes', 'oes')))
{
$str = substr($str, 0, -2);
}
elseif (in_array($end2, array('da', 'ia', 'la')))
{
$str = substr($str, 0, -1).'um';
}
elseif (in_array($end2, array('bi', 'ei', 'gi', 'li', 'mi', 'pi')))
{
$str = substr($str, 0, -1).'us';
}
else
{
if ($end1 == 's' && $end2 != 'us' && $end2 != 'ss')
{
$str = substr($str, 0, -1);
}
}
return $str;
}
}
// --------------------------------------------------------------------
/**
* Plural
*
* Takes a singular word and makes it plural (improved by stensi)
*
* @access public
* @param string
* @param bool
* @return str
*/
if ( ! function_exists('plural'))
{
function plural($str, $force = FALSE)
{
$str = strtolower(trim($str));
$end3 = substr($str, -3);
$end2 = substr($str, -2);
$end1 = substr($str, -1);
if ($end3 == 'eau')
{
$str .= 'x';
}
elseif ($end3 == 'man')
{
$str = substr($str, 0, -2).'en';
}
elseif (in_array($end3, array('dum', 'ium', 'lum')))
{
$str = substr($str, 0, -2).'a';
}
elseif (strlen($str) > 4 && in_array($end3, array('bus', 'eus', 'gus', 'lus', 'mus', 'pus')))
{
$str = substr($str, 0, -2).'i';
}
elseif ($end3 == 'ife')
{
$str = substr($str, 0, -2).'ves';
}
elseif ($end1 == 'f')
{
$str = substr($str, 0, -1).'ves';
}
elseif ($end1 == 'y')
{
if(preg_match('#[aeiou]y#i', $end2))
{
// ays, oys, etc.
$str = $str . 's';
}
else
{
$str = substr($str, 0, -1).'ies';
}
}
elseif ($end1 == 'o')
{
if(preg_match('#[aeiou]o#i', $end2))
{
// oos, etc.
$str = $str . 's';
}
else
{
$str .= 'es';
}
}
elseif ($end1 == 'x' || in_array($end2, array('ss', 'ch', 'sh')) )
{
$str .= 'es';
}
elseif ($end1 == 's')
{
if ($force == TRUE)
{
$str .= 'es';
}
}
else
{
$str .= 's';
}
return $str;
}
}
// --------------------------------------------------------------------
/**
* Camelize
*
* Takes multiple words separated by spaces or underscores and camelizes them
*
* @access public
* @param string
* @return str
*/
if ( ! function_exists('camelize'))
{
function camelize($str)
{
$str = 'x'.strtolower(trim($str));
$str = ucwords(preg_replace('/[\s_]+/', ' ', $str));
return substr(str_replace(' ', '', $str), 1);
}
}
// --------------------------------------------------------------------
/**
* Underscore
*
* Takes multiple words separated by spaces and underscores them
*
* @access public
* @param string
* @return str
*/
if ( ! function_exists('underscore'))
{
function underscore($str)
{
return preg_replace('/[\s]+/', '_', strtolower(trim($str)));
}
}
// --------------------------------------------------------------------
/**
* Humanize
*
* Takes multiple words separated by underscores and changes them to spaces
*
* @access public
* @param string
* @return str
*/
if ( ! function_exists('humanize'))
{
function humanize($str)
{
return ucwords(preg_replace('/[_]+/', ' ', strtolower(trim($str))));
}
}
/* End of file inflector_helper.php */
/* Location: ./application/helpers/inflector_helper.php */

View File

@@ -0,0 +1,25 @@
<?php
$lang['alpha_dash_dot'] = 'El camp de %s només permet caràcters alfanumèrics, guions baixos, ratlles i punts finals.';
$lang['alpha_slash_dot'] = 'El camp de %s només permet caràcters alfanumèrics, guions baixos, ratlles, barres i punts finals.';
$lang['min_date'] = 'El camp de %s ha de ser posterior o igual a %s.';
$lang['max_date'] = 'El camp de %s no pot superar %s.';
$lang['min_size'] = 'El camp de %s com a mínim permet %s.';
$lang['max_size'] = 'El camp de %s com a màxim permet %s.';
$lang['transaction'] = '%s ha fallat en %s.';
$lang['unique'] = '%s proposat ja existeix.';
$lang['unique_pair'] = 'La combinació proposada de %s amb %s ja existeix.';
$lang['valid_date'] = 'El camp %s ha de contenir una data vàlida.';
$lang['valid_date_group'] = 'El camp %s ha de contenir un grup de dates vàlides.';
$lang['valid_match'] = 'El camp %s només pot contenir %s.';
$lang['related_required'] = 'Es requereix la relació %s.';
$lang['related_min_size'] = 'Es requereix que la relació %s sigui com a mìnim de %s.';
$lang['related_max_size'] = 'Es requereix que la relació %s no excedeixi %s.';
$lang['dm_save_rel_failed'] = 'La relació %s no està ben definida.';
$lang['dm_save_rel_nothis'] = 'No es pot guardar la relació %s: Aquest objecte no està guardat.';
$lang['dm_save_rel_noobj'] = 'No es pot guardar la relació %s: Aquest objecte relacionat no està guardat.';
/* End of file datamapper_lang.php */
/* Location: ./application/language/catalan/datamapper_lang.php */

View File

@@ -0,0 +1,25 @@
<?php
$lang['alpha_dash_dot'] = 'The %s field may only contain alpha-numeric characters, underscores, dashes, and full stops.';
$lang['alpha_slash_dot'] = 'The %s field may only contain alpha-numeric characters, underscores, dashes, slashes, and full stops.';
$lang['min_date'] = 'The %s field must be at least %s.';
$lang['max_date'] = 'The %s field can not exceed %s.';
$lang['min_size'] = 'The %s field must be at least %s.';
$lang['max_size'] = 'The %s field can not exceed %s.';
$lang['transaction'] = 'The %s failed to %s.';
$lang['unique'] = 'The %s you supplied is already taken.';
$lang['unique_pair'] = 'The combination of %s and %s you supplied is already taken.';
$lang['valid_date'] = 'The %s field must contain a valid date.';
$lang['valid_date_group'] = 'The %2$s fields must contain a valid date.';
$lang['valid_match'] = 'The %s field may only be %s.';
$lang['related_required'] = 'The %s relationship is required.';
$lang['related_min_size'] = 'The %s relationship must be at least %s.';
$lang['related_max_size'] = 'The %s relationship can not exceed %s.';
$lang['dm_save_rel_failed'] = 'The %s relationship is not properly defined.';
$lang['dm_save_rel_nothis'] = 'Unable to save the %s relationship: This object is not saved.';
$lang['dm_save_rel_noobj'] = 'Unable to save the %s relationship: The related object was not saved.';
/* End of file datamapper_lang.php */
/* Location: ./application/language/english/datamapper_lang.php */

View File

@@ -0,0 +1,25 @@
<?php
$lang['alpha_dash_dot'] = 'El campo de %s sólo permite caracteres alfanuméricos, guiones bajos, guiones y puntos finals.';
$lang['alpha_slash_dot'] = 'El campo de %s sólo permite caracteres alfanuméricos, guiones bajos, guiones, barras y puntos finales.';
$lang['min_date'] = 'El campo de %s tiene que ser superior o igual a %s.';
$lang['max_date'] = 'El campo de %s no puede superar %s.';
$lang['min_size'] = 'El campo de %s como minimo permite %s.';
$lang['max_size'] = 'El campo de %s como maximo permite %s.';
$lang['transaction'] = '%s falló en %s.';
$lang['unique'] = '%s que se ha propuesto ya existe.';
$lang['unique_pair'] = 'La combinación propuesta de %s con %s ya existe.';
$lang['valid_date'] = 'El campo %s tiene que contener una fecha valida.';
$lang['valid_date_group'] = 'El campo %s tiene que contener un grupo de fechas validas.';
$lang['valid_match'] = 'El campo %s sólo puede contener %s.';
$lang['related_required'] = 'Se requiere %s.';
$lang['related_min_size'] = 'Se requiere que de %s haya como minimo %s.';
$lang['related_max_size'] = 'Se requiere que de %s no exceda %s.';
$lang['dm_save_rel_failed'] = 'La relación %s no esta bien definida.';
$lang['dm_save_rel_nothis'] = 'No se puede guardar la relación %s: Este objeto no esta guardado.';
$lang['dm_save_rel_noobj'] = 'No se puede guardar la relación %s: Este objeto relacionado no esta guardado.';
/* End of file datamapper_lang.php */
/* Location: ./application/language/spanish/datamapper_lang.php */

View File

@@ -0,0 +1,25 @@
<?php
$lang['alpha_dash_dot'] = 'Le champ %s ne doit contenir que des caractères alphanumériques, des tirets bas ou haut, et des points.';
$lang['alpha_slash_dot'] = 'Le champ %s ne doit contenir que des caractères alphanumériques, des tirets bas ou haut, des slashes et des points.';
$lang['min_date'] = 'Le champ %s doit etre ultérieur á %s.';
$lang['max_date'] = 'Le champ %s doit ètre antérieur á %s.';
$lang['min_size'] = 'Le champ %s doit ètre supérieur á %s';
$lang['max_size'] = 'Le champ %s doit ètre inférieur á %s.';
$lang['transaction'] = '%s a échoué á %s.';
$lang['unique'] = 'La valeur du champ %s renseignée est déjá prise.';
$lang['unique_pair'] = 'La combinaison des champs %s et %s est déjá prise.';
$lang['valid_date'] = 'Le champ %s doit contenir une date valide.';
$lang['valid_date_group'] = 'Les champs %2$s doivent contenir une date valide.';
$lang['valid_match'] = 'La valeur du champ %s doit ètre %s.';
$lang['related_required'] = 'Une relation %s est requise.';
$lang['related_min_size'] = 'La relation %s doit ètre supérieure á %s.';
$lang['related_max_size'] = 'La relation %s doit ètre inférieure á %s.';
$lang['dm_save_rel_failed'] = 'La relation %s n\'est pas définie correctement.';
$lang['dm_save_rel_nothis'] = 'Impossible de sauvegarde la relation %s : cet objet n\'est pas sauvegardé.';
$lang['dm_save_rel_noobj'] = 'Impossible de sauvegarde la relation %s. L\'objet en relation n\'est pas sauvegardé.';
/* End of file datamapper_lang.php */
/* Location: ./application/language/english/datamapper_lang.php */

View File

@@ -0,0 +1,25 @@
<?php
$lang['alpha_dash_dot'] = '%s darf nur alpha-numerische Zeichen, Unterstriche, Bindestriche und Punkte enthalten.';
$lang['alpha_slash_dot'] = '%s darf nur alpha-numerische Zeichen, Unterstriche, Bindestriche, Punkte und Schrägstriche enthalten.';
$lang['min_date'] = '%s muss größer als %s sein.';
$lang['max_date'] = '%s muss kleiner als %s sein.';
$lang['min_size'] = '%s muss größer als %s sein.';
$lang['max_size'] = '%s muss kleiner als %s sein.';
$lang['transaction'] = 'Feld %s hatte einen Fehler bei %s.';
$lang['unique'] = '%s ist bereits vorhanden.';
$lang['unique_pair'] = 'Die Kombination von %s und %s ist bereits vergeben.';
$lang['valid_date'] = '%s muss ein gültiges Datum enthalten.';
$lang['valid_date_group'] = '%2$s müssen ein gültiges Datum enthalten.';
$lang['valid_match'] = 'Das Feld %s darf nur %s entsprechen.';
$lang['related_required'] = 'Eine Beziehung des Feldes %s ist erforderlich.';
$lang['related_min_size'] = 'Eine Beziehung des Feldes %s muss mindestens %s sein.';
$lang['related_max_size'] = 'Eine Beziehung des Feldes %s darf maximal %s sein.';
$lang['dm_save_rel_failed'] = 'Die Beziehung des Feldes %s ist nicht korrekt definiert.';
$lang['dm_save_rel_nothis'] = 'Beziehung des Feldes %s: Das Objekt ist nicht gespeichert.';
$lang['dm_save_rel_noobj'] = 'Beziehung des Feldes %s: Das verwandte Objekt ist nicht gespeichert.';
/* End of file datamapper_lang.php */
/* Location: ./application/language/german/datamapper_lang.php */

View File

@@ -0,0 +1,25 @@
<?php
$lang['alpha_dash_dot'] = 'Het veld %s mag alleen alfanumerieke tekens, streepjes, en punten bevatten.';
$lang['alpha_slash_dot'] = 'Het veld %s mag alleen alfanumerieke tekens, streepjes, schuine strepen en punten bevatten.';
$lang['min_date'] = 'De datum in het veld %s mag niet vroeger zijn dan %s.';
$lang['max_date'] = 'De datum in het veld %s mag niet later zijn dan %s.';
$lang['min_size'] = 'Het veld %s mag niet kleiner zijn dan %s.';
$lang['max_size'] = 'Het veld %s mag niet groter zijn dan %s.';
$lang['transaction'] = 'De %s "%s" is mislukt.';
$lang['unique'] = 'De waarde %s is al in gebruik.';
$lang['unique_pair'] = 'De combinatie van %s en %s is al in gebruik.';
$lang['valid_date'] = 'Het veld %s moet een geldige datum bevatten.';
$lang['valid_date_group'] = 'De %2$s velden moeten een geldige datum bevatten.';
$lang['valid_match'] = 'Het veld %s mag alleen maar %s bevatten.';
$lang['related_required'] = 'De %s relatie is verplicht.';
$lang['related_min_size'] = 'De %s relatie moet minimaal %s zijn.';
$lang['related_max_size'] = 'De %s relatie mag maximaal %s zijn.';
$lang['dm_save_rel_failed'] = 'De %s relatie is niet correct gedefinieerd.';
$lang['dm_save_rel_nothis'] = '%s relatie kan niet worden opgeslagen: Dit object is niet bewaard.';
$lang['dm_save_rel_noobj'] = '%s relatie kan niet worden opgeslagen: Het gerelateerde object is niet bewaard.';
/* End of file datamapper_lang.php */
/* Location: ./application/language/nl/datamapper_lang.php */

View File

@@ -0,0 +1,25 @@
<?php
$lang['alpha_dash_dot'] = 'O campo %s deve conter apenas caractéres alfa-numéricos, sublinhados, traços e paradas completas.';
$lang['alpha_slash_dot'] = 'O campo %s deve conter apenas caractéres alfa-numéricos, underscores, traços, barras e paradas completas.';
$lang['min_date'] = 'O campo %s deve ser no minímo %s';
$lang['max_date'] = 'O campo %s não pode exceder %s';
$lang['min_size'] = 'O campo %s deve ser no minímo %s';
$lang['max_size'] = 'O campo %s não pode exceder %s';
$lang['transaction'] = 'O %s falhou para %s';
$lang['unique'] = 'O %s que você tentou já está sendo usado.';
$lang['unique_pair'] = 'A combinação de %s e %s que você tentou já está sendo usada.';
$lang['valid_date'] = 'O campo %s deve conter uma data válida.';
$lang['valid_date_group'] = 'Os campos %s$s devem conter uma data válida';
$lang['valid_match'] = 'O campo %s deve conter apenas %s';
$lang['related_required'] = 'O relacionamento %s é necessário.';
$lang['related_min_size'] = 'O relacionamento %s deve ser no minímo %s.';
$lang['related_max_size'] = 'O relacionamento %s não pode exceder %s.';
$lang['dm_save_rel_failer'] = 'O relacionamento %s não está definido corretamente.';
$lang['dm_save_rel_nothis'] = 'Não foi possível salvar o relacionamento %s: O objeto não está salvo.';
$lang['dm_save_rel_noobj'] = 'Não foi possível saver o relacionamento %s: O objeto relacionado não foi salvo.';
/* End of file datamapper_lang.php */
/* Location: ./application/language/pt_BR/datamapper_lang.php */

File diff suppressed because it is too large Load Diff