コード例 #1
0
ファイル: Page.php プロジェクト: innomatic/innomedia
 public function updateContent()
 {
     if ($this->id == 0) {
         return false;
     }
     $pagesParamsQuery = $this->domainDa->execute("SELECT params\n            FROM innomedia_pages\n            WHERE id = {$this->id}");
     $params = \Innomedia\Locale\LocaleWebApp::getParamsDecodedByLocalesForUpdate(null, $pagesParamsQuery->getFields('params'), $this->parameters, 'backend');
     // Update the page database row.
     $updated = $this->domainDa->execute("UPDATE innomedia_pages\n            SET\n            name        =" . $this->domainDa->formatText($this->name) . ",\n            params      =" . $this->domainDa->formatText(json_encode($params)) . ",\n            blocks      =" . $this->domainDa->formatText(json_encode($this->instanceBlocks)) . "\n            WHERE id={$this->id}");
     if (!$updated) {
         return false;
     }
     // Set the page name for the page tree path.
     $pageName = isset($this->parameters['slug']) ? $this->parameters['slug'] : '';
     // Fallback to page title if the page slug is empty.
     if (!strlen($pageName)) {
         $pageName = isset($this->parameters['title']) ? $this->parameters['title'] : '';
     }
     // Fallback to internal page name if the page title is empty.
     if (!strlen($pageName)) {
         $pageName = $this->name;
     }
     // Fallback to page id if the page name is still empty.
     if (!strlen($pageName)) {
         $pageName = $id;
     }
     // Rename the page tree path if needed.
     $tree = new PageTree();
     $tree->renamePage($this->id, $pageName);
 }