X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fuserset.inc.php;h=31358d261dc2eaf0f5f7456e065d6c02a98c49a0;hb=7f12e3b4113791f3372f11572a205925d7bb6b97;hp=ab77c016429e9ea1af5698daeb3bd8beb308c469;hpb=f70f2bcdc077c220e40ecebaf569e097f6028743;p=platal.git diff --git a/include/userset.inc.php b/include/userset.inc.php index ab77c01..31358d2 100644 --- a/include/userset.inc.php +++ b/include/userset.inc.php @@ -163,11 +163,11 @@ class MinificheView extends MultipageView global $globals; $this->entriesPerPage = $globals->search->per_page; if (@$params['with_score']) { - $this->addSortKey('score', array('-score', '-date', '-promo', 'nom', 'prenom'), 'pertinence'); + $this->addSortKey('score', array('-score', '-date', '-promo', 'name_sort'), 'pertinence'); } - $this->addSortKey('name', array('nom', 'prenom'), 'nom'); - $this->addSortKey('promo', array('-promo', 'nom', 'prenom'), 'promotion'); - $this->addSortKey('date_mod', array('-date', '-promo', 'nom', 'prenom'), 'dernière modification'); + $this->addSortKey('name', array('name_sort'), 'nom'); + $this->addSortKey('promo', array('-promo', 'name_sort'), 'promotion'); + $this->addSortKey('date_mod', array('-date', '-promo', 'name_sort'), 'dernière modification'); parent::__construct($set, $data, $params); } @@ -184,8 +184,8 @@ class MinificheView extends MultipageView ad0.text AS app0text, ad0.url AS app0url, ai0.type AS app0type, ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type, adr.city, gp.a2, gp.pays AS countrytxt, gr.name AS region, - IF(u.nom_usage<>'',u.nom_usage,u.nom) AS sortkey, - (COUNT(em.email) > 0 OR FIND_IN_SET('googleapps', u.mail_storage) > 0) AS actif" . + (COUNT(em.email) > 0 OR FIND_IN_SET('googleapps', u.mail_storage) > 0) AS actif, + nd.display AS name_display, nd.tooltip AS name_tooltip, nd.sort AS name_sort" . (S::logged() ? ", c.contact AS contact" : ''); } @@ -203,12 +203,30 @@ class MinificheView extends MultipageView AND FIND_IN_SET('active', adr.statut)".(S::logged() ? "" : " AND adr.pub = 'public'").") LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2) LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region) - LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = 'active')" . + LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = 'active') + INNER JOIN profile_names_display AS nd ON (nd.user_id = u.user_id)" . (S::logged() ? "LEFT JOIN contacts AS c On (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")" : ""); } + public function bounds() + { + $order = Env::v('order', $this->defaultkey); + $show_bounds = 0; + if (($order == "name") || ($order == "-name")) { + $this->bound_field = "nom"; + $show_bounds = 1; + } elseif (($order == "promo") || ($order == "-promo")) { + $this->bound_field = "promo"; + $show_bounds = -1; + } + if ($order{0} == '-') { + $show_bounds = -$show_bounds; + } + return $show_bounds; + } + public function templateName() { return 'include/plview.minifiche.tpl'; @@ -221,17 +239,40 @@ class MentorView extends MultipageView { $this->entriesPerPage = 10; $this->addSortKey('rand', array('RAND(' . S::i('uid') . ')'), 'aléatoirement'); - $this->addSortKey('name', array('nom', 'prenom'), 'nom'); - $this->addSortKey('promo', array('-promo', 'nom', 'prenom'), 'promotion'); - $this->addSortKey('date_mod', array('-date', '-promo', 'nom', 'prenom'), 'dernière modification'); + $this->addSortKey('name', array('name_sort'), 'nom'); + $this->addSortKey('promo', array('-promo', 'name_sort'), 'promotion'); + $this->addSortKey('date_mod', array('-date', '-promo', 'name_sort'), 'dernière modification'); parent::__construct($set, $data, $params); } public function fields() { - return "m.uid, u.prenom, u.nom, u.promo, - a.alias AS forlife, m.expertise, mp.pid, - ms.secteur, ms.ss_secteur"; + return "m.uid, u.promo, + a.alias AS bestalias, m.expertise, mp.pid, + ms.secteur, ms.ss_secteur, + nd.display AS name_display, nd.tooltip AS name_tooltip, nd.sort AS name_sort"; + } + + public function joins() + { + return "INNER JOIN profile_names_display AS nd ON (nd.user_id = u.user_id)"; + } + + public function bounds() + { + $order = Env::v('order', $this->defaultkey); + $show_bounds = 0; + if (($order == "name") || ($order == "-name")) { + $this->bound_field = "nom"; + $show_bounds = 1; + } elseif (($order == "promo") || ($order == "-promo")) { + $this->bound_field = "promo"; + $show_bounds = -1; + } + if ($order{0} == '-') { + $show_bounds = -$show_bounds; + } + return $show_bounds; } public function templateName() @@ -245,23 +286,41 @@ class TrombiView extends MultipageView public function __construct(PlSet &$set, $data, array $params) { $this->entriesPerPage = 24; - $this->order = explode(',', Env::v('order', 'nom,prenom,promo')); + $this->order = explode(',', Env::v('order', 'name_sort')); if (@$params['with_score']) { - $this->addSortKey('score', array('-score', '-watch_last', '-promo', 'nom', 'prenom'), 'pertinence'); + $this->addSortKey('score', array('-score', '-watch_last', '-promo', 'name_sort'), 'pertinence'); } - $this->addSortKey('name', array('nom', 'prenom'), 'nom'); - $this->addSortKey('promo', array('-promo', 'nom', 'prenom'), 'promotion'); + $this->addSortKey('name', array('name_sort'), 'nom'); + $this->addSortKey('promo', array('-promo', 'name_sort'), 'promotion'); parent::__construct($set, $data, $params); } public function fields() { - return "u.user_id, IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom, u.prenom, u.promo, a.alias AS forlife "; + return "u.user_id, nd.display AS name_display, nd.tooltip AS name_tooltip, nd.sort AS name_sort, u.promo, a.alias AS forlife "; } public function joins() { - return "INNER JOIN photo AS p ON (p.uid = u.user_id) "; + return "INNER JOIN photo AS p ON (p.uid = u.user_id) + INNER JOIN profile_names_display AS nd ON (nd.user_id = u.user_id)"; + } + + public function bounds() + { + $order = Env::v('order', $this->defaultkey); + $show_bounds = 0; + if (($order == "name") || ($order == "-name")) { + $this->bound_field = "nom"; + $show_bounds = 1; + } elseif (($order == "promo") || ($order == "-promo")) { + $this->bound_field = "promo"; + $show_bounds = -1; + } + if ($order{0} == '-') { + $show_bounds = -$show_bounds; + } + return $show_bounds; } public function templateName() @@ -385,7 +444,6 @@ class GadgetView implements PlView { return "u.user_id AS id, u.*, a.alias AS forlife," . - (S::logged() ? "q.profile_mobile AS mobile, " : "IF(q.profile_mobile_pub = 'public', q.profile_mobile, NULL) as mobile, ") . "u.perms != 'pending' AS inscrit, u.perms != 'pending' AS wasinscrit, u.deces != 0 AS dcd, u.deces,