diff --git a/application/controllers/users.php b/application/controllers/users.php new file mode 100644 index 0000000..a2eae6b --- /dev/null +++ b/application/controllers/users.php @@ -0,0 +1,33 @@ + + * + */ +class Users extends MY_Controller { + + /** + * Constructor. + */ + public function __construct() { + parent::__construct(); + $this->load->model('user'); + } + + /** + * Shows a list of all users. + */ + public function index() { + $data['users'] = $this->user->getAll(); + $this->load->view('admin/users/index', $data); + } + + /** + * Allows admins to create a new user. + */ + public function create() { + $this->load->view('admin/users/create'); + } +} \ No newline at end of file diff --git a/application/language/english/users_lang.php b/application/language/english/users_lang.php new file mode 100644 index 0000000..d9ee277 --- /dev/null +++ b/application/language/english/users_lang.php @@ -0,0 +1,15 @@ +load->config('auth', true); @@ -313,6 +316,15 @@ class User extends CI_Model { return $this->db->get('users'); } + /** + * Gets all users. + * + * @return array + */ + public function getAll() { + return $this->get()->result_array(); + } + /** * Returns the number of users. * @@ -427,7 +439,7 @@ class User extends CI_Model { } /** - * delete + * Deletes the specified user. * * @return boolean */ diff --git a/application/views/admin/users/create.php b/application/views/admin/users/create.php new file mode 100644 index 0000000..aa7810a --- /dev/null +++ b/application/views/admin/users/create.php @@ -0,0 +1,73 @@ +load->view('header');?> + +
| =lang('username');?> | +=lang('realname');?> | +=lang('options');?> | +
|---|---|---|
| =$user['username'];?> | +=$user['firstname'];?> =$user['lastname'];?> | +=anchor('users/edit/' . $user['id'], lang('user_edit'));?> | =anchor('users/delete/' . $user['id'], lang('user_delete'));?> | +