function delete() { $db = Loader::db(); $cvID = $this->cvID; $c = Page::getByID($this->cID, $cvID); $cID = $c->getCollectionID(); $q = "select bID, arHandle from CollectionVersionBlocks where cID = ? and cvID = ?"; $r = $db->query($q, array($cID, $cvID)); if ($r) { while ($row = $r->fetchRow()) { if ($row['bID']) { $b = Block::getByID($row['bID'], $c, $row['arHandle']); if (is_object($b)) { $b->deleteBlock(); } } unset($b); } } $features = CollectionVersionFeatureAssignment::getList($this); foreach ($features as $fa) { $fa->delete(); } $r = $db->Execute('select avID, akID from CollectionAttributeValues where cID = ? and cvID = ?', array($cID, $cvID)); while ($row = $r->FetchRow()) { $cak = CollectionAttributeKey::getByID($row['akID']); $cav = $c->getAttributeValueObject($cak); if (is_object($cav)) { $cav->delete(); } } $db->Execute('delete from CollectionVersionBlockStyles where cID = ? and cvID = ?', array($cID, $cvID)); $db->Execute('delete from CollectionVersionThemeCustomStyles where cID = ? and cvID = ?', array($cID, $cvID)); $db->Execute('delete from CollectionVersionRelatedEdits where cID = ? and cvID = ?', array($cID, $cvID)); $db->Execute('delete from CollectionVersionAreaStyles where cID = ? and cvID = ?', array($cID, $cvID)); $q = "delete from CollectionVersions where cID = '{$cID}' and cvID='{$cvID}'"; $r = $db->query($q); $this->refreshCache(); }
public function getFeatureAssignments() { if (is_object($this->vObj)) { return CollectionVersionFeatureAssignment::getList($this); } return array(); }
public function delete() { $app = Facade::getFacadeApplication(); $db = $app->make('database')->connection(); $cvID = $this->cvID; $c = Page::getByID($this->cID, $cvID); $cID = $c->getCollectionID(); $q = "select bID, arHandle from CollectionVersionBlocks where cID = ? and cvID = ?"; $r = $db->executeQuery($q, array($cID, $cvID)); while ($row = $r->fetch()) { if ($row['bID']) { $b = Block::getByID($row['bID'], $c, $row['arHandle']); if (is_object($b)) { $b->deleteBlock(); } unset($b); } } $features = CollectionVersionFeatureAssignment::getList($this); foreach ($features as $fa) { $fa->delete(); } $category = $app->make('Concrete\\Core\\Attribute\\Category\\PageCategory'); $attributes = $category->getAttributeValues($this); foreach ($attributes as $attribute) { $category->deleteValue($attribute); } $db->executeQuery('delete from CollectionVersionBlockStyles where cID = ? and cvID = ?', array($cID, $cvID)); $db->executeQuery('delete from CollectionVersionThemeCustomStyles where cID = ? and cvID = ?', array($cID, $cvID)); $db->executeQuery('delete from CollectionVersionRelatedEdits where cID = ? and cvID = ?', array($cID, $cvID)); $db->executeQuery('delete from CollectionVersionAreaStyles where cID = ? and cvID = ?', array($cID, $cvID)); $q = "delete from CollectionVersions where cID = '{$cID}' and cvID='{$cvID}'"; $db->executeQuery($q); $this->refreshCache(); }