Exemple #1
0
 /**
  * Display the Feed
  *
  * @param   sting $tpl template
  *
  * @return void
  */
 public function display($tpl = null)
 {
     $this->doc->setMimeEncoding('application/xml');
     $model = $this->getModel();
     $this->oaiModel->setListModel($model);
     $root = $this->oaiModel->root();
     $root->appendChild($this->oaiModel->responseDate());
     $root->appendChild($this->request());
     $this->params = $model->getParams();
     $model->setOutPutFormat('feed');
     $this->app->allowCache(true);
     if (!parent::access($model)) {
         exit;
     }
     $filter = $this->filter();
     foreach ($filter as $key => $val) {
         $_GET[$key] = $val;
     }
     $model->render();
     $rows = $model->getData();
     $total = $model->getTotalRecords();
     if ($total === 0) {
         echo $this->model->generateError(array('code' => 'noRecordsMatch', 'msg' => 'No records matched'));
     }
     $this->rowIdentifier = 'oai:' . $this->oaiModel->repositoryIdentifier() . ':' . $model->getId() . '/';
     $listRecords = $this->listRecords($rows);
     if ($total > count($rows)) {
         $listRecords->appendChild($this->oaiModel->resumptionToken($total, $filter));
     }
     $root->appendChild($listRecords);
     $this->oaiModel->appendChild($root);
     print_r($this->oaiModel->dom->saveXML());
 }
Exemple #2
0
 /**
  * Execute and display a template script.
  *
  * @param   string $tpl The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a JError object.
  */
 public function display($tpl = null)
 {
     $this->doc->setMimeEncoding('application/xml');
     $model = $this->getModel('form');
     $model->render();
     // @TODO replace with OAI errors.
     if (!$this->canAccess()) {
         return false;
     }
     $listModel = $model->getListModel();
     $this->oaiModel->setListModel($listModel);
     $this->oaiModel->setRecord($model->getData());
     $dom = $this->oaiModel->getRecord();
     echo $dom->saveXML();
 }