function delete() { $old_assign_object = new AssignObject($this->id); $ret = parent::delete(); $old_assign_object->delete(); return $ret; }
/** * {@inheritdoc } */ public function delete() { // Resort members $query = "UPDATE statusgruppe_user SET position = position - 1 WHERE statusgruppe_id = ? AND position > ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->statusgruppe_id, $this->position)); return parent::delete(); }
/** * Deletes the asset. * * @return int indicating how many rows were deleted */ public function delete() { $filename = $this->getFilepath(); if (file_exists($filename)) { unlink($filename); } return parent::delete(); }
/** * Delete all the links to this file and the file itself. */ public function delete() { $db = DBManager::get(); if (isset($this->storage_object)) { $this->storage_object->delete(); } $stmt = $db->prepare('DELETE FROM file_refs WHERE file_id = ?'); $stmt->execute(array($this->file_id)); parent::delete(); }
public function delete() { // do not delete until one calendar is left if (sizeof($this->calendars) > 1) { return false; } $calendars = $this->calendars; $ret = parent::delete(); // only one calendar is left if ($ret) { $calendars->each(function ($c) { $c->delete(); }); } return $ret; }
public function afterUpdate(SimpleORMap $object, $line) { $old_domains = array_map(function ($domain) { return $domain->getID(); }, $this->old_domains); $new_domains = UserDomain::getUserDomainsForUser($object->getId()); foreach ($new_domains as $domain_id) { if (!in_array($domain_id, $old_domains)) { if ($domain_id === "alumni") { if (count($new_domains) == 1) { $statement = DBManager::get()->prepare("\n SELECT seminar_user.Seminar_id \n FROM seminar_user\n LEFT JOIN seminar_userdomain ON (seminar_user.Seminar_id = seminar_userdomain.Seminar_id)\n WHERE seminar_user.user_id = :user_id\n AND seminar_user.Seminar_id NOT IN (SELECT seminar_id FROM seminar_userdomain WHERE userdomain_id = 'alumni')\n "); $statement->execute(array('user_id' => $object->getId())); foreach ($statement->fetchAll(PDO::FETCH_COLUMN, 0) as $seminar_id) { $seminar = new Seminar($seminar_id); $seminar->deleteMember($object->getId()); } } $datafield = Datafield::findOneBySQL("name = 'Ich will weiterhin als Alumni in Stud.IP geführt werden' AND object_type = 'user'"); $user_wants_to_stay = DatafieldEntry::findOneBySQL("datafield_id = ? AND range_id = ?", array($datafield->getId(), $object->getId())); if ($user_wants_to_stay['content']) { //In Veranstaltung ALUMNI die Statusgruppe anlegen: $datafield = Datafield::findOneBySQL("name = 'Alumni' AND object_type = 'user'"); $entry = DatafieldEntry::findOneBySQL("datafield_id = ? AND range_id = ?", array($datafield->getId(), $object->getId())); $course = Course::findOneByName("ALUMNI"); $gruppenname = $entry ? $entry['content'] : null; if ($course && $gruppenname) { $statusgruppe = Statusgruppen::findOneBySQL("name = ? range_id = ?", array($gruppenname, $course->getId())); if (!$statusgruppe) { $statusgruppe = new Statusgruppen(); $statusgruppe['name'] = $gruppenname; $statusgruppe['range_id'] = $course->getId(); $statusgruppe->store(); } if (!$statusgruppe->isMember($object->getId())) { $statusgruppe->addUser($object->getId()); } } } else { $object->delete(); $deleted = true; } } } } }
/** * delete entry from database * the object is cleared and turned to new state * @return boolean */ public function delete() { if (!$this->isNew()) { // Remove banner file unlink($GLOBALS['DYNAMIC_CONTENT_PATH'] . '/banner/' . $this->banner_path); } return parent::delete(); }
public function delete() { $db = DBManager::get(); $query = "DELETE FROM resources_requests_properties WHERE request_id=" . $db->quote($this->getId()); $properties_deleted = $db->exec($query); // LOGGING log_event("RES_REQUEST_DEL", $this->seminar_id, $this->resource_id, "Termin: {$this->termin_id}, Metadate: {$this->metadate_id}", ""); return parent::delete() || $properties_deleted; }
public function delete() { parent::delete(); unlink($this->getFilePath()); }
/** * @see SimpleORMap::delete() */ function delete() { $id = $this->getId(); $object_type = $this->object_type; $ret = parent::delete(); $db = DBManager::get(); $tables['sem'] = 'seminare'; $tables['inst'] = 'Institute'; $tables['user'] = '******'; $db->exec("UPDATE " . $tables[$object_type] . " SET lock_rule='' WHERE lock_rule = " . $db->quote($id)); return $ret; }
public function delete() { $success = parent::delete(); if ($success) { $this->setTopics(array()); @unlink($this->getFilePath()); } return $success; }
function delete() { object_kill_visits(null, $this->getId()); object_kill_views($this->getId()); return parent::delete(); }
/** * Delete entry from database. * The object is cleared and turned to new state. * Posts the Notifications "Document(Will|Did)Delete" if successful. * The subject of the notification is the former document. * * @return boolean always true */ function delete() { $to_delete = clone $this; NotificationCenter::postNotification('DocumentWillDelete', $to_delete); if ($ret = parent::delete()) { NotificationCenter::postNotification('DocumentDidDelete', $to_delete); } return $ret; }
public function delete() { $id = $this->getId(); NotificationCenter::postNotification("PostingWillDelete", $this); foreach ((array) self::findBySQL(__CLASS__, "parent_id = " . DBManager::get()->quote($this->getId())) as $child_posting) { $child_posting->delete(); } $success = parent::delete(); if ($success) { NotificationCenter::postNotification("PostingHasDeleted", $this); } DBManager::get()->exec("INSERT INTO blubber_events_queue " . "SET event_type = 'delete', " . "item_id = " . DBManager::get()->quote($id) . ", " . "mkdate = UNIX_TIMESTAMP() " . ""); return $success; }
/** * Deletes the cycle. * * @return int number of affected rows */ public function delete() { $cycle_info = $this->toString(); $seminar_id = $this->seminar_id; $result = parent::delete(); if ($result) { StudipLog::log('SEM_DELETE_CYCLE', $seminar_id, null, $cycle_info); } return $result; }
/** * Deletes this posting and all regarding information. * @return integer: 1 if posting successfully deleted, else 0. */ public function delete() { $id = $this->getId(); $root_id = $this['root_id']; NotificationCenter::postNotification("PostingWillDelete", $this); foreach ((array) self::findBySQL("parent_id = ? ", array($id)) as $child_posting) { $child_posting->delete(); } $success = parent::delete(); if ($success) { NotificationCenter::postNotification("PostingHasDeleted", $this); } //insert into event-queue so it disappears from people's live-stream $delete_stmt = DBManager::get()->prepare("INSERT INTO blubber_events_queue " . "SET event_type = 'delete', " . "item_id = :item_id, " . "mkdate = UNIX_TIMESTAMP() " . ""); $delete_stmt->execute(array('item_id' => $id)); if ($id !== $root_id) { $thread = new BlubberPosting($root_id); $thread['chdate'] = time(); $thread->store(); } else { $delete_hashtags = DBManager::get()->prepare("DELETE FROM blubber_tags " . "WHERE topic_id = :topic_id " . ""); $delete_hashtags->execute(array('topic_id' => $id)); } return $success; }