- $cases = Array(
- 'contacts' => Array('wfield' => 'contact', 'ufield' => 'user_id', 'need_contact' => false,
- 'freq_sql' => '',
- 'contact_sql' => '1'
- ),
- 'watch_promo' => Array('wfield' => 'promo', 'ufield' => 'promo', 'need_contact' => true,
- 'freq_sql' => ' AND ( wc.type = "basic" OR wc.type="near" AND (u.promo <= v.promo_sortie-2 AND u.promo_sortie >= v.promo+2) )',
- 'contact_sql' => 'NOT (c.contact IS NULL)'
- ),
- 'watch_nonins' => Array('wfield' => 'ni_id', 'ufield' => 'user_id', 'need_contact' => false,
- 'freq_sql' => '',
- 'contact_sql' => '0'
- )
- );
-
- $our = $cases[$table];
- $sql = "
- (
- SELECT u.promo, u.prenom, IF(u.nom_usage='',u.nom,u.nom_usage) AS nom,
- u.deces != 0 AS dcd,
- a.alias AS bestalias,
- wo.*,
- {$our['contact_sql']} AS contact,
- (u.perms IN('admin','user')) AS inscrit";
- if ($mail) {
- $sql.=",
- w.uid AS aid, v.prenom AS aprenom, IF(v.nom_usage='',v.nom,v.nom_usage) AS anom,
- b.alias AS abestalias, (v.flags='femme') AS sexe, q.core_mail_fmt AS mail_fmt";
- }
-
- $sql .= "
- FROM $table AS w
- INNER JOIN auth_user_md5 AS u ON(u.{$our['ufield']} = w.{$our['wfield']})
- INNER JOIN auth_user_quick AS q ON(q.user_id = w.uid)
- INNER JOIN auth_user_md5 AS v ON(v.user_id = q.user_id)";
- if ($mail) {
- $sql .="
- INNER JOIN aliases AS b ON(b.id = q.user_id AND FIND_IN_SET('bestalias', b.flags))";
- }
- if ($our['need_contact']) {
- $sql .="
- LEFT JOIN contacts AS c ON(c.uid = w.uid AND c.contact = u.user_id)";
- }
-
- $sql .="
- INNER JOIN watch_ops AS wo ON(wo.uid = u.user_id AND ".($mail ? 'wo.known > q.watch_last' : '( wo.known > {?} OR wo.date=NOW() )').")
- INNER JOIN watch_sub AS ws ON(ws.cid = wo.cid AND ws.uid = w.uid)
- INNER JOIN watch_cat AS wc ON(wc.id = wo.cid{$our['freq_sql']})
- LEFT JOIN aliases AS a ON(a.id = u.user_id AND FIND_IN_SET('bestalias', a.flags))
- WHERE $where
- )";
-
- return $sql;
-}
+ private static $order = null;
+
+ public $flag = 'profile';
+ public $title = 'Mise$s à jour de fiche';
+ private $date = null;
+
+ public static function register(Profile $profile, $field)
+ {
+ XDB::execute('INSERT INTO watch_profile (pid, ts, field)
+ VALUES ({?}, NOW(), {?})
+ ON DUPLICATE KEY UPDATE ts = NOW()',
+ $profile->id(), $field);
+ }