root/releases/0.673/search/index.php

Revision 659, 4.1 kB (checked in by misja, 2 years ago)

Taking gettext to a new level, see message <http://lists.elgg.org/pipermail/development/2006-October/000590.html>. In a nutshell: all gettext calls are replaced by gettext, revamped gettext handling plus some additional fixes.

  • Property svn:eol-style set to native
Line 
1 <?php
2
3     //    ELGG profile search page
4
5         global $PAGE, $db, $search_exclusions;
6     
7     // Run includes
8         require_once(dirname(dirname(__FILE__))."/includes.php");
9         
10         run("search:init");
11         run("search:all:tagtypes");
12
13         define("context","search");
14                 
15         $title = __gettext("Search");
16         templates_page_setup();
17         
18         $PAGE->search_type_unformatted = optional_param('user_type','');
19         $PAGE->search_type = $db->qstr($PAGE->search_type_unformatted);
20         
21         $PAGE->returned_items = optional_param('returned_items','');
22         
23         $querystring = "";
24         if (isset($_GET) && !empty($_GET)) {
25             foreach($_GET as $key => $value) {
26                 if ($key != 'user_type') {
27                     if (!empty($querystring)) {
28                         $querystring .= "&";
29                     }
30                     $querystring .= urlencode($key);
31                     $querystring .= "=";
32                     $querystring .= urlencode(optional_param($key,''));
33                 }
34             }
35         }
36         $querystring = $CFG->wwwroot . "search/index.php?" . $querystring;
37         
38         $body = "<p>" . __gettext("Search for results from:") . " ";
39         
40         if ($PAGE->search_type  == "''") {
41             $body .= "<b class=\"selected_search_type\">";
42         }
43         $body .= "<a href=\"$querystring\">" . __gettext("All") . "</a> ";
44         if ($PAGE->search_type  == "''") {
45             $body .= "</b>";
46         }
47               
48         if (isset($PAGE->search_menu) && is_array($PAGE->search_menu) && !empty($PAGE->search_menu)) {
49             foreach($PAGE->search_menu as $search_type) {
50                 if ($PAGE->search_type_unformatted == $search_type['user_type']) {
51                     $body .= "<b class=\"selected_search_type\">";
52                 }
53                 $body .= "<a href=\"$querystring&user_type=" . $search_type['user_type'] . "\">" . $search_type['name'] . "</a> ";
54                 if ($PAGE->search_type_unformatted == $search_type['user_type']) {
55                     $body .= "</b>";
56                 }
57             }
58         }
59         $body .= "</p>";
60         
61         
62         
63         $querystring = "";
64         if (isset($_GET) && !empty($_GET)) {
65             foreach($_GET as $key => $value) {
66                 if ($key != 'returned_items') {
67                     if (!empty($querystring)) {
68                         $querystring .= "&";
69                     }
70                     $querystring .= urlencode($key);
71                     $querystring .= "=";
72                     $querystring .= urlencode(optional_param($key,''));
73                 }
74             }
75         }
76         $querystring = $CFG->wwwroot . "search/index.php?" . $querystring;
77         
78         $body .= "<p>" . __gettext("Filter by content type:") . " ";
79         if (empty($PAGE->returned_items)) {
80             $body .= "<b class=\"search_displaying_type\">";
81         }
82         $body .= "<a href=\"$querystring\">" . __gettext("Everything") . "</a> ";
83         if (empty($PAGE->returned_items)) {
84             $body .= "</b>";
85         }
86         if ($PAGE->returned_items == 'accounts') {
87             $body .= "<b class=\"search_displaying_type\">";
88         }
89         $body .= "<a href=\"$querystring&returned_items=accounts\">" . __gettext("Users and communities") . "</a> ";
90         if ($PAGE->returned_items == 'accounts') {
91             $body .= "</b>";
92         }
93         if ($PAGE->returned_items == 'resources') {
94             $body .= "<b class=\"search_displaying_type\">";
95         }
96         $body .= "<a href=\"$querystring&returned_items=resources\">" . __gettext("Resources") . "</a> ";
97         if ($PAGE->returned_items == 'resources') {
98             $body .= "</b>";
99         }
100         
101         
102         $body .= run("search:display");
103         
104         $body = templates_draw(array(
105                         'context' => 'contentholder',
106                         'title' => $title,
107                         'body' => $body
108                     )
109                     );
110                     
111         echo templates_page_draw( array(
112                     $title, $body
113                 )
114                 );
115
116 ?>
Note: See TracBrowser for help on using the browser.