Exemple #1
0
 private function selectQuery(OnpubQueryOptions $queryOptions = NULL)
 {
     if ($queryOptions === NULL) {
         $queryOptions = new OnpubQueryOptions();
     }
     $where = "";
     $orderBy = "";
     $limit = "";
     if ($queryOptions->dateLimit) {
         $where = "WHERE images.created <= " . $this->pdo->quote($queryOptions->dateLimit->format('Y-m-d H:i:s'));
     }
     if ($queryOptions->orderBy) {
         $orderBy = "ORDER BY " . $queryOptions->orderBy;
         if ($queryOptions->order) {
             $orderBy .= " " . $queryOptions->order;
         }
     }
     if ($queryOptions->getPage() && $queryOptions->rowLimit && $queryOptions->rowLimit > 0) {
         $limit = "LIMIT " . ($queryOptions->getPage() - 1) * $queryOptions->rowLimit . "," . $queryOptions->rowLimit;
     } elseif ($queryOptions->rowLimit && $queryOptions->rowLimit > 0) {
         $limit = "LIMIT 0," . $queryOptions->rowLimit;
     }
     return "SELECT images.ID, images.websiteID, images.fileName, " . "images.description, images.url, images.created, images.modified, " . "website.imageID as websiteImageID, website.name as websiteName, " . "website.url as websiteURL, website.imagesURL as websiteImagesURL, " . "website.imagesDirectory as websiteImagesDirectory, website.created " . "as websiteCreated, website.modified as websiteModified FROM " . "OnpubImages as images LEFT JOIN OnpubWebsites as website ON " . "images.websiteID = website.ID {$where} {$orderBy} {$limit}";
 }
Exemple #2
0
 private function selectQuery(OnpubQueryOptions $queryOptions = NULL, $sectionID = NULL, $articleID = NULL)
 {
     if ($sectionID) {
         $sectionID = ctype_digit($sectionID) ? $sectionID : $this->pdo->quote($sectionID);
     }
     if ($articleID) {
         $articleID = ctype_digit($articleID) ? $articleID : $this->pdo->quote($articleID);
     }
     if ($queryOptions === NULL) {
         $queryOptions = new OnpubQueryOptions();
     }
     $where = "";
     $orderBy = "";
     $limit = "";
     if ($queryOptions->dateLimit) {
         $where = "WHERE created <= " . $this->pdo->quote($queryOptions->dateLimit->format('Y-m-d H:i:s'));
         if ($sectionID) {
             $where .= " AND sectionID = {$sectionID}";
         } elseif ($articleID) {
             $where .= " AND articleID = {$articleID}";
         }
     } else {
         if ($sectionID) {
             $where = "WHERE sectionID = {$sectionID}";
         } elseif ($articleID) {
             $where = "WHERE articleID = {$articleID}";
         }
     }
     if ($queryOptions->orderBy) {
         $orderBy = "ORDER BY " . $queryOptions->orderBy;
         if ($queryOptions->order) {
             $orderBy .= " " . $queryOptions->order;
         }
     }
     if ($queryOptions->getPage() && $queryOptions->rowLimit && $queryOptions->rowLimit > 0) {
         $limit = "LIMIT " . ($queryOptions->getPage() - 1) * $queryOptions->rowLimit . "," . $queryOptions->rowLimit;
     } elseif ($queryOptions->rowLimit && $queryOptions->rowLimit > 0) {
         $limit = "LIMIT 0," . $queryOptions->rowLimit;
     }
     return "SELECT ID, sectionID, articleID, created, modified FROM OnpubSAMaps {$where} {$orderBy} {$limit}";
 }
