method getWhenObject documentation in bbn\Appui\Event

Makes a When object by an event.

function(array &$event) { // Recurring table fields $rf =& $this->class_cfg['arch']['recurring']; // Events table fields $ef =& $this->class_cfg['arch']['events']; // Extra fields $extf =& $this->class_cfg['arch']['extra']; // When object instance $when = new \When\When($event[$ef['start']]); // Trick to have the possibility to set the start date different to the first occurrence $when->RFC5545_COMPLIANT = 2; // Set the frequency $when->freq($event[$rf['type']]); // Remove the original event from the occurrences $excs = $event[$ef['start']]; // If the exceptions are present add them to exclusions list if ( !empty($event[$extf['exceptions']]) ){ if ( \is_array($event[$extf['exceptions']]) ){ $excs .= implode(',', $event[$extf['exceptions']]); } else if ( \is_string($event[$extf['exceptions']]) ){ $excs .= $event[$extf['exceptions']]; } } $when->exclusions($excs); // Interval if ( !empty($event[$rf['interval']]) ){ $when->interval($event[$rf['interval']] + 1); } // Number of occurrences if ( !empty($event[$rf['occurrences']]) ){ $when->count($event[$rf['occurrences']]); } // Until if ( !empty($event[$rf['until']]) ){ $until = new \DateTime($event[$rf['until']]); $until->add(new \DateInterval('P1D')); $when->until($until); } // Specific week's day if ( \is_null($event[$rf['wd']]) ){ $event[$rf['wd']] = []; } else if (Str::isJson($event[$rf['wd']]) ){ $event[$rf['wd']] = json_decode($event[$rf['wd']], true); } if ( !empty($event[$rf['wd']]) ){ $wds =& $this->weekdays; $days = array_map(function($d) use($wds){ return substr($wds[$d], 0, 2); }, $event[$rf['wd']]); $when->byday($days); } // Specific month's day if ( \is_null($event[$rf['md']]) ){ $event[$rf['md']] = []; } else if (Str::isJson($event[$rf['md']]) ){ $event[$rf['md']] = json_decode($event[$rf['md']], true); } if ( !empty($event[$rf['md']]) ){ $when->bymonthday($event[$rf['md']]); } // Specific year's month if ( \is_null($event[$rf['ym']]) ){ $event[$rf['ym']] = []; } else if (Str::isJson($event[$rf['ym']]) ){ $event[$rf['ym']] = json_decode($event[$rf['ym']], true); } if ( !empty($event[$rf['ym']]) ){ $when->bymonth($event[$rf['ym']]); } // Specific month's week if ( \is_null($event[$rf['mw']]) ){ $event[$rf['mw']] = []; } else if (Str::isJson($event[$rf['mw']]) ){ $event[$rf['mw']] = json_decode($event[$rf['mw']], true); } return $when; }

Makes a When object by an event. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.