예제 #1
0
 /**
  * Transform XML to HTML
  * 
  * @param mixed $xml  XML-like data
  * @param string $path_to_xsl
  * @param array $params
  */
 protected function transform($xml, $path_to_xsl, array $params = array())
 {
     $registry = Registry::getInstance();
     $import_array = array();
     // the xsl lives here
     $distro_xsl_dir = $this->_script_path . "/";
     $local_xsl_dir = realpath(getcwd()) . "/views/";
     // language file
     $request = new Request();
     $language = $request->getParam("lang");
     if ($language == "") {
         $language = $registry->defaultLanguage();
     }
     // english file is included by default (as a fallback)
     array_push($import_array, "labels/eng.xsl");
     // if language is set to something other than english
     // then include that file to override the english labels
     if ($language != "eng" && $language != '') {
         array_push($import_array, "labels/{$language}.xsl");
     }
     // make sure we've got a reference to the local includes too
     array_push($import_array, "includes.xsl");
     // transform
     $xsl = new Xsl($distro_xsl_dir, $local_xsl_dir);
     return $xsl->transformToXml($xml, $path_to_xsl, $this->format, $params, $import_array);
 }
예제 #2
0
파일: Group.php 프로젝트: navtis/xerxes
 /**
  * Merge the search results
  * 
  * @param string $primary_sort			primary sort order
  * @param string $secondary_sort		secondary sort order
  * 
  * @return Status
  */
 public function merge($primary_sort = null, $secondary_sort = null)
 {
     // merge results
     $merged_xml = $this->client()->merge($this->id, $primary_sort, $secondary_sort);
     // create new merged set
     $this->merged_set = new MergedResultSet($merged_xml);
     // fetch facets
     // only if we should show facets and there is more than 15 results
     if ($this->merged_set->total > 15) {
         // full version (this is huge)
         $facet_xml = $this->client()->getFacets($this->merged_set->set_number, "all");
         $this->cache()->set("facets-" . $this->id, $facet_xml->saveXML());
         // slimmed down version (used for display)
         $xsl = new Xsl(__DIR__, getcwd());
         $facets_slim = $xsl->transformToXml($facet_xml, "xsl/facets-slim.xsl");
         $this->cache()->set("facets-slim-" . $this->id, $facets_slim);
     }
     // update search status
     return $this->getSearchStatus();
 }