twitter bootstrap - Use an array or object in edit.php in Grocery CRUD -
i have code:
public function render() { // apply filters if $this->applyfilters(); // define columns , fields $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', 'citizenship', 'phone', 'email', 'identity', 'afm', 'amka', 'family', 'education', 'education_reason', 'marital', 'protected_members', 'occupation', 'unemployment_card', 'social_security', 'income', 'income_from', 'allowances', 'profile_info', 'vulnerable', 'guardianship', 'outcast', 'learning_difficulties', 'homeless_reverse', 'homeless_reverse_way', 'history', 'family_type', 'family_head', 'residence', 'residence_size', 'residence_rooms', 'electricity', 'hot_water', 'internet', 'family_info', 'status'); } else{ $fields = array('name', 'surname', 'fname', 'gender', 'birth', 'address', 'zip', 'city', 'region', 'section', 'district', 'citizenship', 'phone', 'email', 'identity', 'afm', 'amka', 'family', 'education', 'education_reason', 'marital', 'protected_members', 'occupation', 'unemployment_card', 'social_security', 'income', 'income_from', 'allowances', 'profile_info'); } $this->ci->uri->segment(3) == "export" ? $this->crud->columns($fields) : $this->crud->columns($columns); // set labels. set labels upfront because may need overwrite label using traditional way $this->setlabels($fields); // prepare crud $this->crud ->fields($fields) ->required_fields('gender', 'name', 'birth', 'status') ->display_as('residence_size', 'Αριθμός Δωματίων:') /* set relations */ ->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('occupation', '_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('guardianship','beneficiaries','{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', array($this,'callback_field_family_type')) ->callback_field('family_head', array($this,'callback_field_family_head')) ->callback_field('residence', array($this,'callback_field_residence')) ->callback_field('residence_size', array($this,'callback_field_residence_size')) ->callback_field('residence_rooms', array($this,'callback_field_residence_rooms')) ->callback_field('electricity', array($this,'callback_field_electricity')) ->callback_field('hot_water', array($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')); } return $this->crud->render($tabs); }
i'm struggling transfer array or object function assets/grocery-grud/themes/bootstrap/edit.php file.
do have idea how can that?
i tried create new protected variable in grocery_crud class in libraries/grocery_crud.php not successfully.
do know if correct way?
i solve problem!
the way pass array model assets/grocery-grud/themes/bootstrap/views/edit.php file using sessions.
in model save array session
$my_object = array ( 'foo' => 'my_contect' ); $this->session->set_userdata($my_object);
and in edit.php file use it:
$ci =& get_instance(); $content= $ci->session->userdata('foo'); echo($content);
Comments
Post a Comment