/** * Delete an entry and associated data * * @return boolean True on success, false on error */ public function delete() { // Remove all children foreach ($this->assetgroups() as $group) { if (!$group->delete()) { $this->setError($group->getError()); } } // Remove all assets foreach ($this->assets() as $asset) { if (!$asset->delete()) { $this->setError($asset->getError()); } } // Remove dates if ($this->get('section_id')) { $dt = new Tables\SectionDate($this->_db); $dt->load($this->get('id'), $this->_scope, $this->get('section_id')); if (!$dt->delete()) { $this->setError($dt->getError()); } } $this->importPlugin('courses')->trigger('onUnitDelete', array($this)); // Remove this record from the database and log the event return parent::delete(); }
/** * Store changes to this offering * * @param boolean $check Perform data validation check? * @return boolean False if error, True on success */ public function delete() { // Remove associated date data $sd = new Tables\SectionDate($this->_db); if (!$sd->deleteBySection($this->get('id'))) { $this->setError($sd->getError()); return false; } // Remove associated member data $sm = new Tables\Member($this->_db); if (!$sm->deleteBySection($this->get('id'))) { $this->setError($sm->getError()); return false; } $value = parent::delete(); $this->importPlugin('courses')->trigger('onAfterDeleteSection', array($this)); return $value; }
/** * Delete an asset * Deleted asset_associations until there is only one * association left, then it deletes the association, * the asset record, and asset file(s) * * @return boolean True on success, false on error */ public function delete() { // Remove dates if ($this->get('section_id')) { $dt = new Tables\SectionDate($this->_db); $dt->load($this->get('id'), $this->_scope, $this->get('section_id')); if (!$dt->delete()) { $this->setError($dt->getError()); } } // Remove this record from the database and log the event return parent::delete(); }