0
我在CI HMVC是新在那裏上市,我使用CI generate_crud()方法象下面這樣:笨HMVC與條件
public function index()
{
$crud = $this->generate_crud('users');
$crud->columns('groups', 'username', 'email', 'first_name', 'last_name', 'company', 'no_employee', 'active');
$this->unset_crud_fields('ip_address', 'last_login');
// only webmaster and admin can change member groups
if ($crud->getState()=='list' || $this->ion_auth->in_group(array('webmaster', 'admin')))
{
$crud->set_relation_n_n('groups', 'users_groups', 'groups', 'user_id', 'group_id', 'name');
}
// only webmaster and admin can reset user password
if ($this->ion_auth->in_group(array('webmaster', 'admin')))
{
$crud->add_action('Reset Password', '', 'admin/user/reset_password', 'fa fa-repeat');
$crud->add_action('Edit', '', 'admin/user/edit_user', 'edit-icon');
}
// disable direct create/delete Frontend User
$crud->unset_add();
$this->mPageTitle = 'Users';
$this->render_crud();
}
這將返回我的所有活動和非活動的用戶列表中,但我想唯一的活動列表中的用戶。我如何修改我的代碼,以便我可以獲取僅有活動用戶的列表。
非常感謝,這對我很有用。 +1給你歡呼。 –
有沒有什麼辦法可以做到這一點:$ crud-> where('active',true,false);對於活動記錄和非活動記錄,因爲我的活動記錄中也有其他值。其實我只想顯示活躍和不活躍的其他狀態值。 –