method edit documentation in bbn\Appui\Event
function(string $id, array $event)
{
if ( Str::isUid($id) ){
$f =& $this->fields;
$rf =& $this->class_cfg['arch']['recurring'];
$ok = 0;
$old_is_rec = $this->db->selectOne($this->class_table, $this->fields['recurring'], [
$this->fields['id'] => $id
]);
if ( array_key_exists($f['id'], $event) ){
unset($event[$f['id']]);
}
if (
!empty($event[$f['cfg']]) &&
!Str::isJson($event[$f['cfg']])
){
$event[$f['cfg']] = json_encode($event[$f['cfg']]);
}
$ok2 = $this->db->update($this->class_table, [
$f['id_type'] => $event[$f['id_type']],
$f['start'] => $event[$f['start']],
$f['end'] => $event[$f['end']] ?? null,
$f['name'] => $event[$f['name']] ?? null,
$f['recurring'] => $event[$f['recurring']] ?? 0,
$f['cfg'] => $event[$f['cfg']] ?? null
], [
$f['id'] => $id
]);
if ( !empty($event[$f['recurring']]) ){
$ok = $this->db->insertUpdate($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
]);
}
else if ( !empty($old_is_rec) ){
$this->deleteRecurrences($id);
}
return $ok || $ok2;
}
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.
© 2011-2023
BBN Solutions