You are here

function views_oai_pmh_plugin_style::render in Views OAI-PMH 7

Same name and namespace in other branches
  1. 6.2 plugins/views_oai_pmh_plugin_style.inc \views_oai_pmh_plugin_style::render()
  2. 6 plugins/views_oai_pmh_plugin_style.inc \views_oai_pmh_plugin_style::render()
  3. 7.3 plugins/views_oai_pmh_plugin_style.inc \views_oai_pmh_plugin_style::render()
  4. 7.2 plugins/views_oai_pmh_plugin_style.inc \views_oai_pmh_plugin_style::render()

Render the display in this style.

Overrides views_plugin_style::render

File

plugins/views_oai_pmh_plugin_style.inc, line 6

Class

views_oai_pmh_plugin_style

Code

function render() {
  $content = '';
  $oai_resumption_token = '';
  if ($this
    ->uses_row_plugin() && empty($this->row_plugin)) {
    vpr('views_plugin_style_default: Missing row plugin');
    return;
  }
  $this->oai_args = $this->display->handler
    ->get_oai_args();
  if (!count($this->oai_args['errors'])) {
    $content = $this
      ->render_content();
    if (!empty($content) && isset($this->oai_args['verb']) && in_array($this->oai_args['verb'], array(
      'ListRecords',
      'ListIdentifiers',
      'ListSets',
    ))) {
      $oai_resumption_token = $this->display->handler
        ->build_oai_resumption_token();
    }
  }
  if (empty($content) && isset($this->oai_args['verb']) && in_array($this->oai_args['verb'], array(
    'ListRecords',
    'ListIdentifiers',
  ))) {
    $this->oai_args['errors'] = $this->display->handler
      ->oai_error('noRecordsMatch');
  }
  if (empty($content) && isset($this->oai_args['verb']) && $this->oai_args['verb'] == 'GetRecord') {
    $this->oai_args['errors'] = $this->display->handler
      ->oai_error('idDoesNotExist', $this->oai_args['identifier']);
  }
  return theme('views_oai_pmh_response', array(
    'view' => $this->view,
    'options' => $this->options,
    'oai_args' => $this->oai_args,
    'oai_content' => $content,
    'resumption_token' => $oai_resumption_token,
  ));
}