本文整理汇总了PHP中Area::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Area::get方法的具体用法?PHP Area::get怎么用?PHP Area::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Area
的用法示例。
在下文中一共展示了Area::get方法的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: setPermissionObject
public function setPermissionObject(Block $b)
{
$this->permissionObject = $b;
// if the area overrides the collection permissions explicitly (with a one on the override column) we check
if ($b->overrideAreaPermissions()) {
$this->permissionObjectToCheck = $b;
} else {
$a = $b->getBlockAreaObject();
if (is_object($a)) {
if ($a->overrideCollectionPermissions()) {
$this->permissionObjectToCheck = $a;
} elseif ($a->getAreaCollectionInheritID()) {
$mcID = $a->getAreaCollectionInheritID();
$mc = Page::getByID($mcID, 'RECENT');
$ma = Area::get($mc, $a->getAreaHandle());
if ($ma->overrideCollectionPermissions()) {
$this->permissionObjectToCheck = $ma;
} else {
$this->permissionObjectToCheck = $ma->getAreaCollectionObject();
}
} else {
$this->permissionObjectToCheck = $a->getAreaCollectionObject();
}
} else {
$this->permissionObjectToCheck = Page::getCurrentPage();
}
}
}
示例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: postListar
/**
* Store a newly created resource in storage.
* POST /area/listar
*
* @return Response
*/
public function postListar()
{
//si la peticion es ajax
if (Request::ajax()) {
$areas = Area::get(Input::all());
return Response::json(array('rst' => 1, 'datos' => $areas));
}
}
示例5: addScrapbook
public function addScrapbook()
{
$scrapbookName = $_REQUEST['scrapbookName'];
$c = $this->getCollectionObject();
$a = Area::get($c, $scrapbookName);
if (!is_object($a)) {
$a = Area::getOrCreate($c, $scrapbookName);
}
$this->redirect('/dashboard/scrapbook/');
}
示例6: addScrapbook
public function addScrapbook(){
$txt = Loader::helper('text');
$valt = Loader::helper('validation/token');
if(!$valt->validate('add_scrapbook')){
$this->set('error', array($valt->getErrorMessage()));
$this->view();
return;
}
$scrapbookName = $txt->sanitize($_REQUEST['scrapbookName']);
$c=$this->getCollectionObject();
$a = Area::get($c, $scrapbookName);
if (!is_object($a)) {
$a = Area::getOrCreate( $c, $scrapbookName);
}
$this->redirect('/dashboard/scrapbook/');
}
示例7: importPageAreas
public function importPageAreas(Page $page, \SimpleXMLElement $px)
{
foreach ($px->area as $ax) {
if (isset($ax->blocks)) {
foreach ($ax->blocks->block as $bx) {
if ($bx['type'] != '') {
// we check this because you might just get a block node with only an mc-block-id, if it's an alias
$bt = BlockType::getByHandle((string) $bx['type']);
if (!is_object($bt)) {
throw new \Exception(t('Invalid block type handle: %s', strval($bx['type'])));
}
$btc = $bt->getController();
$btc->import($page, (string) $ax['name'], $bx);
} else {
if ($bx['mc-block-id'] != '') {
// we find that block in the master collection block pool and alias it out
$bID = array_search((string) $bx['mc-block-id'], ContentImporter::getMasterCollectionTemporaryBlockIDs());
if ($bID) {
$mc = Page::getByID($page->getMasterCollectionID(), 'RECENT');
$block = Block::getByID($bID, $mc, (string) $ax['name']);
$block->alias($page);
if ($block->getBlockTypeHandle() == BLOCK_HANDLE_LAYOUT_PROXY) {
// we have to go get the blocks on that page in this layout.
$btc = $block->getController();
$arLayout = $btc->getAreaLayoutObject();
$columns = $arLayout->getAreaLayoutColumns();
foreach ($columns as $column) {
$area = $column->getAreaObject();
$blocks = $area->getAreaBlocksArray($mc);
foreach ($blocks as $_b) {
$_b->alias($page);
}
}
}
}
}
}
}
}
if (isset($ax->style)) {
$area = \Area::get($page, (string) $ax['name']);
$set = StyleSet::import($ax->style);
$page->setCustomStyleSet($area, $set);
}
}
}
示例8: export
/**
* @param $stack \Concrete\Core\Page\Stack\Stack
* @param \SimpleXMLElement $xml
* @return mixed
*/
public function export($stack, \SimpleXMLElement $xml)
{
$db = \Database::connection();
$node = $xml->addChild('stack');
$node->addAttribute('name', \Core::make('helper/text')->entities($stack->getCollectionName()));
if ($stack->getStackTypeExportText()) {
$node->addAttribute('type', $stack->getStackTypeExportText());
}
$node->addAttribute('path', substr($stack->getCollectionPath(), strlen(STACKS_PAGE_PATH)));
// you shouldn't ever have a sub area in a stack but just in case.
$r = $db->Execute('select arHandle from Areas where cID = ? and arParentID = 0', array($stack->getCollectionID()));
while ($row = $r->FetchRow()) {
$ax = \Area::get($stack, $row['arHandle']);
$ax->export($node, $stack);
}
return $node;
}
示例9: submit
public function submit()
{
if ($this->validateAction() && $this->canAccess()) {
$a = \Area::get($this->page, $_GET['arHandle']);
$c = $this->page;
if (is_object($a)) {
$b = \Block::getByID($_GET['bID'], $c, $a);
$p = new \Permissions($b);
if ($p->canAdminBlock() && $c->isMasterCollection()) {
if (is_array($_POST['cIDs'])) {
foreach ($_POST['cIDs'] as $cID) {
$nc = \Page::getByID($cID);
if (!$b->isAlias($nc)) {
$bt = $b->getBlockTypeObject();
if ($bt->isCopiedWhenPropagated()) {
$b->duplicate($nc, true);
} else {
$b->alias($nc);
}
}
}
}
// now remove any items that WERE checked and now aren't
if (is_array($_POST['checkedCIDs'])) {
foreach ($_POST['checkedCIDs'] as $cID) {
if (!is_array($_POST['cIDs']) || !in_array($cID, $_POST['cIDs'])) {
$nc = \Page::getByID($cID, 'RECENT');
$nb = \Block::getByID($_GET['bID'], $nc, $a);
if (is_object($nb) && !$nb->isError()) {
$nb->deleteBlock();
}
$nc->rescanDisplayOrder($_REQUEST['arHandle']);
}
}
}
$er = new EditResponse();
$er->setPage($this->page);
$er->setAdditionalDataAttribute('bID', $b->getBlockID());
$er->setAdditionalDataAttribute('aID', $a->getAreaID());
$er->setAdditionalDataAttribute('arHandle', $a->getAreaHandle());
$er->setMessage(t('Defaults updated.'));
$er->outputJSON();
}
}
}
}
示例10: getAreaPermissions
private static function getAreaPermissions($unknownObj) {
// this is split out because it's so f'ing complicated
$cObj = $unknownObj->getAreaCollectionObject();
if ($unknownObj->overrideCollectionPermissions()) {
$po = PermissionsProxy::getNewOrCached($unknownObj, 'AreaPermissions');
} else {
if ($unknownObj->getAreaCollectionInheritID() > 0) {
$areac = Page::getByID($unknownObj->getAreaCollectionInheritID());
$inheritArea = Area::get($areac, $unknownObj->getAreaHandle());
if ($inheritArea->overrideCollectionPermissions()) {
$po = PermissionsProxy::getNewOrCached($inheritArea, 'AreaPermissions');
}
}
}
if (!isset($po)) {
// otherwise we grab the collection permissions for this page
$po = PermissionsProxy::getNewOrCached($cObj, 'CollectionPermissions');
}
return $po;
}
示例11: t
}
?>
href="javascript:void(0)" onclick="window.location.href='<?php
echo DIR_REL . "/" . DISPATCHER_FILENAME . "?cID=" . $stack->getCollectionID() . "&ctask=approve-recent" . $token;
?>
'" class="btn small ccm-main-nav-edit-option ccm-button-v2-right"><?php
echo t('Approve Changes');
?>
</a>
<?php
}
?>
</div>
<div class="ccm-pane-body ccm-pane-body-footer clearfix" id="ccm-stack-container">
<?php
$a = Area::get($stack, 'Main');
$bv = new BlockView();
$bv->renderElement('block_area_header', array('a' => $a));
$bv->renderElement('block_area_header_view', array('a' => $a));
foreach ($blocks as $b) {
$bv = new BlockView();
$bv->setAreaObject($a);
$p = new Permissions($b);
if ($p->canViewBlock()) {
$bv->renderElement('block_controls', array('a' => $a, 'b' => $b, 'p' => $p));
$bv->renderElement('block_header', array('a' => $a, 'b' => $b, 'p' => $p));
$bv->render($b);
$bv->renderElement('block_footer');
}
}
$bv->renderElement('block_area_footer_view', array('a' => $a));
示例12:
if ($ap->canAddBlock($bt)) {
if (!$bt->includeAll()) {
$nvc = $c->getVersionToModify();
$b->alias($nvc);
} else {
$b->alias($c);
}
}
}
}
} else {
if (isset($_REQUEST['bID'])) {
if ($_REQUEST['globalBlock']) {
$scrapbookHelper = Loader::helper('concrete/scrapbook');
$c1 = $scrapbookHelper->getGlobalScrapbookPage();
$a1 = Area::get($c1, $_REQUEST['globalScrapbook']);
$b = Block::getByID($_REQUEST['bID'], $c1, $a1);
} else {
$b = Block::getByID($_REQUEST['bID']);
}
$bt = BlockType::getByHandle($b->getBlockTypeHandle());
if ($ap->canAddBlock($bt)) {
$b->setBlockAreaObject($a);
if (!$bt->includeAll()) {
$nvc = $c->getVersionToModify();
$b->alias($nvc);
} else {
$b->alias($c);
}
}
}
示例13: array
?>
'"><?php
echo $publishTitle;
?>
</button>
</li>
</ul>
<?php
}
?>
</div>
</nav>
<div id="ccm-stack-container">
<?php
$a = Area::get($stackToEdit, STACKS_AREA_NAME);
$a->forceControlsToDisplay();
View::element('block_area_header', array('a' => $a));
foreach ($blocks as $b) {
$bv = new BlockView($b);
$bv->setAreaObject($a);
$p = new Permissions($b);
if ($p->canViewBlock()) {
$bv->render('view');
}
}
//View::element('block_area_footer', array('a' => $a));
print '</div>';
// No, we don't include the footer because we don't want all area controls available.
// But the footer element has a closing DIV we need.
?>
示例14: t
exit;
}
break;
case 'output':
$p = $_REQUEST['pID'] ? Pile::get($_REQUEST['pID']) : Pile::getDefault();
if (is_object($p)) {
if ($p->isMyPile()) {
$p->output($_REQUEST['module']);
exit;
}
}
break;
}
}
if ($_REQUEST['btask'] == 'add') {
$a = Area::get($c, $_REQUEST['arHandle']);
$b = Block::getByID($_REQUEST['bID'], $c, $a);
if (!$a) {
echo t('Error: Area not found.');
} elseif (!intval($b->bID)) {
echo t('Error: Block not found.');
} elseif (!$_REQUEST['scrapbookName'] && $_REQUEST['btask'] == 'add') {
$sp = Pile::getDefault();
$scrapBookAreasData = $scrapbookHelper->getAvailableScrapbooks();
$ih = Loader::helper('concrete/interface');
$defaultScrapbook = $scrapbookHelper->getDefault();
?>
<script type="text/javascript">
if(!ccmSaveToScrapbookDialogTarget)
var ccmSaveToScrapbookDialogTarget=null;
示例15: migrateBlockPermissions
protected function migrateBlockPermissions()
{
if (PERMISSIONS_MODEL == 'simple') {
return;
}
$db = Loader::db();
$tables = $db->MetaTables();
if (!in_array('CollectionVersionBlockPermissions', $tables)) {
return false;
}
// permissions
$permissionMap = array('r' => array(PermissionKey::getByHandle('view_block')), 'wa' => array(PermissionKey::getByHandle('edit_block'), PermissionKey::getByHandle('edit_block_custom_template'), PermissionKey::getByHandle('edit_block_design')), 'db' => array(PermissionKey::getByHandle('delete_block'), PermissionKey::getByHandle('schedule_guest_access'), PermissionKey::getByHandle('edit_block_permissions')));
$r = $db->Execute('select * from CollectionVersionBlockPermissions order by cID asc');
while ($row = $r->FetchRow()) {
$pe = $this->migrateAccessEntity($row);
if (!$pe) {
continue;
}
$permissions = $this->getPermissionsArray($row['cbgPermissions']);
$co = Page::getByID($row['cID'], $row['cvID']);
if (!is_object($co) || $co->isError()) {
continue;
}
$arHandle = $db->GetOne('select arHandle from CollectionVersionBlocks cvb where cvb.cID = ? and
cvb.cvID = ? and cvb.bID = ?', array($row['cID'], $row['cvID'], $row['bID']));
$a = Area::get($co, $arHandle);
$bo = Block::getByID($row['bID'], $co, $a);
if (is_object($bo)) {
foreach ($permissions as $p) {
$permissionsToApply = $permissionMap[$p];
foreach ($permissionsToApply as $pko) {
$pko->setPermissionObject($bo);
$pt = $pko->getPermissionAssignmentObject();
$pa = $pko->getPermissionAccessObject();
if (!is_object($pa)) {
$pa = PermissionAccess::create($pko);
} else {
if ($pa->isPermissionAccessInUse()) {
$pa = $pa->duplicate();
}
}
$pa->addListItem($pe, false, BlockPermissionKey::ACCESS_TYPE_INCLUDE);
$pt->assignPermissionAccess($pa);
}
}
}
}
}