- global $globals;
- return "u.user_id AS id, u.*,
- CONCAT(a.alias, '@{$globals->mail->domain}') AS bestemail,
- 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, e.web AS job_web, 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 aliases AS a ON (a.id = u.user_id AND FIND_IN_SET('bestalias', a.flags))
- 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') . ")"
- : "");
+ parent::__construct(new UFC_Email($emails));
+ }
+}
+
+
+/** A multipage view for profiles or users
+ * Allows the display of bounds when sorting by name or promo.
+ */
+abstract class MixedView extends MultipageView
+{
+ protected function getBoundValue($obj)
+ {
+ if ($obj instanceof Profile) {
+ switch ($this->bound_field) {
+ case 'name':
+ $name = $obj->name('%l');
+ return strtoupper($name);
+ case 'promo':
+ return $obj->promo();
+ default:
+ return null;
+ }
+ } elseif ($obj instanceof User) {
+ switch ($this->bound_field) {
+ case 'name':
+ $name = $obj->lastName();
+ return strtoupper($name);
+ case 'promo':
+ if ($obj->hasProfile()) {
+ return $obj->profile()->promo();
+ } else {
+ return 'ext';
+ }
+ default:
+ return null;
+ }
+ }
+ return null;