コード例 #1
0
 function getHTMLResults()
 {
     global $mvgIP, $wgOut, $mvgScriptPath, $mvgContLang, $wgUser, $wgParser;
     //print_r($this->results);
     //for each stream range:
     $o = '';
     //print_r($this->results );
     require_once $mvgIP . '/includes/MV_Title.php';
     require_once $mvgIP . '/includes/MV_MetavidInterface/MV_Overlay.php';
     if (count($this->results) == 0) {
         return '<h3>' . wfMsg('mv_search_no_results') . '</h3>';
     }
     foreach ($this->results as $stream_id => &$stream_set) {
         $matches = 0;
         $stream_out = $mvTitle = '';
         $sk =& $wgUser->getSkin();
         foreach ($stream_set as &$srange) {
             $cat_html = $mvd_out = '';
             $range_match = 0;
             foreach ($srange['rows'] as &$mvd) {
                 $matches++;
                 if (isset($mvd->text)) {
                     //@@todo parse category info if present
                     //$cat_html = $mvd->text;
                     //run via parser to add in Category info:
                     $parserOptions = ParserOptions::newFromUser($wgUser);
                     $parserOptions->setEditSection(false);
                     $parserOptions->setTidy(true);
                     $title = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title);
                     $parserOutput = $wgParser->parse($mvd->text, $title, $parserOptions);
                     $cats = $parserOutput->getCategories();
                     foreach ($cats as $catkey => $title_str) {
                         $title = Title::MakeTitle(NS_CATEGORY, $catkey);
                         $cat_html .= ' ' . $sk->makeKnownLinkObj($title, $catkey);
                     }
                     //add category pre-text:
                     if ($cat_html != '') {
                         $cat_html = wfMsg('Categories') . ':' . $cat_html;
                     }
                     //$wgOut->addCategoryLinks( $parserOutput->getCategories() );
                     //$cat_html = $sk->getCategories();
                     //empty out the categories
                     //$wgOut->mCategoryLinks = array();
                 }
                 $mvTitle = new MvTitle($mvd->wiki_title);
                 //retive only the first article:
                 //$title = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title);
                 //$article = new Article($title);
                 $bgcolor = MV_Overlay::getMvdBgColor($mvd);
                 $mvd_out .= '<span style="background:#' . $bgcolor . '">&nbsp; &nbsp; &nbsp; &nbsp;' . $mvTitle->getTimeDesc() . '&nbsp;</span>';
                 $mvd_out .= '<a title="' . wfMsg('mv_expand_play') . '" href="javascript:mv_ex(\'' . $mvd->id . '\')"><img id="mv_img_ex_' . $mvd->id . '" border="0" src="' . $mvgScriptPath . '/skins/images/closed.png"></a>' . '&nbsp;';
                 //output control liniks:
                 //make stream title link:
                 $mvStreamTitle = Title::MakeTitle(MV_NS_STREAM, $mvTitle->getNearStreamName());
                 //$mvTitle->getStreamName() .'/'.$mvTitle->getStartTime() .'/'. $mvTitle->getEndTime() );
                 $mvd_out .= $sk->makeKnownLinkObj($mvStreamTitle, '<img border="0" src="' . $mvgScriptPath . '/skins/images/run_mv_stream.png">', '', '', '', '', ' title="' . wfMsg('mv_view_in_stream_interface') . '" ');
                 //$title = MakeTitle::()
                 $mvd_out .= '&nbsp;';
                 $mvdTitle = Title::MakeTitle(MV_NS_MVD, $mvd->wiki_title);
                 $mvd_out .= $sk->makeKnownLinkObj($mvdTitle, '<img border="0" src="' . $mvgScriptPath . '/skins/images/run_mediawiki.png">', '', '', '', '', ' title="' . wfMsg('mv_view_wiki_page') . '" ');
                 $mvd_out .= '<div id="mvr_' . $mvd->id . '" style="display:none;background:#' . $bgcolor . ';" ></div>';
                 $mvd_out .= '<br>' . "\n";
             }
             if (count($srange['rows']) != 1) {
                 $stream_out .= '&nbsp;' . $cat_html . ' In range:' . seconds2ntp($srange['s']) . ' to ' . seconds2ntp($srange['e']) . wfMsg('mv_match_text', count($srange['rows'])) . '<br>' . "\n";
                 $stream_out .= $mvd_out;
             } else {
                 $stream_out .= $mvd_out;
             }
         }
         $nsary = $mvgContLang->getNamespaceArray();
         //output stream name and mach count
         /*$o.='<br><img class="mv_stream_play_button" name="'.$nsary[MV_NS_STREAM].':' .
         			$mvTitle->getStreamName() .
         				'" align="left" src="'.$mvgScriptPath.'/skins/mv_embed/images/vid_play_sm.png">';
         		*/
         $o .= '<h3>' . $mvTitle->getStreamNameText() . wfMsg('mv_match_text', $matches) . '</h3>';
         $o .= '<div id="mv_stream_' . $stream_id . '">' . $stream_out . '</div>';
     }
     return $o;
 }