diff options
-rw-r--r-- | app/class/Media.php | 2 | ||||
-rw-r--r-- | app/class/Medialist.php | 5 | ||||
-rw-r--r-- | app/class/Model.php | 8 | ||||
-rw-r--r-- | app/class/Modelmedia.php | 4 | ||||
-rw-r--r-- | app/view/templates/home.php | 6 | ||||
-rw-r--r-- | app/view/templates/media.php | 8 |
6 files changed, 17 insertions, 16 deletions
diff --git a/app/class/Media.php b/app/class/Media.php index ad36b8e..f29d2c9 100644 --- a/app/class/Media.php +++ b/app/class/Media.php @@ -174,7 +174,7 @@ class Media extends Item } } - public function date($option = 'string') + public function date($option = 'date') { return $this->datetransform('date', $option); } diff --git a/app/class/Medialist.php b/app/class/Medialist.php index 2141d40..ca42f4b 100644 --- a/app/class/Medialist.php +++ b/app/class/Medialist.php @@ -31,7 +31,6 @@ class Medialist extends Item /** @var string display the file name of the file */ protected $filename = 0; - const SORT_BY_FILTER = ['id', 'size', 'type', 'date']; const TYPES = ['image', 'sound', 'video', 'other']; @@ -95,7 +94,7 @@ class Medialist extends Item */ public function getsortbyadress(string $sortby) : string { - if(!in_array($sortby, self::SORT_BY_FILTER)) { + if(!in_array($sortby, Model::MEDIA_SORTBY)) { $sortby = 'id'; } if ($this->sortby === $sortby) { @@ -201,7 +200,7 @@ class Medialist extends Item public function setsortby(string $sortby) { - if (in_array($sortby, self::SORT_BY_FILTER)) { + if (in_array($sortby, Model::MEDIA_SORTBY)) { $this->sortby = $sortby; } } diff --git a/app/class/Model.php b/app/class/Model.php index 9e66af4..ea75da8 100644 --- a/app/class/Model.php +++ b/app/class/Model.php @@ -21,6 +21,14 @@ abstract class Model const DATABASE_DIR = '.' . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR; const PAGES_DIR = self::DATABASE_DIR . 'pages' . DIRECTORY_SEPARATOR; + const MEDIA_SORTBY = [ + 'id' => 'id', + 'size' => 'size', + 'type' => 'type', + 'date' => 'date', + 'extension' => 'extension' + ]; + const MAP_LAYOUTS = [ 'cose' => 'cose', 'cose-bilkent' => 'cose-bilkent', diff --git a/app/class/Modelmedia.php b/app/class/Modelmedia.php index 567e659..079a5f7 100644 --- a/app/class/Modelmedia.php +++ b/app/class/Modelmedia.php @@ -5,10 +5,6 @@ namespace Wcms; class Modelmedia extends Model { - const MEDIA_SORTBY = ['id', 'size', 'type']; - - - /** * Get the Media Object * diff --git a/app/view/templates/home.php b/app/view/templates/home.php index d1b3421..6c3ad62 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -163,13 +163,13 @@ <td class="linkto"><?= $opt->linktolink($item->linkto('array')) ?></td> <?php } if ($columns['datemodif']) { ?> - <td class="datemodif"><time datetime="<?= $item->datemodif('string') ?>" title="<?= $item->datemodif('dmy') . ' ' . $item->datemodif('ptime') ?>"><?= $item->datemodif('hrdi') ?></time></td> + <td class="datemodif" <?= $item->datemodif('dmy') ?> <?= $item->datemodif('ptime') ?>><time datetime="<?= $item->datemodif('string') ?>" title="<?= $item->datemodif('dmy') . ' ' . $item->datemodif('ptime') ?>"><?= $item->datemodif('hrdi') ?></time></td> <?php } if ($columns['datecreation']) { ?> - <td class="datecreation"><time datetime="<?= $item->datecreation('string') ?>" title="<?= $item->datecreation('dmy') . ' ' . $item->datecreation('ptime') ?>"><?= $item->datecreation('hrdi') ?></time></td> + <td class="datecreation" <?= $item->datecreation('dmy') ?> <?= $item->datecreation('ptime') ?>><time datetime="<?= $item->datecreation('string') ?>" title="<?= $item->datecreation('dmy') . ' ' . $item->datecreation('ptime') ?>"><?= $item->datecreation('hrdi') ?></time></td> <?php } if ($columns['date']) { ?> - <td class="date"><time datetime="<?= $item->date('string') ?>" title="<?= $item->date('dmy') . ' ' . $item->date('ptime') ?>"><?= $item->date('dmy') ?></time></td> + <td class="date" <?= $item->date('dmy') ?> <?= $item->date('ptime') ?>><time datetime="<?= $item->date('string') ?>" title="<?= $item->date('dmy') . ' ' . $item->date('ptime') ?>"><?= $item->date('dmy') ?></time></td> <?php } if ($columns['secure']) { ?> <td class="secure"><?= $opt->securelink($item->secure('int') , $item->secure('string')) ?></td> diff --git a/app/view/templates/media.php b/app/view/templates/media.php index 054022a..50fc0d6 100644 --- a/app/view/templates/media.php +++ b/app/view/templates/media.php @@ -48,9 +48,7 @@ $this->layout('layout', ['title' => 'media', 'stylesheets' => [$css . 'home.css' <fieldset> <legend>Sort</legend> <select name="sortby" id="sortby"> - <option value="id" <?= $mediaopt->sortby() === 'id' ? 'selected' : '' ?>>id</option> - <option value="type" <?= $mediaopt->sortby() === 'type' ? 'selected' : '' ?>>type</option> - <option value="size" <?= $mediaopt->sortby() === 'size' ? 'selected' : '' ?>>size</option> + <?= options(Model::MEDIA_SORTBY, $mediaopt->sortby()) ?> </select> </br> <input type="radio" name="order" id="asc" value="1" <?= $mediaopt->order() == 1 ? 'checked' : '' ?>><label for="asc">ascending</label> @@ -78,7 +76,7 @@ $this->layout('layout', ['title' => 'media', 'stylesheets' => [$css . 'home.css' <tr> <th id="checkall">x</th> <th><a href="<?= $mediaopt->getsortbyadress('id') ?>">id</a></th> - <th>ext</th> + <th><a href="<?= $mediaopt->getsortbyadress('extension') ?>">ext</a></th> <th><a href="<?= $mediaopt->getsortbyadress('type') ?>">type</a></th> <th><a href="<?= $mediaopt->getsortbyadress('size') ?>">size</a></th> <th><a href="<?= $mediaopt->getsortbyadress('date') ?>">date</a></th> @@ -97,7 +95,7 @@ $this->layout('layout', ['title' => 'media', 'stylesheets' => [$css . 'home.css' <td><?= $media->extension() ?></td> <td class="nowrap"><a href="<?= $media->getfullpath() ?>" target="_blank"><?= $media->type() == 'image' ? '<span class="thumbnail">' . $media->getsymbol() . '<img src="' . $media->getfullpath() . '"></span>' : $media->getsymbol() ?></a></td> <td class="nowrap"><?= $media->size('hr') ?></td> - <td class="nowrap"><?= $media->date('hrdi') ?></td> + <td class="nowrap" title="<?= $media->date('dmy') ?> <?= $media->date('ptime') ?>"><?= $media->date('hrdi') ?></td> <td><?= $media->width() ?></td> <td><?= $media->height() ?></td> <td><?= $media->length() ?></td> |