aboutsummaryrefslogtreecommitdiff
path: root/w/class/controllerart.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-11-02 02:03:52 +0100
committervincent-peugnet <v.peugnet@free.fr>2018-11-02 02:03:52 +0100
commit85824de70ded75c98bd50220160e2171fdc8df41 (patch)
tree11480f65ff97ddbb3ea4806ff1f313628ced15a0 /w/class/controllerart.php
parent36ef34af2abcdea63a73b578208f20ca40b52f49 (diff)
downloadwcms-85824de70ded75c98bd50220160e2171fdc8df41.tar.gz
wcms-85824de70ded75c98bd50220160e2171fdc8df41.zip
render working and url auto link
Diffstat (limited to 'w/class/controllerart.php')
-rw-r--r--w/class/controllerart.php50
1 files changed, 32 insertions, 18 deletions
diff --git a/w/class/controllerart.php b/w/class/controllerart.php
index 064474a..340e8e5 100644
--- a/w/class/controllerart.php
+++ b/w/class/controllerart.php
@@ -4,19 +4,23 @@ class Controllerart extends Controllerdb
{
/** @var Art2 */
protected $art;
-
-
- public function __construct($id) {
- parent::__construct();
+ protected $artmanager;
+ protected $renderengine;
-
+ public function __construct($id)
+ {
+ parent::__construct();
+
+
$this->art = new Art2(['id' => $id]);
+ $this->artmanager = new Modelart();
+ $this->renderengine = new Modelrender();
}
public function importart()
{
$art = $this->artmanager->get($this->art);
- if($art !== false) {
+ if ($art !== false) {
$this->art = $art;
//$this->art->autotaglistupdate($this->artmanager->taglist($this->artmanager->getlister(['id', 'title', 'description', 'tag']), $this->art->autotaglist()));
return true;
@@ -32,20 +36,22 @@ class Controllerart extends Controllerdb
$display = $this->user->level() >= $this->art->secure();
$cancreate = $this->user->cancreate();
- $this->showtemplate('read', ['art' => $this->art, 'artexist' => $artexist, 'display' => $display, 'cancreate' => $cancreate]);
-
+ $renderbody = $this->renderengine->render($this->art);
+
+ //$this->showtemplate('read', ['art' => $this->art, 'artexist' => $artexist, 'display' => $display, 'cancreate' => $cancreate]);
+
}
public function edit()
{
- if($this->importart() && $this->user->canedit()) {
+ if ($this->importart() && $this->user->canedit()) {
$this->showtemplate('edit', ['art' => $this->art, 'artexist' => true]);
} else {
$this->redirect('?id=' . $this->art->id());
}
-
+
}
public function log()
@@ -63,25 +69,33 @@ class Controllerart extends Controllerdb
public function delete()
{
- echo '<h2>Delete</h2>';
- $this->artmanager->delete($this->art);
+ if ($this->user->canedit() && $this->importart()) {
+
+ if (isset($_POST['deleteconfirm']) && $_POST['deleteconfirm'] == true) {
+ $this->artmanager->delete($this->art);
+ $this->redirect('?id=' . $this->art->id());
+ } else {
+ $this->showtemplate('delete', ['art' => $this->art, 'artexist' => true]);
+ }
+ } else {
+ $this->redirect('?id=' . $this->art->id());
+ }
}
public function update()
{
- if($this->importart()) {
+ if ($this->importart() && $this->user->canedit()) {
$this->art->hydrate($_POST);
- }
+ $this->art->updateedited();
+ $this->artmanager->update($this->art);
- // $this->art->updatelinkfrom();
- // $this->art->autotaglistcalc($this->artmanager->taglist($this->artmanager->getlister(['id', 'title', 'tag']), $this->art->autotaglist()));
- $this->artmanager->update($this->art);
+ }
$this->redirect('?id=' . $this->art->id() . '&aff=edit');
-
+
}
}