Hi jinbatsu,
Thanks for letting me know the code option. I was searching for it but was not able to find it.! :P Here is my code of controller.
function users()
{
if($this->checkSession())
{
$crud = new grocery_CRUD();
$crud->where('status','c');
$crud->where('member_type','u');
$crud->set_table('member');
$crud->set_subject('User');
$crud->columns('member_id','profile_photo','first_name','last_name','age','username','email');
/*$crud->add_fields('member_type','profile_photo','first_name','last_name','age','username','email','news_letter_subscription','status');
$crud->edit_fields('member_type','profile_photo','first_name','last_name','age','username','email','news_letter_subscription','status');*/
$crud->field_type('member_type','dropdown', array('u' => lang('user'), 's' => lang('specialist')));
$crud->field_type('news_letter_subscription','dropdown',array('y' => lang('sub'), 'n' => lang('nosub')));
$crud->field_type('status','dropdown', array('i' => lang('inactive'), 'c' => lang('confirmed'), 'b' => lang('banned')));
$crud->display_as('member_id',lang('user').' '.lang('id'))
->display_as('first_name',lang('first_name'))
->display_as('last_name',lang('last_name'));
$crud->required_fields('first_name','last_name','age','status');
$crud->unset_edit_fields('password','json_status','reg_date','activation_code');
//$crud->change_field_type('last_login_date','invisible');
$crud->unset_add_fields('json_status','reg_date','activation_code');
$crud->callback_edit_field('email',array($this,'email_callback'));
$crud->callback_edit_field('username',array($this,'username_callback'));
//$crud->callback_edit_field('reg_date',array($this,'reg_date_callback'));
//$crud->callback_edit_field('last_login_date',array($this,'last_login_callback'));
$output = $crud->render();
$this->_users_output($output);
}
}
function email_callback($value, $primary_key)
{
return $value;
}
function username_callback($value, $primary_key)
{
return $value;
}
function reg_date_callback($value, $primary_key)
{
return $value;
}
function last_login_callback($value, $primary_key)
{
return $value;
}
public function _users_output($output = null)
{
$data = array();
$data['main_content'] = 'backoffice/users';
$data = array_merge($data,(array)$output);
$this->load->view('backoffice/backoffice_template', $data);
}
Please check it and let me know where I am doing wrong.! :rolleyes: