diff --git a/application/controllers/yllapito.php b/application/controllers/yllapito.php index fd83ff3..5be014a 100644 --- a/application/controllers/yllapito.php +++ b/application/controllers/yllapito.php @@ -37,6 +37,89 @@ class Yllapito extends CI_Controller $this->load->view('_footer', $data); } + public function ecards($section = 'list') + { + 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 'save': + $page = 'yllapito/list_cards'; + $post = $this->input->post(); + $from_page = $this->input->post('from_page'); + $post = $this->ecard->formatPost($post); + + $save = false; + if (! empty($post)) { + $save = $this->ecard->saveCards($post); + } + + if (empty($save)) { + $this->session->flashdata('message', 'Tallennus onnistui'); + $this->session->keep_flashdata('message'); + redirect($from_page); + } else { + $this->session->flashdata('message', 'Tallennus epäonnistui'); + $this->session->keep_flashdata('message'); + redirect($from_page); + } + break; + case 'queue': + $page = "yllapito/list_cards"; + $page_title[] = "Jonossa"; + $page_classes = array('admin', 'ecards', 'queue'); + $limit = $section; + break; + case 'public': + $page = "yllapito/list_cards"; + $page_title[] = "Julkisia"; + $page_classes = array('admin', 'ecards', 'public'); + $limit = $section; + break; + case 'private': + $page = "yllapito/list_cards"; + $page_title[] = "Yksityisiä"; + $page_classes = array('admin', 'ecards', 'private'); + $limit = $section; + break; + case 'hidden': + $page = "yllapito/list_cards"; + $page_title[] = "Piilotetut"; + $page_classes = array('admin', 'ecards', 'hidden'); + $limit = $section; + break; + default: + $page = "yllapito/list_cards"; + $page_title[] = "Kaikki"; + $limit = null; + $page_classes = array('admin', 'ecards', 'list_all'); + break; + } + + if (empty($limit)) { + $data['cards'] = $this->ecard->order_by('created_at')->get_all(); + } else { + $data['cards'] = $this->ecard->order_by('created_at')->get_many_by('card_status', $limit); + } + + $data['page_title'] = array_merge($page_title, $data['page_title']); + + $this->load->view('_header', $data); + $this->load->view($page, $data); + $this->load->view('_footer', $data); + } + public function kirjaudu() { // POST diff --git a/application/views/show_one.php b/application/views/show_one.php index bfc5b0b..a99e3f3 100644 --- a/application/views/show_one.php +++ b/application/views/show_one.php @@ -3,19 +3,61 @@
response == "200" ) { -?> -

Postikortti #id;?>

- +if (empty($ecard)) { + $ecard = new stdClass(); +} + +if ($ecard and $ecard->response == "200") { + + + $time = date("d.m.Y \k\l\o H.i", strtotime($ecard->created_at)); + + ?> + + +

message_title; ?>

+

+ message_content); ?> +

+ +
+ + card_status == "queue") { ?> +
+ Tämä kortti on vielä ylläpidon jonossa, eikä se näy kuin linkkiä seuraamalla.
+ private == "yes") { ?> + Koska valitsit että korttia ei saa julkaista, + ei ylläpitokaan sitä pysty lisäämään sivuston "Listaa kaikki"-osioon. + + Kun ylläpito on tarkastanut kortin, päätetään voidaanko korttia julkaista "Listaa kaikki"-osioon. +
+ +

+

+

+ + +

Tunnuksella ei löytynyt ainuttakaan korttia

Sähköpostikortti on joko poistettu järjestelmästä, tai sitten seurasit rikkinäistä linkkiä.

- -
+
diff --git a/application/views/yllapito/dashboard.php b/application/views/yllapito/dashboard.php index c2ff031..8c37cbb 100644 --- a/application/views/yllapito/dashboard.php +++ b/application/views/yllapito/dashboard.php @@ -2,6 +2,58 @@
+all; + +// Percentages +if ($all > 0) { + $p_queue = round($count->queue/$all*100, 2); + $p_public = round($count->public/$all*100, 2); + $p_private = round($count->private/$all*100, 2); + $p_hidden = round($count->hidden/$all*100, 2); +} +?> + +

Tilastot

+ Kortteja yhteensä tietokannassa: kpl. +
+ 0) { ?> + + 0) { ?> + + 0) { ?> + + 0) { ?> + + + +
+

+    
+
+ +session->flashdata('message'); +if (empty($message)) { + $message = array(); +} +if (! empty($message)) { ?> +
+ +
+ + + + +
" method="post" accept-charset="utf-8"> + + + + + + + + + + + + + + +id; + + ?> + + + + + + + + + + + +
Koska lähetettyKorttiTiedotViestiStatus
created_at)); ?> + email_sent == 'no') { + echo "Korttia ei vielä lähetetty"; + } else { + echo "Kortti lähetetty"; + } + + ?> + Lähettäjä
+ uploader_name; ?>
+ uploader_email; ?>

+ + Vastaanottaja
+ receiver_name; ?>
+ receiver_email; ?>

+
+ message_title; ?>
+ message_content)) < 21) { + ?> + message_content; ?> + + message_content, 20); ?> + + +
+ 'Jonossa', + 'public' => 'Julkaise', + 'private' => 'Piilota', + 'hidden' => 'Hylkää' + ); + + + foreach ($checkboxes as $value => $label) { + + $private = false; + + // Can't make private cards public + if ($value == "public") { + $private = ($card->private == "yes") ? true : false; + } + + echo str_repeat(" ", 28) + . checkboxed( + 'card_status', + $card->card_status, + $value, + $label, + $card->id, + $private + ). "\n"; + } + + ?> + +
+ + +
+
+
+
diff --git a/assets/css/style.css b/assets/css/style.css index 82a89cc..b2ca254 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -8,6 +8,8 @@ html { body { color: #333; background: transparent url('../img/headerbg2.png') top center no-repeat; + font-family: 'Open Sans', sans-serif; + font-weight: 300; } body footer { @@ -43,6 +45,19 @@ table.valign thead tr, table thead th button { margin: 0px; } +#cardlist td label { + display: block; +} +#cardlist td label input { + margin-right: 10px; + padding: 0px; + margin-bottom: 0px !important; +} + +#cardlist img { + margin-bottom: 3px; +} + .center { text-align: center; }