Manage added cards!

This commit is contained in:
Ismo Vuorinen
2013-07-16 19:04:41 +03:00
parent fe84af8649
commit a6765d26f3
5 changed files with 341 additions and 10 deletions

View File

@@ -3,19 +3,61 @@
<div class="large-12 columns">
<div class="panel">
<?php
if( $ecard and $ecard->response == "200" ) {
?>
<h2>Postikortti #<?php echo $ecard->id;?></h2>
<?php
} else {
?>
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));
?>
<img src="<?php echo site_url('assets/cards/' . $ecard->hash . '.png'); ?>" width="100%">
<h2><?php echo $ecard->message_title; ?></h2>
<p>
<?php echo nl2br($ecard->message_content); ?>
</p>
<hr>
<?php
if ($ecard->card_status == "queue") { ?>
<div data-alert class="alert-box">
Tämä kortti on vielä ylläpidon jonossa, eikä se näy kuin linkkiä seuraamalla.<br>
<?php
if ($ecard->private == "yes") { ?>
Koska valitsit että korttia ei saa julkaista,
ei ylläpitokaan sitä pysty lisäämään sivuston "Listaa kaikki"-osioon.
<?php
} else { ?>
Kun ylläpito on tarkastanut kortin, päätetään voidaanko korttia julkaista "Listaa kaikki"-osioon.
<?php
}
?></div><?php
}
?>
<p>
<ul style="list-style: none">
<li>Lähettäjä: <?php echo $ecard->uploader_name; ?></li>
<li>Vastaanottaja: <?php echo $ecard->receiver_name; ?></li>
<li>Koska lähetetty: <?php echo $time; ?></li>
<li>Osoite tähän korttiin: <code><?php echo site_url('ecards/' . $ecard->hash); ?></code></li>
</ul>
</p>
<?php
} else {
?>
<h2>Tunnuksella ei löytynyt ainuttakaan korttia</h2>
<p>Sähköpostikortti on joko poistettu järjestelmästä, tai sitten seurasit rikkinäistä linkkiä.</p>
<p></p>
<?php
}
?>
<pre><?php var_export($ecard); ?></pre>
<?php
}
?>
</div>
</div>

View File

@@ -2,6 +2,58 @@
<div class="row">
<div class="large-12 columns">
<div class="panel">
<?php
$all = $count->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);
}
?>
<h2>Tilastot</h2>
Kortteja yhteensä tietokannassa: <?php echo $all; ?> kpl.
<div class="progress large-12">
<?php
if ($p_queue > 0) { ?>
<span data-tooltip
class="has-tip left queue meter"
data-width="210"
title="Kortteja jonossa <?=$count->queue; ?> kpl"
style="width: <?=$p_queue;?>%"></span>
<?php
}
if ($p_public > 0) { ?>
<span data-tooltip
class="has-tip left public meter"
data-width="210"
title="Kortteja julkaistuna <?=$count->public; ?> kpl"
style="width: <?=$p_public;?>%"></span>
<?php
}
if ($p_private > 0) { ?>
<span data-tooltip
class="has-tip left private meter"
data-width="210"
title="Kortteja piilotettuna <?=$count->private; ?> kpl"
style="width: <?=$p_private;?>%"></span>
<?php
}
if ($p_hidden > 0) { ?>
<span data-tooltip
class="has-tip left hidden meter"
data-width="210"
title="Poistettuja kortteja <?=$count->hidden; ?> kpl"
style="width: <?=$p_hidden;?>%"></span>
<?php
}
?>
</div>
<pre><?php
if (empty($user)) {

View File

@@ -0,0 +1,139 @@
<div class="row">
<div class="large-12 columns">
<div class="panel">
<?php
$message = $this->session->flashdata('message');
if (empty($message)) {
$message = array();
}
if (! empty($message)) { ?>
<div data-alert class="alert-box <?php echo $message?>">
<?php echo $message;?>
</div>
<?php
}
?>
<dl class="sub-nav">
<dt>Näytä:</dt>
<dd><?= lnk("yllapito/ecards", "Kaikki {$count->all}"); ?></dd>
<dd><?= lnk("yllapito/ecards/queue", "Jonossa {$count->queue}"); ?></dd>
<dd><?= lnk("yllapito/ecards/public", "Julkiset {$count->public}"); ?></dd>
<dd><?= lnk("yllapito/ecards/private", "Yksityiset {$count->private}"); ?></dd>
<dd><?= lnk("yllapito/ecards/hidden", "Hylätyt {$count->hidden}"); ?></dd>
</dl>
<form action="<?php echo site_url("yllapito/ecards/save");?>" method="post" accept-charset="utf-8">
<input type="hidden" name="from_page" value="<?php echo current_url();?>">
<input type="hidden" name="page" value="<?php echo current_url();?>">
<table id="cardlist" class="valign">
<thead>
<tr>
<th width="130">Koska lähetetty</th>
<th width="150">Kortti</th>
<th>Tiedot</th>
<th>Viesti</th>
<th width="160">Status</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($cards)) {
foreach ($cards as $card) {
$i = $card->id;
?>
<tr class="valign-top">
<td class="center valign"><?php echo date("j.n.Y H.i", strtotime($card->created_at)); ?></td>
<td><img src="<?php echo site_url('assets/cards/' . $card->hash . '.png'); ?>" alt="">
<span class="label"><?php
if ($card->email_sent == 'no') {
echo "Korttia ei vielä lähetetty";
} else {
echo "Kortti lähetetty";
}
?></span>
</td>
<td><strong>Lähettäjä</strong><br>
<?= $card->uploader_name; ?><br>
<?= $card->uploader_email; ?><br><br>
<strong>Vastaanottaja</strong><br>
<?= $card->receiver_name; ?><br>
<?= $card->receiver_email; ?><br><br>
</td>
<td><!-- Message -->
<strong><?= $card->message_title; ?></strong><br>
<?php
if (count(explode(" ", $card->message_content)) < 21) {
?>
<?php echo $card->message_content; ?>
<?php
} else {
?>
<span data-tooltip
class="has-tip tip-top"
data-width="380"
title="<?= $card->message_content; ?>"
><?= word_limiter($card->message_content, 20); ?></span>
<?php
}
?>
</td>
<td><!-- Status -->
<?php echo "\n";
$checkboxes = array(
'queue' => '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";
}
?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<input type="submit" name="" class="button success" value="Tallenna muutokset">
</form>
</div>
</div>
</div>