public function display() { $owebsites = new OnpubWebsites($this->pdo); $osections = new OnpubSections($this->pdo); $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "name"; $queryOptions->order = "ASC"; try { $websites = $owebsites->select($queryOptions); } catch (PDOException $e) { throw $e; } $widget = new OnpubWidgetHeader("New Section", ONPUBAPI_SCHEMA_VERSION, $this->pdo); $widget->display(); en('<form id="onpub-form" action="index.php" method="post" enctype="multipart/form-data">'); en('<div>'); if ($this->osection->name === NULL) { en('<h3 class="onpub-field-header">Name</h3><p><input type="text" maxlength="255" size="' . 30 . '" name="name" value="' . htmlentities($this->osection->name) . '"> <img src="' . ONPUBGUI_IMAGE_DIRECTORY . 'exclamation.png" align="top" alt="Required field" title="Required field"></p>'); } else { en('<h3 class="onpub-field-header">Name</h3><p><input type="text" maxlength="255" size="' . 30 . '" name="name" value="' . htmlentities($this->osection->name) . '"></p>'); } if ($this->osection->parentID) { $sectionIDs = array(); $sectionIDs[] = $this->osection->parentID; } else { $sectionIDs = NULL; } $widget = new OnpubWidgetSections(); $widget->sectionIDs = $sectionIDs; $widget->websites = $websites; $widget->osections = $osections; $widget->heading = "Parent Section"; $widget->multiple = FALSE; $widget->fieldName = "sectionID"; $widget->parentID = $this->osection->parentID; $widget->display(); $widget = new OnpubWidgetWebsites($this->osection->websiteID, $websites, "section"); $widget->display(); if (sizeof($websites)) { if ($this->visible) { en('<h3 class="onpub-field-header">Visibility</h3>'); en('<p><input type="checkbox" id="id_visible" name="visible" value="1" checked="checked"> <label for="id_visible">De-select to hide this section from the Frontend.</label></p>'); } else { en('<h3 class="onpub-field-header">Visibility</h3>'); en('<p><input type="checkbox" id="id_visible" name="visible" value="1"> <label for="id_visible">Select to show this section on the Frontend.</label></p>'); } } en('<input type="submit" value="Save">'); en('<input type="hidden" name="onpub" value="NewSectionProcess">'); en('</div>'); en('</form>'); $widget = new OnpubWidgetFooter(); $widget->display(); }
public function display() { $oarticles = new OnpubArticles($this->pdo); $osections = new OnpubSections($this->pdo); $owebsites = new OnpubWebsites($this->pdo); $articles = array(); $websites = array(); try { if (is_array($this->articleIDs)) { $queryOptions = new OnpubQueryOptions(); $queryOptions->includeContent = FALSE; for ($i = 0; $i < sizeof($this->articleIDs); $i++) { $articles[] = $oarticles->get($this->articleIDs[$i], $queryOptions); } } $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "name"; $queryOptions->order = "ASC"; $websites = $owebsites->select($queryOptions); } catch (PDOException $e) { throw $e; } $widget = new OnpubWidgetHeader("Move Articles", ONPUBAPI_SCHEMA_VERSION, $this->pdo); $widget->display(); en('<form id="onpub-form" action="index.php" method="post">'); en('<div>'); if (sizeof($articles)) { en('<h3>Selected Articles</h3>'); en('<ul>'); for ($i = 0; $i < sizeof($articles); $i++) { en('<li><a href="index.php?onpub=EditArticle&articleID=' . $articles[$i]->ID . '" title="Edit">' . $articles[$i]->title . '</a></li>'); en('<input type="hidden" name="articleIDs[]" value="' . $articles[$i]->ID . '">'); } en('</ul>'); $widget = new OnpubWidgetSections(); $widget->websites = $websites; $widget->osections = $osections; $widget->display(); en('<input type="submit" value="Move">'); } else { en('<span class="onpub-error">No articles were selected to move.</span>'); } en('<input type="hidden" name="onpub" value="ArticleMoveProcess">'); en('</div>'); en('</form>'); $widget = new OnpubWidgetFooter(); $widget->display(); }
public function display() { $oarticles = new OnpubArticles($this->pdo); $owebsites = new OnpubWebsites($this->pdo); $osections = new OnpubSections($this->pdo); $counter = 0; $currentPage = 1; try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "name"; $queryOptions->order = "ASC"; $websites = $owebsites->select($queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } if ($this->page) { $currentPage = $this->page; } if ($this->orderBy && $this->order) { if ($this->keywords) { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->includeContent = FALSE; $queryOptions->fullTextSearch = $this->fullTextSearch; $queryOptions->orderBy = $this->orderBy; $queryOptions->order = $this->order; $articles = $oarticles->search($this->keywords, $queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } $totalArticles = sizeof($articles); } else { if ($this->sectionID) { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->includeContent = FALSE; $queryOptions->orderBy = $this->orderBy; $queryOptions->order = $this->order; $queryOptions->setPage($currentPage, ONPUBGUI_PDO_ROW_LIMIT); $articles = $oarticles->select($queryOptions, $this->sectionID); $totalArticles = $oarticles->count($this->sectionID); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } } else { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->includeContent = FALSE; $queryOptions->orderBy = $this->orderBy; $queryOptions->order = $this->order; $queryOptions->setPage($currentPage, ONPUBGUI_PDO_ROW_LIMIT); $articles = $oarticles->select($queryOptions); $totalArticles = $oarticles->count(); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } } } } else { if ($this->keywords) { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->includeContent = FALSE; $queryOptions->fullTextSearch = $this->fullTextSearch; $queryOptions->orderBy = "created"; $queryOptions->order = "DESC"; $articles = $oarticles->search($this->keywords, $queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } $totalArticles = sizeof($articles); } else { if ($this->sectionID) { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->includeContent = FALSE; $queryOptions->orderBy = "created"; $queryOptions->order = "DESC"; $queryOptions->setPage($currentPage, ONPUBGUI_PDO_ROW_LIMIT); $articles = $oarticles->select($queryOptions, $this->sectionID); $totalArticles = $oarticles->count($this->sectionID); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } } else { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->includeContent = FALSE; $queryOptions->orderBy = "created"; $queryOptions->order = "DESC"; $queryOptions->setPage($currentPage, ONPUBGUI_PDO_ROW_LIMIT); $articles = $oarticles->select($queryOptions); $totalArticles = $oarticles->count(); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } } } } $widget = new OnpubWidgetHeader("Articles", ONPUBAPI_SCHEMA_VERSION, $this->pdo); $widget->display(); en('<form id="onpub-form" action="index.php" method="get">'); en('<div>'); en('<input type="hidden" name="onpub" value="EditArticles">'); if ($totalArticles) { if (!$this->keywords) { $widget = new OnpubWidgetSections(); $widget->websites = $websites; $widget->osections = $osections; $widget->heading = "Display articles in.."; $widget->fieldName = "sectionID"; $widget->multiple = false; $widget->defaultOptionText = "All Sections"; if ($this->sectionID) { $widget->sectionIDs = array($this->sectionID); } $widget->display(); } $widget = new OnpubWidgetPaginator($totalArticles, $this->orderBy, $this->order, $this->page, $this->keywords, $this->fullTextSearch, "sectionID", $this->sectionID, "EditArticles"); $widget->display(); en('<table>'); en('<tr>'); en('<td></td>'); if ($this->keywords) { $this->keywords = urlencode($this->keywords); if ($this->fullTextSearch) { switch ($this->orderBy) { case "ID": switch ($this->order) { case "ASC": en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=created&order=DESC">Created</a></span></td>'); break; case "DESC": en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=ID&order=ASC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; case "title": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=title&order=DESC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=created&order=DESC">Created</a></span></td>'); break; case "DESC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; default: switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=created&order=DESC">Created</a></span></td>'); break; case "DESC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=created&order=ASC">Created</a></span></td>'); break; default: en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=created&order=ASC">Created</a></span></td>'); break; } break; } } else { switch ($this->orderBy) { case "ID": switch ($this->order) { case "ASC": en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=created&order=DESC">Created</a></span></td>'); break; case "DESC": en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=ID&order=ASC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; case "title": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=title&order=DESC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=created&order=DESC">Created</a></span></td>'); break; case "DESC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; default: switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=created&order=DESC">Created</a></span></td>'); break; case "DESC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=created&order=ASC">Created</a></span></td>'); break; default: en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&keywords=' . $this->keywords . '&orderBy=created&order=ASC">Created</a></span></td>'); break; } break; } } $this->keywords = urldecode($this->keywords); } else { if ($this->sectionID) { switch ($this->orderBy) { case "ID": switch ($this->order) { case "ASC": en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC§ionID=' . $this->sectionID . '">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC§ionID=' . $this->sectionID . '">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=DESC§ionID=' . $this->sectionID . '">Created</a></span></td>'); break; case "DESC": en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=ASC§ionID=' . $this->sectionID . '">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC§ionID=' . $this->sectionID . '">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=DESC§ionID=' . $this->sectionID . '">Created</a></span></td>'); break; } break; case "title": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC§ionID=' . $this->sectionID . '">ID</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=DESC§ionID=' . $this->sectionID . '">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=DESC§ionID=' . $this->sectionID . '">Created</a></span></td>'); break; case "DESC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC§ionID=' . $this->sectionID . '">ID</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC§ionID=' . $this->sectionID . '">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=DESC§ionID=' . $this->sectionID . '">Created</a></span></td>'); break; } break; default: switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC§ionID=' . $this->sectionID . '">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC§ionID=' . $this->sectionID . '">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=DESC§ionID=' . $this->sectionID . '">Created</a></span></td>'); break; case "DESC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC§ionID=' . $this->sectionID . '">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC§ionID=' . $this->sectionID . '">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=ASC§ionID=' . $this->sectionID . '">Created</a></span></td>'); break; default: en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC§ionID=' . $this->sectionID . '">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC§ionID=' . $this->sectionID . '">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=ASC§ionID=' . $this->sectionID . '">Created</a></span></td>'); break; } break; } } else { switch ($this->orderBy) { case "ID": switch ($this->order) { case "ASC": en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=DESC">Created</a></span></td>'); break; case "DESC": en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=ASC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; case "title": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=DESC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=DESC">Created</a></span></td>'); break; case "DESC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; default: switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=DESC">Created</a></span></td>'); break; case "DESC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=ASC">Created</a></span></td>'); break; default: en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=title&order=ASC">Title</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&orderBy=created&order=ASC">Created</a></span></td>'); break; } break; } } } en('</tr>'); if ($this->keywords) { $index = ($currentPage - 1) * ONPUBGUI_PDO_ROW_LIMIT; } else { $index = 0; } for ($i = 0; $i < ONPUBGUI_PDO_ROW_LIMIT && $index < sizeof($articles); $i++) { $articleID = $articles[$index]->ID; $title = $articles[$index]->title; $created = $articles[$index]->getCreated()->format("M j, Y"); en('<tr valign="top">'); en('<td align="right"><input type="checkbox" id="articleIDs" value="' . $articleID . '"></td>'); switch ($this->order) { case "ASC": switch ($counter) { case 0: en('<td class="onpub-highlight1" align="right">' . $articleID . '</td>'); en('<td class="onpub-highlight1" align="left"><a href="index.php?onpub=EditArticle&articleID=' . $articleID . '" title="Edit">' . $title . '</a></td>'); en('<td class="onpub-highlight1" align="left">' . $created . '</td>'); break; case 1: en('<td class="onpub-highlight2" align="right">' . $articleID . '</td>'); en('<td class="onpub-highlight2" align="left"><a href="index.php?onpub=EditArticle&articleID=' . $articleID . '" title="Edit">' . $title . '</a></td>'); en('<td class="onpub-highlight2" align="left">' . $created . '</td>'); break; } break; case "DESC": switch ($counter) { case 0: en('<td class="onpub-highlight1" align="right">' . $articleID . '</td>'); en('<td class="onpub-highlight1" align="left"><a href="index.php?onpub=EditArticle&articleID=' . $articleID . '" title="Edit">' . $title . '</a></td>'); en('<td class="onpub-highlight1" align="left">' . $created . '</td>'); break; case 1: en('<td class="onpub-highlight2" align="right">' . $articleID . '</td>'); en('<td class="onpub-highlight2" align="left"><a href="index.php?onpub=EditArticle&articleID=' . $articleID . '" title="Edit">' . $title . '</a></td>'); en('<td class="onpub-highlight2" align="left">' . $created . '</td>'); break; } break; default: switch ($counter) { case 0: en('<td class="onpub-highlight1" align="right">' . $articleID . '</td>'); en('<td class="onpub-highlight1" align="left"><a href="index.php?onpub=EditArticle&articleID=' . $articleID . '" title="Edit">' . $title . '</a></td>'); en('<td class="onpub-highlight1" align="left">' . $created . '</td>'); break; case 1: en('<td class="onpub-highlight2" align="right">' . $articleID . '</td>'); en('<td class="onpub-highlight2" align="left"><a href="index.php?onpub=EditArticle&articleID=' . $articleID . '" title="Edit">' . $title . '</a></td>'); en('<td class="onpub-highlight2" align="left">' . $created . '</td>'); break; } break; } en('</tr>'); if ($counter + 1 == 2) { $counter = 0; } else { $counter++; } $index++; } en('</table>'); } else { if ($this->keywords) { en('<p>Your search did not yield any results. <a href="index.php?onpub=EditArticles">Display all articles</a>.</p>'); } else { if ($this->sectionID) { $widget = new OnpubWidgetSections(); $widget->websites = $websites; $widget->osections = $osections; $widget->heading = "Display articles in.."; $widget->fieldName = "sectionID"; $widget->multiple = false; $widget->defaultOptionText = "All Sections"; if ($this->sectionID) { $widget->sectionIDs = array($this->sectionID); } $widget->display(); en('<p>There are 0 articles in the selected section. <a href="index.php?onpub=EditArticles&sectionID=">Display all articles</a>.</p>'); } else { en('<p>There are 0 articles in the database. <a href="index.php?onpub=NewArticle">New Article</a>.</p>'); } } } if ($totalArticles) { en('<p>'); en('<select id="actions">'); en('<option value="EditArticles">Select an action..</option>'); en('<option value="DeleteArticle">Delete selected articles</option>'); en('<option value="ArticleMove">Move selected articles</option>'); en('</select>'); en('</p>'); $widget = new OnpubWidgetStats($totalArticles, $this->keywords, $this->sectionID, "Article", "Section"); $widget->display(); } en('</div>'); en('</form>'); $widget = new OnpubWidgetFooter(); $widget->display(); }
public function display() { $owebsites = new OnpubWebsites($this->pdo); $osections = new OnpubSections($this->pdo); $oimages = new OnpubImages($this->pdo); try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "name"; $queryOptions->order = "ASC"; $websites = $owebsites->select($queryOptions); $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "fileName"; $queryOptions->order = "ASC"; $images = $oimages->select($queryOptions); } catch (PDOException $e) { throw $e; } $widget = new OnpubWidgetHeader("New Article", ONPUBAPI_SCHEMA_VERSION, $this->pdo); $widget->display(); en('<form id="onpub-form" action="index.php" method="post">'); en('<div>'); en('<div class="yui3-g">'); en('<div class="yui3-u-1-2">'); if ($this->oarticle->title === NULL) { en('<p><span class="onpub-field-header">Title</span> <input type="text" maxlength="255" size="40" name="title" value=""> <img src="' . ONPUBGUI_IMAGE_DIRECTORY . 'exclamation.png" align="top" alt="Required field" title="Required field"></p>'); } else { en('<p><span class="onpub-field-header">Title</span> <input type="text" maxlength="255" size="40" name="title" value="' . htmlentities($this->oarticle->title) . '"></p>'); } en('</div>'); en('<div class="yui3-u-1-2">'); en('<p><span class="onpub-field-header">Author</span> <input type="text" maxlength="255" size="40" name="displayAs" value="' . htmlentities($this->oauthor->displayAs) . '"></p>'); en('</div>'); en('</div>'); en('<p><textarea rows="25" name="content" style="width: 100%;">' . htmlentities($this->oarticle->content) . '</textarea></p>'); ?> <script type="text/javascript"> if (CKEDITOR) { CKEDITOR.replace('content', { 'height': 350, 'uiColor': '#eff0f0', 'resize_dir': 'vertical', 'dataIndentationChars': ' ', 'allowedContent': true, <?php if (file_exists(ONPUBGUI_YUI_DIRECTORY)) { en("'contentsCss': [onpub_dir_yui + 'cssnormalize/cssnormalize-min.css', onpub_dir_yui + 'cssfonts/cssfonts-min.css', onpub_dir_yui + 'cssgrids/cssgrids-min.css', '" . ONPUBGUI_CKEDITOR_DIRECTORY . "contents.css', 'css/ckeditor.css']"); } else { en("'contentsCss': ['http://yui.yahooapis.com/" . ONPUBGUI_YUI_VERSION . "/build/cssnormalize/cssnormalize-min.css', 'http://yui.yahooapis.com/" . ONPUBGUI_YUI_VERSION . "/build/cssfonts/cssfonts-min.css', 'http://yui.yahooapis.com/" . ONPUBGUI_YUI_VERSION . "/build/cssgrids/cssgrids-min.css', 'ckeditor/contents.css', 'css/ckeditor.css']"); } ?> }); } </script> <?php $widget = new OnpubWidgetDateCreated($this->oarticle->getCreated()); $widget->display(); en('<div class="yui3-g">'); en('<div class="yui3-u-1-2">'); $widget = new OnpubWidgetSections(); $widget->sectionIDs = $this->oarticle->sectionIDs; $widget->websites = $websites; $widget->osections = $osections; $widget->display(); en('</div>'); en('<div class="yui3-u-1-2">'); $widget = new OnpubWidgetImages("Image", $this->oarticle->imageID, $images); $widget->display(); en('</div>'); en('</div>'); en('<input type="submit" value="Save">'); en('<input type="hidden" name="onpub" value="NewArticleProcess">'); en('</div>'); en('</form>'); $widget = new OnpubWidgetFooter(); $widget->display(); }
public function display() { $osections = new OnpubSections($this->pdo); $owebsites = new OnpubWebsites($this->pdo); $oarticles = new OnpubArticles($this->pdo); $oimages = new OnpubImages($this->pdo); $owsmaps = new OnpubWSMaps($this->pdo); $queryOptions = new OnpubQueryOptions(); $queryOptions->includeArticles = TRUE; $queryOptions->includeContent = FALSE; try { $this->osection = $osections->get($this->osection->ID, $queryOptions); $website = $owebsites->get($this->osection->websiteID); $numOfArticles = $oarticles->count(); $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "fileName"; $queryOptions->order = "ASC"; $images = $oimages->select($queryOptions); $wsmap = new OnpubWSMap(); $wsmap->websiteID = $this->osection->websiteID; $wsmap->sectionID = $this->osection->ID; $this->visible = $owsmaps->getID($wsmap); $wsmaps = $owsmaps->select(NULL, NULL, $this->osection->ID); $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "name"; $queryOptions->order = "ASC"; if (sizeof($wsmaps)) { $websites = $owebsites->select($queryOptions); } else { $websites = array(); } } catch (PDOException $e) { throw $e; } $widget = new OnpubWidgetHeader("Section " . $this->osection->ID . " - " . $this->osection->name, ONPUBAPI_SCHEMA_VERSION, $this->pdo); $widget->display(); en('<form id="onpub-form" action="index.php" method="post">'); en('<div>'); en('<div class="yui3-g">'); en('<div class="yui3-u-1-2">'); if ($this->osection->name === NULL) { en('<h3 class="onpub-field-header">Name</h3><p><input type="text" maxlength="255" size="40" name="name" value=""> <img src="' . ONPUBGUI_IMAGE_DIRECTORY . 'exclamation.png" align="top" alt="Required field" title="Required field"></p>'); } else { en('<h3 class="onpub-field-header">Name</h3><p><input type="text" maxlength="255" size="40" name="name" value="' . htmlentities($this->osection->name) . '"></p>'); } en('</div>'); en('<div class="yui3-u-1-2">'); if ($this->visible !== NULL) { en('<h3 class="onpub-field-header">Visibility</h3>'); en('<p><input type="checkbox" id="id_visible" name="visible" value="1" checked="checked"> <label for="id_visible">De-select to hide this section from the Frontend.</label></p>'); } else { en('<h3 class="onpub-field-header">Visibility</h3>'); en('<p><input type="checkbox" id="id_visible" name="visible" value="1"> <label for="id_visible">Select to show this section on the Frontend.</label></p>'); } en('</div>'); en('</div>'); en('<div class="yui3-g">'); en('<div class="yui3-u-1-2">'); if ($this->osection->parentID) { $sectionIDs = array($this->osection->parentID); } else { $sectionIDs = array(); } $widget = new OnpubWidgetSections(); $widget->sectionIDs = $sectionIDs; $widget->websites = array($website); $widget->osections = $osections; $widget->heading = "Parent Section"; $widget->multiple = FALSE; $widget->fieldName = "parentID"; $widget->osection = $this->osection; $widget->display(); en('</div>'); en('<div class="yui3-u-1-2">'); en('<h3 class="onpub-field-header">Website</h3><p><a href="index.php?onpub=EditWebsite&websiteID=' . $website->ID . '" title="Edit">' . $website->name . '</a></p>'); en('</div>'); en('</div>'); en('<div class="yui3-g">'); en('<div class="yui3-u-1-2">'); if ($numOfArticles) { $widget = new OnpubWidgetArticles($this->pdo, $this->osection); $widget->display(); } else { en('<h3 class="onpub-field-header">Visible Articles</h3><p>'); en('There are 0 articles in the database. <a href="index.php?onpub=NewArticle">New Article</a>.</p>'); } en('</div>'); en('<div class="yui3-u-1-2">'); $widget = new OnpubWidgetImages("Image", $this->osection->imageID, $images); $widget->display(); en('</div>'); en('</div>'); if ($this->osection->url) { $go = ' <a href="' . $this->osection->url . '" target="_blank"><img src="' . ONPUBGUI_IMAGE_DIRECTORY . 'world_go.png" border="0" align="top" alt="Go" title="Go" width="16" height="16"></a>'; } else { $go = ''; } en('<div class="yui3-g">'); en('<div class="yui3-u-1-2">'); en('<h3 class="onpub-field-header">Static Link</h3><p><small>The Frontend will link this section to the path or URL entered below.<br>Leave blank to use auto-generated Frontend URLs.</small><br><input type="text" maxlength="255" size="40" name="url" value="' . htmlentities($this->osection->url) . '">' . $go . '</p>'); en('</div>'); en('<div class="yui3-u-1-2">'); if (sizeof($wsmaps)) { $websitesMap = array(); foreach ($websites as $website) { $websitesMap["{$website->ID}"] = $website; } $urlLabel = sizeof($wsmaps) > 1 ? 'URLs' : 'URL'; en('<h3 class="onpub-field-header">Frontend ' . $urlLabel . '</h3>'); en('<p>'); en('<small>This section is displayed by the Frontend at the ' . $urlLabel . ' listed below.</small><br>'); for ($i = 0; $i < sizeof($wsmaps); $i++) { $wsmap = $wsmaps[$i]; $website = $websitesMap["{$wsmap->websiteID}"]; $frontendURL = addTrailingSlash($website->url) . 'index.php?s=' . $wsmap->sectionID; en('• <a href="' . $frontendURL . '" target="_blank">' . $frontendURL . '</a>'); if ($i + 1 != sizeof($wsmaps)) { en('<br>'); } } en('</p>'); } en('</div>'); en('</div>'); en('<div class="yui3-g">'); en('<div class="yui3-u-1-2">'); en('<h3 class="onpub-field-header">Created</h3><p>' . $this->osection->getCreated()->format('M j, Y g:i:s A') . '</p>'); en('</div>'); en('<div class="yui3-u-1-2">'); en('<h3 class="onpub-field-header">Modified</h3><p>' . $this->osection->getModified()->format('M j, Y g:i:s A') . '</p>'); en('</div>'); en('</div>'); en('<input type="submit" value="Save" id="selectAll"> <input type="button" value="Delete" id="deleteSection">'); en('<input type="hidden" name="onpub" value="EditSectionProcess">'); en('<input type="hidden" name="sectionID" value="' . $this->osection->ID . '">'); en('<input type="hidden" name="websiteID" value="' . $this->osection->websiteID . '">'); en('</div>'); en('</form>'); $widget = new OnpubWidgetFooter(); $widget->display(); }
public function display() { $oarticles = new OnpubArticles($this->pdo); $owebsites = new OnpubWebsites($this->pdo); $osamaps = new OnpubSAMaps($this->pdo); $osections = new OnpubSections($this->pdo); $oimages = new OnpubImages($this->pdo); try { $queryOptions = new OnpubQueryOptions(); $queryOptions->includeAuthors = TRUE; $this->oarticle = $oarticles->get($this->oarticle->ID, $queryOptions); $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "fileName"; $queryOptions->order = "ASC"; $images = $oimages->select($queryOptions); $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "name"; $queryOptions->order = "ASC"; $websites = $owebsites->select($queryOptions); $queryOptions = new OnpubQueryOptions(); $samaps = $osamaps->select($queryOptions, NULL, $this->oarticle->ID); } catch (PDOException $e) { throw $e; } $author = $this->oarticle->authors; if (sizeof($author)) { $author = $author[0]; } else { $author = new OnpubAuthor(); } $widget = new OnpubWidgetHeader("Article " . $this->oarticle->ID . " - " . $this->oarticle->title, ONPUBAPI_SCHEMA_VERSION, $this->pdo); $widget->display(); en('<form id="onpub-form" action="index.php" method="post">'); en('<div>'); en('<p><textarea rows="25" name="content" style="width: 100%;">' . htmlentities($this->oarticle->content) . '</textarea></p>'); ?> <script type="text/javascript"> if (CKEDITOR) { CKEDITOR.replace('content', { 'height': 350, 'uiColor': '#eff0f0', 'resize_dir': 'vertical', 'dataIndentationChars': ' ', 'allowedContent': true, <?php if (file_exists(ONPUBGUI_YUI_DIRECTORY)) { en("'contentsCss': [onpub_dir_yui + 'cssnormalize/cssnormalize-min.css', onpub_dir_yui + 'cssfonts/cssfonts-min.css', onpub_dir_yui + 'cssgrids/cssgrids-min.css', '" . ONPUBGUI_CKEDITOR_DIRECTORY . "contents.css', 'css/ckeditor.css']"); } else { en("'contentsCss': ['http://yui.yahooapis.com/" . ONPUBGUI_YUI_VERSION . "/build/cssnormalize/cssnormalize-min.css', 'http://yui.yahooapis.com/" . ONPUBGUI_YUI_VERSION . "/build/cssfonts/cssfonts-min.css', 'http://yui.yahooapis.com/" . ONPUBGUI_YUI_VERSION . "/build/cssgrids/cssgrids-min.css', '" . ONPUBGUI_CKEDITOR_DIRECTORY . "contents.css', 'css/ckeditor.css']"); } ?> }); } </script> <?php en('<div class="yui3-g">'); en('<div class="yui3-u-1-2">'); en('<h3 class="onpub-field-header">Title</h3><p><input type="text" maxlength="255" size="40" name="title" value="' . htmlentities($this->oarticle->title) . '"></p>'); en('</div>'); en('<div class="yui3-u-1-2">'); en('<h3 class="onpub-field-header">Author</h3><p><input type="text" maxlength="255" size="40" name="displayAs" value="' . htmlentities($author->displayAs) . '"></p>'); en('</div>'); en('</div>'); en('<div class="yui3-g">'); en('<div class="yui3-u-1-2">'); $widget = new OnpubWidgetSections(); $widget->websites = $websites; $widget->osections = $osections; $widget->samaps = $samaps; $widget->display(); en('</div>'); en('<div class="yui3-u-1-2">'); $widget = new OnpubWidgetImages("Image", $this->oarticle->imageID, $images); $widget->display(); en('</div>'); en('</div>'); if ($this->oarticle->url) { $go = ' <a href="' . $this->oarticle->url . '" target="_blank"><img src="' . ONPUBGUI_IMAGE_DIRECTORY . 'world_go.png" border="0" align="top" alt="Go" title="Go" width="16" height="16"></a>'; } else { $go = ''; } en('<div class="yui3-g">'); en('<div class="yui3-u-1-2">'); en('<h3 class="onpub-field-header">Static Link</h3><p><small>The Frontend will link this article to the path or URL entered below.<br>Leave blank to use auto-generated Frontend URLs.</small><br><input type="text" maxlength="255" size="40" name="url" value="' . htmlentities($this->oarticle->url) . '">' . $go . '</p>'); en('</div>'); en('<div class="yui3-u-1-2">'); if (sizeof($samaps)) { $websitesMap = array(); foreach ($websites as $website) { $websitesMap["{$website->ID}"] = $website; } $sections = array(); $articleIDs = array(); foreach ($samaps as $samap) { $section = $osections->get($samap->sectionID); if ($section && isset($websitesMap["{$section->websiteID}"])) { $website = $websitesMap["{$section->websiteID}"]; if ($website->url) { $sections[] = $section; $articleIDs[] = $samap->articleID; } } } if (sizeof($sections)) { $urlLabel = sizeof($sections) > 1 ? 'URLs' : 'URL'; en('<h3 class="onpub-field-header">Frontend ' . $urlLabel . '</h3>'); en('<p>'); en('<small>This article is displayed by the Frontend at the ' . $urlLabel . ' listed below.</small><br>'); for ($i = 0; $i < sizeof($sections); $i++) { $section = $sections[$i]; $website = $websitesMap["{$section->websiteID}"]; $frontendURL = addTrailingSlash($website->url) . 'index.php?s=' . $section->ID . '&a=' . $articleIDs[$i]; en('• <a href="' . $frontendURL . '" target="_blank">' . $frontendURL . '</a>'); if ($i + 1 != sizeof($sections)) { en('<br>'); } } en('</p>'); } } en('</div>'); en('</div>'); $widget = new OnpubWidgetDateCreated($this->oarticle->getCreated()); $widget->display(); $modified = $this->oarticle->getModified(); en('<h3 class="onpub-field-header">Modified</h3><p>' . $modified->format('M j, Y g:i:s A') . '</p>'); en('<input type="submit" value="Save"> <input type="button" value="Delete" id="deleteArticle">'); en('<input type="hidden" name="articleID" id="articleID" value="' . $this->oarticle->ID . '">'); en('<input type="hidden" name="authorID" value="' . $author->ID . '">'); en('<input type="hidden" name="authorImageID" value="' . $author->imageID . '">'); en('<input type="hidden" name="lastDisplayAs" value="' . htmlentities($author->displayAs) . '">'); en('<input type="hidden" name="onpub" value="EditArticleProcess">'); en('</div>'); en('</form>'); $widget = new OnpubWidgetFooter(); $widget->display(); }