From 12fa01f92c6c8e364ceddaba911399d4e4bff454 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Tue, 16 Jul 2013 19:05:52 +0300 Subject: [PATCH] List and show user details, new model User --- application/controllers/yllapito.php | 45 ++++++++++ application/models/user_model.php | 20 +++++ application/views/yllapito/users_listall.php | 84 +++++++++++++++++++ application/views/yllapito/users_show.php | 37 ++++++++ assets/img/no.png | Bin 0 -> 172 bytes assets/img/ok.png | Bin 0 -> 236 bytes 6 files changed, 186 insertions(+) create mode 100644 application/models/user_model.php create mode 100644 application/views/yllapito/users_listall.php create mode 100644 application/views/yllapito/users_show.php create mode 100755 assets/img/no.png create mode 100755 assets/img/ok.png 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 0000000000000000000000000000000000000000..dbe5749c5cd5f0b4de6df2eda0eb7c68977931b5 GIT binary patch literal 172 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;=WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!foKTj9OkcwML2?+@X43B<0{F(1mBcCM}%F`@;iX%0Ew@1pt zg{Ow$=n)214L8OYoxu$(?3@dhC#$h(F|VqwG`ZQs!n`u>fKkA1E(Q(*hN=Hk{d4`M R{Rf)N;OXk;vd$@?2>@PXGZz2= literal 0 HcmV?d00001 diff --git a/assets/img/ok.png b/assets/img/ok.png new file mode 100755 index 0000000000000000000000000000000000000000..35e767c23613abb4ad43d4c56bfead08e064a32c GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;=WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!h8K2I0NkcwML2?+@W43EA${F(2>V|2Jt@RUHp0=^#yI80^b zD;SP&FMLy>5T=l#rMO;UcU;4Ss-&0`9Y+}}MEUcWBR9AlU}h4Nad@n~z+FVg;r-;9 zH7pCN5}zHAG)78&qol`;+0A?{wBme*a literal 0 HcmV?d00001