aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-01-11 18:48:47 +0100
committervincent-peugnet <v.peugnet@free.fr>2020-01-11 18:48:47 +0100
commitb7c2d553face9ccdc5f96bcaaa181510c4328530 (patch)
treea560f1750128eb5f4b333e6b5f95dd765e840959
parentc599b349667630b328ab2560abccbb7e4fe47801 (diff)
downloadwcms-b7c2d553face9ccdc5f96bcaaa181510c4328530.tar.gz
wcms-b7c2d553face9ccdc5f96bcaaa181510c4328530.zip
multi edit :
- title - description
-rw-r--r--app/class/Controllerhome.php5
-rw-r--r--app/class/Modelpage.php7
-rw-r--r--app/view/templates/home.php4
-rw-r--r--app/view/templates/homemenu.php9
4 files changed, 19 insertions, 6 deletions
diff --git a/app/class/Controllerhome.php b/app/class/Controllerhome.php
index 6e691a6..d8c126d 100644
--- a/app/class/Controllerhome.php
+++ b/app/class/Controllerhome.php
@@ -130,7 +130,10 @@ class Controllerhome extends Controllerpage
public function multiedit()
{
if ($this->user->issupereditor() && isset($_POST['pagesid'])) {
- $datas = $_POST['datas'] ?? [];
+ $datas = $_POST['datas']?? [];
+ $datas = array_filter($datas, function ($var) {
+ return $var !== "";
+ });
$reset = $_POST['reset'] ?? [];
$addtag = $_POST['addtag'] ?? '';
$addauthor = $_POST['addauthor'] ?? '';
diff --git a/app/class/Modelpage.php b/app/class/Modelpage.php
index a13b3d4..21cdf8a 100644
--- a/app/class/Modelpage.php
+++ b/app/class/Modelpage.php
@@ -4,6 +4,8 @@ namespace Wcms;
use Exception;
use JamesMoss\Flywheel\Document;
+use DateTimeImmutable;
+
class Modelpage extends Modeldb
{
@@ -362,6 +364,7 @@ class Modelpage extends Modeldb
*/
public function reset(Page $page, array $reset) : Page
{
+ $now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
if($reset['tag']) {
$page->settag([]);
}
@@ -369,10 +372,10 @@ class Modelpage extends Modeldb
$page->setauthors([]);
}
if($reset['date']) {
- // reset date as now
+ $page->setdate($now);
}
if($reset['datemodif']) {
- // reset datemodif as now
+ $page->setdatemodif($now);
}
return $page;
}
diff --git a/app/view/templates/home.php b/app/view/templates/home.php
index a60a5cc..f95c60f 100644
--- a/app/view/templates/home.php
+++ b/app/view/templates/home.php
@@ -36,7 +36,7 @@
<table id="home2table">
<thead>
<tr>
- <th id="checkall" class="hidephone">x</th>
+ <?php if($user->issupereditor()) { ?><th id="checkall" class="hidephone">x</th> <?php } ?>
<th><a href="<?= $opt->getadress('id') ?>">id</a></th>
<th>edit</th>
<th>see</th>
@@ -85,7 +85,7 @@
<tbody>
<?php foreach ($table2 as $item) { ?>
<tr>
- <td class="hidephone"><input type="checkbox" name="pagesid[]" value="<?= $item->id() ?>" id="id_<?= $item->id() ?>" form="multiedit"></td>
+ <?php if($user->issupereditor()) { ?><td class="hidephone"><input type="checkbox" name="pagesid[]" value="<?= $item->id() ?>" id="id_<?= $item->id() ?>" form="multiedit"></td><?php } ?>
<td><label title="<?= $item->title() ?>" for="id_<?= $item->id() ?>"><?= $item->id() ?></label></td>
<td><a href="<?= $this->upage('pageedit', $item->id()) ?>"><img src="<?= Wcms\Model::iconpath() ?>edit.png" class="icon"></a></td>
<td><a href="<?= $this->upage('pageread/', $item->id()) ?>" target="_blank"><img src="<?= Wcms\Model::iconpath() ?>read.png" class="icon"></a></td>
diff --git a/app/view/templates/homemenu.php b/app/view/templates/homemenu.php
index ade9bac..21f9af8 100644
--- a/app/view/templates/homemenu.php
+++ b/app/view/templates/homemenu.php
@@ -1,7 +1,7 @@
<aside class="home">
-
+<?php if($user->issupereditor()) { ?>
<details class="hidephone" id="json">
<summary>File</summary>
<div class="submenu">
@@ -45,6 +45,12 @@
</form>
<h2>Edit Meta infos</h2>
<form action="<?= $this->url('multiedit') ?>" method="post" id="multiedit">
+ <input type="text" name="datas[title]" id="title">
+ <label for="title">title</label>
+ </br>
+ <input type="text" name="datas[description]" id="description">
+ <label for="description">description</label>
+ </br>
<strong>Tag</strong>
</br>
<input type="hidden" name="reset[tag]" value="0">
@@ -142,6 +148,7 @@
</form>
</div>
</details>
+ <?php } ?>