From 7fb607b48c181512b31f52a7ef7e302f331ec18d Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Wed, 5 Dec 2018 18:37:30 +0100 Subject: mediastyle --- app/class/controllerfont.php | 2 +- app/class/controllerhome.php | 9 ++++++ app/class/controllerinfo.php | 25 +++++++++++++++ app/class/controllermedia.php | 6 +++- app/class/modelmedia.php | 40 +++++++++++++---------- app/class/routes.php | 4 ++- app/view/templates/admin.php | 2 +- app/view/templates/backtopbar.php | 21 ++++++++---- app/view/templates/font.php | 2 +- app/view/templates/home.php | 2 +- app/view/templates/info.php | 25 +++++++++++++++ app/view/templates/media.php | 67 ++++++++++++++++++++++++++++++++++++++- assets/css/home.css | 43 +++++++++++++++++++++++-- 13 files changed, 215 insertions(+), 33 deletions(-) create mode 100644 app/class/controllerinfo.php create mode 100644 app/view/templates/info.php diff --git a/app/class/controllerfont.php b/app/class/controllerfont.php index b1cd0d9..7a59cd6 100644 --- a/app/class/controllerfont.php +++ b/app/class/controllerfont.php @@ -14,7 +14,7 @@ class Controllerfont extends Controller public function desktop() { - if($this->user->isadmin()) { + if($this->user->iseditor()) { $fontlist = $this->fontmanager->getfontlist(); diff --git a/app/class/controllerhome.php b/app/class/controllerhome.php index 4d5feb8..1309adb 100644 --- a/app/class/controllerhome.php +++ b/app/class/controllerhome.php @@ -48,6 +48,15 @@ class Controllerhome extends Controller } + public function search() + { + if(isset($_POST['id']) && !empty($_POST['id'])) { + $this->routedirect('artread/', ['art' => $_POST['id']]); + } else { + $this->routedirect('home'); + } + } + diff --git a/app/class/controllerinfo.php b/app/class/controllerinfo.php new file mode 100644 index 0000000..8f8b494 --- /dev/null +++ b/app/class/controllerinfo.php @@ -0,0 +1,25 @@ +user->iseditor()) { + $this->showtemplate('info', []); + } + } + + + + +} + + +?> \ No newline at end of file diff --git a/app/class/controllermedia.php b/app/class/controllermedia.php index 48f803b..1fa564b 100644 --- a/app/class/controllermedia.php +++ b/app/class/controllermedia.php @@ -14,7 +14,11 @@ class Controllermedia extends Controller public function desktop() { - + if($this->user->iseditor()) { + $medialist = $this->mediamanager->getlistermedia(Model::MEDIA_DIR); + $faviconlist = $this->mediamanager->getlistermedia(Model::FAVICON_DIR); + $this->showtemplate('media', ['medialist' => $medialist, 'faviconlist' => $faviconlist]); + } } public function addmedia() diff --git a/app/class/modelmedia.php b/app/class/modelmedia.php index a5c48fe..3402a04 100644 --- a/app/class/modelmedia.php +++ b/app/class/modelmedia.php @@ -40,17 +40,20 @@ class Modelmedia extends Model { $fileinfo = pathinfo($entry); - $filepath = $fileinfo['dirname'] . '.' . $fileinfo['extension']; - - $donnees = array( - 'id' => str_replace('.' . $fileinfo['extension'], '', $fileinfo['filename']), - 'path' => $dir, - 'extension' => $fileinfo['extension'] - ); - + if(isset($fileinfo['extension'])) { + $filepath = $fileinfo['dirname'] . '.' . $fileinfo['extension']; + + $datas = array( + 'id' => str_replace('.' . $fileinfo['extension'], '', $fileinfo['filename']), + 'path' => $dir, + 'extension' => $fileinfo['extension'] + ); + return new Media($datas); + } else { + return false; + } - return new Media($donnees); } @@ -63,21 +66,24 @@ class Modelmedia extends Model $media = $this->getmedia($entry, $dir); - - $media->analyse(); - - if (in_array($type, self::MEDIA_TYPES)) { - if ($media->type() == $type) { + if($media != false) { + + $media->analyse(); + + if (in_array($type, self::MEDIA_TYPES)) { + if ($media->type() == $type) { + $list[] = $media; + } + } else { $list[] = $media; } - } else { - $list[] = $media; + } + } } - return $list; } return $list; diff --git a/app/class/routes.php b/app/class/routes.php index 6eb992b..b324e64 100644 --- a/app/class/routes.php +++ b/app/class/routes.php @@ -17,10 +17,12 @@ class Routes ['GET|POST', '/', 'Controllerhome#desktop', 'home'], ['POST', '/!co', 'Controllerconnect#log', 'log'], ['GET', '/!co', 'Controllerconnect#connect', 'connect'], - ['GET', '/!m', 'Controllermedia#desktop', 'media'], + ['POST', '/!search', 'Controllerhome#search', 'search'], + ['GET', '/!media', 'Controllermedia#desktop', 'media'], ['GET', '/!font', 'Controllerfont#desktop', 'font'], ['POST', '/!admin', 'Controlleradmin#update', 'adminupdate'], ['GET', '/!admin', 'Controlleradmin#desktop', 'admin'], + ['GET', '/!info', 'Controllerinfo#desktop', 'info'], ['GET', '/!font/render', 'Controllerfont#render', 'fontrender'], ['POST', '/!font/add', 'Controllerfont#add', 'fontadd'], ['GET', '/[cid:art]/', 'Controllerart#read', 'artread/'], diff --git a/app/view/templates/admin.php b/app/view/templates/admin.php index 5edf262..6e8e0ab 100644 --- a/app/view/templates/admin.php +++ b/app/view/templates/admin.php @@ -5,7 +5,7 @@ - insert('backtopbar', ['user' => $user]) ?> + insert('backtopbar', ['user' => $user, 'tab' => 'admin']) ?>
diff --git a/app/view/templates/backtopbar.php b/app/view/templates/backtopbar.php index a06c304..d769993 100644 --- a/app/view/templates/backtopbar.php +++ b/app/view/templates/backtopbar.php @@ -1,5 +1,13 @@
+ +
+ + +
+
+ + isvisitor()) { ?> @@ -14,7 +22,7 @@ -User level : level() ?> +level() ?> @@ -33,17 +41,18 @@ User level : level() ?> iseditor()) { ?> - -home + +>home +>media +>font isadmin()) { ?> -font -admin +>admin -| github↝ +>info diff --git a/app/view/templates/font.php b/app/view/templates/font.php index 6e55686..90614a9 100644 --- a/app/view/templates/font.php +++ b/app/view/templates/font.php @@ -5,7 +5,7 @@ - insert('backtopbar', ['user' => $user]) ?> + insert('backtopbar', ['user' => $user, 'tab' => 'font']) ?>
diff --git a/app/view/templates/home.php b/app/view/templates/home.php index a83361d..87cdb8d 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -8,7 +8,7 @@ - insert('backtopbar', ['user' => $user]) ?> + insert('backtopbar', ['user' => $user, 'tab' => 'home']) ?> iseditor()) { ?> diff --git a/app/view/templates/info.php b/app/view/templates/info.php new file mode 100644 index 0000000..231a114 --- /dev/null +++ b/app/view/templates/info.php @@ -0,0 +1,25 @@ +layout('layout', ['title' => 'info', 'css' => $css . 'home.css']) ?> + + +start('page') ?> + + + + insert('backtopbar', ['user' => $user, 'tab' => 'info']) ?> + + +
+ +

Info

+ +πŸ±β€πŸ‘€ Github + +πŸ“• Manual +🌡 Website + +

About

+ +
+ + +stop('page') ?> \ No newline at end of file diff --git a/app/view/templates/media.php b/app/view/templates/media.php index 31e3ad0..043000d 100644 --- a/app/view/templates/media.php +++ b/app/view/templates/media.php @@ -1 +1,66 @@ -layout('layout', ['title' => 'Media']) ?> +layout('layout', ['title' => 'media', 'css' => $css . 'home.css']) ?> + + +start('page') ?> + + + + insert('backtopbar', ['user' => $user, 'tab' => 'media']) ?> + + +
+ +

Media

+ + + + + + + + + + + + + + + + + +
idextensionpathtypesizewidthheightlengh
id() ?>extension() ?>path() ?>type() ?>size()) ?>width() ?>height() ?>length() ?>
+ +

