/** * Returns an instance of class (singleton pattern implementation). * * @return OASEO_BOL_SitemapPageDao */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
/** * @return array */ public function findPages($first, $count, $broken = false) { if ($broken) { return $this->sitemapPageDao->findBrokenPages($first, $count); } return $this->sitemapPageDao->findPages($first, $count, $broken); }
public function findItemsByType($type, $first, $count) { $result = $this->dbo->queryForColumnList("SELECT `id` FROM `" . $this->getTableName() . "` WHERE `type` = " . $type . " ORDER BY `id` LIMIT ?,?", array($first, $count)); if (!$result) { return array(); } $query = "SELECT `i`.*, `p`.`url` FROM `" . $this->getTableName() . "` AS `i`\n LEFT JOIN `" . OASEO_BOL_SitemapPageItemDao::getInstance()->getTableName() . "` AS `pi` ON (`i`.`id` = `pi`.`itemId`)\n LEFT JOIN `" . OASEO_BOL_SitemapPageDao::getInstance()->getTableName() . "` AS `p` ON (`pi`.`pageId` = `p`.`id`)\n WHERE `pi`.`type` = " . ($type == OASEO_BOL_SitemapItemDao::VALUE_BROKEN_LINK ? OASEO_BOL_SitemapPageItemDao::TYPE_VALUE_PAGE : OASEO_BOL_SitemapPageItemDao::TYPE_VALUE_ITEM) . " AND `i`.`id` IN ( " . $this->dbo->mergeInClause($result) . " ) "; return $this->dbo->queryForList($query); }