Exemple #3
0
 private function selectQuery(OnpubQueryOptions $queryOptions = NULL, $websiteID, $parentID)
 {
     if ($websiteID) {
         $websiteID = ctype_digit($websiteID) ? $websiteID : $this->pdo->quote($websiteID);
     }
     if ($parentID) {
         $parentID = ctype_digit($parentID) ? $parentID : $this->pdo->quote($parentID);
     }
     if ($queryOptions === NULL) {
         $queryOptions = new OnpubQueryOptions();
     }
     $where = "";
     $orderBy = "";
     $limit = "";
     if ($queryOptions->dateLimit) {
         $where = "WHERE created <= " . $this->pdo->quote($queryOptions->dateLimit->format('Y-m-d H:i:s'));
         if ($websiteID) {
             $where .= " AND websiteID = {$websiteID}";
         } elseif ($parentID) {
             $where .= " AND parentID = {$parentID}";
         }
     } else {
         if ($websiteID) {
             $where = "WHERE websiteID = {$websiteID}";
         } elseif ($parentID) {
             $where = "WHERE parentID = {$parentID}";
         }
     }
     if ($queryOptions->orderBy) {
         $orderBy = "ORDER BY " . $queryOptions->orderBy;
         if ($queryOptions->order) {
             $orderBy .= " " . $queryOptions->order;
         }
     }
     if ($queryOptions->getPage() && $queryOptions->rowLimit && $queryOptions->rowLimit > 0) {
         $limit = "LIMIT " . ($queryOptions->getPage() - 1) * $queryOptions->rowLimit . "," . $queryOptions->rowLimit;
     } elseif ($queryOptions->rowLimit && $queryOptions->rowLimit > 0) {
         $limit = "LIMIT 0," . $queryOptions->rowLimit;
     }
     return "SELECT ID, imageID, websiteID, parentID, name, url, created, modified FROM OnpubSections {$where} {$orderBy} {$limit}";
 }
Exemple #4
0
 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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=ASC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=title&amp;order=DESC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;order=ASC">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=ASC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=title&amp;order=DESC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;order=ASC">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC&sectionID=' . $this->sectionID . '">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;order=DESC&sectionID=' . $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&amp;orderBy=ID&amp;order=ASC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC&sectionID=' . $this->sectionID . '">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;order=DESC&sectionID=' . $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&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=DESC&sectionID=' . $this->sectionID . '">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;order=DESC&sectionID=' . $this->sectionID . '">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC&sectionID=' . $this->sectionID . '">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;order=DESC&sectionID=' . $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&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC&sectionID=' . $this->sectionID . '">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;order=DESC&sectionID=' . $this->sectionID . '">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC&sectionID=' . $this->sectionID . '">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;order=ASC&sectionID=' . $this->sectionID . '">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC&sectionID=' . $this->sectionID . '">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;order=ASC&sectionID=' . $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&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=ASC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=DESC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;order=ASC">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=title&amp;order=ASC">Title</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditArticles&amp;orderBy=created&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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();
 }
