[eluser]viv81ster[/eluser]
Code:
function index()
{
//$this->load->library('pagination');
//let's paginate results
$config['base_url'] = base_url().$this->config->item('index_page').'/'.'admin/users';
$config['uri_segment'] = 3;
$config['per_page'] = $this->config->item('FAL_admin_console_records_per_page');
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$config['cur_tag_open'] = '<b>';
$config['cur_tag_close'] = '</b>';
$config['next_link'] = '>';
$config['prev_link'] = '<';
$fields='id';
$query = $this->usermodel->getUsers($fields);
$config['total_rows'] = $query->num_rows();
//$this->pagination->initialize($config);
$this->load->library('pagination',$config);
$query->free_result();
$page = $this->uri->segment(3, 0);
$fields= 'id, user_name, role';
$limit= array('start'=>$config['per_page'],
'end'=>$page
);
$query = $this->usermodel->getUsers($fields, $limit);
if ($query->num_rows()>0)
{
$i=1;
foreach ($query->result() as $row)
{
// when do we display links for editing or deleting a user ?
// we display the edit and delete links if
// the user in the table is neither a superadmin nor an admin
$data['user'][$i]['show_edit_link'] =
($row->role != 'admin' AND $row->role != 'superadmin');
$data['user'][$i]['show_delete_link'] =
($row->role != 'admin' AND $row->role != 'superadmin');
// then we just fill the infos
$data['user'][$i]['id']= $row->id;
$data['user'][$i]['user_name']= $row->user_name;
$data['user'][$i]['role']= $row->role;
$i++;
}
$query->free_result();
}
else
{
// If we arrive here, it means that we have no users in the db
// hence no ADMIN. But only admins are allowed to
// use this controller.
// The only way to arrive here is to log in as an admin,
// then delete all users 'by hand'
// (since FAL do not allow it), and try to display the users list.
show_error('No user in the database. Please reinstall FreakAuth light.');
}
//let's display the page
$data['heading'] = 'VIEW users';
$data['action'] = 'Manage users';
$data['pagination_links'] = $this->pagination->create_links();
$data['controller'] = 'users';
$data['page'] = $this->config->item('FAL_template_dir').'template_admin/users/list';
$this->load->vars($data);
$this->load->view($this->_container);
//$this->output->enable_profiler(TRUE);
}
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Users::$pagination
Filename: admin/users.php
Line Number: 154
Fatal error: Call to a member function create_links() on a non-object in C:\Sites\home\codeigniter\www\system\application\controllers\admin\users.php on line 154
-- $data['pagination_links'] = $this->pagination->create_links();