当前位置: 首页>>代码示例>>PHP>>正文


PHP BlockType::getByID方法代码示例

本文整理汇总了PHP中BlockType::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP BlockType::getByID方法的具体用法?PHP BlockType::getByID怎么用?PHP BlockType::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BlockType的用法示例。


在下文中一共展示了BlockType::getByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSave

 public function testSave()
 {
     $bt = BlockType::installBlockType($this->btHandle);
     $btx = BlockType::getByID(1);
     $class = $btx->getBlockTypeClass();
     $btc = new $class();
     $bID = 1;
     foreach ($this->requestData as $type => $requestData) {
         $nb = $bt->add($requestData);
         $data = $this->expectedRecordData[$type];
         $db = Loader::db();
         $r = $db->GetRow('select * from `' . $btc->getBlockTypeDatabaseTable() . '` where bID = ?', array($bID));
         foreach ($data as $key => $value) {
             $this->assertTrue($r[$key] == $value, 'Key `' . $key . '` did not equal expected value `' . $value . '` instead equalled `' . $r[$key] . '` (type `' . $type . '`)');
         }
         $bID++;
         ob_start();
         $bv = new BlockView($nb);
         $bv->render('view');
         $contents = ob_get_contents();
         ob_end_clean();
         $contents = trim($contents);
         if (isset($this->expectedOutput[$type])) {
             $this->assertTrue($this->expectedOutput[$type] == $contents, 'Output `' . $contents . '` did not equal expected output `' . $this->expectedOutput[$type] . '` (type `' . $type . '`)');
         }
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:27,代码来源:BlockTypeTestCase.php

示例2: getRssUrl

 function getRssUrl($b)
 {
     $uh = Loader::helper('concrete/urls');
     if (!$b) {
         return '';
     }
     $btID = $b->getBlockTypeID();
     $bt = BlockType::getByID($btID);
     $c = $b->getBlockCollectionObject();
     $a = $b->getBlockAreaObject();
     $rssUrl = $uh->getToolsURL('rss', 'page_list_teasers') . "?bID=" . $b->getBlockID() . "&cID=" . $c->getCollectionID() . "&arHandle=" . $a->getAreaHandle();
     return $rssUrl;
 }
开发者ID:robchenski,项目名称:ids,代码行数:13,代码来源:page_list_teasers.php

示例3: add

 public function add($cID, $arHandle, $btID, $action)
 {
     $c = \Page::getByID($cID);
     if (is_object($c) && !$c->isError()) {
         $a = \Area::getOrCreate($c, $arHandle);
         if (is_object($a)) {
             $ap = new \Permissions($a);
             $bt = \BlockType::getByID($btID);
             if (is_object($bt) && $ap->canAddBlock($bt)) {
                 $controller = $bt->getController();
                 return $this->deliverResponse($controller, $action);
             }
         }
     }
     $response = new Response(t('Access Denied'));
     return $response;
 }
开发者ID:Remo,项目名称:concrete5-1,代码行数:17,代码来源:action.php

示例4: t

	<div class="ccm-dashboard-inner"> 

		<a style="float: right" href="<?=View::url($cPath) ?>"><?= t("&laquo; Return to Scrapbook List") ?></a>		
		
		<div class="sillyIE7"><?= $ih->button_js( t('Add Block to Scrapbook'), 'GlobalScrapbook.addBlock(event)','left'); ?></div>
		
		<div class="ccm-spacer"></div>	
		
		<div id="ccm-scrapbook-list" class="ui-sortable">			
			<? 		 			
			if( !count($globalScrapbookBlocks) ){
				echo t('You have no items in this scrapbook.');
			}else foreach($globalScrapbookBlocks as $b) {
				 $b->setBlockAreaObject($globalScrapbookArea);
				 $bv = new BlockView();
				 $bt = BlockType::getByID( $b->getBlockTypeID() ); 
				 $bp = new Permissions($b);
				 $btIcon = $ci->getBlockTypeIconURL($bt); 			 
				 
				 //give this block a name if it doesn't have one
				 if( !strlen($b->getBlockName()) ){ 
					$b->updateBlockName( $scrapbookName.' '.intval($b->bID) );
				 }
				 ?>
				 <div class="ccm-scrapbook-list-item" id="ccm-scrapbook-list-item-<?=intval($b->bID)?>"> 
					 <div class="ccm-block-type">  
						<div class="options"> 
							<? if ($bp->canWrite()) { ?>
							<a href="javascript:void(0)" onclick="GlobalScrapbook.toggleRename(<?=intval($b->bID) ?>)"><?=t('Rename')?></a>
							&nbsp;|&nbsp; 
							<a href="javascript:void(0)" onclick="GlobalScrapbook.editBlockTemplate(<?=intval($b->bID) ?>)" ><?=t('Custom Template')?></a> 
开发者ID:notzen,项目名称:concrete5,代码行数:31,代码来源:view.php

示例5: stdClass

                 } else {
                     $b->alias($c);
                 }
             }
         }
     }
     $obj = new stdClass();
     $obj->aID = $a->getAreaID();
     $obj->arHandle = $a->getAreaHandle();
     $obj->cID = $c->getCollectionID();
     $obj->bID = $b->getBlockID();
     $obj->error = false;
     print Loader::helper('json')->encode($obj);
     exit;
 } else {
     $bt = BlockType::getByID($_REQUEST['btID']);
     if ($ap->canAddBlock($bt)) {
         $data = $_POST;
         $data['uID'] = $u->getUserID();
         $class = $bt->getBlockTypeClass();
         $bi = new $class($bt);
         $e = $bi->validate($data);
         $obj = new stdClass();
         $obj->aID = $a->getAreaID();
         $obj->arHandle = $a->getAreaHandle();
         $obj->cID = $c->getCollectionID();
         if (!is_object($e) || $e instanceof ValidationErrorHelper && !$e->has()) {
             if (!$bt->includeAll()) {
                 $nvc = $c->getVersionToModify();
                 $nb = $nvc->addBlock($bt, $a, $data);
             } else {
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:31,代码来源:process.php

示例6: deleteBlock

 function deleteBlock($forceDelete = false)
 {
     $db = Loader::db();
     if ($this->bID < 1) {
         return false;
     }
     $this->refreshCache();
     $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 Page && $c->isMasterCollection() && !$this->isAlias() || $forceDelete) {
         // forceDelete is used by the administration console
         $r = $db->Execute('select cID, cvID from CollectionVersionBlocks where bID = ?', array($bID));
         while ($row = $r->FetchRow()) {
             Cache::delete('collection_blocks', $row['cID'] . ':' . $row['cvID']);
         }
         // this is an original. We're deleting it, and everything else having to do with it
         $q = "delete from CollectionVersionBlocks where bID = '{$bID}'";
         $r = $db->query($q);
         $q = "delete from CollectionVersionBlockPermissions where bID = '{$bID}'";
         $r = $db->query($q);
         $q = "delete from CollectionVersionBlockStyles where bID = " . intval($bID);
         $r = $db->query($q);
     } else {
         $q = "delete from CollectionVersionBlocks where cID = '{$cID}' and (cvID = '{$cvID}' or cbIncludeAll=1) and bID = '{$bID}' and arHandle = '{$arHandle}'";
         $r = $db->query($q);
         // next, we delete the groups instance of this block
         $q = "delete from CollectionVersionBlockPermissions where bID = '{$bID}' and cvID = '{$cvID}' and cID = '{$cID}'";
         $r = $db->query($q);
         $q = "delete from CollectionVersionBlockStyles where cID = '{$cID}' and cvID = '{$cvID}' and bID = '{$bID}' and arHandle = '{$arHandle}'";
         $r = $db->query($q);
     }
     //then, we see whether or not this block is aliased to anything else
     $q = "select count(*) as total from CollectionVersionBlocks where bID = '{$bID}'";
     $totalBlocks = $db->getOne($q);
     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);
     }
 }
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:57,代码来源:block.php

示例7: t

    echo $link;
    ?>
">Read full post &raquo;</a>
		</div>
	</div>
	<hr class="blog-entry-divider"/>
	<?php 
}
?>
</div>