Exemple #5
0
 private function selectQuery(OnpubQueryOptions $queryOptions = NULL, $sectionID = NULL, $websiteID = NULL)
 {
     if ($sectionID) {
         $sectionID = ctype_digit($sectionID) ? $sectionID : $this->pdo->quote($sectionID);
     }
     if ($websiteID) {
         $websiteID = ctype_digit($websiteID) ? $websiteID : $this->pdo->quote($websiteID);
     }
     if ($queryOptions === NULL) {
         $queryOptions = new OnpubQueryOptions();
     }
     $articleColumns = "articles.ID, articles.imageID, articles.title, " . "articles.url, articles.created, articles.modified, " . "articleimages.websiteID AS imageWebsiteID, articleimages.fileName AS imageFileName, " . "articleimages.description AS imageDescription, articleimages.url AS " . "articleImageURL, articleimages.created AS imageCreated, " . "articleimages.modified AS imageModified";
     $where = "";
     $orderBy = "";
     $limit = "";
     if ($queryOptions->includeContent) {
         $articleColumns = "articles.ID, articles.imageID, articles.title, " . "articles.content, articles.url, articles.created, " . "articles.modified, articleimages.websiteID AS " . "imageWebsiteID, articleimages.fileName AS " . "imageFileName, articleimages.description AS " . "imageDescription, articleimages.url AS " . "articleImageURL, articleimages.created AS " . "imageCreated, articleimages.modified AS imageModified";
     }
     if ($sectionID || $websiteID) {
         $articleColumns .= ", samaps.sectionID AS sectionID";
     }
     if ($queryOptions->dateLimit) {
         $where = "WHERE articles.created <= " . $this->pdo->quote($queryOptions->dateLimit->format('Y-m-d H:i:s'));
         if ($sectionID && !$websiteID) {
             $where .= " AND samaps.sectionID = {$sectionID}";
         }
         if ($websiteID && !$sectionID) {
             $where .= " AND wsmaps.websiteID = {$websiteID}";
         }
     } else {
         if ($sectionID && !$websiteID) {
             $where = "WHERE samaps.sectionID = {$sectionID}";
         }
         if ($websiteID && !$sectionID) {
             $where = "WHERE wsmaps.websiteID = {$websiteID}";
         }
     }
     if ($queryOptions->orderBy) {
         $orderBy = "ORDER BY articles." . $queryOptions->orderBy;
         if ($queryOptions->order) {
             $orderBy .= " " . $queryOptions->order;
         }
     } else {
         if ($sectionID && !$websiteID) {
             $orderBy = "ORDER BY samaps.ID ASC";
         }
     }
     if ($queryOptions->getPage() && $queryOptions->rowLimit && $queryOptions->rowLimit > 0) {
         $limit = "LIMIT " . ($queryOptions->getPage() - 1) * $queryOptions->rowLimit . "," . $queryOptions->rowLimit;
     } elseif ($queryOptions->rowLimit && $queryOptions->rowLimit > 0) {
         $limit = "LIMIT 0," . $queryOptions->rowLimit;
     }
     if ($sectionID && !$websiteID) {
         return "SELECT {$articleColumns} FROM OnpubArticles AS articles LEFT JOIN " . "OnpubImages AS articleimages ON articles.imageID = articleimages.ID LEFT JOIN " . "OnpubSAMaps AS samaps ON articles.ID = samaps.articleID " . "{$where} {$orderBy} {$limit}";
     } elseif ($websiteID && !$sectionID) {
         return "SELECT {$articleColumns} FROM OnpubArticles AS articles LEFT JOIN " . "OnpubImages AS articleimages ON articles.imageID = articleimages.ID LEFT JOIN " . "OnpubSAMaps AS samaps ON articles.ID = samaps.articleID " . "LEFT JOIN OnpubWSMaps AS wsmaps ON samaps.sectionID = " . "wsmaps.sectionID {$where} {$orderBy} {$limit}";
     } else {
         return "SELECT {$articleColumns} FROM OnpubArticles AS articles LEFT JOIN " . "OnpubImages AS articleimages ON articles.imageID = articleimages.ID " . "{$where} {$orderBy} {$limit}";
     }
 }
Exemple #6
0
 /**
  * Check the status of the Onpub schema.
  *
  * @return mixed The version of the schema in the database as an int. An array
  * of PDOException objects will be returned if the schema is incomplete or
  * not installed.
  */
 public function status()
 {
     $oaamaps = new OnpubAAMaps($this->pdo);
     $oarticles = new OnpubArticles($this->pdo);
     $oauthors = new OnpubAuthors($this->pdo);
     $oimages = new OnpubImages($this->pdo);
     $osamaps = new OnpubSAMaps($this->pdo);
     $osections = new OnpubSections($this->pdo);
     $owebsites = new OnpubWebsites($this->pdo);
     $owsmaps = new OnpubWSMaps($this->pdo);
     $queryOptions = new OnpubQueryOptions($this->pdo);
     $queryOptions->setPage(1, 1);
     $exceptions = array();
     $version = 0;
     try {
         $oaamaps->select($queryOptions);
     } catch (PDOException $e) {
         $exceptions[] = $e;
     }
     try {
         $oarticles->select($queryOptions);
     } catch (PDOException $e) {
         $exceptions[] = $e;
     }
     try {
         $oauthors->select($queryOptions);
     } catch (PDOException $e) {
         $exceptions[] = $e;
     }
     try {
         $oimages->select($queryOptions);
     } catch (PDOException $e) {
         $exceptions[] = $e;
     }
     try {
         $osamaps->select($queryOptions);
     } catch (PDOException $e) {
         $exceptions[] = $e;
     }
     try {
         $osections->select($queryOptions);
     } catch (PDOException $e) {
         $exceptions[] = $e;
     }
     try {
         $owebsites->select($queryOptions);
     } catch (PDOException $e) {
         $exceptions[] = $e;
     }
     try {
         $owsmaps->select($queryOptions);
     } catch (PDOException $e) {
         $exceptions[] = $e;
     }
     if (sizeof($exceptions)) {
         return $exceptions;
     }
     $version = 1;
     return $version;
 }
