コード例 #1
0
ファイル: results.php プロジェクト: Kheros/MMOver
 /**
  * Create the results based on a list of ids return from the search implmentation
  *
  * @param vB_Current_User $user
  * @param vB_Search_Criteria criteria for the search
  * @return vB_Search_Results
  */
 public static function create_from_array($user, $result_array)
 {
     global $vbulletin;
     $results = new vB_Search_Results();
     $results->user = $user;
     $results->criteria = vB_Search_Core::create_criteria(vB_Search_Core::SEARCH_ADVANCED);
     $results->criteria->set_grouped(vB_Search_Core::GROUP_NO);
     $sanitized_results = array();
     foreach ($result_array as $result) {
         //if we only have the type and the id, add a dummy group id.
         //we won't use it, but the code expects it.
         if (count($result) == 2) {
             $result[] = 0;
         }
         $sanitized_results[] = $result;
     }
     $results->results = $sanitized_results;
     //move log_search call after get_results to allow for any changes to the $criteria
     //object that might be made by the searchcontroller
     $results->searchid = $results->log_search();
     $results->dateline = TIMENOW;
     $results->cache_results();
     $searchtime = 0;
     //todo: do we need to set $results->searchtime here as well?
     $results->searchtime = $searchtime;
     $results->complete_search($searchtime);
     return $results;
 }