<?php
load_class( 'Utils/Enumerator.php' );
load_class( 'XSLT/XSLT.php' );
load_class( 'Content/Content.php' );
class PageRepository{
var $pageIdArray;
var $pageIdEnumerator;
function PageRepository(){
$this->pageIdEnumerator = new Enumerator();
$this->pageIdEnumerator->setElements( $this->pageIdArray );
$this->pageIdArray = $this->getPagesId();
$this->pageIdArray[] = 'fp'; // add first page
}
function getPagesId(){
$xslt = new XSLT();
$content = new Content();
$xslt->setXML( $content->getContent( 'db-xml:pages.xml' ) );
$xslt->setXSLT( $content->getContent( 'xslt:other/pages2text.xsl' ) );
$xslt->transform();
$result = $xslt->getResult();
$lines = array();
$arr = array();
$lines = explode( "\n", $result );
foreach( $lines as $line ){
$line = chop( $line );
if ( empty( $line ) ) continue;
list( $id, $name ) = explode( ';', $line );
$arr[] = $id;
}
return $arr;
}
} // end class
?>