/**
  * As we have the same document preparation process in every demo action,
  * we difine this onInit method to take care of this
  */
 function onInit() {
   $this->document = new HTMLDocument($this->getResponce());
   $demos = FDRouterForm::getDemos();
   $this->document->setTemplate($this->getPackage()->getResourcePath('template.html'));
   $this->document->setVariable('main', get_class($this) . '.html');
   $this->document->setVariable('title', $this->getTitle());
   $this->document->setVariable('freddy', Package::getPackageByName('freddy'));
 }
Ejemplo n.º 2
0
 function onInit() {
   parent::onInit();
   $demos = FDRouterForm::getDemos();
   $d = $this->getDocument();
   $d->setVariable('prev', $prev = $this->getPrev());
   if($prev) {
     $d->setVariable('prevTitle', $demos[$prev->getAction()]);
   }
   $d->setVariable('next', $next = $this->getNext());
   if($next) {
     $d->setVariable('nextTitle', $demos[$next->getAction()]);
   }
   $d->setVariable('routerForm', new FDRouterForm($this->getRequest()));
   $d->setVariable('viewSource', new Location('FDViewSource', array('demo'=>get_class($this))));
   $d->setVariable('viewTemplate', new Location('FDViewSource', array('demo'=>get_class($this), 'template'=>'1')));
 }