public function handleFeatureAssignment(Assignment $fa)
 {
     // we ALSO write the information into a table.
     // Yes, this is duplication of data but we need to join in the DB at times
     $db = Database::get();
     $db->Execute('insert into ConversationFeatureDetailAssignments (faID, cnvID) values (?, ?)', array($fa->getFeatureAssignmentID(), $this->cnvID));
 }
 public function delete()
 {
     $db = Loader::db();
     $db->Execute('delete from GatheringItemFeatureAssignments where faID = ? and gaiID = ?', array($this->getFeatureAssignmentID(), $this->gaiID));
     if (!$this->assignmentIsInUse()) {
         parent::delete();
     }
 }
 public function delete()
 {
     $db = Loader::db();
     $db->Execute('delete from BlockFeatureAssignments where faID = ? and cID = ? and cvID = ?', array($this->getFeatureAssignmentID(), $this->cID, $this->cvID));
     $db->Execute('delete from CollectionVersionFeatureAssignments where faID = ? and cID = ? and cvID = ?', array($this->getFeatureAssignmentID(), $this->cID, $this->cvID));
     if (!$this->assignmentIsInUse()) {
         parent::delete();
     }
 }
 public function assignmentIsInUse(\Concrete\Core\Feature\Assignment\Assignment $fa)
 {
     $db = Loader::db();
     $num = $db->GetOne('select count(faID) from CollectionVersionFeatureAssignments where faID = ?', array($fa->getFeatureAssignmentID()));
     return $num > 0;
 }
示例#5
0
 public function deleteBlock($forceDelete = false)
 {
     $db = Loader::db();
     if ($this->bID < 1) {
         return false;
     }
     $cID = $this->cID;
     $c = $this->getBlockCollectionObject();
     $cvID = $c->getVersionID();
     $bID = $this->bID;
     $arHandle = $this->arHandle;
     // if this block is located in a master collection, we're going to delete all the instances of the block,
     // regardless
     if ($c instanceof \Concrete\Core\Page\Page && $c->isMasterCollection() && !$this->isAlias() || $forceDelete) {
         // forceDelete is used by the administration console
         // this is an original. We're deleting it, and everything else having to do with it
         $q = "delete from CollectionVersionBlocks where bID = ?";
         $r = $db->query($q, array($bID));
         $q = "delete from BlockPermissionAssignments where bID = ?";
         $r = $db->query($q, array($bID));
         $q = "delete from CollectionVersionBlockStyles where bID = ?";
         $r = $db->query($q, array($bID));
         $q = "delete from CollectionVersionBlocksCacheSettings where bID = ?";
         $r = $db->query($q, array($bID));
     } else {
         $q = "delete from CollectionVersionBlocks where cID = ? and (cvID = ? or cbIncludeAll=1) and bID = ? and arHandle = ?";
         $r = $db->query($q, array($cID, $cvID, $bID, $arHandle));
         // next, we delete the groups instance of this block
         $q = "delete from BlockPermissionAssignments where bID = ? and cvID = ? and cID = ?";
         $r = $db->query($q, array($bID, $cvID, $cID));
         $q = "delete from CollectionVersionBlockStyles where cID = ? and cvID = ? and bID = ? and arHandle = ?";
         $r = $db->query($q, array($cID, $cvID, $bID, $arHandle));
         $q = "delete from CollectionVersionBlocksCacheSettings where cID = ? and cvID = ? and bID = ? and arHandle = ?";
         $r = $db->query($q, array($cID, $cvID, $bID, $arHandle));
     }
     // delete any feature assignments that have been attached to this block to the collection version
     $faIDs = $db->GetCol('select faID from BlockFeatureAssignments where cID = ? and cvID = ? and bID = ?', array($cID, $cvID, $bID));
     foreach ($faIDs as $faID) {
         $fa = FeatureAssignment::getByID($faID, $c);
         $fa->delete();
     }
     //then, we see whether or not this block is aliased to anything else
     $totalBlocks = $db->GetOne('select count(*) from CollectionVersionBlocks where bID = ?', array($bID));
     $totalBlocks += $db->GetOne('select count(*) from btCoreScrapbookDisplay where bOriginalID = ?', array($bID));
     if ($totalBlocks < 1) {
         $q = "delete from BlockRelations where originalBID = ? or bID = ?";
         $r = $db->query($q, array($this->bID, $this->bID));
         // this block is not referenced in the system any longer, so we delete the entry in the blocks table, as well as the entries in the corresponding
         // sub-blocks table
         $v = array($this->bID);
         // so, first we delete the block's sub content
         $bt = BlockType::getByID($this->getBlockTypeID());
         if ($bt && method_exists($bt, 'getBlockTypeClass')) {
             $class = $bt->getBlockTypeClass();
             $bc = new $class($this);
             $bc->delete();
         }
         // now that the block's subcontent delete() method has been run, we delete the block from the Blocks table
         $q = "delete from Blocks where bID = ?";
         $r = $db->query($q, $v);
         // Aaaand then we delete all scrapbooked blocks to this entry
         $r = $db->Execute('select cID, cvID, CollectionVersionBlocks.bID, arHandle from CollectionVersionBlocks inner join btCoreScrapbookDisplay on CollectionVersionBlocks.bID = btCoreScrapbookDisplay.bID where bOriginalID = ?', array($bID));
         while ($row = $r->FetchRow()) {
             $c = Page::getByID($row['cID'], $row['cvID']);
             $b = self::getByID($row['bID'], $c, $row['arHandle']);
             $b->delete();
         }
     }
 }
 public function deleteFeatureAssignment(Assignment $fa)
 {
     $db = Database::get();
     $db->delete('ConversationFeatureDetailAssignments', array('faID' => $fa->getFeatureAssignmentID()));
 }
 public function assignmentIsInUse(\Concrete\Core\Feature\Assignment\Assignment $fa)
 {
     $db = Loader::db();
     $num = $db->GetOne('select count(gaiID) as total from GatheringItemFeatureAssignments where faID = ?', array($fa->getFeatureAssignmentID()));
     return $num > 0;
 }