<div id="blog-index-foot">
	<?php 
if (!$previewMode && $controller->rss) {
    $btID = $b->getBlockTypeID();
    $bt = BlockType::getByID($btID);
    $uh = Loader::helper('concrete/urls');
    $rssUrl = $controller->getRssUrl($b, 'blog_rss');
    $rssIcon = $uh->getBlockTypeAssetsURL($bt, 'rss.png');
    $rssTitle = $controller->rssTitle;
    ?>
		<div id="rss">
			<a href="<?php 
    echo $rssUrl;
    ?>
" target="_blank"><?php 
    echo t('Subscribe to RSS Feed');
    ?>
</a>
			<a href="<?php 
    echo $rssUrl;
开发者ID:janzenz,项目名称:c5_boilerplate,代码行数:31,代码来源:boilerplate_blog.php

示例8: render

 /**
  * Renders a view in the block's folder.
  * <code>
  * public function view() { // The view() method is automatically run when a block is viewed
  *     $this->render("other_special_view"); // don't use .php
  * }
  * </code>
  * @param string $view
  * @return void
  */
 function render($view)
 {
     $bv = new BlockView();
     $bv->setController($this);
     // sometimes we need the block type available in here
     if (is_object($this->getBlockObject())) {
         $bt = BlockType::getByID($this->getBlockObject()->getBlockTypeID());
         $a = $this->getBlockObject()->getBlockAreaObject();
     }
     $this->renderOverride = $view;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:21,代码来源:block_controller.php

示例9: inspect

	public function inspect($btID = 0) { 
		if ($btID > 0) {
			$bt = BlockType::getByID($btID);
		}
		
		if (isset($bt) && ($bt instanceof BlockType)) {
			$this->set('bt', $bt);
			$this->set('num', $bt->getCount());
		} else {
			$this->redirect('/dashboard/blocks/types');
		}
	}
开发者ID:nveid,项目名称:concrete5,代码行数:12,代码来源:types.php

示例10: deleteBlock

 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 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 ComposerContentLayout 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));
     } 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));
     }
     //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 = Block::getByID($row['bID'], $c, $row['arHandle']);
             $b->delete();
         }
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:61,代码来源:block.php

