/**
* manage ()
* -------------------------------------------------------------------
*
* Manage User Data for a Table.
*
* Requires an associate array - result_array()
*
* NOTE: The $actions this adds the edit / delete / view
*/
public function manage()
{
// You can also setup a tzble template for this.
$this->load->library('table');
// Get an array of users from the database ( Change for your Model ).
$data = $this->users->users();
// Set headings for this table ( Change to suit your needs ).
$this->table->set_heading('Username', 'Email', 'Actions');
// Loop through the data and build the table with links.
foreach($data as $value => $key)
{
// Build the actions links View / Edit / Delete.
$actions = anchor("admin/users/view/".$key['id']."/", "View").
anchor("admin/users/edit/".$key['id']."/", "Edit").
anchor("admin/users/delete/".$key['id']."/", "Delete");
// Add the new row to the table ( Change for your table fields ).
$this->table->add_row($key['username'], $key['email'], $actions);
}
// Load the table view.
$this->load->view('users/manage');
}
// In your html view code add this to dispaly the table.
<?php echo $this->table->generate(); ?>