diff --git a/application/controllers/yllapito.php b/application/controllers/yllapito.php index 5be014a..fe37f36 100644 --- a/application/controllers/yllapito.php +++ b/application/controllers/yllapito.php @@ -9,8 +9,11 @@ class Yllapito extends CI_Controller { parent::__construct(); $this->load->model('ecard_model', 'ecard'); + $this->load->model('user_model', 'users'); $this->load->model('erkanaauth_model', 'erkana'); + $this->load->helper('date'); + $this->user = $this->erkana->getUser(); if (!empty($this->user)) { @@ -120,6 +123,48 @@ class Yllapito extends CI_Controller $this->load->view('_footer', $data); } + public function users($section = 'listall', $user_id = null, $action = null) + { + if (empty($this->user)) { + redirect("/yllapito/kirjaudu"); + } + + $data = array( + 'page_title' => array( 'Ystäväkylä eKortti' ), + 'page_classes' => array( 'frontpage' ), + 'user' => $this->user, + 'count' => $this->card_count, + 'messages' => $this->session->flashdata('messages') + ); + $page_title = array(); + + switch ($section) { + case 'modify': + if ($action == "delete" && is_numeric($user_id)) { + $this->user->delete($user_id); + } + redirect("yllapito/users"); + break; + case 'show': + $data['userid'] = $user_id; + $data['userdata'] = $this->users->get($user_id); + $page_title = array("Tiedot", "Käyttäjät"); + break; + default: + $data['users'] = $this->users->get_all(); + $page_title = array("Listaa kaikki", "Käyttäjät"); + break; + } + + + $data['page_title'] = array_merge($page_title, $data['page_title']); + $page = 'yllapito/users_'.$section; + + $this->load->view('_header', $data); + $this->load->view($page, $data); + $this->load->view('_footer', $data); + } + public function kirjaudu() { // POST diff --git a/application/models/user_model.php b/application/models/user_model.php new file mode 100644 index 0000000..f1b76e5 --- /dev/null +++ b/application/models/user_model.php @@ -0,0 +1,20 @@ + +
+
+ +

Kaikki käyttäjät

+ +can_seeusers == 'no') { ?> +
+ Sinulla ei ole oikeutta käyttäjien listaamiseen. +
+ + + + + + + + + + + + + + + can_approve == "yes") ? img($ok, true) : img($no, true); + $seeusr = ($usr->can_seeusers == "yes") ? img($ok, true) : img($no, true); + $modusr = ($usr->can_modusers == "yes") ? img($ok, true) : img($no, true); + + $name = $usr->firstname. " ". $usr->lastname; + + ?> + + + + + + + + + + + + + +
NimiTunnus lisättyEdellinen kirjautuminenJulkaisuNäkee jäsenetHallitsee jäseniä
id, $name); ?>
+ username; ?> +
created_at; ?>
created_at), $now); + ?>
last_login; + ?>
last_login), $now); + ?>
+ + +
+
+ diff --git a/application/views/yllapito/users_show.php b/application/views/yllapito/users_show.php new file mode 100644 index 0000000..9bfea2d --- /dev/null +++ b/application/views/yllapito/users_show.php @@ -0,0 +1,37 @@ + + + +
+
+
+ +can_seeusers == "no") { + ?> +
+ Sinulla ei ole oikeutta käyttäjien listaamiseen. +
+ + +

Käyttäjää tunnisteella # ei löydetty

+ + +

Käyttäjä #id; ?>

+ + + + +
+
+
\ No newline at end of file diff --git a/assets/img/no.png b/assets/img/no.png new file mode 100755 index 0000000..dbe5749 Binary files /dev/null and b/assets/img/no.png differ diff --git a/assets/img/ok.png b/assets/img/ok.png new file mode 100755 index 0000000..35e767c Binary files /dev/null and b/assets/img/ok.png differ