Beispiel #1
0
function generate_wats4u_extract()
{
    $pf = new ProfileFilter(new PFC_True());
    // For debug: replace with iterProfiles(new PlLimit(100));
    $profiles = $pf->iterProfiles();
    $alive_profiles = PlIteratorUtils::filter($profiles, '_filter_profile');
    return PlIteratorUtils::map($alive_profiles, '_map_profile');
}
Beispiel #2
0
 /** Return an iterator over the validation concerning the given type
  * and the given user.
  *
  * @param type The type of the validations to fetch, null mean "any type"
  * @param applyTo A User or a Profile object the validation applies to.
  */
 public static function iterate($type = null, $applyTo = null)
 {
     function toValidation($elt)
     {
         list($result, $stamp) = $elt;
         $result = Validate::unserialize($result);
         $result->stamp = $stamp;
         return $result;
     }
     $where = array();
     if ($type) {
         $where[] = XDB::format('type = {?}', $type);
     }
     if ($applyTo) {
         if ($applyTo instanceof User) {
             $where[] = XDB::format('uid = {?}', $applyTo->id());
         } else {
             if ($applyTo instanceof Profile) {
                 $where[] = XDB::format('pid = {?}', $applyTo->id());
             }
         }
     }
     if (!empty($where)) {
         $where = 'WHERE ' . implode('AND', $where);
     } else {
         $where = '';
     }
     $it = XDB::iterRow('SELECT  data, DATE_FORMAT(stamp, "%Y%m%d%H%i%s")
                           FROM  requests
                              ' . $where . '
                       ORDER BY  stamp');
     return PlIteratorUtils::map($it, 'toValidation');
 }
Beispiel #3
0
 function handler_ical(PlPage $page, PlUser $user)
 {
     require_once 'ical.inc.php';
     $page->changeTpl('carnet/calendar.tpl', NO_SKIN);
     $page->register_function('display_ical', 'display_ical');
     $filter = new UserFilter(new UFC_Contact($user));
     $profiles = $filter->iterProfiles();
     $page->assign('events', PlIteratorUtils::map($profiles, array($this, 'buildBirthRef')));
     pl_cached_content_headers('text/calendar', 1);
 }