本文整理汇总了PHP中Stack::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP Stack::getByID方法的具体用法?PHP Stack::getByID怎么用?PHP Stack::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stack
的用法示例。
在下文中一共展示了Stack::getByID方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Application $app, $config, Block $b, Page $c, Area $a)
{
parent::__construct();
$p = new \Permissions($b);
$this->permissions = $p;
$this->block = $b;
$this->page = $c;
$this->area = $a;
$this->setAttribute('data-block-menu', 'block-menu-b' . $b->getBlockID());
$this->setAttribute('class', 'ccm-edit-mode-block-menu');
$btw = $b->getBlockTypeObject();
$btOriginal = $btw;
$bID = $b->getBlockID();
$aID = $a->getAreaID();
$heightPlus = 20;
$btHandle = $btw->getBlockTypeHandle();
$editInline = false;
if ($btw->supportsInlineEdit()) {
$editInline = true;
}
if ($btw->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
$_bi = $b->getInstance();
$_bo = Block::getByID($_bi->getOriginalBlockID());
$btOriginal = BlockType::getByHandle($_bo->getBlockTypeHandle());
$btHandle = $btOriginal->getBlockTypeHandle();
$heightPlus = 80;
if ($btOriginal->supportsInlineEdit()) {
$editInline = true;
}
}
$canDesign = $p->canEditBlockDesign() && $config->get('concrete.design.enable_custom') == true;
$canModifyGroups = $p->canEditBlockPermissions() && $config->get('concrete.permissions.model') != 'simple' && !$a->isGlobalArea();
$canEditName = $p->canEditBlockName();
$canEditCacheSettings = $p->canEditBlockCacheSettings();
$canEditCustomTemplate = $p->canEditBlockCustomTemplate();
$canScheduleGuestAccess = $config->get('concrete.permissions.model') != 'simple' && $p->canGuestsViewThisBlock() && $p->canScheduleGuestAccess() && !$a->isGlobalArea();
$canAliasBlockOut = $c->isMasterCollection() && !$a->isGlobalArea();
if ($canAliasBlockOut) {
$ct = Type::getByID($c->getPageTypeID());
}
$isAlias = $b->isAlias();
$u = new \User();
$numChildren = !$isAlias ? $b->getNumChildren() : 0;
if ($isAlias) {
$deleteMessage = t('Do you want to delete this block?');
} elseif ($numChildren) {
$deleteMessage = t('Do you want to delete this block? This item is an original. If you delete it, you will delete all blocks aliased to it');
} else {
$deleteMessage = t('Do you want to delete this block?');
}
if ($btOriginal->getBlockTypeHandle() == BLOCK_HANDLE_STACK_PROXY) {
if (is_object($_bo)) {
$bi = $_bo->getInstance();
} else {
$bi = $b->getInstance();
}
$stack = \Stack::getByID($bi->stID);
if (is_object($stack)) {
$sp = new \Permissions($stack);
if ($sp->canWrite()) {
$this->addItem(new LinkItem(\URL::to('/dashboard/blocks/stacks', 'view_details', $stack->getCollectionID()), t('Manage Stack Contents')));
}
}
} else {
if ($p->canEditBlock() && $b->isEditable()) {
if ($editInline) {
if ($b->getBlockTypeHandle() == BLOCK_HANDLE_LAYOUT_PROXY) {
$this->addItem(new LinkItem('javascript:void(0)', t('Edit Layout'), ['data-menu-action' => 'edit_inline', 'data-area-enable-grid-container' => $a->isGridContainerEnabled(), 'data-area-grid-maximum-columns' => $a->getAreaGridMaximumColumns()]));
} else {
$this->addItem(new LinkItem('javascript:void(0)', t('Edit Block'), ['data-menu-action' => 'edit_inline', 'data-area-enable-grid-container' => $a->isGridContainerEnabled(), 'data-area-grid-maximum-columns' => $a->getAreaGridMaximumColumns()]));
}
} else {
$this->addItem(new LinkItem('javascript:void(0)', t('Edit Block'), ['data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/edit'), 'dialog-title' => t('Edit %s', t($btOriginal->getBlockTypeName())), 'dialog-width' => $btOriginal->getBlockTypeInterfaceWidth(), 'dialog-height' => $btOriginal->getBlockTypeInterfaceHeight() + $heightPlus]));
}
}
}
if ($b->getBlockTypeHandle() != BLOCK_HANDLE_LAYOUT_PROXY && $b->getBlockTypeHandle() != BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY) {
$this->addItem(new LinkItem('javascript:void(0)', t('Copy to Clipboard'), ['data-menu-action' => 'block_scrapbook', 'data-token' => $app->make('token')->generate('tools/clipboard/to')]));
}
if ($p->canDeleteBlock()) {
$this->addItem(new LinkItem('javascript:void(0)', t('Delete'), ['data-menu-action' => 'delete_block', 'data-menu-delete-message' => $deleteMessage]));
}
if ($b->getBlockTypeHandle() != BLOCK_HANDLE_LAYOUT_PROXY) {
if ($canDesign || $canEditCustomTemplate || $canEditName || $canEditCacheSettings) {
$this->addItem(new DividerItem());
if ($canDesign || $canEditCustomTemplate) {
$this->addItem(new LinkItem('#', t('Design & Custom Template'), ['data-menu-action' => 'block_design']));
}
if ($b->getBlockTypeHandle() != BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY && ($canEditName || $canEditCacheSettings)) {
$this->addItem(new LinkItem('#', t('Advanced'), ['dialog-title' => t('Advanced Block Settings'), 'data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/cache'), 'dialog-width' => 500, 'dialog-height' => 320]));
}
}
}
if ($b->getBlockTypeHandle() != BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY && ($canModifyGroups || $canScheduleGuestAccess || $canAliasBlockOut)) {
$this->addItem(new DividerItem());
if ($canModifyGroups) {
$this->addItem(new LinkItem('#', t('Permissions'), ['dialog-title' => t('Block Permissions'), 'data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/permissions/list'), 'dialog-width' => 350, 'dialog-height' => 450]));
}
if ($canScheduleGuestAccess) {
$this->addItem(new LinkItem('#', t('Schedule Guest Access'), ['dialog-title' => t('Schedule Guest Access'), 'data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/permissions/guest_access'), 'dialog-width' => 500, 'dialog-height' => 320]));
//.........这里部分代码省略.........
示例2: on_page_view
public function on_page_view()
{
$stack = Stack::getByID($this->stID);
if (!is_object($stack)) {
return false;
}
$p = new Permissions($stack);
if ($p->canViewPage()) {
$blocks = $stack->getBlocks();
foreach ($blocks as $b) {
$bp = new Permissions($b);
if ($bp->canViewBlock()) {
$btc = $b->getInstance();
if ('Controller' != get_class($btc)) {
$btc->outputAutoHeaderItems();
}
$csr = $b->getBlockCustomStyleRule();
if (is_object($csr)) {
$styleHeader = '#' . $csr->getCustomStyleRuleCSSID(1) . ' {' . $csr->getCustomStyleRuleText() . "} \r\n";
$btc->addHeaderItem("<style type=\"text/css\"> \r\n" . $styleHeader . '</style>', 'VIEW');
}
$btc->runTask('on_page_view', array($view));
}
}
}
}
示例3: view_details
public function view_details($cID, $msg = false) {
$s = Stack::getByID($cID);
if (is_object($s)) {
$blocks = $s->getBlocks('Main');
$view = View::getInstance();
foreach($blocks as $b1) {
$btc = $b1->getInstance();
// now we inject any custom template CSS and JavaScript into the header
if('Controller' != get_class($btc)){
$btc->outputAutoHeaderItems();
}
$btc->runTask('on_page_view', array($view));
}
$this->addHeaderItem('<style type="text/css">' . $s->outputCustomStyleHeaderItems(true) . '</style>');
$this->set('stack', $s);
$this->set('blocks', $blocks);
switch($msg) {
case 'delete_saved':
$this->set('message', t('Delete request saved. You must complete the delete workflow before this stack can be deleted.'));
break;
}
} else {
throw new Exception(t('Invalid stack'));
}
}
示例4: get
public function get($itemsToGet = 0, $offset = 0)
{
if ($this->getQuery() == '') {
$this->setBaseQuery();
}
$stacks = array();
$this->setItemsPerPage($itemsToGet);
$r = DatabaseItemList::get($itemsToGet, $offset);
foreach ($r as $row) {
$s = Stack::getByID($row['cID'], 'RECENT');
$stacks[] = $s;
}
return $stacks;
}
示例5: approve
public function approve(WorkflowProgress $wp)
{
$s = Stack::getByID($this->getRequestedPageID());
$v = CollectionVersion::get($s, $this->cvID);
$v->approve(false);
if ($s->getStackName() != $v->getVersionName()) {
// The stack name has changed so we need to
// update that for the stack object as well.
$s->update(array('stackName' => $v->getVersionName()));
}
Events::fire('on_page_version_submit_approve', $s);
$wpr = new WorkflowProgressResponse();
$wpr->setWorkflowProgressResponseURL(BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $s->getCollectionID());
return $wpr;
}
示例6: duplicate
public function duplicate($nc = null, $preserveUserID = false)
{
if (!is_object($nc)) {
// There is not necessarily need to provide the parent
// page for the duplicate since for stacks, that is
// always the same page.
$nc = Page::getByPath(STACKS_PAGE_PATH);
}
$page = parent::duplicate($nc, $preserveUserID);
// we have to do this because we need the area to exist before we try and add something to it.
$a = Area::getOrCreate($page, STACKS_AREA_NAME);
$db = Loader::db();
$v = array($page->getCollectionName(), $page->getCollectionID(), $this->getStackType());
$db->Execute('insert into Stacks (stName, cID, stType) values (?, ?, ?)', $v);
// Make sure we return an up-to-date record
return Stack::getByID($page->getCollectionID());
}
示例7: approve
public function approve(WorkflowProgress $wp)
{
$c = Page::getByID($this->getRequestedPageID());
if ($c->getCollectionTypeHandle() == STACKS_PAGE_TYPE) {
$c = Stack::getByID($this->getRequestedPageID());
$c->delete();
$wpr = new WorkflowProgressResponse();
$wpr->setWorkflowProgressResponseURL(View::url('/dashboard/blocks/stacks', 'stack_deleted'));
return $wpr;
}
$cParentID = $c->getCollectionParentID();
if (ENABLE_TRASH_CAN) {
$c->moveToTrash();
} else {
$c->delete();
}
$wpr = new WorkflowProgressResponse();
$wpr->setWorkflowProgressResponseURL(BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $cParentID);
return $wpr;
}
示例8: view_details
public function view_details($cID)
{
$s = Stack::getByID($cID);
if (is_object($s)) {
$blocks = $s->getBlocks('Main');
$view = View::getInstance();
foreach ($blocks as $b1) {
$btc = $b1->getInstance();
// now we inject any custom template CSS and JavaScript into the header
if ('Controller' != get_class($btc)) {
$btc->outputAutoHeaderItems();
}
$btc->runTask('on_page_view', array($view));
}
$this->addHeaderItem('<style type="text/css">' . $s->outputCustomStyleHeaderItems(true) . '</style>');
$this->set('stack', $s);
$this->set('blocks', $blocks);
} else {
throw new Exception(t('Invalid stack'));
}
}
示例9: outputBlockWrapper
/**
* outputs the block wrapers for each block
* Internal helper function for display()
* @return void
*/
protected function outputBlockWrapper($isStart, &$block, $blockPositionInArea)
{
static $th = null;
$enclosing = $isStart ? $this->enclosingStart : $this->enclosingEnd;
$hasReplacements = $isStart ? $this->enclosingStartHasReplacements : $this->enclosingEndHasReplacements;
if (!empty($enclosing) && $hasReplacements) {
$bID = $block->getBlockID();
$btHandle = $block->getBlockTypeHandle();
$bName = $btHandle == 'core_stack_display' ? Stack::getByID($block->getInstance()->stID)->getStackName() : $block->getBlockName();
$th = is_null($th) ? Loader::helper('text') : $th;
$bSafeName = $th->entities($bName);
$alternatingClass = $blockPositionInArea % 2 == 0 ? 'even' : 'odd';
echo sprintf($enclosing, $bID, $btHandle, $bSafeName, $blockPositionInArea, $alternatingClass);
} else {
echo $enclosing;
}
}
示例10: Permissions
-<?php
echo $a->getAreaID();
?>
">
<div class="arrow"></div>
<div class="popover-inner">
<ul class="dropdown-menu">
<?php
if ($btOriginal->getBlockTypeHandle() == BLOCK_HANDLE_STACK_PROXY) {
if (is_object($_bo)) {
$bi = $_bo->getInstance();
} else {
$bi = $b->getInstance();
}
$stack = Stack::getByID($bi->stID);
if (is_object($stack)) {
$sp = new Permissions($stack);
if ($sp->canWrite()) {
?>
<li><a href="<?php
echo View::url('/dashboard/blocks/stacks', 'view_details', $stack->getCollectionID());
?>
"><?php
echo t("Manage Stack Contents");
?>
</a></li>
<?php
}
示例11: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
?>
<div class="ccm-ui">
<?php
$ci = Loader::helper('concrete/urls');
$st = Stack::getByID($_REQUEST['stackID']);
$blocks = $st->getBlocks(STACKS_AREA_NAME);
if (count($blocks) == 0) {
?>
<p><?php
echo t('There are no blocks in this stack.');
?>
</p>
<div id="ccm-tab-content-add-stack">
<h3><?php
echo t('Add Stack');
?>
</h3>
<p><?php
echo t('Add the entire stack to this page.');
?>
</p>
<p><a class="btn primary" href="javascript:void(0)" onclick="ccmStackAddToArea(<?php
echo $st->getCollectionID();
?>
, '<?php
echo Loader::helper('text')->entities($a->getAreaHandle());
?>
')"><?php
示例12: defined
<?php
defined('C5_EXECUTE') or die('Access Denied.');
$c = Page::getCurrentPage();
$cp = new Permissions($c);
if ($cp->canViewPageVersions()) {
$stack = Stack::getByID($stID);
} else {
$stack = Stack::getByID($stID, 'ACTIVE');
}
if ($stack) {
$ax = Area::get($stack, STACKS_AREA_NAME);
$axp = new Permissions($ax);
if ($axp->canRead()) {
$ax->disableControls();
$ax->display($stack);
}
}
示例13: duplicate
public function duplicate($cID)
{
$s = Stack::getByID($cID);
if (is_object($s)) {
$this->set('stack', $s);
} else {
throw new Exception(t('Invalid stack'));
}
$sps = new Permissions($s);
if (!$sps->canMoveOrCopyPage()) {
$this->redirect('/dashboard/blocks/stacks', 'view_details', $cID);
}
if ($this->isPost()) {
if (Loader::helper('validation/token')->validate('duplicate_stack')) {
if (Loader::helper('validation/strings')->notempty($stackName = trim($this->post('stackName')))) {
$ns = $s->duplicate();
$ns->update(array('stackName' => $stackName));
$this->redirect('/dashboard/blocks/stacks', 'stack_duplicated');
} else {
$this->error->add(t("You must give your stack a name."));
}
} else {
$this->error->add(Loader::helper('validation/token')->getErrorMessage());
}
$name = trim($this->post('name'));
}
}