Esempio n. 1
8
 public function save(\Models\PageModel $page)
 {
     $query = "INSERT INTO page (label, title, body, slug) VALUES (?, ?, ?, ?)";
     $param = [$page->getLabel(), $page->getTitle(), $page->getBody(), $page->getSlug()];
     $this->db->query($query, $param);
     return $this->db->row();
 }
Esempio n. 2
-4
 /**
  * @param Edit $page
  * Edit page -> using Binding model
  */
 public function edit(Edit $page)
 {
     $this->headerIndex();
     $this->headerData();
     $slug = array_pop($_GET);
     $slug = explode('/', trim($slug, '/'));
     $slug = array_pop($slug);
     $content = Page::createInstance()->selectOneContent($slug);
     $id = $content->getId();
     $pages = Page::createInstance()->selectById($id);
     $this->view->title = $pages->getTitle();
     $this->view->label = $pages->getLabel();
     $this->view->slug = $pages->getSlug();
     $this->view->body = $pages->getBody();
     $this->view->id = $pages->getId();
     $label = $page->getLabel();
     $title = $page->getTitle();
     $body = $page->getBody();
     $slug = $page->getSlug();
     $id = $page->getId();
     if ($label && $title && $body && $slug && $id) {
         $updatePage = new PageModel($label, $title, $body, $slug, $id);
         $updatePage->update();
         $this->redirectAdminControllers('home', 'log');
     }
     $this->view->showView();
     $this->view->part('footer');
 }