public function getPages() { // returns an array of pages of this type. Does not check permissions // since this can get pretty long it actually returns a limited amount of data; $db = Loader::db(); $pages = array(); $r = $db->query("select Pages.cID, Collections.cDateAdded, Collections.cDateModified, max(cvID) as cvID, cvName from Pages inner join Collections on Collections.cID = Pages.cID inner join (select * from CollectionVersions order by cvID desc) as Foo on Pages.cID = Foo.cID where ctID = ? and cIsTemplate = 0 group by Foo.cID order by cvName asc;", array($this->getCollectionTypeID())); while ($row = $r->fetchRow()) { $p = new Page; $p->setPropertiesFromArray($row); $p->vObj = new CollectionVersion(); $p->vObj->cvID = $row['cvID']; $p->vObj->cvName = $row['cvName']; $pages[] = $p; } return $pages; }