本文整理汇总了PHP中Stack::getByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Stack::getByName方法的具体用法?PHP Stack::getByName怎么用?PHP Stack::getByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stack
的用法示例。
在下文中一共展示了Stack::getByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$request = $this->request;
$arHandle = $request->query->get('arHandle');
$bID = $request->query->get('bID');
$a = \Area::get($this->page, $arHandle);
if (!is_object($a)) {
throw new \Exception('Invalid Area');
}
$this->area = $a;
if (!$a->isGlobalArea()) {
$b = \Block::getByID($bID, $this->page, $a);
$this->set('isGlobalArea', false);
} else {
$stack = \Stack::getByName($arHandle);
$sc = ConcretePage::getByID($stack->getCollectionID(), 'RECENT');
$b = \Block::getByID($bID, $sc, STACKS_AREA_NAME);
$b->setBlockAreaObject($a);
// set the original area object
$this->set('isGlobalArea', true);
}
$this->block = $b;
$this->permissions = new \Permissions($b);
$this->set('bp', $this->permissions);
$this->set('b', $b);
}
示例2: getImportData
public function getImportData($blockNode) {
$args = array();
$content = (string) $blockNode->stack;
$stack = Stack::getByName($content);
$args['stID'] = $stack->getCollectionID();
return $args;
}
示例3: setPermissionObject
public function setPermissionObject(Area $a)
{
$ax = $a;
if ($a->isGlobalArea()) {
$cx = Stack::getByName($a->getAreaHandle());
$a = Area::get($cx, STACKS_AREA_NAME);
}
$this->permissionObject = $a;
// if the area overrides the collection permissions explicitly (with a one on the override column) we check
if ($a->overrideCollectionPermissions()) {
$this->permissionObjectToCheck = $a;
} else {
if ($a->getAreaCollectionInheritID() > 0) {
// in theory we're supposed to be inheriting some permissions from an area with the same handle,
// set on the collection id specified above (inheritid). however, if someone's come along and
// reverted that area to the page's permissions, there won't be any permissions, and we
// won't see anything. so we have to check
$areac = Page::getByID($a->getAreaCollectionInheritID());
$inheritArea = Area::get($areac, $a->getAreaHandlE());
if (is_object($inheritArea) && $inheritArea->overrideCollectionPermissions()) {
// okay, so that area is still around, still has set permissions on it. So we
// pass our current area to our grouplist, userinfolist objects, knowing that they will
// smartly inherit the correct items.
$this->permissionObjectToCheck = $inheritArea;
}
}
if (!$this->permissionObjectToCheck) {
$this->permissionObjectToCheck = $a->getAreaCollectionObject();
}
}
}
示例4: importStacksContent
protected function importStacksContent(SimpleXMLElement $sx) {
if (isset($sx->stacks)) {
foreach($sx->stacks->stack as $p) {
$stack = Stack::getByName($p['name']);
if (isset($p->area)) {
$this->importPageAreas($stack, $p);
}
}
}
}
示例5: export
public static function export(SimpleXMLElement $x) {
$db = Loader::db();
$r = $db->Execute('select stName, cID, stType from Stacks order by stName asc');
if ($r->NumRows()) {
$gas = $x->addChild('stacks');
while ($row = $r->FetchRow()) {
$stack = Stack::getByName($row['stName']);
$stack->export($gas);
}
}
}
示例6: getBlockToEdit
protected function getBlockToEdit()
{
$ax = $this->area;
$cx = $this->page;
if ($this->area->isGlobalArea()) {
$ax = STACKS_AREA_NAME;
$cx = \Stack::getByName($_REQUEST['arHandle']);
}
$b = \Block::getByID($_REQUEST['bID'], $cx, $ax);
$nvc = $cx->getVersionToModify();
if ($this->area->isGlobalArea()) {
$xvc = $this->page->getVersionToModify();
// we need to create a new version of THIS page as well.
$xvc->relateVersionEdits($nvc);
}
$b->loadNewCollection($nvc);
if ($b->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
// if we're editing a scrapbook display block, we add a new block in this position for the real block type
// set the block to the display order
// delete the scrapbook display block, and save the data
/*
$originalDisplayOrder = $b->getBlockDisplayOrder();
$btx = BlockType::getByHandle($_b->getBlockTypeHandle());
$nb = $nvc->addBlock($btx, $ax, array());
$nb->setAbsoluteBlockDisplayOrder($originalDisplayOrder);
$b->deleteBlock();
$b = &$nb;
*/
$originalDisplayOrder = $b->getBlockDisplayOrder();
$cnt = $b->getController();
$ob = \Block::getByID($cnt->getOriginalBlockID());
$ob->loadNewCollection($nvc);
if (!is_object($ax)) {
$ax = Area::getOrCreate($cx, $ax);
}
$ob->setBlockAreaObject($ax);
$nb = $ob->duplicate($nvc);
$nb->setAbsoluteBlockDisplayOrder($originalDisplayOrder);
$b->deleteBlock();
$b =& $nb;
} else {
if ($b->isAlias()) {
// then this means that the block we're updating is an alias. If you update an alias, you're actually going
// to duplicate the original block, and update the newly created block. If you update an original, your changes
// propagate to the aliases
$nb = $b->duplicate($nvc);
$b->deleteBlock();
$b = $nb;
}
}
return $b;
}
示例7: getBlockToEdit
protected function getBlockToEdit()
{
$ax = $this->area;
$cx = $this->page;
if ($this->area->isGlobalArea()) {
$ax = STACKS_AREA_NAME;
$cx = \Stack::getByName($_REQUEST['arHandle']);
}
$b = \Block::getByID($_REQUEST['bID'], $cx, $ax);
$nvc = $cx->getVersionToModify();
if ($this->area->isGlobalArea()) {
$xvc = $this->page->getVersionToModify();
// we need to create a new version of THIS page as well.
$xvc->relateVersionEdits($nvc);
}
$b->loadNewCollection($nvc);
//if this block is being changed, make sure it's a new version of the block.
if ($b->isAlias()) {
$nb = $b->duplicate($nvc);
$b->deleteBlock();
$b = $nb;
}
return $b;
}
示例8: Permissions
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);
$b->setBlockAreaObject($a);
// set the original area object
}
$bp = new Permissions($b);
if (!$bp->canWrite()) {
$badPermissions = true;
}
}
} else {
$badPermissions = true;
}
if ($badPermissions) {
echo t('Invalid Permissions');
die;
}
示例9: defined
<?
defined('C5_EXECUTE') or die("Access Denied.");
$c = Page::getByID($_REQUEST['cID']);
$a = Area::get($c, $_REQUEST['arHandle']);
if (!$a->isGlobalArea()) {
$b = Block::getByID($_REQUEST['bID'], $c, $a);
} else {
$b = Block::getByID($_REQUEST['bID'], Stack::getByName($_REQUEST['arHandle']), STACKS_AREA_NAME);
$b->setBlockAreaObject($a); // set the original area object
$isGlobalArea = true;
}
$bp = new Permissions($b);
if (!$bp->canWrite()) {
die(t("Access Denied."));
}
if ($_REQUEST['btask'] != 'view' && $_REQUEST['btask'] != 'view_edit_mode') {
include(DIR_FILES_ELEMENTS_CORE . '/dialog_header.php');
}
$bv = new BlockView();
if ($isGlobalArea && $_REQUEST['btask'] != 'view_edit_mode') {
echo '<div class="ccm-ui"><div class="alert-message block-message warning">';
echo t('This block is contained within a global area. Changing its content will change it everywhere that global area is referenced.');
echo('</div></div>');
}
if(($c->isMasterCollection()) && (!in_array($_REQUEST['btask'], array('child_pages','composer','view_edit_mode')))) {
示例10: Permissions
$scrapbookName = $_REQUEST['scrapbookName'];
if ($scrapbookName) {
$scrapbookHelper->setDefault($scrapbookName);
}
$c = Page::getByID($_REQUEST['cID']);
// add a block to a pile
$cp = new Permissions($c);
if (!$cp->canViewPage()) {
exit;
}
if (($_REQUEST['btask'] == 'add' || $_REQUEST['ctask'] == 'add') && $scrapbookName) {
if ($_REQUEST['btask'] == 'add') {
$a = Area::get($c, $_REQUEST['arHandle']);
if ($a->isGlobalArea()) {
$ax = STACKS_AREA_NAME;
$cx = Stack::getByName($_REQUEST['arHandle']);
}
$b = Block::getByID($_REQUEST['bID'], $cx, $ax);
if ($b->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
$bi = $b->getInstance();
$b = Block::getByID($bi->getOriginalBlockID());
}
$ap = new Permissions($a);
if (!$ap->canViewArea()) {
exit;
}
$obj =& $b;
} else {
$obj =& $c;
}
if ($_REQUEST['pID']) {
示例11: GlobalArea
if ($abltb > 0 || $abrtb > 0 || $abctb > 0 || $c->isEditMode()) {
?>
</div>
<?php
}
?>
</div>
<?php
}
?>
<?php
$a = new GlobalArea('Header Nav');
$blocks = $a->getTotalBlocksInArea($c);
if ($blocks > 0 || $c->isEditMode()) {
$stack = Stack::getByName('Header Nav');
if ($stack) {
$getStacks = $stack->getBlocks();
foreach ($getStacks as $getStack) {
if ($getStack->getBlockFilename() !== 'off_canvas') {
echo '<div class="c5h-navigation-wrap clearfix">';
} else {
echo '';
}
}
}
$a->setCustomTemplate('autonav', 'top_bar');
$a->display();
if ($stack) {
$getStacks = $stack->getBlocks();
foreach ($getStacks as $getStack) {
示例12: elseif
<?php
/* Home for all modals which are hidden on page load */
// Error modal
if (isset($error) && $error !== '') {
if ($error instanceof Exception) {
$_error[] = $error->getMessage();
} elseif ($error instanceof ValidationErrorHelper) {
$_error = $error->getList();
} elseif (is_array($error)) {
$_error = $error;
} elseif (is_string($error)) {
$_error[] = $error;
}
}
$sl = Stack::getByName('Social Logins');
if ($sl) {
ob_start();
$sl->display();
// Set the social logins stack as accessible to client-side apps
$this->addFooterItem('<script type="text/javascript">window.JanesWalk = Object.assign({}, window.JanesWalk, {stacks: {"Social Logins": ' . json_encode(ob_get_contents()) . '}});</script>');
ob_end_clean();
}
?>
<div id="modals"></div>
示例13: implode
*/
/*
//unique class for every single menu item
$classes[] = 'nav-item-' . $ni->cID;
*/
//Put all classes together into one space-separated string
$ni->classes = implode(" ", $classes);
}
/******************************************************************************
* DESIGNERS: CUSTOMIZE THE HTML STARTING HERE...
*/
$site = Config::get('concrete.site');
$logoStack = Stack::getByName('topbar_logo');
$iconStack = Stack::getByName('topbar_icon');
$searchStack = Stack::getByName('topbar_search');
$buttonStack = Stack::getByName('topbar_button');
$siteBranding = Config::get('c5hub.fundamental.navigation.branding');
$containToGridConfig = Config::get('c5hub.fundamental.navigation.contain_to_grid');
$stickyConfig = Config::get('c5hub.fundamental.navigation.sticky');
$divider = Config::get('c5hub.fundamental.navigation.divider');
$position = Config::get('c5hub.fundamental.navigation.position');
$brandingPosition = Config::get('c5hub.fundamental.navigation.branding_position');
$topBarWrapper = 'top-bar-wrapper';
if ($containToGridConfig == true) {
$containToGrid = 'contain-to-grid';
}
if ($stickyConfig == true) {
$sticky = 'sticky';
}
$topBarOptions = implode(' ', array($topBarWrapper, $containToGrid, $sticky));
if ($containToGridConfig == true || $stickyConfig == true) {
示例14:
>
<div class="c5h-section-<?php
echo $alignment;
?>
-wrap" <?php
echo $wrapperStyles;
?>
>
<?php
echo $containToGridTop;
?>
<div class="c5h-section-stack">
<?php
if ($controller->sectionStackName) {
$stack = Stack::getByName($controller->sectionStackName);
if (is_object($stack)) {
$stack = $stack->display();
}
}
?>
</div>
<div class="c5h-section-icon">
<?php
echo $icon;
?>
</div><!-- END .c5h-section-icon -->
<div class="c5h-section-content clearfix">
<div class="c5h-section-title">
<?php
示例15: getGlobalBlocks
public function getGlobalBlocks() {
$db = Loader::db();
$v = array( Stack::ST_TYPE_GLOBAL_AREA );
$rs = $db->GetCol('select stName from Stacks where Stacks.stType = ?', $v );
$blocks = array();
if (count($rs) > 0) {
$pcp = new Permissions($this);
foreach($rs as $garHandle) {
if ($pcp->canViewPageVersions()) {
$s = Stack::getByName($garHandle, 'RECENT');
} else {
$s = Stack::getByName($garHandle, 'ACTIVE');
}
if (is_object($s)) {
$blocksTmp = $s->getBlocks(STACKS_AREA_NAME);
$blocks = array_merge($blocks, $blocksTmp);
}
}
}
return $blocks;
}