- $this->addSortKey('rand', array('RAND(' . S::i('uid') . ')'), 'aléatoirement');
- $this->addSortKey('name', array('sort_name'), 'nom');
- $this->addSortKey('promo', array('-d.promo', 'sort_name'), 'promotion');
- $this->addSortKey('date_mod', array('-date', '-d.promo', 'sort_name'), 'dernière modification');
- parent::__construct($set, $data, $params);
- }
-
- public function fields()
- {
- return "m.uid, d.promo, u.hruid,
- m.expertise, mp.country, ms.sectorid, ms.subsectorid,
- d.directory_name, d.sort_name";
- }
-
- public function joins()
- {
- return "INNER JOIN profile_display AS d ON (d.pid = 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;
+ $this->addSort(new PlViewOrder('rand', array(new PFO_Random(S::i('uid'))), 'aléatoirement'));
+ $this->addSort(new PlViewOrder('name', array(new UFO_Name(Profile::DN_SORT)), 'nom'));
+ $this->addSort(new PlViewOrder('promo', array(
+ new UFO_Promo(UserFilter::DISPLAY, true),
+ new UFO_Name(Profile::DN_SORT),
+ ), 'promotion'));
+ $this->addSort(new PlViewOrder('date_mod', array(
+ new UFO_ProfileUpdate(true),
+ new UFO_Promo(UserFilter::DISPLAY, true),
+ new UFO_Name(Profile::DN_SORT),
+ ), 'dernière modification'));
+ parent::__construct($set, $params);