You are here

BiblioStyleEndNote.class.php in Bibliography Module 7.3

EndNote tagged biblio style.

File

plugins/biblio_style/endnote/BiblioStyleEndNote.class.php
View source
<?php

/**
 * @file
 * EndNote tagged biblio style.
 */
class BiblioStyleEndNote extends BiblioStyleBase {
  public function settingsForm() {
    $form['type'] = array(
      '#type' => 'select',
      '#title' => t('Type'),
      '#required' => TRUE,
      '#options' => array(
        'tagged' => t('Tagged'),
        'xml' => t('XML'),
      ),
      '#default_value' => 'tagged',
    );
    return $form;
  }

  /**
   * @inheritdoc
   */
  public function importData($data, $options = array()) {
    $options += array(
      'type' => 'tagged',
    );
    $class_name = FALSE;
    if ($options['type'] == 'tagged') {
      $class_name = 'BiblioStyleEndNoteTagged';
    }
    else {

      // This is an XML, and we need to get the format (EndNote 7 or EndNote 8).
      if (strpos($data, 'record') !== FALSE && strpos($data, 'ref-type') !== FALSE) {
        $class_name = 'BiblioStyleEndNoteXML8';
      }
      elseif (strpos($data, 'RECORD') !== FALSE && strpos($data, 'REFERENCE_TYPE') !== FALSE) {
        $class_name = 'BiblioStyleEndNoteXML7';
      }
    }
    if (!$class_name) {
      return;
    }
    $handler = new $class_name($this->plugin, $this->biblio);
    return $handler
      ->importData($data, $options);
  }

  /**
   * @inheritdoc
   */
  public function render($options = array(), $langcode = NULL) {
    $options += array(
      'type' => 'tagged',
    );
    switch ($options['type']) {
      case 'xml':
        $class_name = 'BiblioStyleEndNoteXML8';
        break;
      default:
        $class_name = 'BiblioStyleEndNoteTagged';
        break;
    }
    $handler = new $class_name($this->plugin, $this->biblio);
    return $handler
      ->render($options, $langcode);
  }

}

Classes

Namesort descending Description
BiblioStyleEndNote @file EndNote tagged biblio style.