public function action_menu($csd_cache = false) { if (!($cachesNode = $this->template->getElementById('caches')) instanceof DOMNode || !$cachesNode->appendChild($ulNode = $this->template->createElement('ul'))) { return false; } $this->template->addHeaderLink("mootools-core.js"); $this->template->addHeaderLink("mootools-more.js"); $cache_names = I2CE::getConfig()->getKeys("/modules/csd_cache"); $only_one = false; if ($csd_cache) { $only_one = true; $cache_names = array_intersect(array($csd_cache), $cache_names); } if (!$only_one) { $soap_full_endpoint = self::getAccessedBaseURL() . "csd_cache?action=full_soap"; $full_update_endpoint = self::getAccessedBaseURL() . "csd_cache?action=full_update"; $full_clear_endpoint = self::getAccessedBaseURL() . "csd_cache?action=full_clear"; $this->template->setDisplayDataImmediate('soap_full_stream', $soap_full_endpoint); $this->template->setDisplayDataImmediate('full_update', $full_update_endpoint); $this->template->setDisplayDataImmediate('full_clear', $full_clear_endpoint); $sample_full = '<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:csd="urn:ihe:iti:csd:2013"> <soap:Header> <wsa:Action soap:mustUnderstand="1" >urn:ihe:iti:csd:2013:GetDirectoryModificationsRequest</wsa:Action> <wsa:MessageID>urn:uuid:def119ad-dc13-49c1-a3c7-e3742531f9b3</wsa:MessageID> <wsa:ReplyTo soap:mustUnderstand="1"> <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address> </wsa:ReplyTo> <wsa:To soap:mustUnderstand="1">' . $soap_full_endpoint . '</wsa:To> </soap:Header> <soap:Body> <csd:getModificationsRequest> <csd:lastModified>2002-05-30T09:30:10.5</csd:lastModified> </csd:getModificationsRequest> </soap:Body> </soap:Envelope>'; $this->template->setDisplayDataImmediate('sample_full', $sample_full); $this->template->setDisplayDataImmediate('show_full', 1); } else { $this->template->setDisplayDataImmediate('show_full', 0); } foreach ($cache_names as $cache_name) { if (!($liNode = $this->template->createElement('li')) instanceof DOMNode || !$ulNode->appendChild($liNode) instanceof DOMNode || !($menuNode = $this->template->appendFileByNode("csd_cache_admin_menu_each.html", 'div', $liNode)) instanceof DOMNode) { continue; } try { $csd_cache = new iHRIS_CSDCache($cache_name); } catch (Exception $e) { $this->template->removeNode($liNode); I2CE::raiseError("Cannot instantiate cache {$cache_name}"); continue; } $base_url = "csd_cache/" . $cache_name; $this->template->setDisplayDataImmediate('cache_name', $cache_name, $menuNode); $this->template->setDisplayDataImmediate('cache_link', $base_url, $menuNode); $this->template->setDisplayDataImmediate('modified', $csd_cache->getLastModified(), $menuNode); $this->template->setDisplayDataImmediate('total', $csd_cache->getTotalRecords(), $menuNode); $this->template->setDisplayDataImmediate('updated', $csd_cache->getUpToDateRecords(), $menuNode); $this->template->setDisplayDataImmediate('stream', $base_url . '/stream', $menuNode); $this->template->setDisplayDataImmediate('xsl', $base_url . '/xsl', $menuNode); $this->template->setDisplayDataImmediate('stream_raw', $base_url . '/stream_raw', $menuNode); $this->template->setDisplayDataImmediate('clear', $base_url . '/clear', $menuNode); $this->template->setDisplayDataImmediate('update', $base_url . '/update', $menuNode); $this->template->setDisplayDataImmediate('do_enable', $base_url . '/enable', $menuNode); $this->template->setDisplayDataImmediate('do_disable', $base_url . '/disable', $menuNode); $this->template->setDisplayDataImmediate('enabled', $csd_cache->enabled() ? 1 : 0, $menuNode); $soap_endpoint = self::getAccessedBaseURL() . "csd_cache/" . $cache_name . "/query_for_updated_services"; $this->template->setDisplayDataImmediate('soap', $soap_endpoint, $menuNode); $form = false; if (($relationship = $csd_cache->getRelationship()) && I2CE::getConfig()->setIfIsSet($form, '/modules/CustomReports/relationships/' . $relationship . '/form') && is_string($form) && strlen($form) > 0 && is_array($ids = I2CE_FormStorage::search($form, false, array(), array(), 3))) { $i = 1; foreach ($ids as $id) { $this->template->setDisplayDataImmediate('rel_example_' . $i, $base_url . '/stream_raw/' . $form . '|' . $id, $menuNode); $this->template->setDisplayDataImmediate('csd_example_' . $i, $base_url . '/stream/' . $form . '|' . $id, $menuNode); $i++; } } $sample = '<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:csd="urn:ihe:iti:csd:2013"> <soap:Header> <wsa:Action soap:mustUnderstand="1" >urn:ihe:iti:csd:2013:GetDirectoryModificationsRequest</wsa:Action> <wsa:MessageID>urn:uuid:def119ad-dc13-49c1-a3c7-e3742531f9b3</wsa:MessageID> <wsa:ReplyTo soap:mustUnderstand="1"> <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address> </wsa:ReplyTo> <wsa:To soap:mustUnderstand="1">' . $soap_endpoint . '</wsa:To> </soap:Header> <soap:Body> <csd:getModificationsRequest> <csd:lastModified>2002-05-30T09:30:10.5</csd:lastModified> </csd:getModificationsRequest> </soap:Body> </soap:Envelope>'; $this->template->setDisplayDataImmediate('sample', $sample, $menuNode); $args = $csd_cache->get_args(); if (($svs_node = $this->template->getElementByID('svs', $menuNode)) instanceof DOMNode && $svs_node->appendChild($ul2_node = $this->template->createElement('ul')) && array_key_exists('svs_dependencies', $args) && is_array($svs = $args['svs_dependencies'])) { foreach ($svs as $list => $oid) { $ul2_node->appendChild($li2_node = $this->template->createElement('li')); $li2_node->appendChild($this->template->createTextNode("{$oid} ({$list})")); $li2_node->appendChild($this->template->createElement('a', array('href' => 'SVS/RetrieveValueSet?id=' . $oid), "Retrieve ")); $li2_node->appendChild($this->template->createTextNode(" / ")); $li2_node->appendChild($this->template->createElement('a', array('href' => 'SVS/publish?id=' . $oid), "Re-Publish ")); } } } return true; }