method insert documentation in bbn\Appui\Event

function(array $event) { $f =& $this->fields; if ( (X::hasProps($event, [$f['id_type']], true) ) && (array_key_exists($this->fields['start'], $event))){ if ( !empty($event[$f['cfg']]) && !Str::isJson($event[$f['cfg']]) ){ $event[$f['cfg']] = json_encode($event[$f['cfg']]); } // Check if the event is recurring if ( $is_rec = !empty($event[$f['recurring']]) ){ $rf =& $this->class_cfg['arch']['recurring']; // If the event's start date is different of its first recurrence to change the start date if ( ($first = $this->getFirstRecurrence($event, false)) && ($event[$f['start']] !== $first) ){ // Check if the event has an end date and to change it if ( !empty($event[$f['end']]) ){ $diff = date_diff(new DateTime($event[$f['start']]), new DateTime($event[$f['end']])); $end = new DateTime($first); $event[$f['end']] = $end->add($diff)->format('Y-m-d H:i:s'); } $event[$f['start']] = $first; } } if ( $this->db->insert($this->class_table, [ $f['id_parent'] => $event[$f['id_parent']] ?? null, $f['id_type'] => $event[$f['id_type']], $f['start'] => $event[$f['start']], $f['end'] => empty($event[$f['end']]) ? null : $event[$f['end']], $f['name'] => empty($event[$f['name']]) ? null : $event[$f['name']], $f['recurring'] => (int)$is_rec, $f['cfg'] => $event[$f['cfg']] ?? null ]) && ($id = $this->db->lastId()) ){ if ( $is_rec ){ $this->db->insert($this->class_cfg['tables']['recurring'], [ $rf['id_event'] => $id, $rf['type'] => $event[$rf['type']], $rf['interval'] => $event[$rf['interval']] ?? null, $rf['occurrences'] => $event[$rf['occurrences']] ?? null, $rf['until'] => $event[$rf['until']] ?? null, $rf['wd'] => !empty($event[$rf['wd']]) ? (Str::isJson($event[$rf['wd']]) ? $event[$rf['wd']] : json_encode($event[$rf['wd']])) : null, $rf['mw'] => !empty($event[$rf['mw']]) ? (Str::isJson($event[$rf['mw']]) ? $event[$rf['mw']] : json_encode($event[$rf['mw']])) : null, $rf['md'] => !empty($event[$rf['md']]) ? (Str::isJson($event[$rf['md']]) ? $event[$rf['md']] : json_encode($event[$rf['md']])) : null, $rf['ym'] => !empty($event[$rf['ym']]) ? (Str::isJson($event[$rf['ym']]) ? $event[$rf['ym']] : json_encode($event[$rf['ym']])) : null ]); } return $id; } } return null; }

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.