Fix organizer display for events created by xnet accounts.
[platal.git] / modules / search.php
index edf62ef..e3bfee7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2011 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -158,8 +158,8 @@ class SearchModule extends PLModule
         $networks[0] = '-';
         ksort($networks);
         $page->assign('networking_types', $networks);
-        $origin_corps_list = DirEnum::getOptions(DirEnum::CURRENTCORPS);
-        $current_corps_list = DirEnum::getOptions(DirEnum::ORIGINCORPS);
+        $origin_corps_list = DirEnum::getOptions(DirEnum::ORIGINCORPS);
+        $current_corps_list = DirEnum::getOptions(DirEnum::CURRENTCORPS);
         $corps_rank_list = DirEnum::getOptions(DirEnum::CORPSRANKS);
         $origin_corps_list[0] = '-';
         $current_corps_list[0] = '-';
@@ -213,7 +213,7 @@ class SearchModule extends PLModule
         $page->assign('public_directory',0);
     }
 
-    private function format_autocomplete(array $item)
+    static public function format_autocomplete(array $item)
     {
         return $item['field'] . ' (' . $item['nb'] . ' camarade' . ($item['nb'] > 1 ? 's' : '') . ')';
     }
@@ -262,7 +262,7 @@ class SearchModule extends PLModule
                         'nb'    => $aux[1],
                         'id'    => $aux[2]
                     );
-                    $item['value'] = $this->format_autocomplete($item);
+                    $item['value'] = self::format_autocomplete($item);
                     array_push($list, $item);
                 }
             }
@@ -292,7 +292,7 @@ class SearchModule extends PLModule
             $to_cache = '';
             foreach ($list as &$item) {
                 $to_cache .= $item['field'] . "\t" . $item['nb'] . "\t" . $item['id'] . "\n";
-                $item['value'] = $this->format_autocomplete($item);
+                $item['value'] = self::format_autocomplete($item);
             }
         }
 
@@ -414,6 +414,7 @@ class SearchModule extends PLModule
         $wp->buildCache();
 
         $page->setTitle('Emploi et Carrières');
+        $page->addJsLink('jquery.ui.xorg.js');
 
         // Count mentors
         $res = XDB::query("SELECT count(distinct pid) FROM profile_mentor_term");
@@ -423,6 +424,12 @@ class SearchModule extends PLModule
         require_once 'ufbuilder.inc.php';
         $ufb = new UFB_MentorSearch();
         if (!$ufb->isEmpty()) {
+
+            // Search query is logged
+            if (S::logged() && !Env::has('page')) {
+                S::logger()->log('search_referent', 'adv=' . var_export($_GET, true));
+            }
+
             require_once 'userset.inc.php';
             $ufc = $ufb->getUFC();
             $set = new ProfileSet($ufc);
@@ -464,5 +471,5 @@ class SearchModule extends PLModule
     }
 }
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
 ?>