From d35a6d887d4ce863e1ca754e4c9e5433c4c5c048 Mon Sep 17 00:00:00 2001 From: Eike Foken Date: Wed, 10 Aug 2011 14:59:48 +0200 Subject: [PATCH] Begin implementing user management --- application/controllers/users.php | 33 ++++++++++ application/language/english/users_lang.php | 15 +++++ application/models/user.php | 14 +++- application/views/admin/users/create.php | 73 +++++++++++++++++++++ application/views/admin/users/index.php | 38 +++++++++++ application/views/dashboard.php | 2 +- assets/css/form.css | 1 + 7 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 application/controllers/users.php create mode 100644 application/language/english/users_lang.php create mode 100644 application/views/admin/users/create.php create mode 100644 application/views/admin/users/index.php 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');?> + +
+ +
+

+
+ +
+
+

Required information

+
    +
  • + +
    + + +
    +
  • +
  • + +
    + + +
    +
  • +
  • + +
    + + +
    +
  • +
  • + +
    + + +
    +
  • +
  • + +
    + + +
    +
  • +
+

Optional information

+
    +
  • + +
    + + +
    +
  • +
  • + +
    + + +
    +
  • +
+

+ Speichern +

+
+
+
+ +load->view('footer');?> \ No newline at end of file diff --git a/application/views/admin/users/index.php b/application/views/admin/users/index.php new file mode 100644 index 0000000..50ee331 --- /dev/null +++ b/application/views/admin/users/index.php @@ -0,0 +1,38 @@ +load->view('header');?> + +
+ +
+

+
+ +
+

+ + + + + + + + + + + + + + + + + +
|
+ +

+

+
+ +load->view('footer');?> \ No newline at end of file diff --git a/application/views/dashboard.php b/application/views/dashboard.php index 12067bd..7a06659 100644 --- a/application/views/dashboard.php +++ b/application/views/dashboard.php @@ -21,7 +21,7 @@

- +

diff --git a/assets/css/form.css b/assets/css/form.css index 1faa7d1..44716d4 100644 --- a/assets/css/form.css +++ b/assets/css/form.css @@ -27,6 +27,7 @@ label.choice { input.text, textarea { + margin: 5px 0 5px 0; padding: 3px 5px; border: 1px solid #d2d2d2; font-size: 12px;