https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113905
Revision: 113905
Author: schuellersa
Date: 2012-03-15 10:56:13 +0000 (Thu, 15 Mar 2012)
Log Message:
-----------
Language fix
Modified Paths:
--------------
trunk/extensions/SolrStore/templates/SolrSearchTemplate_FIS.php
Modified: trunk/extensions/SolrStore/templates/SolrSearchTemplate_FIS.php
===================================================================
--- trunk/extensions/SolrStore/templates/SolrSearchTemplate_FIS.php
2012-03-15 10:43:51 UTC (rev 113904)
+++ trunk/extensions/SolrStore/templates/SolrSearchTemplate_FIS.php
2012-03-15 10:56:13 UTC (rev 113905)
@@ -1,4 +1,5 @@
<?php
+
/**
* Dynamic Template 'FIS' -> Example
*
@@ -6,9 +7,9 @@
* with : makeHighlightText and makeHighlightTitle functions
*
* to use this template add this peace of code to LocalSettings.php
- *
+ *
* # define Template
- * $wgSolrTemplate = "_FIS";
+ * $wgSolrTemplate = "_FIS";
*
*
* @ingroup SolrStore
@@ -28,6 +29,10 @@
var $mHighlightText = null;
var $mHighlightTitle = null;
var $mWordCount = null;
+ var $category = null;
+ var $higherdept = null;
+ var $maindept = null;
+ var $methode = null;
public function applyTemplate( $xml ) {
global $wgSolrFields;
@@ -38,7 +43,8 @@
// Bugfix: clear the var!
unset( $this->Inhalt_de_t );
-
+ unset( $this->methode );
+ print_r( $xml );
// get Size, Wordcound, Date, Inhalt_de_t from XML:
foreach ( $xml->arr as $doc ) {
switch ( $doc[ 'name' ] ) {
@@ -63,10 +69,36 @@
case 'Zuletzt geƤndert_dt':
$this->mDate = $doc->date;
break;
-
+
case 'Inhalt de_t':
$this->Inhalt_de_t[ ] = $doc->str;
break;
+
+ case 'Inhalt fr_t':
+ $this->Inhalt_de_t[ ] = $doc->str;
+ break;
+
+ case 'Inhalt en_t':
+ $this->Inhalt_de_t[ ] = $doc->str;
+ break;
+
+ case 'category':
+ $this->category = $doc->str;
+ break;
+
+ case 'Higher-Dept_s':
+ $this->higherdept = $doc->str;
+ break;
+
+ case 'Main-Dept_s':
+ $this->maindept = $doc->str;
+ break;
+
+ case 'Methode_t':
+ foreach ( $doc->str as $methoden ) {
+ $this->methode[ ] = $methoden;
+ }
+ break;
}
}
@@ -133,6 +165,38 @@
$this->makeHighlightText( $wgSolrFields, $textsnip );
// TEXTSNIP: Highlight the searching stuff:
} else {
$this->mHighlightText = "";
+ if ( $this->category == 'Institution' ) {
+ $tmpmaind = 0;
+ if ( $this->maindept != '' ) {
+ $this->mHighlightText = $this->maindept;
+ $tmpmaind = 1;
+ }
+ if ( $this->higherdept != '' ) {
+ if ( $tmpmaind == 1 ) {
+ $this->mHighlightText.="<br>";
+ }
+ $this->mHighlightText.=
$this->higherdept;
+ }
+ $textsnip = $this->mHighlightText;
+ $this->makeHighlightText( $wgSolrFields,
$textsnip ); // TEXTSNIP: Highlight the searching stuff:
+ }
+ if ( $this->category == 'Projekte' ) {
+ $tmpmethode = "";
+ if ( count( $this->methode ) > 0 ) {
+ for ( $i = 0; $i <= count(
$this->methode ); $i++ ) {
+ if ( $i == 0 ) {
+ $tmpmethode =
"Vorgehensweise: " . $this->methode[ $i ];
+ } else {
+ if ( $this->methode[ $i
] != "" ) {
+ $tmpmethode.=",
" . $this->methode[ $i ];
+ }
+ }
+ }
+ }
+
+ $textsnip = $this->mHighlightText =
$tmpmethode; // . "->" . count( $this->methode );
+ $this->makeHighlightText( $wgSolrFields,
$textsnip ); // TEXTSNIP: Highlight the searching stuff:
+ }
}
return $this;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs