Esempio n. 1
0
 /**
  * Parses the CitationItems configuration.
  *
  * @param \SimpleXMLElement $xml
  * @throws \ErrorException If layout is missing
  */
 public function __construct(\SimpleXMLElement $xml)
 {
     // init child elements
     foreach ($xml->children() as $child) {
         switch ($child->getName()) {
             case 'layout':
                 $this->layout = new Layout($child);
                 break;
             case 'sort':
                 $this->sort = new Sort($child);
                 break;
         }
     }
     if (isset($this->layout) == false) {
         throw new \ErrorException('Missing layout!');
     }
     // citation options
     $this->layout->setOptions(new CitationOptions($xml));
     // set global options and inheritable name options
     $options = new Options();
     $options->set('citation', $xml);
 }
Esempio n. 2
0
 protected function initElement($layout, $json, $citation, $mode = 'citation')
 {
     $data = new Data();
     $data->set($json);
     Container::setData($data);
     $citationItems = new CitationItems();
     $citationItems->set($citation);
     Container::setCitationItem($citationItems);
     Container::getContext()->setName($mode);
     $xml = new \SimpleXMLElement($layout);
     $this->object = new Layout($xml);
     $this->object->setOptions(new Citation(new \SimpleXMLElement('<xml/>')));
 }