Example #1
0
 /**
  * vBForum_Search_Type_Post::listUi()
  *This function generates the search elements for the user to search for posts
  * @param mixed $prefs : the array of user preferences / propogated form values.
  * @param mixed $contenttypeid : the content type for which we are going to
  *    search
  * @param array registers : any additional elements to be registered. These are
  * 	just passed to the template
  * @param string $template_name : name of the template to use for display. We have
  *		a default template.
  * @return $html: complete html for the search elements
  */
 public function listUi($prefs = null, $contenttypeid = null, $registers = null, $template_name = null)
 {
     global $vbulletin, $vbphrase;
     if (!isset($template_name)) {
         $template_name = 'search_input_post';
     }
     if (!isset($contenttypeid)) {
         $contenttypeid = $this->get_contenttypeid();
     }
     $template = vB_Template::create($template_name);
     if ($prefs['searchthreadid']) {
         if ($thread = vB_Legacy_Thread::create_from_id($prefs['searchthreadid'])) {
             $template->register('thread_title', $thread->get_field('title'));
         }
     }
     $template->register('securitytoken', $vbulletin->userinfo['securitytoken']);
     $template->register('contenttypeid', $contenttypeid);
     $template->register('search_forum_options', $this->showForumOptions($prefs['forumchoice']));
     $prefix_selected = array('anythread' => (empty($prefs['prefixchoice']) or in_array('', $prefs['prefixchoice'])) ? 'selected="selected"' : '', 'anyprefix' => ($prefs['prefixchoice'] and in_array('-2', $prefs['prefixchoice'])) ? 'selected="selected"' : '', 'none' => ($prefs['prefixchoice'] and in_array('-1', $prefs['prefixchoice'])) ? 'selected="selected"' : '');
     $template->register('prefix_selected', $prefix_selected);
     $template->register('search_prefix_options', vB_Search_Searchtools::getPrefixOptions($prefs['prefixchoice'], false));
     $this->setPrefs($template, $prefs, array('select' => array('sortby', 'order', 'forumchoice', 'prefixchoice', 'titleonly', 'starteronly', 'searchdate', 'beforeafter'), 'cb' => array('childforums', 'exactname', 'nocache'), 'value' => array('query', 'searchuser', 'tag', 'searchthreadid'), 'rb' => array('showposts')));
     vB_Search_Searchtools::searchIntroRegisterHumanVerify($template);
     if (isset($registers) and is_array($registers)) {
         foreach ($registers as $key => $value) {
             $template->register($key, htmlspecialchars_uni($value));
         }
     }
     ($hook = vBulletinHook::fetch_hook('search_listui_complete')) ? eval($hook) : false;
     return $template->render();
 }