2710月/140
Grocery CRUD + CodeIginitor
一个与数据库操作打交道的应用,必然涉及到数据的添加、修改、删除等操作。因此CRUD操作几乎成为每个后台管理站点的必备功能。数据库的复杂性,导致PHP操作代码也会有不少的冗余,因此,如果可以有工具自动生成CRUD的代码,那将是一件十分让人欣慰的事情。
这里介绍一些目前可以找到的针对Codeigniter的解决方案。
顺便一提,对于数据表单的显示,也有一些很不错的工具,可以对table进行分页、排序等,比如DataTables(Bootstrap版本很赞),jTable等等,如果需要ORM(对象关系映射)操作数据库,还可以参考DataMapper。
http://www.grocerycrud.com/downloads
http://www.grocerycrud.com/examples
http://www.grocerycrud.com/documentation
功能名称 | 小说明 |
---|---|
add_action | 添加动作/动作的清单表。 |
add_fields | 该用户将在加法运算中看到的字段 |
callback_add_field | 这个回调逃脱字段名在添加表单默认的自动励磁输出。 |
callback_after_delete | 回调运行时,删除操作成功完成 |
callback_after_insert | 这是CRUD的自动插入后的回调。 |
callback_after_update | 这是所述的CRUD的自动更新之后使用回调。 |
callback_after_upload | 回调后上传功能触发。 |
callback_before_delete | 这个回调运行之前自动将污物的删除。 |
callback_before_insert | 这个回调的污物的自动插入之前运行。 |
callback_before_update | 这个回调的污物的自动更新之前运行。 |
callback_before_upload | 回调的上传功能之前触发。这个回调,建议进行验证检查。 |
callback_column | 这个回调运行的每一行上。它避开了汽车的列值,并运行回调。 |
callback_delete | 这个回调逃脱CRUD的自动删除,并且只运行回调。 |
callback_edit_field | 这个回调逃脱字段名在编辑表单默认的自动励磁输出。 |
callback_field | 这个回调逃脱字段名的默认自动输出领域的添加和编辑表单。 |
callback_insert | 这个回调逃脱CRUD的自动插入,并且只运行插入回调。 |
callback_update | 这个回调逃脱CRUD的自动更新,并且只运行回调。 |
callback_upload | 一个回调,取代默认的自动上传。 |
change_field_type | 更改默认的字段类型 |
columns | 该列显示该用户看到 |
display_as | 更改表字段的显示标签 |
edit_fields | 该用户将在编辑操作请参见领域 |
fields | 该字段用户在添加/编辑看到 |
field_type | 只是一个别名change_field_type方法。 |
getState | 根据文档获取状态字符串键。 |
getStateInfo | 获取状态信息的发射操作。 |
get_field_types | 注意:吸气只是查看一些信息,并始终工作在渲染功能后, |
get_primary_key | 注意:吸气只是查看一些信息,并始终工作在渲染功能后, |
like | 一样笨的像列表。 |
limit | 一样笨的表列表限制 |
ORDER_BY | 快速第一ORDER_BY(同笨)我们的名单 |
or_like | 相同or_like笨的表列表 |
or_where | 一样笨or_where为列表。 |
render | 否则......使其工作!Web应用程序需要做什么,并展示给用户的决定。 |
required_fields | 设置必要的添加和编辑字段的字段。 |
set_crud_url_path | 如果没有正确指定的路径是这样的方法非常有用。尤其是当我们使用的路线。 |
set_field_upload | 将字段名称是上传的文件。 |
set_language | 只需设置语言。 |
set_lang_string | 直接设置的语言字符串。 |
set_model | 设置了污物会使用模型(该模型总是要延伸grocery_Model) |
set_primary_key | 处理默认的主键为特定表。 |
set_relation | 设置的关系1-N的关系数据库。 |
set_relation_n_n | 设置与神经网络的关系的关系。 |
set_rules | 设置验证规则(同笨set_rules) |
set_subject | 设定一个主题,了解你使用什么类型的CRUD的。 |
set_table | 设置基本数据库表,我们将得到我们的数据。 |
set_theme | 设置CRUD主题 - 现在就只有'flexigrid“和”数据表“。默认主题是flexigrid。 |
unique_fields | 添加它们在数据库中的结构作为唯一的字段 |
unset_add | 取消将添加操作 |
unset_add_fields | 取消设置在添加表单中的字段。 |
unset_back_to_list | 取消设置所有的“返回列表”按钮和消息。 |
unset_columns | 从列表中未设置的列 |
unset_delete | 从CRUD网格上的删除操作 |
unset_edit | 取消将编辑操作 |
unset_edit_fields | 取消设置在编辑表单中的字段。 |
unset_export | 取消设置的导出按钮,不要让用户在使用此功能。 |
unset_fields | 来自添加和编辑表单域取消设置。 |
unset_jquery | 取消设置Jquery的加载。 |
unset_jquery_ui | 取消设置jQueryUI的加载。 |
unset_list | 取消设置的第一页名单(数据网格) |
unset_operations | 取消设置的所有操作。用户只能访问到电网。 |
unset_print | 取消设置的打印按钮,不要让用户在使用此功能。 |
unset_read | 不设置读操作 |
unset_texteditor | 取消将所选字段的文本编辑 |
where | 一个快速的数据库,在那里(同笨)到我们的名单 |
API and Functions list
Function Name | Small Description |
---|---|
add_action | Add an action/operation to the list table. |
add_fields | The fields that user will see on add operation |
callback_add_field | This callback escapes the default auto field output of the field name at the add form. |
callback_after_delete | The callback runs when the operation delete completed successfully |
callback_after_insert | This is a callback after the auto insert of the CRUD. |
callback_after_update | This is a callback that is used after the automatic update of the CRUD. |
callback_after_upload | A callback that triggered after the upload functionality. |
callback_before_delete | This callback runs before the auto delete of the crud. |
callback_before_insert | This callback runs before the auto insert of the crud. |
callback_before_update | This callback runs before the auto update of the crud. |
callback_before_upload | A callback that triggered before the upload functionality. This callback is suggested for validation checks. |
callback_column | This callback runs on each row. It escapes the auto column value and runs the callback. |
callback_delete | This callback escapes the auto delete of the CRUD , and runs only the callback. |
callback_edit_field | This callback escapes the default auto field output of the field name at the edit form. |
callback_field | This callback escapes the default auto field output of the field name for the add and edit form. |
callback_insert | This callback escapes the auto insert of the CRUD, and runs only the inserted callback. |
callback_update | This callback escapes the auto update of the CRUD , and runs only the callback. |
callback_upload | A callback that replaces the default auto uploader. |
change_field_type | Changes the default field type |
columns | The displayed columns that user see |
display_as | Changes the displaying label of the table field |
edit_fields | The fields that user will see on edit operation |
fields | The fields that user will see on add/edit |
field_type | Just an alias to the change_field_type method. |
getState | Get the state string key according to the documentation. |
getStateInfo | Get the state information for the operation that fired. |
get_field_types | Note: Getters is only to view some info and always works after the function render |
get_primary_key | Note: Getters is only to view some info and always works after the function render |
like | Same as codeigniter's like for the list. |
limit | Same as limit of codeigniter for the table list |
order_by | A quick first order_by (same as codeigniter) to our list |
or_like | Same as or_like of codeigniter for the table list |
or_where | Same as codeigniter or_where for the list. |
render | Or else ... make it work!! The web application takes decision of what to do and show it to the user. |
required_fields | Sets the required fields of add and edit fields. |
set_crud_url_path | This method is useful when the path is not specified correctly. Especially when we are using routes. |
set_field_upload | Sets a field name to be an uploaded file. |
set_language | Simply set the language. |
set_lang_string | Set a language string directly. |
set_model | Sets the model that crud will use ( The model always must extends grocery_Model ) |
set_primary_key | Handles the default primary key for a specific table. |
set_relation | Set a relation 1-n database relation. |
set_relation_n_n | Sets a relation with n-n relationship. |
set_rules | Set Validation Rules ( Same as Codeigniter set_rules) |
set_subject | Set a subject to understand what type of CRUD you use. |
set_table | Sets the basic database table that we will get our data. |
set_theme | Set the CRUD theme - For now on there is only 'flexigrid' and 'datatables' . The default theme is flexigrid. |
unique_fields | Add the fields that they are as UNIQUE in the database structure |
unset_add | Unsets the add operation |
unset_add_fields | unsets the fields at the add form. |
unset_back_to_list | Unset all the "back to list" buttons and messages. |
unset_columns | Unset columns from the list |
unset_delete | Remove the delete operation from the CRUD grid |
unset_edit | Unsets the edit operation |
unset_edit_fields | unsets the fields at the edit form. |
unset_export | Unset the export button and don't let the user to use this functionality. |
unset_fields | Unset fields from both add and edit form. |
unset_jquery | Unset the Jquery from loading. |
unset_jquery_ui | Unset the JqueryUI from loading. |
unset_list | Unset the first page list (datagrid) |
unset_operations | Unset all the operations . A user have access only to the grid. |
unset_print | Unset the print button and don't let the user to use this functionality. |
unset_read | Unsets the read operation |
unset_texteditor | Unsets the texteditor of the selected fields |
where | A quick database where (Same as codeigniter) to our list |