コード例 #1
0
ファイル: class.php プロジェクト: seanfbrown/jinzora
 /**
  * Draws the search results page.
  * 
  * @author Ben Dodson
  * @version 12/18/04
  * @since 11/20/04
  */
 function searchResults($string, $type, $power_search = false)
 {
     global $cms_type, $jzSERVICES;
     $display =& new jzDisplay();
     $blocks =& new jzBlocks();
     $tracks = array();
     $nodes = array();
     // remember, $this is a frontend.
     // This has to go before SQL querries.
     // If our keywords say to play the results
     // we cannot print any HTML.
     if ($power_search === false) {
         $check = splitKeywords($string);
         if (!muteOutput($check['keywords'])) {
             $display->preheader('Search Results', $this->width, $this->align);
             $this->pageTop('Search Results');
         }
         $results = handleSearch($string, $type);
         if (sizeof($results) == 0 && muteOutput($check['keywords'])) {
             $display->preheader('Search Results', $this->width, $this->align);
             $this->pageTop('Search Results');
         }
     } else {
         // Power search:
         $display->preheader('Search Results', $this->width, $this->align);
         $this->pageTop('Search Results');
         $root = new jzMediaNode();
         $results = $root->powerSearch();
     }
     echo '<table width="100%" cellpadding="3"><tr><td>';
     foreach ($results as $val) {
         if ($val->isLeaf()) {
             $tracks[] = $val;
         } else {
             $nodes[] = $val;
         }
     }
     // show the page
     if (sizeof($tracks) > 0) {
         $blocks->blockHeader(sizeof($tracks) . " " . word("Matching Tracks") . " " . word("for search") . ' "' . $_POST['search_query'] . '"');
         $blocks->blockBodyOpen();
         $blocks->trackTable($tracks, "search");
         $blocks->blockBodyClose();
         $blocks->blockSpacer();
     }
     if (sizeof($nodes) > 0) {
         $blocks->blockHeader(sizeof($nodes) . " " . word("Other Matches") . " " . word("for search") . ' "' . $_POST['search_query'] . '"');
         $blocks->blockBodyOpen();
         $blocks->nodeTable($nodes, "search");
         $blocks->blockBodyClose();
         $blocks->blockSpacer();
     }
     if (sizeof($nodes) == 0 && sizeof($tracks) == 0) {
         $blocks->blockHeader(word("No matches found"));
     }
     $this->footer();
     $jzSERVICES->cmsClose();
 }