Exemple #7
0
 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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=ASC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;order=ASC">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=ASC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;order=ASC">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;keywords=' . $this->keywords . '&amp;orderBy=name&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC&websiteID=' . $this->websiteID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=ASC&websiteID=' . $this->websiteID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;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&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;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&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC&websiteID=' . $this->websiteID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC&websiteID=' . $this->websiteID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC&websiteID=' . $this->websiteID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=ASC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;order=ASC">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditSections&amp;orderBy=name&amp;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&amp;orderBy=created&amp;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 .= ' &ndash; ' . $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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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();
 }
Exemple #8
0
 private function selectQuery(OnpubQueryOptions $queryOptions = NULL)
 {
     if ($queryOptions === NULL) {
         $queryOptions = new OnpubQueryOptions();
     }
     $where = "";
     $orderBy = "";
     $limit = "";
     if ($queryOptions->dateLimit) {
         $where = "WHERE created <= " . $this->pdo->quote($queryOptions->dateLimit->format('Y-m-d H:i:s'));
     }
     if ($queryOptions->orderBy) {
         $orderBy = "ORDER BY " . $queryOptions->orderBy;
         if ($queryOptions->order) {
             $orderBy .= " " . $queryOptions->order;
         }
     }
     if ($queryOptions->getPage() && $queryOptions->rowLimit && $queryOptions->rowLimit > 0) {
         $limit = "LIMIT " . ($queryOptions->getPage() - 1) * $queryOptions->rowLimit . "," . $queryOptions->rowLimit;
     } elseif ($queryOptions->rowLimit && $queryOptions->rowLimit > 0) {
         $limit = "LIMIT 0," . $queryOptions->rowLimit;
     }
     return "SELECT ID, imageID, givenNames, familyName, displayAs, url, created, modified FROM OnpubAuthors {$where} {$orderBy} {$limit}";
 }
Exemple #9
0
 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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=fileName&amp;order=ASC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=ASC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=fileName&amp;order=ASC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=fileName&amp;order=DESC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=fileName&amp;order=ASC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=fileName&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=fileName&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;order=ASC">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=fileName&amp;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&amp;keywords=' . $this->keywords . '&amp;fullTextSearch=' . $this->fullTextSearch . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=fileName&amp;order=ASC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=ASC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=fileName&amp;order=ASC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=fileName&amp;order=DESC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=fileName&amp;order=ASC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=fileName&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=fileName&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;order=ASC">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;keywords=' . $this->keywords . '&amp;orderBy=fileName&amp;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&amp;keywords=' . $this->keywords . '&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=ASC&sectionID=' . $this->sectionID . '">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=created&amp;order=DESC&sectionID=' . $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&amp;orderBy=ID&amp;order=ASC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=ASC&sectionID=' . $this->sectionID . '">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=created&amp;order=DESC&sectionID=' . $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&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=DESC&sectionID=' . $this->sectionID . '">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=created&amp;order=DESC&sectionID=' . $this->sectionID . '">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=ASC&sectionID=' . $this->sectionID . '">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=created&amp;order=DESC&sectionID=' . $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&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=ASC&sectionID=' . $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&amp;orderBy=created&amp;order=DESC&sectionID=' . $this->sectionID . '">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=ASC&sectionID=' . $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&amp;orderBy=created&amp;order=ASC&sectionID=' . $this->sectionID . '">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=ID&amp;order=DESC&sectionID=' . $this->sectionID . '">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=ASC&sectionID=' . $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&amp;orderBy=created&amp;order=ASC&sectionID=' . $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&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=ASC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=ASC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=ASC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=DESC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left" class="onpub-highlight2"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;order=ASC">File Name</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=created&amp;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&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;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&amp;orderBy=created&amp;order=DESC">Created</a></span></td>');
                                 break;
                             case "DESC":
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;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&amp;orderBy=created&amp;order=ASC">Created</a></span></td>');
                                 break;
                             default:
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=ID&amp;order=DESC">ID</a></span></td>');
                                 en('<td align="left"><span class="onpub-field-header"><a href="index.php?onpub=EditImages&amp;orderBy=fileName&amp;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&amp;orderBy=created&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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();
 }
