Skip to content
Browse files

Remove gas orm

Signed-off-by: Purwandi <free6300@gmail.com>
  • Loading branch information...
1 parent 06e5800 commit e16b9361339cd9c76ff52245c2afaf0f8c021ed4 @purwandi purwandi committed Mar 12, 2012
View
16 sparks/gas-orm/1.4.3/README.markdown
@@ -1,16 +0,0 @@
-# CodeIgniter Gas ORM Library
-
-A lighweight and easy-to-use ORM for CodeIgniter
-
-## Requirement
-
-* PHP v.5.2.x
-* CodeIgniter v.2.x.x
-
-## What is Gas ORM ?
-
-A lighweight and easy-to-use ORM for CodeIgniter. Gas was built specifically for CodeIgniter app. It uses standard CI DB packages, also take anvantages from CI validator class. Gas ORM provide a set of methods that will map your database tables and its relationship, into accesible object.
-
-## Documentation and Examples
-
-Go to [home of Gas ORM](http://gasorm-doc.taufanaditya.com "home of Gas ORM") for full guide about convention and in-depth usage.
View
9 sparks/gas-orm/1.4.3/config/autoload.php
@@ -1,9 +0,0 @@
-<?php
-/*
-| -------------------------------------------------------------------
-| Library Autoload
-| -------------------------------------------------------------------
-| For an easy to use implementation, is better to autoload Gas class.
-|
-*/
-$autoload['libraries'] = array('gas');
View
146 sparks/gas-orm/1.4.3/config/gas.php
@@ -1,146 +0,0 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/*
-| -------------------------------------------------------------------
-| Gas Configuration
-| -------------------------------------------------------------------
-| This file contains an array of Gas ORM configuration
-| used by the Gas ORM library.
-|
-*/
-
-/*
-| -------------------------------------------------------------------
-| Models path
-| -------------------------------------------------------------------
-| Prototype:
-|
-| $config['models_path'] = array(APPPATH.'models', APPPATH.'modules', FCPATH.'modules');
-|
-*/
-
-$config['models_path'] = array(APPPATH.'models', APPPATH.'modules', FCPATH.'modules');
-
-/*
-| -------------------------------------------------------------------
-| Models suffix
-| -------------------------------------------------------------------
-| Instruction:
-|
-| Each Gas model should have suffix, and its better to have suffix
-| other than '_model', because ussually that suffix is used by
-| CI native models. For example, if you have 'User' class then it
-| should named as 'user_gas.php'.
-|
-| Prototype:
-|
-| $config['models_suffix'] = '_gas';
-|
-*/
-
-$config['models_suffix'] = '_gas';
-
-/*
-| -------------------------------------------------------------------
-| Auto-load models
-| -------------------------------------------------------------------
-| Prototype:
-|
-| $config['autoload_models'] = TRUE;
-|
-*/
-
-$config['autoload_models'] = TRUE;
-
-/*
-| -------------------------------------------------------------------
-| Extensions list
-| -------------------------------------------------------------------
-| Prototype:
-|
-| $config['extensions'] = array('dummy', 'html', 'jquery');
-|
-*/
-
-$config['extensions'] = array('dummy', 'html', 'jquery');
-
-/*
-| -------------------------------------------------------------------
-| Auto-load extensions
-| -------------------------------------------------------------------
-| Prototype:
-|
-| $config['autoload_extensions'] = TRUE;
-|
-*/
-
-$config['autoload_extensions'] = TRUE;
-
-/*
-| -------------------------------------------------------------------
-| Cache request
-| -------------------------------------------------------------------
-| Prototype:
-|
-| $config['cache_request'] = TRUE;
-|
-*/
-
-$config['cache_request'] = TRUE;
-
-/*
-| -------------------------------------------------------------------
-| Auto-create models and migration files
-| -------------------------------------------------------------------
-| Instruction:
-|
-| Before you enable this configuration option, make sure you already
-| have some exists tables within your database.
-| If you enable this option, Gas ORM will create a basic Gas model
-| based by your database schema, and its sibling Migration files.
-|
-| Auto-create models are disabled by default for security reasons.
-| You should enable this only whenever you intend to do a schema migration
-| from database to your Gas model, and disable it back when you're done.
-|
-| NOTE :
-|
-| 1. If you already have some Gas model files, back-up first.
-| 2. You have to enable migration library.
-| 3. To avoid unexpected results, backup any exists migration files.
-|
-| Prototype:
-|
-| $config['auto_create_models'] = TRUE;
-|
-*/
-
-$config['auto_create_models'] = FALSE;
-
-/*
-| -------------------------------------------------------------------
-| Auto-create tables and migration files
-| -------------------------------------------------------------------
-| Instruction:
-|
-| Before you enable this configuration option, make sure you already
-| have some exists Gas model within your model directories.
-| If you enable this option, Gas ORM will create sibling Migration files
-| for based by each of your models and then run it via Migration mechanism.
-|
-| Auto-create tables are disabled by default for security reasons.
-| You should enable this only whenever you intend to do a schema migration
-| from your Gas model to database, and disable it back when you're done.
-|
-| NOTE :
-|
-| 1. You have to enable migration library.
-| 2. To avoid unexpected results, backup any exists migration files.
-| 3. Gas ORM will ignore this option, if your migration version not '0'.
-|
-| Prototype:
-|
-| config['auto_create_tables'] = TRUE;
-|
-*/
-
-$config['auto_create_tables'] = FALSE;
View
1,565 sparks/gas-orm/1.4.3/controllers/gasunittest.php
0 additions, 1,565 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
32 sparks/gas-orm/1.4.3/language/dutch/gas_lang.php
@@ -1,32 +0,0 @@
-<?php
-
-$lang['db_connection_error'] = 'Kan geen verbinding met de database maken: %s';
-
-$lang['models_not_found'] = 'Kan opgegeven models locatie niet vinden: %s';
-
-$lang['models_found_no_relations'] = 'Model %s gevonden, maar de relatie eigenschappen ontbreken.';
-
-$lang['extensions_not_found'] = 'Opgegeven extensions locatie niet gevonden: %s';
-
-$lang['empty_arguments'] = 'Kan %s niet uitvoeren zonder parameter(s).';
-
-$lang['cannot_create_model'] = 'Gas ORM kan geen model(s) bestand cre&euml;ren in: %s';
-
-$lang['cannot_create_migration'] = 'Gas ORM kan geen migration(s) bestand cre&euml;ren in: %s';
-
-$lang['migration_no_setting'] = 'Gas ORM auto-migrate is gestopt, omdat er geen instellingen zijn gevonden.';
-
-$lang['migration_no_dir'] = 'Gas ORM auto-migrate is gestopt, omdat er geen geldige directory is gevonden.';
-
-$lang['migration_no_initial'] = 'Gas ORM auto-migrate is gestopt, omdat de migration versie boven \'0\' is.';
-
-$lang['migration_disabled'] = 'Gas ORM auto-migrate is gestopt, omdat de migration library is uitgeschakeld.';
-
-$lang['both_auto_error'] = 'Gas ORM kan niet tegelijkertijd automatisch aangemaakte tabellen en modellen uit voeren, schakel &eacute;&eacute;n van hen uit.';
-
-
-$lang['auto_check'] = 'Het veld %s is een ongeldig AUTOINCREMENT veld.';
-
-$lang['char_check'] = 'Het veld %s is een ongeldig CHAR veld.';
-
-$lang['date_check'] = 'Het veld %s is een ongeldig DATETIME veld.';
View
10 sparks/gas-orm/1.4.3/language/dutch/index.html
@@ -1,10 +0,0 @@
-<html>
-<head>
- <title>403 Forbidden</title>
-</head>
-<body>
-
-<p>Directory access is forbidden.</p>
-
-</body>
-</html>
View
32 sparks/gas-orm/1.4.3/language/english/gas_lang.php
@@ -1,32 +0,0 @@
-<?php
-
-$lang['db_connection_error'] = 'Cannot connect to database with these connection group or dsn string : %s';
-
-$lang['models_not_found'] = 'Unable to locate the models path you have specified: %s';
-
-$lang['models_found_no_relations'] = 'Model %s located, but missing relationship properties.';
-
-$lang['extensions_not_found'] = 'Unable to locate the extensions path you have specified: %s';
-
-$lang['empty_arguments'] = 'Cannot continue executing %s without any passed parameter.';
-
-$lang['cannot_create_model'] = 'Gas ORM cannot create a model(s) file at: %s';
-
-$lang['cannot_create_migration'] = 'Gas ORM cannot create a migration(s) file at: %s';
-
-$lang['migration_no_setting'] = 'Gas ORM auto-migrate was stopped, because no settings are found.';
-
-$lang['migration_no_dir'] = 'Gas ORM auto-migrate was stopped, because no valid directory is found.';
-
-$lang['migration_no_initial'] = 'Gas ORM auto-migrate was stopped, because migration version is above \'0\'.';
-
-$lang['migration_disabled'] = 'Gas ORM auto-migrate was stopped, because migration library is disabled.';
-
-$lang['both_auto_error'] = 'Gas ORM cannot execute both auto-created tables and models at same time, disabled one of them.';
-
-
-$lang['auto_check'] = 'The %s field was an invalid autoincrement field.';
-
-$lang['char_check'] = 'The %s field was an invalid char field.';
-
-$lang['date_check'] = 'The %s field was an invalid datetime field.';
View
10 sparks/gas-orm/1.4.3/language/english/index.html
@@ -1,10 +0,0 @@
-<html>
-<head>
- <title>403 Forbidden</title>
-</head>
-<body>
-
-<p>Directory access is forbidden.</p>
-
-</body>
-</html>
View
32 sparks/gas-orm/1.4.3/language/indonesia/gas_lang.php
@@ -1,32 +0,0 @@
-<?php
-
-$lang['db_connection_error'] = 'Tidak dapat menghubungi database dengan koneksi group atau dsn berikut : %s';
-
-$lang['models_not_found'] = 'Tidak bisa mendapatkan path model yang dicari: %s';
-
-$lang['models_found_no_relations'] = 'Model %s ditemukan, tapi propery relations tidak ada.';
-
-$lang['extensions_not_found'] = 'Tidak bisa mendapatkan path ekstensi yang dicari: %s';
-
-$lang['empty_arguments'] = 'Tidak dapat melanjutkan eksekusi %s tanpa parameter.';
-
-$lang['cannot_create_model'] = 'Gas ORM tidak dapat membuat file model di: %s';
-
-$lang['cannot_create_migration'] = 'Gas ORM tidak dapat membuat file migrasi di: %s';
-
-$lang['migration_no_setting'] = 'Gas ORM auto-migrate tidak dapat melanjutkan, karena konfigurasi tidak ditemukan.';
-
-$lang['migration_no_dir'] = 'Gas ORM auto-migrate tidak dapat melanjutkan, karena direktori yang valid tidak ditemukan.';
-
-$lang['migration_no_initial'] = 'Gas ORM auto-migrate tidak dapat melanjutkan, karena versi migrasi diatas \'0\'.';
-
-$lang['migration_disabled'] = 'Gas ORM auto-migrate tidak dapat melanjutkan, karena migrasi tidak diaktifkan.';
-
-$lang['both_auto_error'] = 'Gas ORM tidak dapat melanjutkan auto-create tabel dan model di saat bersamaan, matikan salah satu.';
-
-
-$lang['auto_check'] = 'Bidang %s adalah karakter auto yang tidak valid.';
-
-$lang['char_check'] = 'Bidang %s adalah karakter char yang tidak valid.';
-
-$lang['date_check'] = 'Bidang %s adalah karakter datetime yang tidak valid.';
View
10 sparks/gas-orm/1.4.3/language/indonesia/index.html
@@ -1,10 +0,0 @@
-<html>
-<head>
- <title>403 Forbidden</title>
-</head>
-<body>
-
-<p>Directory access is forbidden.</p>
-
-</body>
-</html>
View
31 sparks/gas-orm/1.4.3/language/italian/gas_lang.php
@@ -1,31 +0,0 @@
-<?php
-
-$lang['db_connection_error'] = 'Impossibile connettersi al database con questi gruppi o una stringa di connessione dsn: %s';
-
-$lang['models_not_found'] = 'Il percorso %s specificato nel file di configurazione non &egrave; valido.';
-
-$lang['models_found_no_relations'] = 'Nessuna relazione valida trovata nel model %s.';
-
-$lang['extensions_not_found'] = 'Il percorso %s specificato nel file di configurazione non &egrave; valido.';
-
-$lang['empty_arguments'] = '%s non pu&ograve; essere invocato senza parametri.';
-
-$lang['cannot_create_model'] = 'Gas ORM non pu&ograve; creare il model: %s';
-
-$lang['cannot_create_migration'] = 'Gas ORM non pu&ograve; creare il file migration: %s';
-
-$lang['migration_no_setting'] = 'Gas ORM auto-migrate si &egrave; arrestato poich&egrave; non &egrave; stata trovata alcuna configurazione.';
-
-$lang['migration_no_dir'] = 'Gas ORM auto-migrate si &egrave; arrestato poich&egrave; non non &egrave; stata trovata alcuna directory valida.';
-
-$lang['migration_no_initial'] = 'Gas ORM auto-migrate si &egrave; arrestato poich&egrave; la versione &egrave; maggiore di \'0\'.';
-
-$lang['migration_disabled'] = 'Gas ORM auto-migrate si &egrave; arrestato poich&egrave; migration library &egrave stata disabilitata.';
-
-$lang['both_auto_error'] = 'Gas ORM non pu&ograve; eseguire contemporaneamente le tabelle create automaticamente e i model disabilitare una delle due opzioni.';
-
-$lang['auto_check'] = 'Il campo %s non &egrave; un campo di tipo autoincrement valido.';
-
-$lang['char_check'] = 'Il campo %s non &egrave; un campo di tipo char valido.';
-
-$lang['date_check'] = 'Il campo %s non &egrave; un campo di tipo datetime valido.';
View
10 sparks/gas-orm/1.4.3/language/italian/index.html
@@ -1,10 +0,0 @@
-<html>
-<head>
- <title>403 Forbidden</title>
-</head>
-<body>
-
-<p>Directory access is forbidden.</p>
-
-</body>
-</html>
View
34 sparks/gas-orm/1.4.3/language/spanish/gas_lang.php
@@ -1,34 +0,0 @@
-<?php
-
-$lang['db_connection_error'] = 'No se puede conectar a la base de datos con este grupo de conexión o cadena dsn : %s';
-
-$lang['models_not_found'] = 'No se pueden encontrar los modelos en la ruta especificada: %s';
-
-$lang['models_found_no_relations'] = 'Modelo %s localizado, pero no se encuentran las propiedades de relación.';
-
-$lang['extensions_not_found'] = 'No se pueden encontrar las extensiones en la ruta especificada: %s';
-
-$lang['empty_arguments'] = 'No se puede continuar ejecutando %s sin pasar algún parámetro.';
-
-$lang['cannot_create_model'] = 'Gas ORM no puede crear el fichero para el/los modelo/s: %s';
-
-$lang['cannot_create_migration'] = 'Gas ORM no se puede crear un fichero para la migración: %s';
-
-$lang['migration_no_setting'] = 'Gas ORM auto-migración fue detenida porque no se ha encontrado la configuración.';
-
-$lang['migration_no_dir'] = 'Gas ORM auto-migración fue detenida porque no se ha encontrado un directorio válido..';
-
-$lang['migration_no_initial'] = 'Gas ORM auto-migración fue detenida porque la versión de migración es superior a \'0\'.';
-
-$lang['migration_disabled'] = 'Gas ORM auto-migración fue detenida porque la libreria de migración está deshabilitada.';
-
-$lang['both_auto_error'] = 'Gas ORM no puede ejecutar la auto creación de tablas y modelos al mismo tiempo, desactiva alguna de las opciones.';
-
-
-$lang['auto_check'] = 'El campo %s no es válido para el auto-incremento.';
-
-$lang['char_check'] = 'El campo %s no es valido para tipos char.';
-
-$lang['date_check'] = 'El campo %s no es válido para tipos datetime.';
-
-
View
10 sparks/gas-orm/1.4.3/language/spanish/index.html
@@ -1,10 +0,0 @@
-<html>
-<head>
- <title>403 Forbidden</title>
-</head>
-<body>
-
-<p>Directory access is forbidden.</p>
-
-</body>
-</html>
View
5,114 sparks/gas-orm/1.4.3/libraries/Gas.php
0 additions, 5,114 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
123 sparks/gas-orm/1.4.3/libraries/Gas_extension_dummy.php
@@ -1,123 +0,0 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
-/**
- * Gas Extension Dummy.
- *
- * @package Gas Library
- * @subpackage Gas Extension
- * @category Libraries
- * @author Taufan Aditya A.K.A Toopay
- * @link http://gasorm-doc.taufanaditya.com/
- * @license BSD(http://gasorm-doc.taufanaditya.com/what_is_gas_orm.html#bsd)
- */
-
-class Gas_extension_dummy implements Gas_extension {
-
- // This is a properties, which will be used to transport Gas Instance
- public $gas;
-
- public $explanation;
-
- /**
- * __init
- *
- * Initialize extension
- *
- * @access public
- * @param object
- * @return void
- */
- public function __init($gas)
- {
- // Here, Gas will transport your instance
- $this->gas = $gas;
- }
-
- /**
- * explain
- *
- * Explain about related Gas instance
- *
- * @access public
- * @param mixed
- * @return string
- */
- public function explain($args = null)
- {
- $CI =& get_instance();
-
- if ( ! class_exists('CI_Typography')) $CI->load->library('typography');
-
- if ( ! class_exists('CI_Table')) $CI->load->library('table');
-
- $arguments = ! is_null($this->explanation) ? var_export($this->explanation, TRUE) : var_export($args, TRUE);
-
- $nickname = key($this->gas->extensions);
-
- $fullname = $this->gas->extensions[$nickname];
-
- $path = __FILE__;
-
- $model = ucfirst($this->gas->model());
-
- $structure = $this->gas->list_fields();
-
- $relationships = array_keys($this->gas->relations);
-
- $records = $this->gas->get_raw_record();
-
- $CI->table->set_heading($structure);
-
- foreach ($records as $record)
- {
-
- $CI->table->add_row(array_values($record));
-
- }
-
- $table = $CI->table->generate();
-
- $CI->table->clear();
-
-
- $explanation = 'Hello, i am an extension. ';
-
- $explanation .= 'My nickname is '.$nickname.' and my fullname is '.$fullname.'.'."\n";
-
- $explanation .= 'You can found me at '.$path.'.'."\n";
-
- $explanation .= 'You call me through '.$model.' instance, and passing bellow arguments : '."\n";
-
- $explanation .= $arguments ."\n";
-
- $explanation .= 'to processed, and to explain what '.$model.' model looks like.'."\n";
-
- $explanation .= $model.' model have table structure : ';
-
- $explanation .= implode(', ', $structure)."\n";
-
- $explanation .= $model.' model have defined relationship : ';
-
- $explanation .= implode(', ', $relationships)."\n";
-
- $explanation .= $model.' instance now is holding : '.count($records).' record(s)'."\n";
-
- $explanation .= 'With little help from Table and Typography library,'."\n";
-
- $explanation .= 'I can create this paragraph, also output the record into this table : '."\n";
-
- $explanation .= $table;
-
- $explanation .= 'So basicly, my purpose is to become a standard interface which you can use,'."\n";
-
- $explanation .= 'to share common function which utilize either CI Library or your own library, '."\n";
-
- $explanation .= 'across your Gas models/instances.'."\n";
-
- $explanation .= 'This is all I can say.'."\n";
-
- $formatted_explanation = $CI->typography->auto_typography($explanation);
-
- return '<pre>'.$formatted_explanation.'</pre>';
- }
-}
View
459 sparks/gas-orm/1.4.3/libraries/Gas_extension_html.php
@@ -1,459 +0,0 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
-/**
- * Gas Extension HTML.
- *
- * @package Gas Library
- * @subpackage Gas Extension
- * @category Libraries
- * @author Taufan Aditya A.K.A Toopay
- * @link http://gasorm-doc.taufanaditya.com/
- * @license BSD(http://gasorm-doc.taufanaditya.com/what_is_gas_orm.html#bsd)
- */
-
-class Gas_extension_html implements Gas_extension {
-
- public $gas;
-
- public $table_headings;
-
- public $table_template;
-
- public $table_records;
-
- public $form_labels;
-
- public $form_definitions;
-
- public $form_separator = '';
-
- public $form_entity_prefix = '<p>';
-
- public $form_entity_suffix = '</p>';
-
- public $form_submit = '';
-
- public $hidden_keys = array();
-
- /**
- * __init
- *
- * Initialize extension
- *
- * @access public
- * @param object
- * @return void
- */
- public function __init($gas)
- {
- $this->gas = $gas;
- }
-
- /**
- * hide
- *
- * Hide keys for next operation
- *
- * @access public
- * @param array
- * @return void
- */
- public function hide($keys = array())
- {
- if ( ! empty($keys)) $this->hidden_keys = $keys;
-
- return $this;
- }
-
- /**
- * template
- *
- * Set table templates
- *
- * @access public
- * @param array
- * @return void
- */
- public function template($tmpl = array())
- {
- $this->table_template = $tmpl;
-
- return $this;
- }
-
- /**
- * heading
- *
- * Set table heading
- *
- * @access public
- * @param array
- * @return void
- */
- public function heading($headings = null)
- {
- if (is_null($headings))
- {
- $list_fields = $this->all_collumns();
-
- $headings = array_filter($list_fields, get_class($this).'::avoid_keys');
-
- array_walk_recursive($headings, get_class($this).'::human_name');
- }
-
- $this->table_headings = $headings;
-
- return $this;
- }
-
- /**
- * table
- *
- * Generate HTML table
- *
- * @access public
- * @return string
- */
- public function table()
- {
- $CI =& get_instance();
-
- if ( ! class_exists('CI_Table')) $CI->load->library('table');
-
- if (is_null($this->table_headings)) $this->heading();
-
- $CI->table->set_heading($this->table_headings);
-
- $CI->table->set_template($this->table_template);
-
- $records = $this->gas->get_raw_record();
-
- foreach ($records as $record)
- {
- $CI->table->add_row($record);
- }
-
- $raw_rows = $CI->table->rows;
-
- $CI->table->rows = array();
-
- foreach ($raw_rows as $raw_row)
- {
- $row = array_shift($raw_row);
-
- if ( ! empty($this->hidden_keys))
- {
- foreach ($this->hidden_keys as $hidden_key)
- {
- if (isset($row[$hidden_key])) unset($row[$hidden_key]);
- }
- }
-
- $CI->table->add_row(array_values($row));
- }
-
- $table = $CI->table->generate();
-
- $CI->table->clear();
-
- return $table;
- }
-
- /**
- * definition
- *
- * Set form fields entity definition
- *
- * @access public
- * @param array
- * @return void
- */
- public function definition($args = array())
- {
- $this->validate_form();
-
- $collumns = $this->all_collumns();
-
- if (empty($args)) $args = $collumns;
-
- $form_entities = array();
-
- $records = $this->gas->get_raw_record();
-
- if (empty($records)) $records[] = array_combine($collumns, array_fill(0, count($collumns), ''));
-
- $custom = FALSE;
-
- foreach ($records as $record)
- {
- foreach ($args as $key => $arg)
- {
- if (is_numeric($key))
- {
- $value = isset($record[$arg]) ? $record[$arg] : '';
-
- if (isset(Gas_core::$old_input[$arg])) $value = Gas_core::$old_input[$arg];
-
- $option = array('name' => $arg, 'value' => $value);
-
- $form_entities[$arg] = call_user_func('form_input', $option);
- }
- else
- {
- if ($custom == FALSE)
- {
- $this->definition();
-
- $custom = TRUE;
- }
-
- $type = key($arg);
-
- $value = isset($record[$key]) ? $record[$key] : '';
-
- if (isset(Gas_core::$old_input[$key])) $value = Gas_core::$old_input[$key];
-
- $option = $arg[$type];
-
- if ($type == 'dropdown' or $type == 'multiselect')
- {
- if ($type == 'dropdown')
- {
- $form_entities[$key] = form_dropdown($key, $option, $value);
- }
- else
- {
- $form_entities[$key] = form_multiselect($key.'[]', $option, $value);
- }
- }
- elseif ($type == 'checkbox' or $type == 'radio')
- {
- $checked = ! empty($value);
-
- $option = array_merge($option, array('name' => $key, 'checked' => $checked));
-
- $form_entities[$key] = call_user_func('form_'.$type, $option);
- }
- else
- {
- $option = array_merge($option, array('name' => $key, 'value' => $value));
-
- if ($type == 'hidden')
- {
- $form_entities[$key] = ':hidden:'.call_user_func('form_'.$type, $option);
- }
- else
- {
- $form_entities[$key] = call_user_func('form_'.$type, $option);
- }
- }
- }
- }
-
- if ($custom == TRUE)
- {
- $this->form_definitions = array_merge($this->form_definitions, $form_entities);
- }
- else
- {
- $this->form_definitions = $form_entities;
- }
-
- return $this;
- }
- }
-
- /**
- * separator
- *
- * Set form separator
- *
- * @access public
- * @param string
- * @return void
- */
- public function separator($separator = '')
- {
- $this->form_separator = $separator;
-
- return $this;
- }
-
- /**
- * entity
- *
- * Set Entity prefix or/and suffix
- *
- * @access public
- * @param string
- * @param string
- * @return void
- */
- public function entity($prefix = '<p>', $suffix = '</p>')
- {
- $this->form_entity_prefix = $prefix;
-
- $this->form_entity_suffix = $suffix;
-
- return $this;
- }
-
- /**
- * submit
- *
- * Set form submit
- *
- * @access public
- * @param string
- * @param string
- * @return void
- */
- public function submit($arg = 'submit', $content = 'Submit')
- {
- $this->validate_form();
-
- $this->form_submit = is_array($arg) ? form_submit($arg) : form_submit($arg, $content);
-
- return $this;
- }
-
- /**
- * form
- *
- * Generate HTML form
- *
- * @access public
- * @param string
- * @param array
- * @param bool
- * @param bool
- * @return string
- */
- public function form($url = '', $attributes = array(), $multipart = FALSE, $as_array = FALSE)
- {
- $this->validate_form();
-
- if (is_null($this->form_definitions)) $this->definition();
-
- $method = array('method' => 'POST');
-
- $attributes = empty($attributes) ? $method : array_merge($attributes, $method);
-
- $open_tag = ($multipart) ? form_open_multipart($url, $attributes) : form_open($url, $attributes);
-
- $entities = array();
-
- foreach ($this->form_definitions as $label => $entity)
- {
- if ( ! in_array($label, $this->hidden_keys))
- {
- if (strpos($entity, ':hidden:') === 0)
- {
- $entity = str_replace(':hidden:', '', $entity);
-
- $entities[] = $this->form_entity_prefix.$entity.$this->form_entity_suffix;
- }
- else
- {
- $entities[] = $this->form_entity_prefix.form_label(ucfirst($label)).$entity.$this->form_entity_suffix;
- }
- }
- }
-
- if (empty($this->form_submit)) $this->submit();
-
- $close_tag = form_close();
-
- if ($as_array)
- {
- $form = array(
-
- 'open_tag' => $open_tag,
-
- 'entities' => $entities,
-
- 'submit' => $this->form_submit,
-
- 'close_tag' => $close_tag,
-
- );
- }
- else
- {
- $form = $open_tag
-
- .implode($this->form_separator, $entities)
-
- .$this->form_separator
-
- .$this->form_submit
-
- .$close_tag;
- }
-
- return $form;
- }
-
- /**
- * validate_form
- *
- * Check form helper state
- *
- * @access protected
- * @return void
- */
- protected function validate_form()
- {
- if ( ! function_exists('form_open'))
- {
- $CI =& get_instance();
-
- $CI->load->helper('form');
- }
-
- return;
- }
-
- /**
- * all_collumns
- *
- * Return table collumns name
- *
- * @access protected
- * @return array
- */
- protected function all_collumns()
- {
- return $this->gas->list_fields();
- }
-
- /**
- * human_name
- *
- * Generate label portion
- *
- * @access protected
- * @param mixed
- * @param mixed
- * @return void
- */
- protected function human_name(&$v, $k)
- {
- $v = ucfirst(str_replace('_', '', $v));
- }
-
- /**
- * avoid_keys
- *
- * Sorting keys for hidden keys
- *
- * @access protected
- * @param mixed
- * @param mixed
- * @return void
- */
- protected function avoid_keys($v)
- {
- return( ! in_array($v, $this->hidden_keys));
- }
-}
View
135 sparks/gas-orm/1.4.3/libraries/Gas_extension_jquery.php
@@ -1,135 +0,0 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
-/**
- * Gas Extension jQuery.
- *
- * @package Gas Library
- * @subpackage Gas Extension
- * @category Libraries
- * @author Taufan Aditya A.K.A Toopay
- * @link http://gasorm-doc.taufanaditya.com/
- * @license BSD(http://gasorm-doc.taufanaditya.com/what_is_gas_orm.html#bsd)
- */
-
-class Gas_extension_jquery implements Gas_extension {
-
- public $gas;
-
- /**
- * __init
- *
- * Initialize extension
- *
- * @access public
- * @param object
- * @return void
- */
- public function __init($gas)
- {
- $this->gas = $gas;
- }
-
- /**
- * get_datatable_input
- *
- * Populate data for jQuery datatable (http://datatables.net)
- *
- * @access public
- * @param array
- * @return array
- */
- public function get_datatable_input($data)
- {
- // Define all possible input
- $echo = isset($data['sEcho']) ? intval($data['sEcho']) : 1;
-
- $like = (isset($data['sSearch']) and ! empty($data['sSearch'])) ? $data['sSearch'] : FALSE;
-
- $limit = (isset($data['iDisplayLength']) and $data['iDisplayLength'] != '-1') ? $data['iDisplayLength'] : 10;
-
- $offset = (isset($data['iDisplayStart'])) ? $data['iDisplayStart'] : 0;
-
- $order = (isset($data['iSortCol_0']) and ($data['iSortCol_0'])) ? array($data['iSortCol_0'], $data['sSortDir_0']) : FALSE;
-
- return array($echo, $like, $limit, $offset, $order);
- }
-
- /**
- * set_datatable_output
- *
- * Output JSON for datatable (http://datatables.net)
- *
- * @access public
- * @param array
- * @return json
- */
- public function set_datatable_output($echo, $limit, $total, $results)
- {
- // Prepare JSON
- $json['sEcho'] = $echo;
-
- $json['iTotalRecords'] = (string) $limit;
-
- $json['iTotalDisplayRecords'] = (string) $total;
-
- foreach($results as $record) $json['aaData'][] = array_values($record->to_array());
-
- return Gas_janitor::to_json($json);
- }
-
- /**
- * datatable
- *
- * Generate JSON for jQuery datatable (http://datatables.net)
- *
- * @access public
- * @param array
- * @return json
- */
- public function datatable($data)
- {
- list($echo, $like, $limit, $offset, $order) = $this->get_datatable_input($data);
-
- // Working on it
- $model = Gas::factory($this->gas->model());
-
- $collumns = Gas::factory($this->gas->model())->list_fields();
-
- if ($like !== FALSE)
- {
- $counter = 0;
-
- foreach ($collumns as $collumn)
- {
- if ($counter === 0)
- {
- $model->like($collumn, $like);
- }
- else
- {
- $model->or_like($collumn, $like);
- }
-
- $counter++;
- }
- }
-
- if ($order !== FALSE)
- {
- $field = array_shift($order);
-
- $direction = array_shift($order);
-
- $model->order_by($collumns[$field], $direction);
- }
-
- $model->limit($limit, $offset);
-
- // Populate result
- $results = $model->all();
-
- $total = Gas::factory($this->gas->model())->count_all();
-
- return $this->set_datatable_output($echo, $limit, $total, $results);
- }
-}
View
4 sparks/gas-orm/1.4.3/spark.info
@@ -1,4 +0,0 @@
-name: gas
-version: 1.4.3
-compatibility: 2.1.0
-tags: ["orm", "gas", "active record"]

0 comments on commit e16b936

Please sign in to comment.
Something went wrong with that request. Please try again.