Example #1
0
 /**
  * Sets the block type description
  */
 public function setBlockTypeDescription($btDescription)
 {
     return parent::setBlockTypeDescription($btDescription);
 }
 /**
  * {@inheritDoc}
  */
 public function setBlockTypeDescription($btDescription)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setBlockTypeDescription', array($btDescription));
     return parent::setBlockTypeDescription($btDescription);
 }
Example #3
0
 /**
  * Gets a list of block types that are not installed, used to get blocks that can be installed
  * This function only surveys the web/blocks directory - it's not looking at the package level.
  * @return BlockType[]
  */
 public static function getAvailableList()
 {
     $blocktypes = array();
     $dir = DIR_FILES_BLOCK_TYPES;
     $db = Loader::db();
     $btHandles = $db->GetCol("select btHandle from BlockTypes order by btDisplayOrder asc, btName asc, btID asc");
     $aDir = array();
     if (is_dir($dir)) {
         $handle = opendir($dir);
         while (($file = readdir($handle)) !== false) {
             if (strpos($file, '.') === false) {
                 $fdir = $dir . '/' . $file;
                 if (is_dir($fdir) && !in_array($file, $btHandles) && file_exists($fdir . '/' . FILENAME_BLOCK_CONTROLLER)) {
                     $bt = BlockType::getByHandle($file);
                     if (!is_object($bt)) {
                         $bt = new BlockType();
                         $bt->setBlockTypeHandle($file);
                         $class = $bt->getBlockTypeClass();
                         $bta = new $class();
                         $bt->setBlockTypeName($bta->getBlockTypeName());
                         $bt->setBlockTypeDescription($bta->getBlockTypeDescription());
                         $bt->hasCustomViewTemplate = file_exists(DIR_FILES_BLOCK_TYPES . '/' . $file . '/' . FILENAME_BLOCK_VIEW);
                         $bt->hasCustomEditTemplate = file_exists(DIR_FILES_BLOCK_TYPES . '/' . $file . '/' . FILENAME_BLOCK_EDIT);
                         $bt->hasCustomAddTemplate = file_exists(DIR_FILES_BLOCK_TYPES . '/' . $file . '/' . FILENAME_BLOCK_ADD);
                         $bt->installed = false;
                     } else {
                         $bt->installed = true;
                     }
                     $blocktypes[] = $bt;
                 }
             }
         }
     }
     return $blocktypes;
 }