diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2019-01-12 14:53:41 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2019-01-12 14:53:41 +0100 |
commit | 393709dcf84776c760146722560816172167fe98 (patch) | |
tree | 4b5c1f24beae72a0ed9e6535f725031b46be165d /app/class | |
parent | 19458f7fc46c5a275f9a04b9e80fdf8175c85c6e (diff) | |
download | wcms-393709dcf84776c760146722560816172167fe98.tar.gz wcms-393709dcf84776c760146722560816172167fe98.zip |
visit counter
Diffstat (limited to 'app/class')
-rw-r--r-- | app/class/art2.php | 21 | ||||
-rw-r--r-- | app/class/config.php | 1 | ||||
-rw-r--r-- | app/class/controllerart.php | 7 | ||||
-rw-r--r-- | app/class/modelhome.php | 2 |
4 files changed, 28 insertions, 3 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 4a2da53..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', 'affcount']); + $opt->setcol(['id', 'tag', 'linkfrom', 'linkto', 'description', 'title', 'datemodif', 'datecreation', 'date', 'secure', 'visitcount']); $opt->settaglist($table); $opt->submit(); |