/** * Delete Ephemeride * @author The Zikula Development Team * @param 'eid' the id of the ephemerid * @return true if success, false otherwise */ public function delete($args) { // argument check if (!isset($args['eid']) || !is_numeric($args['eid'])) { return LogUtil::registerArgsError(); } // get the existing item $item = ModUtil::apiFunc('Ephemerides', 'user', 'get', array('eid' => $args['eid'])); if (!$item) { return LogUtil::registerError($this->__('No such Ephemeride found.')); } // delete the item and check the return value for error $res = DBUtil::deleteObjectByID('ephem', $args['eid'], 'eid'); if (!$res) { return LogUtil::registerError($this->__('Error! Ephemeride deletion failed.')); } // delete any object category mappings for this item ObjectUtil::deleteObjectCategories($item, 'ephem', 'eid'); return true; }
/** * Post-processing after this object has beens deleted. * * This routine is responsible for deleting the 'extra' data (attributes, categories, * and meta data) from the database and the optionally creating an * entry in the object-log table. * * @param mixed $object The object wehave just saved. * @param string $table The treated table reference. * @param integer $idfield The id column for the object/table combination. * * @deprecated * @see CategorisableListener, AttributableListener, MetaDataListener, LoggableListener * @return void */ private static function _deletePostProcess($object, $table, $idfield) { $tables = self::getTables(); $enableAllServices = isset($tables["{$table}_db_extra_enable_all"]) && $tables["{$table}_db_extra_enable_all"]; if (($enableAllServices || isset($tables["{$table}_db_extra_enable_categorization"]) && $tables["{$table}_db_extra_enable_categorization"]) && System::getVar('Z_CONFIG_USE_OBJECT_CATEGORIZATION') && $table != 'categories_' && $table != 'objectdata_attributes' && $table != 'objectdata_log' && ModUtil::available('ZikulaCategoriesModule')) { ObjectUtil::deleteObjectCategories($object, $table, $idfield); } if ((isset($tables["{$table}_db_extra_enable_all"]) && $tables["{$table}_db_extra_enable_all"] || isset($tables["{$table}_db_extra_enable_attribution"]) && $tables["{$table}_db_extra_enable_attribution"] || System::getVar('Z_CONFIG_USE_OBJECT_ATTRIBUTION')) && $table != 'objectdata_attributes' && $table != 'objectdata_log') { ObjectUtil::deleteObjectAttributes($object, $table, $idfield); } if (($enableAllServices || isset($tables["{$table}_db_extra_enable_meta"]) && $tables["{$table}_db_extra_enable_meta"] || System::getVar('Z_CONFIG_USE_OBJECT_META')) && $table != 'objectdata_attributes' && $table != 'objectdata_meta' && $table != 'objectdata_log') { ObjectUtil::deleteObjectMetaData($object, $table, $idfield); } if (($enableAllServices || isset($tables["{$table}_db_extra_enable_logging"]) && $tables["{$table}_db_extra_enable_logging"]) && System::getVar('Z_CONFIG_USE_OBJECT_LOGGING') && strcmp($table, 'objectdata_log') !== 0) { $log = new ObjectData_Log(); $log['object_type'] = $table; $log['object_id'] = $object[$idfield]; $log['op'] = 'D'; $log['diff'] = serialize($object); $log->save(); } }