$profile->id(), $field);
}
- public static function getCondition(PlUser &$user)
+ public function getCondition(PlUser &$user)
{
- return new UFC_And(new UFC_ProfileUpdated('>=', $user->watch_last),
+ return new UFC_And(new UFC_ProfileUpdated('>', $user->watch_last),
new UFC_WatchContacts($user->id()));
}
}
{
const ID = 2;
- public static function getCondition(PlUser &$user)
+ public function getCondition(PlUser &$user)
{
- return new UFC_And(new UFC_Registered(false, '>=', $user->watch_last),
- new UFC_WatchRegistration($user->id()));
+ return new UFC_And(new UFC_Registered(false, '>', $user->watch_last),
+ new UFC_Or(new UFC_WatchContacts($user->id()),
+ new UFC_WatchPromo($user->id()),
+ new UFC_WatchRegistration($user->id())));
}
}
{
const ID = 3;
- public static function getCondition(PlUser &$user)
+ public function getCondition(PlUser &$user)
{
- return new UFC_And(new UFC_Dead('>=', $user->watch_last, true),
+ return new UFC_And(new UFC_Dead('>', $user->watch_last, true),
new UFC_Or(new UFC_WatchPromo($user->id()),
new UFC_WatchContacts($user->id())));
}
{
const ID = 4;
- public static function getCondition(PlUser &$user)
+ public function getCondition(PlUser &$user)
{
- return new UFC_And(new UFC_Birthday(),
+ return new UFC_And(new UFC_OR(new UFC_Birthday('=', time()),
+ new UFC_And(new UFC_Birthday('<=', time() + 864000),
+ new UFC_Birthday('>', $user->watch_last + 864000))),
new UFC_Or(new UFC_WatchPromo($user->id()),
new UFC_WatchContacts($user->id())));
}
}
+class Watch
+{
+ private static $classes = array('WatchRegistration',
+ 'WatchProfileUpdate',
+ 'WatchDeath',
+ 'WatchBirthday');
+
+ private static function fetchCount(PlUser &$user, $class)
+ {
+ $obj = new $class();
+ $uf = new UserFilter($obj->getCondition($user));
+ return $uf->getTotalCount();
+ }
+
+ public static function getCount(PlUser &$user)
+ {
+ $count = 0;
+ foreach (self::$classes as $class) {
+ $count += self::fetchCount($user, $class);
+ }
+ return $count;
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>