- XDB::execute('REPLACE INTO watch_profile (uid, ts, field)
- VALUES ({?}, NOW(), {?})',
+ if ($count == 1) {
+ return str_replace(array('$x', '$s'), '', $this->title);
+ } else {
+ return str_replace(array('$x', '$s'), array('x', 's'), $this->title);
+ }
+ }
+
+ public function getCondition(Watch $watch)
+ {
+ if (!$watch->user()->watchType($this->flag)) {
+ if (!self::$false) {
+ self::$false = new PFC_False();
+ }
+ return self::$false;
+ } else {
+ return $this->buildCondition($watch);
+ }
+ }
+
+ abstract protected function buildCondition(Watch $watch);
+ abstract public function getOrder();
+ abstract public function getDate(PlUser $user);
+
+ public function publicationDate(PlUser $user)
+ {
+ return $this->getDate($user);
+ }
+
+ public function seen(PlUser $user, $last)
+ {
+ return strtotime($this->getDate($user)) > $last;
+ }
+
+ public function getData(PlUser $user)
+ {
+ return null;
+ }
+}
+
+class WatchProfileUpdate extends WatchOperation
+{
+ 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()',