示例11: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Block\Form\MiniSurvey;
$miniSurvey = new MiniSurvey();
$bID = $_GET['bID'];
//Permissions Check
$bID = $_REQUEST['bID'];
if ($_GET['cID'] && $_GET['arHandle']) {
    $c = Page::getByID($_GET['cID'], 'RECENT');
    $a = Area::get($c, $_GET['arHandle']);
    if (intval($_GET['bID']) == 0) {
        //add survey mode
        $ap = new Permissions($a);
        $bt = BlockType::getByID($_GET['btID']);
        if (!$ap->canAddBlock($bt)) {
            $badPermissions = true;
        }
    } else {
        //edit survey mode
        // this really ought to be refactored
        if (!$a->isGlobalArea()) {
            $b = Block::getByID($_REQUEST['bID'], $c, $a);
            if ($b->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
                $b = Block::getByID($b->getController()->getOriginalBlockID());
                $b->setBlockAreaObject($a);
                $b->loadNewCollection($c);
                $bID = $b->getBlockID();
            }
        } else {
            $b = Block::getByID($_REQUEST['bID'], Stack::getByName($a->getAreaHandle()), STACKS_AREA_NAME);
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:31,代码来源:services.php

示例12: t

	<strong><?php 
        echo $pk->getPermissionKeyDisplayName();
        ?>
</strong>
	<?php 
        echo t('Permission on ');
        if ($pk instanceof AreaPermissionKey) {
            ?>
			<strong><?php 
            echo $pk->getPermissionObject()->getAreaHandle();
            ?>
</strong>.
		<?php 
        } else {
            if ($pk instanceof BlockPermissionKey) {
                $bt = BlockType::getByID($pk->getPermissionObject()->getBlockTypeID());
                $obj = $pk->getPermissionObject();
                if ($obj->getBlockName() != '') {
                    ?>

			<?php 
                    echo t('the %s block named <strong>%s</strong> in <strong>%s</strong> Area. ', t($bt->getBlockTypeName()), $obj->getBlockName(), $pk->getPermissionObject()->getAreaHandle());
                    ?>
			
			<?php 
                } else {
                    ?>
			
			<?php 
                    echo t('<strong>%s Block</strong> in <strong>%s</strong> Area. ', t($bt->getBlockTypeName()), $pk->getPermissionObject()->getAreaHandle());
                    ?>
开发者ID:Zyqsempai,项目名称:amanet,代码行数:31,代码来源:collection_timed_permission_list.php

示例13: view

 public function view()
 {
     $btc = $this->block->getInstance();
     $btc->outputAutoHeaderItems();
     $bv = new BlockView($this->block);
     $bv->addScopeItems(array('c' => $this->page, 'a' => $this->area, 'dialogController' => $this));
     $this->set('bv', $bv);
     $canEditCustomTemplate = false;
     if ($this->permissions->canEditBlockCustomTemplate()) {
         $canEditCustomTemplate = true;
         switch ($this->block->getBlockTypeHandle()) {
             case BLOCK_HANDLE_SCRAPBOOK_PROXY:
                 $bi = $this->block->getInstance();
                 $bx = \Block::getByID($bi->getOriginalBlockID());
                 $bt = \BlockType::getByID($bx->getBlockTypeID());
                 $bFilename = $bx->getBlockFilename();
                 break;
             case BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY:
                 $bi = $this->block->getInstance();
                 $output = $bi->getComposerOutputControlObject();
                 $control = FormLayoutSetControl::getByID($output->getPageTypeComposerFormLayoutSetControlID());
                 $object = $control->getPageTypeComposerControlObject();
                 if ($object instanceof BlockControl) {
                     $bt = $object->getBlockTypeObject();
                 }
                 $bFilename = $this->block->getBlockFilename();
                 break;
             default:
                 $bt = \BlockType::getByID($this->block->getBlockTypeID());
                 $bFilename = $this->block->getBlockFilename();
                 break;
         }
         $templates = array();
         if (is_object($bt)) {
             $templates = $bt->getBlockTypeCustomTemplates();
         }
         $this->set('bFilename', $bFilename);
         $this->set('templates', $templates);
     }
     $this->set('canEditCustomTemplate', $canEditCustomTemplate);
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:41,代码来源:design.php

示例14: getBlockTypeArray

		/**
		 * Gets a list of installed BlockTypes 
		 * - could be defined as static
		 * @todo we have three duplicate functions getBlockTypeArray, getInstalledList, getBlockTypeList
		 * @return BlockType[]
		 */	
		public function getBlockTypeArray() {
			$db = Loader::db();
			$q = "select btID from BlockTypes order by btDisplayOrder asc, btName asc, btID asc";
			$r = $db->query($q);
			$btArray = array();
			if ($r) {
				while ($row = $r->fetchRow()) {
					$bt = BlockType::getByID($row['btID']);
					if (is_object($bt)) {
						$btArray[] = $bt;
					}
				}
				$r->free();
			}
			return $btArray;
		}
开发者ID:ronlobo,项目名称:concrete5,代码行数:22,代码来源:block_types.php

示例15: view

 public function view()
 {
     $btc = $this->block->getInstance();
     $btc->outputAutoHeaderItems();
     $bv = new BlockView($this->block);
     $bv->addScopeItems(array('c' => $this->page, 'a' => $this->area, 'dialogController' => $this));
     $this->set('bv', $bv);
     $canEditCustomTemplate = false;
     if ($this->permissions->canEditBlockCustomTemplate()) {
         $canEditCustomTemplate = true;
         if ($this->block->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
             $bi = $this->block->getInstance();
             $bx = \Block::getByID($bi->getOriginalBlockID());
             $bt = \BlockType::getByID($bx->getBlockTypeID());
         } else {
             $bt = \BlockType::getByID($this->block->getBlockTypeID());
         }
         $templates = $bt->getBlockTypeCustomTemplates();
         $this->set('templates', $templates);
     }
     $this->set('canEditCustomTemplate', $canEditCustomTemplate);
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:22,代码来源:design.php


注:本文中的BlockType::getByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。