-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Rapyd Components
Rapyd Components Library is a set of classes that can help you to develop applications in Code Igniter. Rapyd provide:
[b]Data Presentation Components[/b]
* It has lists, grids, tables
* It has a theme/views system to standardize components layout
* A tag-based function-engine (for easily format field values ... "<substr><#body#>|0|100</substr>.. ")
* An easy way to paginate data (with CI helpers / libraries like uri and pagination)
[b]Data Editing Components[/b]
* 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)
[b]Other features[/b]
* A user class (simple with rules)
* A Session Class (PHP)
example of DataSet:
[code]
$this->rapyd->load('dataset');
//salmple query: select * from articles where status = 'public'; //but it can work also 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 //but thught $datagrid->parameter
$data["navigator"] = $dataset->navigator;
$this->load->view('myview', $data);
//note: page offset can be autodetected by uri (it assume last segment if is numeric) // or can be setted by uri_segment property (like CI pagination class) [/code]
example of DataGrid:
[code]
$this->rapyd->load('datagrid');
//$mixed can be atable name, or a multidim. array, or null //when it's null the DataGrid use current AR 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('repetable', null, true);
$datatable->build();
$data["table"] = $datatable->output;
$data["rapyd_head"] = $this->rapyd->get_head();
$this->load->view('myview', $data);
[/code]
example of integration of 2 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 rapid component DataEdit, that is a complete crud application to manage a record Basically it extend 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.5 beta based on CI 1.5.1