aboutsummaryrefslogtreecommitdiff
path: root/app/view/templates
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-01-20 10:22:49 +0100
committervincent-peugnet <v.peugnet@free.fr>2020-01-20 10:22:49 +0100
commit61d7c9de6b7d50eb151e513e3be1e1805b4690d3 (patch)
treed41e5fc8d20a598f74c943789b3d191ac3487e62 /app/view/templates
parent727d37179803378a8da8dcec02e3b8f063d07e6d (diff)
parent9fc3c177b3228f7d68ce464a7d5056002ca9a8d0 (diff)
downloadwcms-61d7c9de6b7d50eb151e513e3be1e1805b4690d3.tar.gz
wcms-61d7c9de6b7d50eb151e513e3be1e1805b4690d3.zip
Merge branch 'implement-better-ui'
Diffstat (limited to 'app/view/templates')
-rw-r--r--app/view/templates/admin.php355
-rw-r--r--app/view/templates/info.php75
-rw-r--r--app/view/templates/user.php259
3 files changed, 372 insertions, 317 deletions
diff --git a/app/view/templates/admin.php b/app/view/templates/admin.php
index d8255ba..c201d90 100644
--- a/app/view/templates/admin.php
+++ b/app/view/templates/admin.php
@@ -12,277 +12,286 @@
<section>
- <form action="<?= $this->url('adminupdate') ?>" method="post">
+ <div class="block">
+ <h1>Administration</h1>
+
+ <div class="scroll">
+
+ <form action="<?= $this->url('adminupdate') ?>" method="post">
- <article>
- <h1>Administration</h1>
+ <article>
- <input type="submit" value="Update configuration">
- </article>
- <article>
+ <input type="submit" value="Update configuration">
+ </article>
- <h2>Home page</h2>
+ <article>
- <p>Here you can set the home-page view for visitors.</p>
+ <h2>Home page</h2>
- <div class="radio">
- <input type="radio" name="homepage" value="default" id="default" <?= Wcms\Config::homepage() === 'default' ? 'checked' : '' ?>>
- <label for="default">default</label>
- </div>
+ <p>Here you can set the home-page view for visitors.</p>
- <div class="radio">
- <input type="radio" name="homepage" value="search" id="searchbar" <?= Wcms\Config::homepage() === 'search' ? 'checked' : '' ?>>
- <label for="searchbar">search bar</label>
- </div>
+ <div class="radio">
+ <input type="radio" name="homepage" value="default" id="default" <?= Wcms\Config::homepage() === 'default' ? 'checked' : '' ?>>
+ <label for="default">default</label>
+ </div>
- <div class="radio">
- <input type="radio" name="homepage" value="redirect" id="redirect" <?= Wcms\Config::homepage() === 'redirect' ? 'checked' : '' ?>>
- <label for="redirect">redirect to page</label>
- </div>
+ <div class="radio">
+ <input type="radio" name="homepage" value="search" id="searchbar" <?= Wcms\Config::homepage() === 'search' ? 'checked' : '' ?>>
+ <label for="searchbar">search bar</label>
+ </div>
- <select name="homeredirect" id="homeredirect">
- <option value="" <?= Wcms\Config::homeredirect() === null ? 'selected' : '' ?>>--select page to redirect--</option>
+ <div class="radio">
+ <input type="radio" name="homepage" value="redirect" id="redirect" <?= Wcms\Config::homepage() === 'redirect' ? 'checked' : '' ?>>
+ <label for="redirect">redirect to page</label>
+ </div>
- <?php
- foreach ($pagelist as $page) {
- ?>
- <option value="<?= $page ?>" <?= Wcms\Config::homeredirect() === $page ? 'selected' : '' ?>><?= $page ?></option>
- <?php
- }
+ <select name="homeredirect" id="homeredirect">
+ <option value="" <?= Wcms\Config::homeredirect() === null ? 'selected' : '' ?>>--select page to redirect--</option>
+
+ <?php
+ foreach ($pagelist as $page) {
+ ?>
+ <option value="<?= $page ?>" <?= Wcms\Config::homeredirect() === $page ? 'selected' : '' ?>><?= $page ?></option>
+ <?php
+ }
- ?>
- </select>
+ ?>
+ </select>
- </article>
+ </article>
- <article>
+ <article>
- <h2>Page creation</h2>
+ <h2>Page creation</h2>
- <p>What really happend when you create a new page</p>
+ <p>What really happend when you create a new page</p>
- <label for="defaultprivacy">Default privacy</label>
- <select name="defaultprivacy" id="defaultprivacy">
- <option value="0" <?= Wcms\Config::defaultprivacy() == 0 ? 'selected' : '' ?>>public</option>
- <option value="1" <?= Wcms\Config::defaultprivacy() == 1 ? 'selected' : '' ?>>private</option>
- <option value="2" <?= Wcms\Config::defaultprivacy() == 2 ? 'selected' : '' ?>>not published</option>
- </select>
+ <label for="defaultprivacy">Default privacy</label>
+ <select name="defaultprivacy" id="defaultprivacy">
+ <option value="0" <?= Wcms\Config::defaultprivacy() == 0 ? 'selected' : '' ?>>public</option>
+ <option value="1" <?= Wcms\Config::defaultprivacy() == 1 ? 'selected' : '' ?>>private</option>
+ <option value="2" <?= Wcms\Config::defaultprivacy() == 2 ? 'selected' : '' ?>>not published</option>
+ </select>
- <label for="defaultpage">Or, create new page BODY based on an already existing one</label>
- <select name="defaultpage" id="defaultpage">
- <option value="" <?= Wcms\Config::defaultpage() === '' || !$defaultpageexist ? 'selected' : '' ?>>--use default BODY element--</option>
- <?php
- foreach ($pagelist as $page) {
+ <label for="defaultpage">Or, create new page BODY based on an already existing one</label>
+ <select name="defaultpage" id="defaultpage">
+ <option value="" <?= Wcms\Config::defaultpage() === '' || !$defaultpageexist ? 'selected' : '' ?>>--use default BODY element--</option>
+ <?php
+ foreach ($pagelist as $page) {
+ ?>
+ <option value="<?= $page ?>" <?= Wcms\Config::defaultpage() === $page ? 'selected' : '' ?>><?= $page ?></option>
+ <?php }
+ ?>
+ </select>
+
+ <?php
+ if (empty(!$defaultpageexist || Wcms\Config::defaultpage())) {
+ ?>
+ <label for="defaultbody">Edit default BODY element</label>
+ <textarea name="defaultbody" id="defaultbody" cols="30" rows="10"><?= Wcms\Config::defaultbody() ?></textarea>
+ <?php
+ }
?>
- <option value="<?= $page ?>" <?= Wcms\Config::defaultpage() === $page ? 'selected' : '' ?>><?= $page ?></option>
- <?php }
- ?>
- </select>
- <?php
- if (empty(!$defaultpageexist || Wcms\Config::defaultpage())) {
- ?>
- <label for="defaultbody">Edit default BODY element</label>
- <textarea name="defaultbody" id="defaultbody" cols="30" rows="10"><?= Wcms\Config::defaultbody() ?></textarea>
- <?php
- }
- ?>
+ </article>
- </article>
+ <article>
- <article>
+ <h2>Alert pages</h2>
- <h2>Alert pages</h2>
+ <h4>Common options</h4>
- <h4>Common options</h4>
+ <label for="alerttitle">H1 Title</label>
+ <input type="text" name="alerttitle" id="alerttitle" value="<?= Wcms\Config::alerttitle() ?>">
- <label for="alerttitle">H1 Title</label>
- <input type="text" name="alerttitle" id="alerttitle" value="<?= Wcms\Config::alerttitle() ?>">
+ <label for="alertlink">Link to this page (for visitors)</label>
+ <select name="alertlink" id="alertlink">
+ <option value="" <?= empty(Wcms\Config::alertlink()) ? 'selected' : '' ?>>--No link--</option>
+ <?php
+ foreach ($pagelist as $page) {
+ ?>
+ <option value="<?= $page ?>" <?= Wcms\Config::alertlink() === $page ? 'selected' : '' ?>><?= $page ?></option>
+ <?php }
+ ?>
+ </select>
- <label for="alertlink">Link to this page (for visitors)</label>
- <select name="alertlink" id="alertlink">
- <option value="" <?= empty(Wcms\Config::alertlink()) ? 'selected' : '' ?>>--No link--</option>
- <?php
- foreach ($pagelist as $page) {
- ?>
- <option value="<?= $page ?>" <?= Wcms\Config::alertlink() === $page ? 'selected' : '' ?>><?= $page ?></option>
- <?php }
- ?>
- </select>
+ <label for="alertlinktext">Link text</label>
+ <input type="text" name="alertlinktext" id="alertlinktext" value="<?= Wcms\Config::alertlinktext() ?>">
- <label for="alertlinktext">Link text</label>
- <input type="text" name="alertlinktext" id="alertlinktext" value="<?= Wcms\Config::alertlinktext() ?>">
+ <h4>Un-existing</h4>
- <h4>Un-existing</h4>
+ <label for="existnot">Text to show when a page does not exist yet.</label>
+ <i>This will also be shown as a tooltip over links.</i>
+ <input type="text" name="existnot" id="existnot" value="<?= Wcms\Config::existnot() ?>">
- <label for="existnot">Text to show when a page does not exist yet.</label>
- <i>This will also be shown as a tooltip over links.</i>
- <input type="text" name="existnot" id="existnot" value="<?= Wcms\Config::existnot() ?>">
+ <div class="checkbox">
+ <input type="hidden" name="existnotpass" value="0">
+ <input type="checkbox" name="existnotpass" id="existnotpass" value="1" <?= Wcms\Config::existnotpass() ? 'checked' : '' ?>>
+ <label for="existnotpass">Ask for password</label>
+ </div>
- <div class="checkbox">
- <input type="hidden" name="existnotpass" value="0">
- <input type="checkbox" name="existnotpass" id="existnotpass" value="1" <?= Wcms\Config::existnotpass() ? 'checked' : '' ?>>
- <label for="existnotpass">Ask for password</label>
- </div>
+ <h4>Private</h4>
- <h4>Private</h4>
+ <label for="private">Text to show when a page is private.</label>
+ <input type="text" name="private" id="private" value="<?= Wcms\Config::private() ?>">
- <label for="private">Text to show when a page is private.</label>
- <input type="text" name="private" id="private" value="<?= Wcms\Config::private() ?>">
+ <div class="checkbox">
+ <input type="hidden" name="privatepass" value="0">
+ <input type="checkbox" name="privatepass" id="privatepass" value="1" <?= Wcms\Config::privatepass() ? 'checked' : '' ?>>
+ <label for="privatepass">Ask for password</label>
+ </div>
- <div class="checkbox">
- <input type="hidden" name="privatepass" value="0">
- <input type="checkbox" name="privatepass" id="privatepass" value="1" <?= Wcms\Config::privatepass() ? 'checked' : '' ?>>
- <label for="privatepass">Ask for password</label>
- </div>
+ <h4>Not published</h4>
- <h4>Not published</h4>
+ <label for="notpublished">Text to show when a page is not published.</label>
+ <input type="text" name="notpublished" id="notpublished" value="<?= Wcms\Config::notpublished() ?>">
- <label for="notpublished">Text to show when a page is not published.</label>
- <input type="text" name="notpublished" id="notpublished" value="<?= Wcms\Config::notpublished() ?>">
+ <div class="checkbox">
+ <input type="hidden" name="notpublishedpass" value="0">
+ <input type="checkbox" name="notpublishedpass" id="notpublishedpass" value="1" <?= Wcms\Config::notpublishedpass() ? 'checked' : '' ?>>
+ <label for="notpublishedpass">Ask for password</label>
+ </div>
- <div class="checkbox">
- <input type="hidden" name="notpublishedpass" value="0">
- <input type="checkbox" name="notpublishedpass" id="notpublishedpass" value="1" <?= Wcms\Config::notpublishedpass() ? 'checked' : '' ?>>
- <label for="notpublishedpass">Ask for password</label>
- </div>
+ <h4>CSS</h4>
- <h4>CSS</h4>
+ <div class="checkbox">
+ <input type="hidden" name="alertcss" value="0">
+ <input type="checkbox" name="alertcss" id="alertcss" value="1" <?= Wcms\Config::alertcss() ? 'checked' : '' ?>>
+ <label for="alertcss">Use global.css for those page as well</label>
+ </div>
- <div class="checkbox">
- <input type="hidden" name="alertcss" value="0">
- <input type="checkbox" name="alertcss" id="alertcss" value="1" <?= Wcms\Config::alertcss() ? 'checked' : '' ?>>
- <label for="alertcss">Use global.css for those page as well</label>
- </div>
+ <p>
+ <i>You can use <code>body.alert</code> class to specify style.</i>
+ </p>
- <p>
- <i>You can use <code>body.alert</code> class to specify style.</i>
- </p>
+ </article>
+
+
+ <article>
+
- </article>
-
-
- <article>
-
+ <h2>Render</h2>
- <h2>Render</h2>
+ <div class="checkbox">
+ <input type="hidden" name="reccursiverender" value="0">
+ <input type="checkbox" name="reccursiverender" id="reccursiverender" value="1" <?= Wcms\Config::reccursiverender() ? 'checked' : '' ?>>
+ <label for="reccursiverender">Reccursive render</label>
+ </div>
- <div class="checkbox">
- <input type="hidden" name="reccursiverender" value="0">
- <input type="checkbox" name="reccursiverender" id="reccursiverender" value="1" <?= Wcms\Config::reccursiverender() ? 'checked' : '' ?>>
- <label for="reccursiverender">Reccursive render</label>
- </div>
+ <h4>Links</h4>
- <h4>Links</h4>
+ <div class="checkbox">
+ <input type="hidden" name="externallinkblank" value="0">
+ <input type="checkbox" name="externallinkblank" id="externallinkblank" value="1" <?= Wcms\Config::externallinkblank() ? 'checked' : '' ?>>
+ <label for="externallinkblank">Open external links in new tab</label>
+ </div>
- <div class="checkbox">
- <input type="hidden" name="externallinkblank" value="0">
- <input type="checkbox" name="externallinkblank" id="externallinkblank" value="1" <?= Wcms\Config::externallinkblank() ? 'checked' : '' ?>>
- <label for="externallinkblank">Open external links in new tab</label>
- </div>
+ <div class="checkbox">
+ <input type="hidden" name="internallinkblank" value="0">
+ <input type="checkbox" name="internallinkblank" id="internallinkblank" value="1" <?= Wcms\Config::internallinkblank() ? 'checked' : '' ?>>
+ <label for="internallinkblank">Open internal links in new tab</label>
+ </div>
- <div class="checkbox">
- <input type="hidden" name="internallinkblank" value="0">
- <input type="checkbox" name="internallinkblank" id="internallinkblank" value="1" <?= Wcms\Config::internallinkblank() ? 'checked' : '' ?>>
- <label for="internallinkblank">Open internal links in new tab</label>
- </div>
+ <i>(This modifications need re-rendering)</i>
- <i>(This modifications need re-rendering)</i>
+ </article>
- </article>
+ <article>
- <article>
+ <h2>CSS</h2>
- <h2>CSS</h2>
+ <label for="globalcss">Edit global css that will apply to every pages</label>
+ <textarea name="globalcss" id="globalcss" cols="30" rows="10"><?= $globalcss ?></textarea>
- <label for="globalcss">Edit global css that will apply to every pages</label>
- <textarea name="globalcss" id="globalcss" cols="30" rows="10"><?= $globalcss ?></textarea>
+ <label for="defaultfavicon">Default favicon</label>
+ <select name="defaultfavicon" id="defaultfavicon">
+ <option value="">--no favicon--</option>
+ <?php
+ foreach ($faviconlist as $favicon) {
+ ?>
+ <option value="<?= $favicon ?>" <?= Wcms\Config::defaultfavicon() === $favicon ? 'selected' : '' ?>><?= $favicon ?></option>
+ <?php
+ }
+ ?>
+ </select>
- <label for="defaultfavicon">Default favicon</label>
- <select name="defaultfavicon" id="defaultfavicon">
- <option value="">--no favicon--</option>
- <?php
- foreach ($faviconlist as $favicon) {
- ?>
- <option value="<?= $favicon ?>" <?= Wcms\Config::defaultfavicon() === $favicon ? 'selected' : '' ?>><?= $favicon ?></option>
- <?php
- }
- ?>
- </select>
+ </article>
- </article>
+ <article>
- <article>
+ <h2>Interface</h2>
- <h2>Interface</h2>
+ <p>Set interface Style</p>
- <p>Set interface Style</p>
+ <select name="interfacecss" id="interfacecss">
+ <option value="null">--default interface style---</option>
+ <?php
+ foreach ($interfacecsslist as $interfacecss) {
+ ?>
+ <option value="<?= $interfacecss ?>" <?= $interfacecss === Wcms\Config::interfacecss() ? 'selected' : '' ?>><?= $interfacecss ?></option>
+ <?php
+ }
+ ?>
+ </select>
- <select name="interfacecss" id="interfacecss">
- <option value="null">--default interface style---</option>
- <?php
- foreach ($interfacecsslist as $interfacecss) {
- ?>
- <option value="<?= $interfacecss ?>" <?= $interfacecss === Wcms\Config::interfacecss() ? 'selected' : '' ?>><?= $interfacecss ?></option>
- <?php
- }
- ?>
- </select>
+ </article>
- </article>
+ <article>
- <article>
+ <h2>Tracking</h2>
- <h2>Tracking</h2>
+ <label for="analytics">Google analytics Tracking ID</label>
+ <input type="text" name="analytics" id="analytics" value="<?= Wcms\Config::analytics() ?>">
- <label for="analytics">Google analytics Tracking ID</label>
- <input type="text" name="analytics" id="analytics" value="<?= Wcms\Config::analytics() ?>">
+ <i>(Need rendering to work)</i>
- <i>(Need rendering to work)</i>
+ </article>
- </article>
+ <article>
+ <input type="submit" value="Update configuration">
+ </article>
- <article>
- <input type="submit" value="Update configuration">
- </article>
+ </form>
- </form>
+ </div>
+
+ </div>
</section>
diff --git a/app/view/templates/info.php b/app/view/templates/info.php
index f1ca1f9..8f6377b 100644
--- a/app/view/templates/info.php
+++ b/app/view/templates/info.php
@@ -10,44 +10,73 @@
<main class="info">
+<nav>
+ <div class="block">
+ <h2>Manual Summary</h2>
+ <div class="scroll">
+ <ul>
+ <li><a href="#startup">Startup</a></li>
+ <ul>
-<section>
+ </ul>
+ <li><a href="#structure">Structure</a></li>
+ <ul>
+ <li><a href="#attributes">Page attributes</a></li>
+ <li><a href="#database">Database</a></li>
+ </ul>
+ <li><a href="#editor">Editor</a></li>
+ <ul>
+ <li><a href="#elementsyntax">Elements syntax</a></li>
+ <li><a href="#bodysyntax">Body syntax</a></li>
+ </ul>
+ </ul>
+ </div>
+ </div>
+</nav>
-<article>
+<section class="info">
-<h1>Info</h1>
+ <div class="block">
+ <div class="scroll">
+ <article>
-<h2>Version</h2>
+ <h1>Info</h1>
-<?= $version ?>
+ <h2>Version</h2>
-<h2>Links</h2>
+ <?= $version ?>
-<ul>
-<li><a href="https://github.com/vincent-peugnet/wcms" target="_blank">🐱‍👤 Github</a></li>
-<li><a href="#manual">📕 Manual</a></li>
-<li><a href="https://w-cms.top" target="_blank">🌵 Website</a></li>
-</ul>
+ <h2>Links</h2>
-<h2>About</h2>
+ <ul>
+ <li><a href="https://github.com/vincent-peugnet/wcms" target="_blank">🐱‍👤 Github</a></li>
+ <li><a href="#manual">📕 Manual</a></li>
+ <li><a href="https://w-cms.top" target="_blank">🌵 Website</a></li>
+ </ul>
-<h3>W-cms was made using these open sources and free components :</h3>
+ <h2>About</h2>
-<ul>
-<li><a href="https://github.com/jamesmoss/flywheel" target="_blank">🎡 James Moss's Flywheel Database</a> <i>as json noSQL flatfile database engine</i></li>
-<li><a href="https://github.com/michelf/php-markdown" target="_blank">📝 Michel Fortin's Markdown Extra</a> <i>markdown library</i></li>
-<li><a href="https://github.com/thephpleague/plates" target="_blank">🎨 Plates</a> <i>as templating engine</i></li>
-<li><a href="https://github.com/dannyvankooten/AltoRouter">🐶 Alto Router</a> <i>as router engine</i></li>
-</ul>
+ <h3>W-cms was made using these open sources and free components :</h3>
-<h3>Special thanks to :</h3>
+ <ul>
+ <li><a href="https://github.com/jamesmoss/flywheel" target="_blank">🎡 James Moss's Flywheel Database</a> <i>as json noSQL flatfile database engine</i></li>
+ <li><a href="https://github.com/michelf/php-markdown" target="_blank">📝 Michel Fortin's Markdown Extra</a> <i>markdown library</i></li>
+ <li><a href="https://github.com/thephpleague/plates" target="_blank">🎨 Plates</a> <i>as templating engine</i></li>
+ <li><a href="https://github.com/dannyvankooten/AltoRouter">🐶 Alto Router</a> <i>as router engine</i></li>
+ </ul>
-<a href="https://nicolas.club1.fr" target="_blank">🚲 Nicolas Peugnet</a>
+ <h3>Special thanks to :</h3>
-</article>
+ <a href="https://nicolas.club1.fr" target="_blank">🚲 Nicolas Peugnet</a>
+
+ </article>
+
+ <?php $this->insert('man') ?>
+
+ </div>
+ </div>
-<?php $this->insert('man') ?>
</section>
diff --git a/app/view/templates/user.php b/app/view/templates/user.php
index 21a7639..f281c93 100644
--- a/app/view/templates/user.php
+++ b/app/view/templates/user.php
@@ -10,157 +10,174 @@
<main class="user">
-<section>
+ <section>
+ <div class="block">
-<article>
+
+ <h1>User : <?= $user->id() ?></h1>
+
+ <div class="scroll">
-<h1>User : <?= $user->id() ?></h1>
-<h2>Infos</h2>
+ <h2>Infos</h2>
-<p>Connections count : <?= $getuser->connectcount() ?></p>
+ <p>Connections count : <?= $getuser->connectcount() ?></p>
-<p>Account will expire in : <?= $getuser->expiredate('hrdi') ?></p>
+ <p>Account will expire in : <?= $getuser->expiredate('hrdi') ?></p>
-<h2>Preferences</h2>
+ <h2>Preferences</h2>
-<form action="<?= $this->url('userpref') ?>" method="post">
+ <form action="<?= $this->url('userpref') ?>" method="post">
-<p>
- <input type="number" name="cookie" value="<?= $getuser->cookie() ?>" id="cookie" min="0" max="365">
- <label for="cookie">Cookie conservation time <i>(In days)</i></label>
- <input type="submit" value="submit">
-</p>
-
-</form>
-
-</article>
-
-
-<?php if($user->isadmin()) { ?>
-
-<article>
-
-<h1>Admin panel</h1>
-
-<table>
-<tr>
-<th>id</th><th>password</th><th>hash</th><th>level</th><th>set expiration date</th><th>action</th><th>expire</th><th>connect</th>
-</tr>
-
-<tr>
- <form action="<?= $this->url('useradd') ?>" method="post">
- <td>
- <input type="text" name="id" maxlength="128" required>
- </td>
- <td>
- <input type="password" name="password" minlength="4" maxlength="64" required>
- </td>
-
- <td>
- <input type="hidden" name="passwordhashed" value="0">
- <input type="checkbox" name="passwordhashed" value="1">
- </td>
-
- <td>
- <select name="level" id="level">
- <option value="1">reader</option>
- <option value="2">invite</option>
- <option value="3">editor</option>
- <option value="4">super editor</option>
- <option value="10">admin</option>
- </select>
- </td>
- <td>
- <input type="date" name="expiredate" id="expiredate" min="<?= $now ?>">
- </td>
- <td>
- <input type="submit" value="add">
- </td>
- <td>
-
- </td>
- <td>
-
- </td>
-
- </form>
-</tr>
+ <p>
+ <input type="number" name="cookie" value="<?= $getuser->cookie() ?>" id="cookie" min="0" max="365">
+ <label for="cookie">Cookie conservation time <i>(In days)</i></label>
+ <input type="submit" value="submit">
+ </p>
+
+ </form>
+
+
+ </div>
+
+
+ </div>
+ </section>
-<?php
-foreach ($userlist as $user ) {
- ?>
- <tr>
- <form action="<?= $this->url('userupdate') ?>" method="post">
-
- <td>
- <?= $user->id() ?>
- </td>
-
- <td>
- <input type="password" name="password" minlength="4" maxlength="64" >
- </td>
-
- <td>
- <?= $user->passwordhashed() ? '🔑' : '<input type="hidden" name="passwordhashed" value="0"><input type="checkbox" name="passwordhashed" value="1">' ?>
- </td>
-
- <td>
- <select name="level" id="level">
- <option value="1" <?= $user->level() === 1 ? 'selected' : '' ?>>reader</option>
- <option value="2" <?= $user->level() === 2 ? 'selected' : '' ?>>invite</option>
- <option value="3" <?= $user->level() === 3 ? 'selected' : '' ?>>editor</option>
- <option value="4" <?= $user->level() === 4 ? 'selected' : '' ?>>super editor</option>
- <option value="10" <?= $user->level() === 10 ? 'selected' : '' ?>>admin</option>
- </select>
- </td>
-
-
- <td>
- <input type="date" name="expiredate" id="expiredate"<?= $user->expiredate() !== false ? 'value="' . $user->expiredate('string') . '"' : '' ?>>
- <span>reset<input type="checkbox" name="expiredate" id="expiredate" value="null"></span>
+ <?php if($user->isadmin()) { ?>
+
+ <section>
- </td>
+ <div class="block">
+
+ <h1>Admin panel</h1>
+
+ <div class="scroll">
+
+ <table>
+ <tr>
+ <th>id</th><th>password</th><th>hash</th><th>level</th><th>set expiration date</th><th>action</th><th>expire</th><th>connect</th>
+ </tr>
+
+ <tr>
+ <form action="<?= $this->url('useradd') ?>" method="post">
+ <td>
+ <input type="text" name="id" maxlength="128" required>
+ </td>
+ <td>
+ <input type="password" name="password" minlength="4" maxlength="64" required>
+ </td>
+
+ <td>
+ <input type="hidden" name="passwordhashed" value="0">
+ <input type="checkbox" name="passwordhashed" value="1">
+ </td>
+
+ <td>
+ <select name="level" id="level">
+ <option value="1">reader</option>
+ <option value="2">invite</option>
+ <option value="3">editor</option>
+ <option value="4">super editor</option>
+ <option value="10">admin</option>
+ </select>
+ </td>
+ <td>
+ <input type="date" name="expiredate" id="expiredate" min="<?= $now ?>">
+ </td>
+ <td>
+ <input type="submit" value="add">
+ </td>
+ <td>
+
+ </td>
+ <td>
+
+ </td>
+
+ </form>
+ </tr>
+
+
+ <?php
+ foreach ($userlist as $user ) {
+ ?>
+
+ <tr>
+ <form action="<?= $this->url('userupdate') ?>" method="post">
+
+ <td>
+ <?= $user->id() ?>
+ </td>
+
+ <td>
+ <input type="password" name="password" minlength="4" maxlength="64" >
+ </td>
+
+ <td>
+ <?= $user->passwordhashed() ? '🔑' : '<input type="hidden" name="passwordhashed" value="0"><input type="checkbox" name="passwordhashed" value="1">' ?>
+ </td>
+
+ <td>
+ <select name="level" id="level">
+ <option value="1" <?= $user->level() === 1 ? 'selected' : '' ?>>reader</option>
+ <option value="2" <?= $user->level() === 2 ? 'selected' : '' ?>>invite</option>
+ <option value="3" <?= $user->level() === 3 ? 'selected' : '' ?>>editor</option>
+ <option value="4" <?= $user->level() === 4 ? 'selected' : '' ?>>super editor</option>
+ <option value="10" <?= $user->level() === 10 ? 'selected' : '' ?>>admin</option>
+ </select>
+ </td>
+
+
+ <td>
+ <input type="date" name="expiredate" id="expiredate"<?= $user->expiredate() !== false ? 'value="' . $user->expiredate('string') . '"' : '' ?>>
+ <span>reset<input type="checkbox" name="expiredate" id="expiredate" value="null"></span>
+
+ </td>
+
+ <td>
+ <input type="hidden" name="id" value="<?= $user->id() ?>">
+ <input type="submit" name="action" value="update">
+ <input type="submit" name="action" value="delete">
+ </form>
+
+ </td>
+
- <td>
- <input type="hidden" name="id" value="<?= $user->id() ?>">
- <input type="submit" name="action" value="update">
- <input type="submit" name="action" value="delete">
- </form>
- </td>
+ <td>
+ <?= $user->expiredate('hrdi') ?>
+ </td>
+ <td>
+ <?= $user->connectcount() ?>
+ </td>
- <td>
- <?= $user->expiredate('hrdi') ?>
- </td>
+ </tr>
- <td>
- <?= $user->connectcount() ?>
- </td>
+ <?php
+ }
+ ?>
+ </table>
- </tr>
- <?php
- }
-?>
+ </div>
-</table>
+ </div>
-</article>
-<?php } ?>
+ </section>
+ <?php } ?>
-</section>
</main>