3 * Laconica - a distributed open-source microblogging tool
4 * Copyright (C) 2008, Controlez-Vous, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('LACONICA')) { exit(1); }
22 class SearchAction extends Action {
24 function handle($args) {
25 parent::handle($args);
29 function show_top($arr=NULL) {
34 common_element('p', 'error', $error);
36 $instr = $this->get_instructions();
37 $output = common_markup_to_html($instr);
38 common_element_start('div', 'instructions');
40 common_element_end('div');
45 function get_title() {
49 function show_header($arr) {
53 function show_form($error=NULL) {
54 $q = $this->trimmed('q');
55 $page = $this->trimmed('page', 1);
57 common_show_header($this->get_title(), array($this, 'show_header'), array($q, $error),
58 array($this, 'show_top'));
59 common_element_start('form', array('method' => 'get',
61 'action' => common_local_url($this->trimmed('action'))));
62 common_element_start('p');
63 common_element('input', array('name' => 'q',
66 'class' => 'input_text',
67 'value' => ($q) ? $q : ''));
69 common_element('input', array('type' => 'submit',
73 'value' => _('Search')));
75 common_element_end('p');
76 common_element_end('form');
78 $this->show_results($q, $page);
83 function search_menu() {
84 # action => array('prompt', 'title')
86 array('peoplesearch' =>
88 'Find people on this site'),
91 'Find content of notices'));
92 $this->nav_menu($menu);