Favicon

+ + + + + + + + + + + + + + + +
idextensionpathsizewidthheight
id() ?>extension() ?>path() ?>size()) ?>width() ?>height() ?>
+ +
+ + +stop('page') ?> \ No newline at end of file diff --git a/assets/css/home.css b/assets/css/home.css index 1032c71..da820dd 100644 --- a/assets/css/home.css +++ b/assets/css/home.css @@ -33,11 +33,10 @@ tr:hover { } #topbar { - height: 30px; background-color: #7b97b9; - line-height: 30px; position: fixed; width: 100%; + padding: 3px 0.5%; } #topbar form { @@ -69,11 +68,13 @@ th { section { padding-top: 30px; - margin-left: 4px; + margin: 0 0.5%; } section.admin input, select, textarea { display: block; + width: 100%; + max-width: 400px; } section.font input, select, textarea { @@ -82,4 +83,40 @@ section.font input, select, textarea { span#user { float: right; +} + +span#search { + float: left; +} + +#topbar span#menu { + display: inline-block; + margin: 0 1%; +} + +input#id {width: 100px;} + + +section.info a { + display: block; + width: fit-content; +} + +section.font table#fontlist { + width: 100%; + max-width: 500px; +} + +section.media table#medialist { + width: 100%; + max-width: 960px; +} + +#topbar a.actualpage { + text-decoration: underline; +} + +section.media table#faviconlist { + width: 100%; + max-width: 640px; } \ No newline at end of file -- cgit v1.2.3