【发布时间】:2016-01-27 10:38:33
【问题描述】:
我有这个代码:
公共函数渲染(){ // 应用过滤器(如果有) $this->applyFilters(); // 定义列和字段 $columns = array('code', 'name', 'fname', 'family', 'status' ); if ( $this->ci->uri->segment(3)=='edit' ){ $fields = array('name', 'surname', 'fname', 'gender', 'birth', 'address', 'zip', 'city', 'region', 'section', 'district', '公民身份','电话','电子邮件','身份','afm','amka', '家庭','教育','education_reason','marital','protected_members','职业','unemployment_card','social_security','income','income_from','allowances','profile_info', '易受伤害的','监护权','弃儿','learning_difficulties','homeless_reverse','homeless_reverse_way','历史', 'family_type'、'family_head'、'residence'、'residence_size'、'residence_rooms'、'electricity'、'hot_water'、'internet'、'family_info'、'status'); } 别的{ $fields = array('name', 'surname', 'fname', 'gender', 'birth', 'address', 'zip', 'city', 'region', 'section', 'district', '公民身份','电话','电子邮件','身份','afm','amka', “家庭”、“教育”、“教育原因”、“婚姻”、“受保护成员”、“职业”、“失业卡”、“社会保障”、“收入”、“收入来源”、“津贴”、“档案信息”); } $this->ci->uri->segment(3) == "export" ? $this->crud->columns($fields) : $this->crud->columns($columns); // 设置标签。我们预先设置标签,因为我们可能需要使用传统方式覆盖标签 $this->setLabels($fields); // 准备 CRUD $this->crud ->字段($字段) -> required_fields('性别','姓名','出生','状态') ->display_as('residence_size', 'Αριθμός Δωματίων:') /* 设置关系 */ ->set_relation('gender', '_map_genders', 'title') ->set_relation('citizenship', '_map_citizenship', 'title') ->set_relation('family','beneficiaries','{name} {surname} ({fname})', NULL, 'id ASC') ->set_relation('education', '_map_education', 'title', NULL, 'id ASC') ->set_relation('marital', '_map_marital', 'title') ->set_relation('职业', '_map_occupation', 'title') ->set_relation('unemployment_card', '_map_unemployment_card', 'title', NULL, 'id ASC') ->set_relation('social_security', '_map_social_security', 'title') ->set_relation('income_from', '_map_income_from', 'title') ->set_relation_n_n('allowances', 'allowances_link', '_map_allowances', 'beneficiary_id', 'map_id', 'title', NULL) ->set_relation_n_n('vulnerable', 'vulnerable_link', '_map_vulnerable', 'beneficiary_id', 'map_id', 'title', NULL) ->set_relation('监护人','受益人','{name} {surname} ({fname})', NULL, 'id ASC') ->set_relation('outcast', '_map_outcast', 'title') ->set_relation('learning_difficulties', '_map_learning_difficulties', 'title') ->set_relation_n_n('indirect_income','indirect_income_link','_map_indirect_income','beneficiary_id','map_id','title',NULL) ->set_relation_n_n('homeless_reason','homeless_reason_link','_map_homeless_reason','beneficiary_id','map_id','title',NULL) ->set_relation_n_n('homeless_reverse_way','homeless_reverse_way_link','_map_homeless_reverse_way','beneficiary_id','map_id','title',NULL) ->set_relation('status', 'statuses', '{title}', 'statuses.mode = "generic"'); if ( $this->ci->uri->segment(3)=='edit' ){ $this->crud ->callback_update(array($this,'callback_update')) ->callback_field('family_type', 数组($this,'callback_field_family_type')) ->callback_field('family_head', 数组($this,'callback_field_family_head')) ->callback_field('residence', array($this,'callback_field_residence')) ->callback_field('residence_size', 数组($this,'callback_field_residence_size')) ->callback_field('residence_rooms', 数组($this,'callback_field_residence_rooms')) ->callback_field('electricity', array($this,'callback_field_electricity')) ->callback_field('hot_water', 数组($this,'callback_field_hot_water')) ->callback_field('internet', array($this,'callback_field_internet')) ->callback_field('family_info', array($this,'callback_field_family_info')) ->callback_field('status', array($this,'callback_field_status')); } 返回 $this->crud->render($tabs); }我正在努力将数组或对象从这个函数传输到 assets/grocery-grud/themes/bootstrap/edit.php 文件。
你知道我该怎么做吗?
我尝试在 libraries/grocery_crud.php 的 grocery_crud 类中创建一个新的受保护变量,但没有成功。
你知道这是否正确吗?
【问题讨论】:
-
您是否尝试过调用edit.php 中的函数并将变量传递给它?例如:
edit($arrayOrObject)?
标签: php twitter-bootstrap grocery-crud