public function displayValues($content_node, $transient_options, $action) { if (!($mainNode = $this->template->appendFileByNode('swiss_svs_lists.html', 'div', $content_node)) instanceof DOMNode || !($listNode = $this->template->getElementByName('lists', 0, $mainNode)) instanceof DOMNode) { return false; } $publish_text = 'Publish a new version'; $retrieve_text = 'Retrieve the most recent version'; $edit_text = 'Edit %s configuration'; $other_text = 'Other Versions:'; $based_on_form_text = 'Based on the list %s'; I2CE::getConfig()->setIfIsSet($publish_text, "/modules/SVS/messages/publish"); I2CE::getConfig()->setIfIsSet($retrieve_text, "/modules/SVS/messages/retrieve"); I2CE::getConfig()->setIfIsSet($edit_text, "/modules/SVS/messages/edit"); I2CE::getConfig()->setIfIsSet($other_text, "/modules/SVS/messages/other"); I2CE::getConfig()->setIfIsSet($based_on_form_text, "/modules/SVS/messages/basd_on_form_style"); foreach ($this->storage->getKeys() as $oid) { if (!($swissChild = $this->getChild($oid)) instanceof I2CE_Swiss_SVS) { continue; } $form = $swissChild->getField('list'); $id = 'list_' . $oid; $listNode->appendChild($liNode = $this->template->createElement('li')); $liNode->appendChild($spanNode = $this->template->createElement('span', array('id' => $id))); $spanNode->appendChild($aNode = $this->template->createElement('a', array('id' => $id . '_link'))); $aNode->appendChild($this->template->createElement('h3', array(), sprintf($edit_text, $oid))); if ($form) { $spanNode->appendChild($pNode = $this->template->createElement('p', array(), sprintf($based_on_form_text, $form))); } $spanNode->appendChild($divNode = $this->template->createElement('div', array('id' => $id . '_ajax', 'class' => 'indented'))); $spanNode->appendChild($linkDivNode = $this->template->createElement('div', array('class' => 'indented'))); $publish = I2CE_Page::getAccessedBaseURL() . '/SVS/publish?id=' . $oid; $retrieve = I2CE_Page::getAccessedBaseURL() . '/SVS/RetrieveValueSet?id=' . $oid; $linkDivNode->appendChild($this->template->createElement('a', array('href' => $publish), $publish_text)); $linkDivNode->appendChild($this->template->createElement('br')); $versions = iHRIS_SVS::getVersions($oid); if (count($versions) > 0) { $linkDivNode->appendChild($this->template->createElement('a', array('href' => $retrieve), $retrieve_text)); $linkDivNode->appendChild($this->template->createElement('br')); $linkDivNode->appendChild($this->template->createTextNode($other_text)); sort($versions); foreach ($versions as $i => $version) { if ($i != 0) { $linkDivNode->appendChild($this->template->createTextNode(',')); } $linkDivNode->appendChild($this->template->createElement('a', array('href' => $retrieve . '&version=' . $version), " {$version} ")); } } $linkDivNode->appendChild($this->template->createElement('pre', array(), $retrieve)); $swissChild->addAjaxLink($id . '_link', 'contents', $id . '_ajax', $spanNode, $action, $transient_options); } return true; }
protected function generateMultiDoc($params) { $doc = new DOMDocument('1.0', 'UTF-8'); if (!$doc->loadXML('<svs:RetrieveMultipleValueSetsResponse xmlns:svs="urn:ihe:iti:svs:2008"/>')) { return false; } $ids = iHRIS_SVS::getOIDs(); if ($params['ID']) { if (in_array($params['ID'], $ids)) { $ids = array($params['ID']); } else { $ids = array(); } } foreach ($ids as $id) { try { $svsObj = new iHRIS_SVS($id); } catch (Exception $e) { I2CE::raiseError("Could not access {$id}"); continue; } $meta = $svsObj->getMeta(); $versions = iHRIS_SVS::getVersions($id); foreach ($versions as $version) { $langs = iHRIS_SVS::getLangs($id, $version); foreach ($langs as $lang) { if (!is_string($svs = iHRIS_SVS::getPublishedConceptList($id, $version, $lang)) || !($svs_doc = new DOMDocument('1.0', 'UTF-8')) || !$svs_doc->loadXML($svs)) { I2CE::raiseError("Could not retrieve {$id} ({$version}) in {$lang}"); continue; } $doc->documentElement->appendChild($dvs = $doc->createElement('svs:DescribedValueSet')); $dvs->setAttribute('version', $version); $dvs->setAttribute('ID', $id); $dvs->setAttribute('displayName', $id); $dvs->appendChild($doc->importNode($svs_doc->documentElement, true)); $dvs->appendChild($source = $doc->createElement('svs:Source')); $source->appendChild($doc->createTextNode($meta['Source'])); $dvs->appendChild($status = $doc->createElement('svs:Status')); $status->appendChild($doc->createTextNode($meta['Status'])); } } } return $doc; }