Exemple #10
0
 function display()
 {
     en('<!DOCTYPE html>');
     en('<html>');
     en('<head>');
     en('<meta name="viewport" content="width=device-width; initial-scale=1.0">');
     en('<meta charset="ISO-8859-1">');
     en('<title>' . strip_tags("Onpub (on " . $_SERVER['SERVER_NAME'] . ") - " . $this->title) . '</title>');
     /*
     if (file_exists(ONPUBGUI_YUI_DIRECTORY)) {
       en('<link rel="stylesheet" type="text/css" href="' . ONPUBGUI_YUI_DIRECTORY . 'cssnormalize/cssnormalize-min.css">');
       en('<link rel="stylesheet" type="text/css" href="' . ONPUBGUI_YUI_DIRECTORY . 'cssfonts/cssfonts-min.css">');
       en('<link rel="stylesheet" type="text/css" href="' . ONPUBGUI_YUI_DIRECTORY . 'cssgrids/cssgrids-min.css">');
       en('<link rel="stylesheet" type="text/css" href="' . ONPUBGUI_YUI_DIRECTORY . 'node-menunav/assets/skins/sam/node-menunav.css">');
       en('<link rel="stylesheet" type="text/css" href="' . ONPUBGUI_YUI_DIRECTORY . 'widget-base/assets/skins/sam/widget-base.css">');
       en('<link rel="stylesheet" type="text/css" href="' . ONPUBGUI_YUI_DIRECTORY . 'widget-stack/assets/skins/sam/widget-stack.css">');
       en('<link rel="stylesheet" type="text/css" href="' . ONPUBGUI_YUI_DIRECTORY . 'overlay/assets/skins/sam/overlay.css">');
     }
     else {
       en('<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?' .
          ONPUBGUI_YUI_VERSION . '/build/cssnormalize/cssnormalize-min.css&' . ONPUBGUI_YUI_VERSION .
          '/build/cssfonts/cssfonts-min.css&' . ONPUBGUI_YUI_VERSION .
          '/build/cssgrids/cssgrids-min.css&' . ONPUBGUI_YUI_VERSION .
          '/build/node-menunav/assets/skins/sam/node-menunav.css&' . ONPUBGUI_YUI_VERSION .
          '/build/widget-base/assets/skins/sam/widget-base.css&' . ONPUBGUI_YUI_VERSION .
          '/build/widget-stack/assets/skins/sam/widget-stack.css&' . ONPUBGUI_YUI_VERSION .
          '/build/overlay/assets/skins/sam/overlay.css">');
     }
     */
     en('<link rel="stylesheet" type="text/css" href="css/yui-combo-min.css">');
     en('<link href="//fonts.googleapis.com/css?family=Roboto:400,400italic,700,700italic" rel="stylesheet" type="text/css">');
     en('<link rel="stylesheet" type="text/css" href="css/onpub.css">');
     en('<link rel="stylesheet" type="text/css" href="css/onpub-menu.css">');
     en('<script type="text/javascript" src="' . ONPUBGUI_CKEDITOR_DIRECTORY . 'ckeditor.js"></script>');
     en('<script type="text/javascript">');
     en('document.documentElement.className = "yui3-loading";');
     if (file_exists(ONPUBGUI_YUI_DIRECTORY)) {
         en('var onpub_dir_yui = "../bower_components/yui3/build/";');
     } else {
         en('var onpub_dir_yui = null;');
     }
     en('var onpub_yui_version = "' . ONPUBGUI_YUI_VERSION . '";');
     en('</script>');
     en('</head>');
     en('<body class="yui3-skin-sam">');
     en('<div id="onpub-header">');
     en('<div id="onpub-logo">');
     en('<div class="yui3-g">');
     en('<div class="yui3-u-1-4">');
     en('<a href="index.php"><img src="' . ONPUBGUI_IMAGE_DIRECTORY . 'onpub-small.png" width="150" height="60" alt="Onpub" title="Onpub" border="0"></a>', 1);
     en('</div>');
     en('<div class="yui3-u-3-4">');
     en('<div id="onpub-menubar" class="yui3-menu yui3-menu-horizontal yui3-menubuttonnav" style="float: right; margin-top: 2.25em;">');
     en('<div class="yui3-menu-content">');
     en('<ul>');
     if ($this->dbstatus == ONPUBAPI_SCHEMA_VERSION) {
         if ($this->pdo) {
             $oarticles = new OnpubArticles($this->pdo);
         } else {
             $oarticles = null;
         }
         en('<li>');
         en('<a class="yui3-menu-label" href="#new"><em>New</em></a>');
         en('<div id="new" class="yui3-menu">');
         en('<div class="yui3-menu-content">');
         en('<ul>');
         en('<li class="yui3-menuitem"><a class="yui3-menuitem-content" href="index.php?onpub=NewArticle">Article</a></li>');
         en('<li class="yui3-menuitem"><a class="yui3-menuitem-content" href="index.php?onpub=NewSection">Section</a></li>');
         en('<li class="yui3-menuitem"><a class="yui3-menuitem-content" href="index.php?onpub=NewWebsite">Website</a></li>');
         en('</ul>');
         en('</div>');
         en('</div>');
         en('</li>');
         if ($oarticles) {
             $queryOptions = new OnpubQueryOptions();
             $queryOptions->includeContent = FALSE;
             $queryOptions->orderBy = "modified";
             $queryOptions->order = "DESC";
             $queryOptions->setPage(1, ONPUBGUI_PDO_ROW_LIMIT);
             try {
                 $articles = $oarticles->select($queryOptions);
             } catch (PDOException $e) {
                 $articles = null;
             }
         } else {
             $articles = null;
         }
         if ($articles) {
             en('<li>');
             en('<a class="yui3-menu-label" href="index.php?onpub=EditArticles"><em>Articles</em></a>');
             en('<div id="edit" class="yui3-menu">');
             en('<div class="yui3-menu-content">');
             en('<ul>');
             foreach ($articles as $a) {
                 en('<li class="yui3-menuitem"><a class="yui3-menuitem-content" href="index.php?onpub=EditArticle&articleID=' . $a->ID . '">' . $a->title . '</a></li>');
             }
             en('<li class="yui3-menuitem"><a class="yui3-menuitem-content" href="index.php?onpub=EditArticles">All Articles..</a></li>');
             en('</ul>');
             en('</div>');
             en('</div>');
             en('</li>');
         } else {
             en('<li class="yui3-menuitem">');
             en('<a class="yui3-menuitem-content" href="index.php?onpub=EditArticles">Articles</a>');
             en('</li>');
         }
         en('<li class="yui3-menuitem">');
         en('<a class="yui3-menuitem-content" href="index.php?onpub=EditImages">Images</a>');
         en('</li>');
         en('<li class="yui3-menuitem">');
         en('<a class="yui3-menuitem-content" href="index.php?onpub=EditSections">Sections</a>');
         en('</li>');
         en('<li class="yui3-menuitem">');
         en('<a class="yui3-menuitem-content" href="index.php?onpub=EditWebsites">Websites</a>');
         en('</li>');
         en('<li>');
         en('<a class="yui3-menu-label" href="#upload"><em>Upload</em></a>');
         en('<div id="upload" class="yui3-menu">');
         en('<div class="yui3-menu-content">');
         en('<ul>');
         en('<li class="yui3-menuitem"><a class="yui3-menuitem-content" href="index.php?onpub=UploadImages">Images</a></li>');
         en('</ul>');
         en('</div>');
         en('</div>');
         en('</li>');
     }
     en('</ul>');
     en('</div>');
     en('</div>');
     en('</div>');
     en('</div>');
     en('</div>');
     en('</div>');
     en('<div id="onpub-page">');
     en('<div id="onpub-body">');
     en('<div class="yui3-g">');
     en('<div class="yui3-u-1">');
     if ($this->title) {
         en('<h1 style="margin-right: 0;">' . $this->title . '</h1>');
     } else {
         en('<h1 style="margin-right: 0;">Onpub (on ' . $_SERVER['SERVER_NAME'] . ')</h1>');
     }
 }