42 include
$GLOBALS[
'xoops']->path(
'header.php');
44 $sortby_arr = array();
54 include_once
$GLOBALS[
'xoops']->path(
'class/xoopsformloader.php');
55 $searchform =
new XoopsThemeForm(
"",
"searchform",
"search.php",
"post");
59 $name_tray->addElement(
new XoopsFormText(
'',
'uname', 35, 255) );
60 $searchform->addElement($name_tray);
71 $searchform->addElement($group_tray);
78 $sortby_arr[
$i] =
$fields[
$i]->getVar(
'field_title');
79 switch (
$fields[$i]->getVar(
'field_type')) {
88 $searchform->addElement($tray);
100 $searchform->addElement($element);
106 $element->addOption(1,
_YES);
107 $element->addOption(0,
_NO);
108 $searchform->addElement($element);
120 include_once
$GLOBALS[
'xoops']->path(
'class/xoopslists.php');
121 $element->addOptionArray(XoopsLists::getTimeZoneList());
122 $searchform->addElement($element);
128 $searchform->addElement($element);
136 $sortby_select->addOptionArray($sortby_arr);
137 $searchform->addElement($sortby_select);
142 $searchform->addElement($order_select);
145 $searchform->addElement($limit_text);
149 $searchform->assign(
$GLOBALS[
'xoopsTpl']);
155 $total = sprintf(
_PROFILE_MA_ACTUS,
"<span style='color:#ff0000;'>{$acttotal}</span>");
156 $GLOBALS[
'xoopsTpl']->assign(
'total_users', $total);
161 include_once
$GLOBALS[
'xoops']->path(
'header.php');
163 $xoBreadcrumbs[] = array(
'link' => XOOPS_URL .
"/modules/" .
$GLOBALS[
'xoopsModule']->getVar(
'dirname',
'n') .
'/search.php',
'title' =>
_SEARCH);
174 $searchvars = array();
175 $search_url = array();
187 $string =
"%" . $string;
191 $string =
"%" . $string .
"%";
195 $search_url[] =
"uname=" .
$_REQUEST[
'uname'];
196 $search_url[] =
"uname_match=" .
$_REQUEST[
'uname_match'];
197 $searchvars[] =
"uname";
207 $string =
"%" . $string;
211 $string =
"%" . $string .
"%";
214 $searchvars[] =
"email";
215 $search_url[] =
"email=" .
$_REQUEST[
'email'];
216 $search_url[] =
"email_match=" .
$_REQUEST[
'email_match'];
222 foreach (array_keys(
$fields) as $i ) {
227 $fieldname =
$fields[
$i]->getVar(
'field_name');
228 if (in_array(
$fields[$i]->getVar(
'field_type'), array(
"select",
"radio"))) {
234 switch (
$fields[$i]->getVar(
'field_valuetype')) {
237 $value = array_map(
'intval',
$_REQUEST[$fieldname]);
238 $searchvars[] = $fieldname;
239 $criteria->add(
new Criteria($fieldname,
"(" . implode(
',', $value) .
")",
"IN"));
245 $value = array_map(array(
$GLOBALS[
'xoopsDB'],
"quoteString"),
$_REQUEST[$fieldname]);
246 $searchvars[] = $fieldname;
247 $criteria->add(
new Criteria($fieldname,
"(" . implode(
',', $value) .
")",
"IN"));
250 foreach (
$_REQUEST[$fieldname] as $value) {
251 $search_url[] = $fieldname .
"[]=" . $value;
255 switch (
$fields[$i]->getVar(
'field_valuetype')) {
258 switch (
$fields[$i]->getVar(
'field_type')) {
261 $value =
$_REQUEST[$fieldname.
"_larger"];
262 if (!($value = strtotime(
$_REQUEST[$fieldname.
"_larger"]))) {
263 $value = intval(
$_REQUEST[$fieldname .
"_larger"]);
266 $search_url[] = $fieldname .
"_larger=" . $value;
267 $searchvars[] = $fieldname;
271 $value =
$_REQUEST[$fieldname .
"_smaller"];
272 if (!($value = strtotime(
$_REQUEST[$fieldname .
"_smaller"]))) {
273 $value = intval(
$_REQUEST[$fieldname .
"_smaller"]);
276 $search_url[] = $fieldname .
"_smaller=" . $value;
277 $searchvars[] = $fieldname;
283 if (isset(
$_REQUEST[$fieldname .
"_larger"]) && intval(
$_REQUEST[$fieldname .
"_larger"]) != 0) {
284 $value = intval(
$_REQUEST[$fieldname .
"_larger"]);
285 $search_url[] = $fieldname .
"_larger=" . $value;
286 $searchvars[] = $fieldname;
290 if (isset(
$_REQUEST[$fieldname .
"_smaller"]) && intval(
$_REQUEST[$fieldname .
"_smaller"]) != 0) {
291 $value = intval(
$_REQUEST[$fieldname .
"_smaller"]);
292 $search_url[] = $fieldname .
"_smaller=" . $value;
293 $searchvars[] = $fieldname;
302 $search_url[] = $fieldname .
"=" . $value;
305 $value = array_map(
"intval",
$_REQUEST[$fieldname]);
306 foreach ($value as $thisvalue) {
307 $search_url[] = $fieldname .
"[]=" . $thisvalue;
309 $criteria->add(
new Criteria($fieldname,
"(" . implode(
',', $value) .
")",
"IN"));
312 $searchvars[] = $fieldname;
321 switch (
$_REQUEST[$fieldname .
'_match'] ) {
327 $value =
"%" . $value;
331 $value =
"%" . $value .
"%";
334 $search_url[] = $fieldname .
"=" .
$_REQUEST[$fieldname];
335 $search_url[] = $fieldname .
"_match=" .
$_REQUEST[$fieldname .
'_match'];
338 $searchvars[] = $fieldname;
347 }
else if (
$_REQUEST[
'sortby'] ==
"email") {
349 }
else if (
$_REQUEST[
'sortby'] ==
"uname") {
356 $searchgroups = array();
358 $searchgroups = empty($_REQUEST[
'selgroups']) ? array() : array_map(
"intval", $_REQUEST[
'selgroups']);
359 foreach($searchgroups as $group) {
360 $search_url[] =
'selgroups[]=' . $group;
364 $order = $_REQUEST[
'order'] == 0 ?
"ASC" :
"DESC";
370 $start = isset($_REQUEST[
'start']) ? intval($_REQUEST[
'start']) : 0;
376 $GLOBALS[
'xoopsTpl']->assign(
'total_users', $total);
379 foreach (array_keys($users) as $k) {
380 $userarray = array();
381 $userarray[
"output"][] =
"<a href='userinfo.php?uid=" . $users[$k]->getVar(
'uid') .
"' title=''>" . $users[$k]->getVar(
'uname') .
"</a>";
382 $userarray[
"output"][] = ( $users[$k]->getVar(
'user_viewemail') == 1 || (is_object(
$GLOBALS[
'xoopsUser']) &&
$GLOBALS[
'xoopsUser']->isAdmin()) ) ? $users[$k]->getVar(
'email') :
"";
384 foreach (array_keys(
$fields) as $i) {
385 if (in_array(
$fields[$i]->getVar(
'field_id'), $searchable_fields) && in_array(
$fields[$i]->getVar(
'field_type'),
$searchable_types) && in_array(
$fields[$i]->getVar(
'field_name'), $searchvars)) {
386 $userarray[
"output"][] =
$fields[
$i]->getOutputValue($users[$k], $profiles[$k]);
389 $GLOBALS[
'xoopsTpl']->append(
'users', $userarray);
396 foreach (array_keys(
$fields) as $i) {
397 if (in_array(
$fields[$i]->getVar(
'field_id'), $searchable_fields) && in_array(
$fields[$i]->getVar(
'field_type'),
$searchable_types) && in_array(
$fields[$i]->getVar(
'field_name'), $searchvars)) {
398 $captions[] =
$fields[
$i]->getVar(
'field_title');
401 $GLOBALS[
'xoopsTpl']->assign(
'captions', $captions);
403 if ($total_users >
$limit) {
404 $search_url[] =
"op=results";
405 $search_url[] =
"order=" . $order;
406 $search_url[] =
"sortby=" . htmlspecialchars($_REQUEST[
'sortby']);
407 $search_url[] =
"limit=" .
$limit;
408 if (isset($search_url)) {
409 $args = implode(
"&", $search_url);
412 include_once
$GLOBALS[
'xoops']->path(
'class/pagenav.php');
414 $GLOBALS[
'xoopsTpl']->assign(
'nav',
$nav->renderNav(5));