Index: trunk/extensions/SolrStore/templates/SolrSearchTemplate_FIS.php |
— | — | @@ -1,4 +1,5 @@ |
2 | 2 | <?php |
| 3 | + |
3 | 4 | /** |
4 | 5 | * Dynamic Template 'FIS' -> Example |
5 | 6 | * |
— | — | @@ -6,9 +7,9 @@ |
7 | 8 | * with : makeHighlightText and makeHighlightTitle functions |
8 | 9 | * |
9 | 10 | * to use this template add this peace of code to LocalSettings.php |
10 | | - * |
| 11 | + * |
11 | 12 | * # define Template |
12 | | - * $wgSolrTemplate = "_FIS"; |
| 13 | + * $wgSolrTemplate = "_FIS"; |
13 | 14 | * |
14 | 15 | * |
15 | 16 | * @ingroup SolrStore |
— | — | @@ -28,6 +29,10 @@ |
29 | 30 | var $mHighlightText = null; |
30 | 31 | var $mHighlightTitle = null; |
31 | 32 | var $mWordCount = null; |
| 33 | + var $category = null; |
| 34 | + var $higherdept = null; |
| 35 | + var $maindept = null; |
| 36 | + var $methode = null; |
32 | 37 | |
33 | 38 | public function applyTemplate( $xml ) { |
34 | 39 | global $wgSolrFields; |
— | — | @@ -38,7 +43,8 @@ |
39 | 44 | |
40 | 45 | // Bugfix: clear the var! |
41 | 46 | unset( $this->Inhalt_de_t ); |
42 | | - |
| 47 | + unset( $this->methode ); |
| 48 | + print_r( $xml ); |
43 | 49 | // get Size, Wordcound, Date, Inhalt_de_t from XML: |
44 | 50 | foreach ( $xml->arr as $doc ) { |
45 | 51 | switch ( $doc[ 'name' ] ) { |
— | — | @@ -63,10 +69,36 @@ |
64 | 70 | case 'Zuletzt geändert_dt': |
65 | 71 | $this->mDate = $doc->date; |
66 | 72 | break; |
67 | | - |
| 73 | + |
68 | 74 | case 'Inhalt de_t': |
69 | 75 | $this->Inhalt_de_t[ ] = $doc->str; |
70 | 76 | break; |
| 77 | + |
| 78 | + case 'Inhalt fr_t': |
| 79 | + $this->Inhalt_de_t[ ] = $doc->str; |
| 80 | + break; |
| 81 | + |
| 82 | + case 'Inhalt en_t': |
| 83 | + $this->Inhalt_de_t[ ] = $doc->str; |
| 84 | + break; |
| 85 | + |
| 86 | + case 'category': |
| 87 | + $this->category = $doc->str; |
| 88 | + break; |
| 89 | + |
| 90 | + case 'Higher-Dept_s': |
| 91 | + $this->higherdept = $doc->str; |
| 92 | + break; |
| 93 | + |
| 94 | + case 'Main-Dept_s': |
| 95 | + $this->maindept = $doc->str; |
| 96 | + break; |
| 97 | + |
| 98 | + case 'Methode_t': |
| 99 | + foreach ( $doc->str as $methoden ) { |
| 100 | + $this->methode[ ] = $methoden; |
| 101 | + } |
| 102 | + break; |
71 | 103 | } |
72 | 104 | } |
73 | 105 | |
— | — | @@ -133,6 +165,38 @@ |
134 | 166 | $this->makeHighlightText( $wgSolrFields, $textsnip ); // TEXTSNIP: Highlight the searching stuff: |
135 | 167 | } else { |
136 | 168 | $this->mHighlightText = ""; |
| 169 | + if ( $this->category == 'Institution' ) { |
| 170 | + $tmpmaind = 0; |
| 171 | + if ( $this->maindept != '' ) { |
| 172 | + $this->mHighlightText = $this->maindept; |
| 173 | + $tmpmaind = 1; |
| 174 | + } |
| 175 | + if ( $this->higherdept != '' ) { |
| 176 | + if ( $tmpmaind == 1 ) { |
| 177 | + $this->mHighlightText.="<br>"; |
| 178 | + } |
| 179 | + $this->mHighlightText.= $this->higherdept; |
| 180 | + } |
| 181 | + $textsnip = $this->mHighlightText; |
| 182 | + $this->makeHighlightText( $wgSolrFields, $textsnip ); // TEXTSNIP: Highlight the searching stuff: |
| 183 | + } |
| 184 | + if ( $this->category == 'Projekte' ) { |
| 185 | + $tmpmethode = ""; |
| 186 | + if ( count( $this->methode ) > 0 ) { |
| 187 | + for ( $i = 0; $i <= count( $this->methode ); $i++ ) { |
| 188 | + if ( $i == 0 ) { |
| 189 | + $tmpmethode = "Vorgehensweise: " . $this->methode[ $i ]; |
| 190 | + } else { |
| 191 | + if ( $this->methode[ $i ] != "" ) { |
| 192 | + $tmpmethode.=", " . $this->methode[ $i ]; |
| 193 | + } |
| 194 | + } |
| 195 | + } |
| 196 | + } |
| 197 | + |
| 198 | + $textsnip = $this->mHighlightText = $tmpmethode; // . "->" . count( $this->methode ); |
| 199 | + $this->makeHighlightText( $wgSolrFields, $textsnip ); // TEXTSNIP: Highlight the searching stuff: |
| 200 | + } |
137 | 201 | } |
138 | 202 | |
139 | 203 | return $this; |