Article';
//echo $id;
$this->art = new Art2(['id' => $id]);
}
public function importart()
{
if($this->artmanager->exist($this->art->id())) {
$this->art = $this->artmanager->get($this->art);
//var_dump($this->art);
$this->art->autotaglistupdate($this->artmanager->taglist($this->artmanager->getlister(['id', 'title', 'description', 'tag']), $this->art->autotaglist()));
return true;
} else {
echo '
Article does not exist yet.
';
return false;
}
}
public function read()
{
if($this->importart()) {
if($this->user->level() >= $this->art->secure()) {
$datas = $this->art->templaterender(['id', 'title', 'description', 'javascript', 'html', 'header', 'nav', 'aside', 'section', 'footer']);
echo $this->templates->render('reader', $datas);
} else {
echo 'Not enought right to see the article
';
}
}
}
public function edit()
{
echo 'Edit
';
if($this->importart()) {
// vue edit art
}
}
public function add()
{
echo 'Add
';
$this->art->reset();
$this->artmanager->add($this->art);
}
public function delete()
{
echo 'Delete
';
$this->artmanager->delete($this->art);
}
public function update($id, $redir= "home")
{
echo 'Update
';
$this->art = new Art2($_POST);
$this->art->updatelinkfrom();
$this->art->autotaglistcalc($this->artmanager->taglist($this->artmanagergetlister(['id', 'title', 'tag']), $this->art->autotaglist()));
$this->artmanager->update($this->art);
}
}
?>