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() { $oimages = new OnpubImages($this->pdo); $owebsites = new OnpubWebsites($this->pdo); $this->fullTextSearch = "NA"; $counter = 0; $currentPage = 1; if ($this->page) { $currentPage = $this->page; } if ($this->orderBy && $this->order) { if ($this->keywords) { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = $this->orderBy; $queryOptions->order = $this->order; $images = $oimages->search($this->keywords, $queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } $totalImages = sizeof($images); } else { if ($this->sectionID) { } else { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = $this->orderBy; $queryOptions->order = $this->order; $queryOptions->setPage($currentPage, ONPUBGUI_PDO_ROW_LIMIT); $images = $oimages->select($queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } try { $totalImages = $oimages->count(); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } } } } else { if ($this->keywords) { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "created"; $queryOptions->order = "DESC"; $images = $oimages->search($this->keywords, $queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } $totalImages = sizeof($images); } else { if ($this->sectionID) { } else { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "created"; $queryOptions->order = "DESC"; $queryOptions->setPage($currentPage, ONPUBGUI_PDO_ROW_LIMIT); $images = $oimages->select($queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } try { $totalImages = $oimages->count(); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } } } } $widget = new OnpubWidgetHeader("Images", 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="EditImages">'); if ($totalImages) { $widget = new OnpubWidgetPaginator($totalImages, $this->orderBy, $this->order, $this->page, $this->keywords, $this->fullTextSearch, "sectionID", $this->sectionID, "EditImages"); $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=EditImages&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=EditImages&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; case "fileName": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=fileName&order=DESC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&keywords=' . $this->keywords . '&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; case "fileName": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&keywords=' . $this->keywords . '&orderBy=fileName&order=DESC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&keywords=' . $this->keywords . '&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&orderBy=fileName&order=ASC§ionID=' . $this->sectionID . '">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&orderBy=fileName&order=ASC§ionID=' . $this->sectionID . '">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&orderBy=created&order=DESC§ionID=' . $this->sectionID . '">Created</a></span></td>'); break; } break; case "fileName": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&orderBy=fileName&order=DESC§ionID=' . $this->sectionID . '">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&orderBy=fileName&order=ASC§ionID=' . $this->sectionID . '">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&orderBy=fileName&order=ASC§ionID=' . $this->sectionID . '">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&orderBy=fileName&order=ASC§ionID=' . $this->sectionID . '">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&orderBy=fileName&order=ASC§ionID=' . $this->sectionID . '">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&orderBy=ID&order=ASC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; case "fileName": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&orderBy=fileName&order=DESC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&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=EditImages&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&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=EditImages&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&orderBy=created&order=ASC">Created</a></span></td>'); break; default: en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&orderBy=fileName&order=ASC">File Name</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&orderBy=created&order=ASC">Created</a></span></td>'); break; } break; } } } en('<td><span class="onpub-field-header">Preview</span></td>'); en('</tr>'); if ($this->keywords || $this->sectionID) { $index = ($currentPage - 1) * ONPUBGUI_PDO_ROW_LIMIT; } else { $index = 0; } $websites = array(); for ($i = 0; $i < ONPUBGUI_PDO_ROW_LIMIT && $index < sizeof($images); $i++) { $image = $images[$index]; $websiteID = $images[$index]->websiteID; $ID = $images[$index]->ID; $fileName = $images[$index]->fileName; $created = $images[$index]->getCreated()->format("M j, Y"); if (!isset($websites[$websiteID])) { $websites[$websiteID] = $owebsites->get($websiteID); } $thumbURL = OnpubImages::getThumbURL('src=' . urlencode($image->getFullPath()) . '&w=50&f=png'); en('<tr valign="top">'); //en('<td align="right"><input type="checkbox" name="imageIDs[]" value="' . $ID . '"></td>'); switch ($this->order) { case "ASC": switch ($counter) { case 0: en('<td class="onpub-highlight1" align="right">' . $ID . '</td>'); en('<td class="onpub-highlight1" align="left"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit">' . $fileName . '</a></td>'); en('<td class="onpub-highlight1" align="left">' . $created . '</td>'); en('<td class="onpub-highlight1"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit"><img src="' . $thumbURL . '"></a></td>'); break; case 1: en('<td class="onpub-highlight2" align="right">' . $ID . '</td>'); en('<td class="onpub-highlight2" align="left"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit">' . $fileName . '</a></td>'); en('<td class="onpub-highlight2" align="left">' . $created . '</td>'); en('<td class="onpub-highlight2"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit"><img src="' . $thumbURL . '"></a></td>'); break; } break; case "DESC": switch ($counter) { case 0: en('<td class="onpub-highlight1" align="right">' . $ID . '</td>'); en('<td class="onpub-highlight1" align="left"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit">' . $fileName . '</a></td>'); en('<td class="onpub-highlight1" align="left">' . $created . '</td>'); en('<td class="onpub-highlight1"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit"><img src="' . $thumbURL . '"></a></td>'); break; case 1: en('<td class="onpub-highlight2" align="right">' . $ID . '</td>'); en('<td class="onpub-highlight2" align="left"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit">' . $fileName . '</a></td>'); en('<td class="onpub-highlight2" align="left">' . $created . '</td>'); en('<td class="onpub-highlight2"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit"><img src="' . $thumbURL . '"></a></td>'); break; } break; default: switch ($counter) { case 0: en('<td class="onpub-highlight1" align="right">' . $ID . '</td>'); en('<td class="onpub-highlight1" align="left"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit">' . $fileName . '</a></td>'); en('<td class="onpub-highlight1" align="left">' . $created . '</td>'); en('<td class="onpub-highlight1"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit"><img src="' . $thumbURL . '"></a></td>'); break; case 1: en('<td class="onpub-highlight2" align="right">' . $ID . '</td>'); en('<td class="onpub-highlight2" align="left"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit">' . $fileName . '</a></td>'); en('<td class="onpub-highlight2" align="left">' . $created . '</td>'); en('<td class="onpub-highlight2"><a href="index.php?onpub=EditImage&imageID=' . $ID . '" title="Edit"><img src="' . $thumbURL . '"></a></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="javascript:clearSearchField(); submitForm();">Display all images</a>.</p>'); } else { if ($this->sectionID) { } else { en('<p>There are 0 images on file. <a href="index.php?onpub=UploadImages">Upload Images</a>.</p>'); } } } if ($totalImages) { $widget = new OnpubWidgetStats($totalImages, $this->keywords, $this->sectionID, "Image", ""); $widget->display(); } en('</div>'); en('</form>'); $widget = new OnpubWidgetFooter(); $widget->display(); }
public function display() { $osections = new OnpubSections($this->pdo); $owebsites = new OnpubWebsites($this->pdo); $this->fullTextSearch = "NA"; $counter = 0; $currentPage = 1; if ($this->page) { $currentPage = $this->page; } if ($this->orderBy && $this->order) { if ($this->keywords) { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = $this->orderBy; $queryOptions->order = $this->order; $sections = $osections->search($this->keywords, $queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } $totalSections = sizeof($sections); } else { if ($this->websiteID) { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = $this->orderBy; $queryOptions->order = $this->order; $sections = $osections->select($queryOptions, $this->websiteID); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } $totalSections = sizeof($sections); } else { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = $this->orderBy; $queryOptions->order = $this->order; $queryOptions->setPage($currentPage, ONPUBGUI_PDO_ROW_LIMIT); $sections = $osections->select($queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } try { $totalSections = $osections->count(); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } } } } else { if ($this->keywords) { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "created"; $queryOptions->order = "DESC"; $sections = $osections->search($this->keywords, $queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } $totalSections = sizeof($sections); } else { if ($this->websiteID) { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "created"; $queryOptions->order = "DESC"; $sections = $osections->select($queryOptions, $this->websiteID); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } $totalSections = sizeof($sections); } else { try { $queryOptions = new OnpubQueryOptions(); $queryOptions->orderBy = "created"; $queryOptions->order = "DESC"; $queryOptions->setPage($currentPage, ONPUBGUI_PDO_ROW_LIMIT); $sections = $osections->select($queryOptions); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } try { $totalSections = $osections->count(); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); return; } } } } $widget = new OnpubWidgetHeader("Sections", ONPUBAPI_SCHEMA_VERSION, $this->pdo); $widget->display(); en('<form id="onpub-form" action="index.php" method="get">'); en('<div>'); if ($totalSections) { if (!$this->keywords) { $widget = new OnpubWidgetSelectWebsite($this->pdo, $this->websiteID); $widget->display(); } $widget = new OnpubWidgetPaginator($totalSections, $this->orderBy, $this->order, $this->page, $this->keywords, $this->fullTextSearch, "websiteID", $this->websiteID, "EditSections"); $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=EditSections&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=EditSections&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; case "name": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=name&order=DESC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&fullTextSearch=' . $this->fullTextSearch . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&keywords=' . $this->keywords . '&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; case "name": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&keywords=' . $this->keywords . '&orderBy=name&order=DESC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&keywords=' . $this->keywords . '&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&keywords=' . $this->keywords . '&orderBy=created&order=ASC">Created</a></span></td>'); break; } break; } } $this->keywords = urldecode($this->keywords); } else { if ($this->websiteID) { 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=EditSections&orderBy=ID&order=DESC&websiteID=' . $this->websiteID . '">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC&websiteID=' . $this->websiteID . '">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=created&order=DESC&websiteID=' . $this->websiteID . '">Created</a></span></td>'); break; case "DESC": en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=ID&order=ASC&websiteID=' . $this->websiteID . '">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC&websiteID=' . $this->websiteID . '">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=created&order=DESC&websiteID=' . $this->websiteID . '">Created</a></span></td>'); break; } break; case "name": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=ID&order=DESC&websiteID=' . $this->websiteID . '">ID</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=DESC&websiteID=' . $this->websiteID . '">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=created&order=DESC&websiteID=' . $this->websiteID . '">Created</a></span></td>'); break; case "DESC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=ID&order=DESC&websiteID=' . $this->websiteID . '">ID</a></span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC&websiteID=' . $this->websiteID . '">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=created&order=DESC&websiteID=' . $this->websiteID . '">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=EditSections&orderBy=ID&order=DESC&websiteID=' . $this->websiteID . '">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC&websiteID=' . $this->websiteID . '">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=created&order=DESC&websiteID=' . $this->websiteID . '">Created</a></span></td>'); break; case "DESC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=ID&order=DESC&websiteID=' . $this->websiteID . '">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC&websiteID=' . $this->websiteID . '">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=created&order=ASC&websiteID=' . $this->websiteID . '">Created</a></span></td>'); break; default: en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=ID&order=DESC&websiteID=' . $this->websiteID . '">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC&websiteID=' . $this->websiteID . '">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=created&order=ASC&websiteID=' . $this->websiteID . '">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=EditSections&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&orderBy=ID&order=ASC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=created&order=DESC">Created</a></span></td>'); break; } break; case "name": switch ($this->order) { case "ASC": en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&orderBy=name&order=DESC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&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=EditSections&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&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=EditSections&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=created&order=ASC">Created</a></span></td>'); break; default: en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=ID&order=DESC">ID</a></span></td>'); en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=name&order=ASC">Name</a></span></td>'); en('<td align="left"><span class="onpub-field-header">Website</span></td>'); en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&orderBy=created&order=ASC">Created</a></span></td>'); break; } break; } } } en('</tr>'); if ($this->keywords || $this->websiteID) { $index = ($currentPage - 1) * ONPUBGUI_PDO_ROW_LIMIT; } else { $index = 0; } for ($i = 0; $i < ONPUBGUI_PDO_ROW_LIMIT && $index < sizeof($sections); $i++) { $section = $sections[$index]; $this->ID = $sections[$index]->ID; $name = $sections[$index]->name; $created = $sections[$index]->getCreated()->format("M j, Y"); $website = $owebsites->get($sections[$index]->websiteID); $websiteName = $website->name; if ($section->parentID) { $names = array(); $names[] = $name; $name = ""; while ($section->parentID) { $section = $section->parent; $names[] = $section->name; } $names = array_reverse($names); for ($j = 0; $j < sizeof($names); $j++) { if ($j == 0) { $name .= $names[$j]; } else { $name .= ' – ' . $names[$j]; } } } en('<tr valign="top">'); //en('<td align="right"><input type="checkbox" name="sectionIDs[]" value="' . $this->ID . '"></td>'); switch ($this->order) { case "ASC": switch ($counter) { case 0: en('<td class="onpub-highlight1" align="right">' . $this->ID . '</td>'); en('<td class="onpub-highlight1" align="left"><a href="index.php?onpub=EditSection&sectionID=' . $this->ID . '" title="Edit">' . $name . '</a></td>'); en('<td class="onpub-highlight1" align="left">' . $websiteName . '</td>'); en('<td class="onpub-highlight1" align="left">' . $created . '</td>'); break; case 1: en('<td class="onpub-highlight2" align="right">' . $this->ID . '</td>'); en('<td class="onpub-highlight2" align="left"><a href="index.php?onpub=EditSection&sectionID=' . $this->ID . '" title="Edit">' . $name . '</a></td>'); en('<td class="onpub-highlight2" align="left">' . $websiteName . '</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">' . $this->ID . '</td>'); en('<td class="onpub-highlight1" align="left"><a href="index.php?onpub=EditSection&sectionID=' . $this->ID . '" title="Edit">' . $name . '</a></td>'); en('<td class="onpub-highlight1" align="left">' . $websiteName . '</td>'); en('<td class="onpub-highlight1" align="left">' . $created . '</td>'); break; case 1: en('<td class="onpub-highlight2" align="right">' . $this->ID . '</td>'); en('<td class="onpub-highlight2" align="left"><a href="index.php?onpub=EditSection&sectionID=' . $this->ID . '" title="Edit">' . $name . '</a></td>'); en('<td class="onpub-highlight2" align="left">' . $websiteName . '</td>'); en('<td class="onpub-highlight2" align="left">' . $created . '</td>'); break; } break; default: switch ($counter) { case 0: en('<td class="onpub-highlight1" align="right">' . $this->ID . '</td>'); en('<td class="onpub-highlight1" align="left"><a href="index.php?onpub=EditSection&sectionID=' . $this->ID . '" title="Edit">' . $name . '</a></td>'); en('<td class="onpub-highlight1" align="left">' . $websiteName . '</td>'); en('<td class="onpub-highlight1" align="left">' . $created . '</td>'); break; case 1: en('<td class="onpub-highlight2" align="right">' . $this->ID . '</td>'); en('<td class="onpub-highlight2" align="left"><a href="index.php?onpub=EditSection&sectionID=' . $this->ID . '" title="Edit">' . $name . '</a></td>'); en('<td class="onpub-highlight2" align="left">' . $websiteName . '</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="javascript:clearSearchField(); submitForm();">Display all sections</a>.</p>'); } else { if ($this->websiteID) { $widget = new OnpubWidgetSelectWebsite($this->pdo, $this->websiteID); $widget->display(); br(2); en('<p>There are 0 sections in the selected website. <a href="index.php?onpub=EditSections&websiteID=">Display all sections</a>.</p>'); } else { en('<p>There are 0 sections in the database. <a href="index.php?onpub=NewSection">New Section</a>.</p>'); } } } if ($totalSections) { $widget = new OnpubWidgetStats($totalSections, $this->keywords, $this->websiteID, "Section", "Website"); $widget->display(); } en('<input type="hidden" name="onpub" value="EditSections">'); en('</div>'); en('</form>'); $widget = new OnpubWidgetFooter(); $widget->display(); }
$login = new OnpubLogin(); $login->display(); } else { $welcome = new OnpubWelcome($pdo); $welcome->display(); $pdo = NULL; } break; } } else { if (!$loginStatus) { $login = new OnpubLogin(); $login->display(); } else { $welcome = new OnpubWelcome($pdo); if (isset($e)) { // There was a $pdo exception. $welcome->pdoException = $e; } try { $welcome->display(); } catch (PDOException $e) { $widget = new OnpubWidgetPDOException($e); $widget->display(); $pdo = NULL; exit($e->getCode()); } $pdo = NULL; } } }