method delete documentation in bbn\Appui\Planning

Deletes a planning row and the linked event

function(string $id_planning, array $event = NULL) { if ( \bbn\Str::isUid($id_planning) && // Get the id_event linked to this planning ($id_event = $this->getIdEvent($id_planning)) && // Get the old event linked to this planning ($old_event = $this->events->getFull($id_event)) && // Events table fields ($ef =& $this->ecfg['arch']['events']) && // Exceptions table fields ($exf =& $this->ecfg['arch']['exceptions']) && // Events extra fields ($extf =& $this->ecfg['extra']) ){ if ( !empty($event) ){ // Check if the "action" property is set if ( empty($event[$extf['action']]) ){ die('The "'.$extf['action'].'" property is mandatory!'); } switch ( $event[$extf['action']] ){ case 'this': // Check if the event is recurring if ( !empty($old_event[$ef['recurring']]) ){ // Check if the event is a recurrence if ( !empty($event[$extf['recurrence']]) ){ return $this->events->addException($id_event, [ $exf['day'] => $event[$ef['start']], $exf['start'] => $event[$ef['start']], $exf['end'] => $event[$ef['end']], $exf['deleted'] => 1 ]); } else if ( // Get the first event's recurrence ($first_recc = $this->events->getFirstRecurrence($old_event, true, true)) && // Make the recurrences fields structure ($event_next = $this->events->makeRecurrencesFields($old_event, [$first_recc])) ){ $event_next = $event_next[0]; return (bool)$this->events->edit($id_event, $event_next); } } else { return $this->_delete($id_planning, $id_event); } break; case 'all': return $this->_delete($id_planning, $id_event); case 'future': if ( !empty($event[$extf['recurrence']]) ){ $until = date('Y-m-d', strtotime('-1 day', strtotime($event[$ef['start']]))); return $this->events->setUntil($id_event, $until); } else { return $this->_delete($id_planning, $id_event); } } } else{ return $this->_delete($id_planning, $id_event); } } return false; }

Deletes a planning row and the linked 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.