mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
search is now template based
This commit is contained in:
parent
0be3ad6331
commit
87abaada86
@ -26,22 +26,17 @@
|
||||
|
||||
$error = "";
|
||||
|
||||
if (strlen($keywords) == 0)
|
||||
$error = lang("You must enter one or more search keywords.");
|
||||
|
||||
if (strlen($keywords) == 0) {
|
||||
echo "<b>".lang("Error").":</b>";
|
||||
echo lang("You must enter one or more search keywords.");
|
||||
$phpgw->common->phpgw_footer();
|
||||
exit;
|
||||
}
|
||||
$matches = 0;
|
||||
|
||||
?>
|
||||
|
||||
<H2><FONT COLOR="<?php echo $H2COLOR . "\">" . lang("Search Results"); ?></FONT></H2>
|
||||
|
||||
<?php
|
||||
// There is currently a problem searching in with repeated events.
|
||||
// It spits back out the date it was entered. I would like to to say that
|
||||
// it is a repeated event.
|
||||
if (strlen($error)) {
|
||||
echo "<B>" . lang("Error") . ":</B> $error";
|
||||
} else {
|
||||
$ids = array();
|
||||
$words = split(" ", $keywords);
|
||||
for ($i = 0; $i < count($words); $i++) {
|
||||
@ -66,32 +61,44 @@
|
||||
. $phpgw->common->show_date($phpgw->db->f(2)) . ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($matches > 0)
|
||||
$matches = count($ids);
|
||||
|
||||
if ($matches == 1)
|
||||
echo "<B>1 match found.</B><P>";
|
||||
$quantity = "1 match found.";
|
||||
else if ($matches > 0)
|
||||
echo "<B>" . lang("x matches found",$matches) . ".</B><P>";
|
||||
$quantity = lang("x matches found",$matches).".";
|
||||
else
|
||||
$error = lang("no matches found.");
|
||||
|
||||
if($error) {
|
||||
echo "<b>".lang("Error").":</b>";
|
||||
echo $error;
|
||||
$phpgw->common->phpgw_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
$phpgw->template->set_file(array("search_t" => "search.tpl",
|
||||
"search_list" => "search_list.tpl"));
|
||||
|
||||
$phpgw->template->set_block("search_t","search_list");
|
||||
|
||||
$phpgw->template->set_var("color",$phpgw_info["theme"]["bg_text"]);
|
||||
$phpgw->template->set_var("search_text",lang("Search Results"));
|
||||
$phpgw->template->set_var("quantity",$quantity);
|
||||
|
||||
// now sort by number of hits
|
||||
if (! strlen($error)) {
|
||||
arsort ($ids);
|
||||
for (reset($ids); $key = key($ids); next($ids)) {
|
||||
echo "<LI><A HREF=\"" . $phpgw->link("view.php","id=$key") . "\">" . $info[$key] . "</A>\n";
|
||||
|
||||
$phpgw->template->set_var("url_result",$phpgw->link("view.php","id=$key"));
|
||||
$phpgw->template->set_var("result_desc",$info[$key]);
|
||||
$phpgw->template->parse("output","search_list",True);
|
||||
}
|
||||
} else {
|
||||
echo $error;
|
||||
}
|
||||
|
||||
?>
|
||||
$phpgw->template->pparse("out","search_t");
|
||||
|
||||
<P>
|
||||
<?php
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
|
6
calendar/templates/default/search.tpl
Executable file
6
calendar/templates/default/search.tpl
Executable file
@ -0,0 +1,6 @@
|
||||
<!-- $Id$ -->
|
||||
<h2><font color="{color}">{search_text}</font></h2>
|
||||
<b>{quantity}</b><p>
|
||||
{output}
|
||||
<p>
|
||||
|
4
calendar/templates/default/search_list.tpl
Executable file
4
calendar/templates/default/search_list.tpl
Executable file
@ -0,0 +1,4 @@
|
||||
<!-- $Id$ -->
|
||||
<!-- BEGIN search_list -->
|
||||
<li><a href="{url_result}">{result_desc}</a>
|
||||
<!-- END search_list -->
|
Loading…
Reference in New Issue
Block a user