- $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');
- parent::__construct($set, $data, $params);
- }
-
- public function fields()
- {
- return "u.user_id AS id,
- u.*, a.alias AS forlife,
- u.perms != 'pending' AS inscrit,
- u.perms != 'pending' AS wasinscrit,
- u.deces != 0 AS dcd, u.deces, u.matricule_ax,
- FIND_IN_SET('femme', u.flags) AS sexe,
- e.entreprise, es.label AS secteur, ef.fonction_fr AS fonction,
- IF(n.nat='',n.pays,n.nat) AS nat, n.a2 AS iso3166,
- 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" .
- (S::logged() ? ", c.contact AS contact" : '');
- }
-
- public function joins()
- {
- return "LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id".(S::logged() ? "" : " AND e.pub = 'public'").")
- LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id)
- LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id)
- LEFT JOIN geoloc_pays AS n ON (u.nationalite = n.a2)
- LEFT JOIN applis_ins AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0)
- LEFT JOIN applis_def AS ad0 ON (ad0.id = ai0.aid)
- LEFT JOIN applis_ins AS ai1 ON (u.user_id = ai1.uid AND ai1.ordre = 1)
- LEFT JOIN applis_def AS ad1 ON (ad1.id = ai1.aid)
- LEFT JOIN adresses AS adr ON (u.user_id = adr.uid
- 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')" .
- (S::logged() ?
- "LEFT JOIN contacts AS c On (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")"
- : "");