/** * Instantiates the block controller. * * @param BlockType $obj |Block $obj */ public function __construct($obj = null) { parent::__construct(); if ($obj instanceof BlockType) { $this->identifier = 'BLOCKTYPE_' . $obj->getBlockTypeID(); $this->btHandle = $obj->getBlockTypeHandle(); } else { if ($obj instanceof Block) { $b = $obj; $this->identifier = 'BLOCK_' . $obj->getBlockID(); $this->bID = $b->getBlockID(); $this->btHandle = $obj->getBlockTypeHandle(); $this->btCachedBlockRecord = $obj->getBlockCachedRecord(); $this->setBlockObject($b); $this->load(); } } $this->set('controller', $this); }
public function addBlockType(BlockType $bt) { $db = Loader::db(); $no = $db->GetOne("select count(btID) from BlockTypeSetBlockTypes where btID = ? and btsID = ?", array($bt->getBlockTypeID(), $this->getBlockTypeSetID())); if ($no < 1) { $types = $db->GetOne('select count(btID) from BlockTypeSetBlockTypes where btsID = ?', array($this->getBlockTypeSetID())); $displayOrder = 0; if ($types > 0) { $displayOrder = $db->GetOne('select max(displayOrder) from BlockTypeSetBlockTypes where btsID = ?', array($this->getBlockTypeSetID())); $displayOrder++; } $db->Execute('insert into BlockTypeSetBlockTypes (btsID, btID, displayOrder) values (?, ?, ?)', array($this->getBlockTypeSetID(), $bt->getBlockTypeID(), $displayOrder)); } }
/** * {@inheritDoc} */ public function getBlockTypeID() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getBlockTypeID', array()); return parent::getBlockTypeID(); }
/** * @return int */ public function getBlockTypeID() { return parent::getBlockTypeID(); }