aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/class/art2.php21
-rw-r--r--app/class/config.php1
-rw-r--r--app/class/controllerart.php7
-rw-r--r--app/class/modelhome.php2
-rw-r--r--app/view/templates/home.php10
-rw-r--r--app/view/templates/homeopt.php32
-rw-r--r--app/view/templates/user.php16
7 files changed, 77 insertions, 12 deletions
diff --git a/app/class/art2.php b/app/class/art2.php
index a378bd4..2341ff9 100644
--- a/app/class/art2.php
+++ b/app/class/art2.php
@@ -37,6 +37,7 @@ class Art2
protected $invites;
protected $readers;
protected $affcount;
+ protected $visitcount;
protected $editcount;
@@ -110,6 +111,7 @@ class Art2
$this->setinvites([]);
$this->setreaders([]);
$this->setaffcount(0);
+ $this->setvisitcount(0);
$this->seteditcount(0);
}
@@ -432,6 +434,11 @@ class Art2
return $this->affcount;
}
+ public function visitcount($type = 'int')
+ {
+ return $this->visitcount;
+ }
+
public function editcount($type = 'int')
{
return $this->editcount;
@@ -739,6 +746,15 @@ class Art2
}
}
+ public function setvisitcount($visitcount)
+ {
+ if (is_int($visitcount)) {
+ $this->visitcount = $visitcount;
+ } elseif (is_numeric($visitcount)) {
+ $this->visitcount = intval($visitcount);
+ }
+ }
+
public function seteditcount($editcount)
{
if (is_int($editcount)) {
@@ -762,6 +778,11 @@ class Art2
$this->affcount++;
}
+ public function addvisitcount()
+ {
+ $this->visitcount++;
+ }
+
public function updateedited()
{
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
diff --git a/app/class/config.php b/app/class/config.php
index d04c602..06251ca 100644
--- a/app/class/config.php
+++ b/app/class/config.php
@@ -21,7 +21,6 @@ abstract class Config
protected static $defaultprivacy = 0;
-
// _______________________________________ F U N _______________________________________
diff --git a/app/class/controllerart.php b/app/class/controllerart.php
index be86660..00b7558 100644
--- a/app/class/controllerart.php
+++ b/app/class/controllerart.php
@@ -104,7 +104,12 @@ class Controllerart extends Controller
} else {
$page = ['head' => $this->art->renderhead(), 'body' => $this->art->renderbody()];
}
- $this->art->addaffcount();
+ if($canread) {
+ $this->art->addaffcount();
+ if($this->user->level() < 2) {
+ $this->art->addvisitcount();
+ }
+ }
$this->artmanager->update($this->art);
}
$data = array_merge($alerts, $page, ['art' => $this->art, 'artexist' => $artexist, 'canread' => $canread, 'readernav' => Config::showeditmenu(), 'canedit' => $this->canedit()]);
diff --git a/app/class/modelhome.php b/app/class/modelhome.php
index 07c89d8..2efdef4 100644
--- a/app/class/modelhome.php
+++ b/app/class/modelhome.php
@@ -11,7 +11,7 @@ class Modelhome extends Modelart
{
$opt = new Opt(Art2::classvarlist());
- $opt->setcol(['id', 'tag', 'linkfrom', 'linkto', 'description', 'title', 'datemodif', 'datecreation', 'date', 'secure']);
+ $opt->setcol(['id', 'tag', 'linkfrom', 'linkto', 'description', 'title', 'datemodif', 'datecreation', 'date', 'secure', 'visitcount']);
$opt->settaglist($table);
$opt->submit();
diff --git a/app/view/templates/home.php b/app/view/templates/home.php
index 70474c1..5860975 100644
--- a/app/view/templates/home.php
+++ b/app/view/templates/home.php
@@ -22,7 +22,7 @@
<div id="flex">
- <?php $this->insert('homeopt', ['opt' => $opt]) ?>
+ <?php $this->insert('homeopt', ['opt' => $opt, 'user' => $user]) ?>
@@ -55,7 +55,6 @@
<th>edit</th>
<th>see</th>
<th class="delete">del</th>
- <th class="log">log</th>
<th class="tag"><a href="<?= $opt->getadress('tag') ?>">tag</a></th>
<th class="summary">summary</th>
<th class="linkto"><a href="<?= $opt->getadress('linkto') ?>">to</a></th>
@@ -64,15 +63,15 @@
<th class="datecreation"><a href="<?= $opt->getadress('datecreation') ?>">date of creation</a></th>
<th class="date"><a href="<?= $opt->getadress('date') ?>">date</a></th>
<th class="secure"><a href="<?= $opt->getadress('secure') ?>">privacy</a></th>
+ <th class="visitcount"><a href="<?= $opt->getadress('visitcount') ?>">visit</a></th>
</tr>
<?php foreach ($table2 as $item) { ?>
<tr>
- <td><input type="checkbox" name="id[]" value="<?= $item->id() ?>" id="<?= $item->id() ?>"></td>
- <td><label title="<?= $item->title() ?>" for="<?= $item->id() ?>"><?= $item->id() ?></label></td>
+ <td><input type="checkbox" name="id[]" value="<?= $item->id() ?>" id="id_<?= $item->id() ?>"></td>
+ <td><label title="<?= $item->title() ?>" for="id_<?= $item->id() ?>"><?= $item->id() ?></label></td>
<td><a href="<?= $this->uart('artedit', $item->id()) ?>">✏</a></td>
<td><a href="<?= $this->uart('artread/', $item->id()) ?>" target="_blank">👁</a></td>
<td class="delete"><a href="<?= $this->uart('artdelete', $item->id()) ?>" >✖</a></td>
- <td class="log"><a href="<?= $this->uart('artlog', $item->id()) ?>" target="_blank">⁋</a></td>
<td class="tag"><a title="<?= $item->tag('string') ?>"><?= $item->tag('sort') ?></a></td>
<td class="summary" title="<?= $item->description() ?>"><?= $item->description('short') ?></td>
<td class="linkto"><a title="<?= $item->linkto('string') ?>" ><?= $item->linkto('sort') ?></a></td>
@@ -81,6 +80,7 @@
<td class="datecreation"><?= $item->datecreation('hrdi') ?></td>
<td class="date"><?= $item->date('dmy') ?></td>
<td class="secure"><?= $item->secure('string') ?></td>
+ <td class="visitcount"><?= $item->visitcount() ?></td>
</tr>
<?php }?>
diff --git a/app/view/templates/homeopt.php b/app/view/templates/homeopt.php
index a37e65b..5dab881 100644
--- a/app/view/templates/homeopt.php
+++ b/app/view/templates/homeopt.php
@@ -51,9 +51,9 @@ foreach ($opt->taglist() as $tagfilter => $count) {
if (in_array($tagfilter, $opt->tagfilter())) {
- echo '<li><input type="checkbox" name="tagfilter[]" id="' . $tagfilter . '" value="' . $tagfilter . '" checked /><label for="' . $tagfilter . '">' . $tagfilter . ' (' . $count . ')</label></li>';
+ echo '<li><input type="checkbox" name="tagfilter[]" id="tag_' . $tagfilter . '" value="' . $tagfilter . '" checked /><label for="tag_' . $tagfilter . '">' . $tagfilter . ' (' . $count . ')</label></li>';
} else {
- echo '<li><input type="checkbox" name="tagfilter[]" id="' . $tagfilter . '" value="' . $tagfilter . '" /><label for="' . $tagfilter . '">' . $tagfilter . ' (' . $count . ')</label></li>';
+ echo '<li><input type="checkbox" name="tagfilter[]" id="tag_' . $tagfilter . '" value="' . $tagfilter . '" /><label for="tag_' . $tagfilter . '">' . $tagfilter . ' (' . $count . ')</label></li>';
}
}
if ($in = true || $out = true) {
@@ -78,5 +78,33 @@ if ($in = true || $out = true) {
<input type="submit" name="submit" value="filter">
⬅<input type="submit" name="submit" value="reset">
+<?php if($user->isadmin()) { ?>
+
</form>
+
+<h2>Columns</h2>
+
+<form action="" method="post">
+
+<ul>
+
+<?php
+
+foreach ($opt->col() as $col) {
+ ?>
+ <li>
+ <input type="checkbox" name="col[]" id="col_<?= $col ?>">
+ <label for="col_<?= $col ?>"><?= $col ?></label>
+ </li>
+ <?php
+}
+
+?>
+
+</ul>
+
+</form>
+
+<?php } ?>
+
</div>
diff --git a/app/view/templates/user.php b/app/view/templates/user.php
index 2034d30..451d3ce 100644
--- a/app/view/templates/user.php
+++ b/app/view/templates/user.php
@@ -11,12 +11,22 @@
<main class="user">
-<div>
<h1>User : <?= $user->id() ?></h1>
-</div>
+<form action="" method="post">
+
+<h2>Connexion Options</h2>
+
+<input type="number" name="cookie" id="cookie">
+<label for="cookie">Cookie conservation time <i>(In days)</i></label>
+
+<input type="submit" value="submit">
+
+</form>
+
+<h1>Admin panel</h1>
<table>
<tr>
@@ -98,6 +108,8 @@ foreach ($userlist as $user ) {
</table>
+
+
</main>
</body>