Пример #1
0
 protected function formHeader($term)
 {
     global $wgContLang, $wgCanonicalNamespaceNames;
     $sep = '   ';
     $out = Xml::openElement('div', array('style' => 'padding-bottom:0.5em;'));
     $bareterm = $term;
     if ($this->startsWithImage($term)) {
         $bareterm = substr($term, strpos($term, ':') + 1);
     }
     // delete all/image prefix
     $nsAllSet = array_keys(SearchEngine::searchableNamespaces());
     // search profiles headers
     $m = wfMsg('searchprofile-articles');
     $tt = wfMsg('searchprofile-articles-tooltip', implode(', ', SearchEngine::namespacesAsText(SearchEngine::defaultNamespaces())));
     if ($this->active == 'default') {
         $out .= Xml::element('strong', array('title' => $tt), $m);
     } else {
         $out .= $this->makeSearchLink($bareterm, SearchEngine::defaultNamespaces(), $m, $tt);
     }
     $out .= $sep;
     $m = wfMsg('searchprofile-images');
     $tt = wfMsg('searchprofile-images-tooltip');
     if ($this->active == 'images') {
         $out .= Xml::element('strong', array('title' => $tt), $m);
     } else {
         $imageTextForm = $wgContLang->getFormattedNsText(NS_FILE) . ':' . $bareterm;
         $out .= $this->makeSearchLink($imageTextForm, array(NS_FILE), $m, $tt);
     }
     $out .= $sep;
     /*
     $m = wfMsg( 'searchprofile-articles-and-proj' );
     $tt = wfMsg( 'searchprofile-project-tooltip', 
     	implode( ', ', SearchEngine::namespacesAsText( SearchEngine::defaultAndProjectNamespaces() ) ) );
     if( $this->active == 'withproject' ) {
     	$out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );	
     } else {
     	$out .= $this->makeSearchLink( $bareterm, SearchEngine::defaultAndProjectNamespaces(), $m, $tt );
     }
     $out .= $sep;
     */
     $m = wfMsg('searchprofile-project');
     $tt = wfMsg('searchprofile-project-tooltip', implode(', ', SearchEngine::namespacesAsText(SearchEngine::projectNamespaces())));
     if ($this->active == 'project') {
         $out .= Xml::element('strong', array('title' => $tt), $m);
     } else {
         $out .= $this->makeSearchLink($bareterm, SearchEngine::projectNamespaces(), $m, $tt);
     }
     $out .= $sep;
     $m = wfMsg('searchprofile-everything');
     $tt = wfMsg('searchprofile-everything-tooltip');
     if ($this->active == 'all') {
         $out .= Xml::element('strong', array('title' => $tt), $m);
     } else {
         $out .= $this->makeSearchLink($bareterm, $nsAllSet, $m, $tt);
     }
     $out .= $sep;
     $m = wfMsg('searchprofile-advanced');
     $tt = wfMsg('searchprofile-advanced-tooltip');
     if ($this->active == 'advanced') {
         $out .= Xml::element('strong', array('title' => $tt), $m);
     } else {
         $out .= $this->makeSearchLink($bareterm, $this->namespaces, $m, $tt, array('advanced' => '1'));
     }
     $out .= Xml::closeElement('div');
     return $out;
 }