-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Rapyd Components
Category:Libraries | Category:Libraries::CodeGenerators | Category:Libraries::Community
Rapyd Components Library is a set of classes that can help you to develop applications in Code Igniter. Rapyd provides: [h3]Data Presentation Components[/h3] * It has lists, grids, tables * It has a theme/views system to standardize components layout * A tag-based function-engine (to easily format field values ... "<#body#>|0|100.. ") * An easy way to paginate data (with CI helpers / libraries like uri and pagination) [h3]Data Editing Components[/h3] * A tiny dynamic ORM (DataObject), based on CI Active Record (now with a basic support for relationships) * Many field classes: input, textarea, editor (tinyMCE), datetime(jscalendar), etc.. * A form class (based on field classes and CI libs, helpers) * An elegant way to create CRUD interfaces (like CI scaffolding feature, but totally customizable) [h3]Multilanguage Support[/h3] * language & helper class to enable browser-to-language, or uri-to-language detection * rapyd comes with 5 languages (including CI languages): Image:flags.gif [h3]Authorization ACL[/h3] * Rapyd auth class provide a simple acl support. tables: users, roles, permissions, roles_pemissions, users_permissions. It has also helpers (to be used in views) for each method. * Some samples help you to build password-protected areas in five minutes, or complex permission-driven solutions. Image:components.gif
example of DataSet:[code] $this->rapyd->load('dataset');
//sample query: select * from articles where status = 'public'; //but it can also work with associative arrays (by passing a multidim. array as parameter)
$dataset = new DataSet("articles"); $dataset->db->where("status","public"); //db is areference to current CI Active Record $dataset->per_page = 5; $dataset->build();
// in the view you need to iterate this array (that is the page "subset" of data) $data["items"] = $dataset->data;
//this is the navigator $data["navigator"] = $dataset->navigator;
$this->load->view('myview', $data);
// Note: page offset can be autodetected by uri (it assumes last segment if numeric) // or can be set by $dataset->uri_segment property (like CI pagination class) // you can also customize nav link as in the pagination library: // $dataset->num_links = 10; ... and all other pagination config.[/code]
example of DataGrid: [code] $this->rapyd->load('datagrid');
//$mixed can be a table name, or a multidimensional array, or null //When it's null, the DataGrid uses current ActiveRecord DB preset
$datagrid = new DataGrid('Datagrid Name', $mixed);
$datagrid->per_page = 5; $datagrid->use_function("substr"); $datagrid->column_detail("Id","<#article_id#>", site_url('cnt/fnc/det/<#article_id#>')); $datagrid->column("Title",'title'); $datagrid->column("Body", "<#body#>|0|100.."); $datagrid->build();
$data["grid"] = $datagrid->output; $data["rapyd_head"] = $this->rapyd->get_head(); //may contain css/js links
$this->load->view('myview', $data);[/code]
example of DataTable: [code] $this->rapyd->load('datatable');
$datatable = new DataTable($mixed);
$datatable->per_row = 3;
$datatable->per_page = 6;
$datatable->use_function("substr");
$datatable->cell_template = '
<div style="padding:4px">
<div style="color:#119911; font-weight:bold"><#title#></div>
This is the body number <substr><#body#>|5|100</substr>
</div>';
//Or you can use a partial view
//$datatable->cell_template = $this->load->view('repeatable', null, true);
$datatable->build();
$data["table"] = $datatable->output;
$data["rapyd_head"] = $this->rapyd->get_head();
$this->load->view('myview', $data);[/code]
Example of integrating two components to build a filtered / sortable data grid [code] $this->rapyd->load("datafilter","datagrid");
$filter = new DataFilter("Article Filter", "articles");
$filter->title = new inputField("Title", "title");
$filter->state = new dropdownField("Public", "public");
$filter->state ->option("","");
$filter->state ->options(array("y"=>"Yes","n"=>"No"));
$filter->buttons("reset","search");
$filter->build();
$grid = new DataGrid("Article List");
$grid->per_page = 5;
$grid->column_detail("ID","article_id",
site_url('rapydsamples/dataedit/show/<#article_id#>'));
$grid->column_orderby("title","title","title");
$grid->column("body","body");
$grid->add("rapydsamples/dataedit/create");
$grid->build();
$data["crud"] = $filter->output . $grid->output;[/code]
..and this is the main Rapyd component, DataEdit, that is a complete crud application to manage a record. Basically it extends the DataForm component to manage all editing actions/views. [code] $this->rapyd->load("dataedit");
$edit = new DataEdit("Article Detail", "articles");
$edit->back_url = site_url("rapydsamples/crud");
$edit->title = new inputField("Title", "title");
$edit->title->rule = "trim|required|max_length[20]";
$edit->body = new textareaField("Body", "body");
$edit->body->rule = "required";
$edit->body->rows = 10;
$edit->checkbox = new checkboxField("Public", "public", "y","n");
$edit->datefield = new dateField("Date", "datefield","eu");
$edit->buttons("modify", "save", "undo", "delete", "back");
$edit->build();
$data["edit"] = $edit->output;[/code]
There are many other features ...and a tiny user_guide
Online download / Support site: [url]http://www.rapyd.com/[/url] [h3]P.S.[/h3] current version : 0.9.8 based on CI 1.5.4