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


PHP Area::getOrCreate方法代码示例

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


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

示例1: addStack

	public static function addStack($stackName, $type = self::ST_TYPE_USER_ADDED) {
		$ct = new CollectionType();
		$data = array();

		$parent = Page::getByPath(STACKS_PAGE_PATH);
		$data = array();
		$data['name'] = $stackName;
		if (!$stackName) {
			$data['name'] = t('No Name');
		}
		$pagetype = CollectionType::getByHandle(STACKS_PAGE_TYPE);
		$page = $parent->add($pagetype, $data);	

		// 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);
		
		// finally we add the row to the stacks table
		$db = Loader::db();
		$stackCID = $page->getCollectionID();
		$v = array($stackName, $stackCID, $type);
		$db->Execute('insert into Stacks (stName, cID, stType) values (?, ?, ?)', $v);
		
		//Return the new stack
		return self::getByID($stackCID);
	}
开发者ID:nveid,项目名称:concrete5,代码行数:25,代码来源:model.php

示例2: on_start

 public function on_start()
 {
     parent::on_start();
     $this->area = \Area::getOrCreate($this->page, $_REQUEST['arHandle']);
     $this->permissions = new \Permissions($this->area);
     $this->set('a', $this->area);
 }
开发者ID:masteramuk,项目名称:concrete5,代码行数:7,代码来源:design.php

示例3: run

	public function run() {
		$db = Loader::db();
		Loader::model('collection_attributes');
		Loader::model('single_page');
		Loader::model('file_version');
		
		// Add in stuff that may have gotten missed before
		$p = Page::getByPath('/profile');
		if ($p->isError()) {
			$d1 = SinglePage::add('/profile');
			$d2 = SinglePage::add('/profile/edit');
			$d3 = SinglePage::add('/profile/avatar');				
		}
		$p2 = Page::getByPath('/dashboard/users/registration');
		if ($p2->isError()) {
			$d4 = SinglePage::add('/dashboard/users/registration');
		}
		
		// Move any global blocks to new scrapbook page.
		$sc = Page::getByPath("/dashboard/scrapbook/global");
		$scn = Page::getByPath('/dashboard/scrapbook');
		$scu = Page::getByPath('/dashboard/scrapbook/user');
		if (!$sc->isError()) {
			$blocks = $sc->getBlocks("Global Scrapbook");
			if (count($blocks) > 0) {
				// we create the new shared scrapbook 1
				$a = Area::getOrCreate($scn, t('Shared Scrapbook 1'));
				foreach($blocks as $_b) {
					// we move them into the area on the new page. 
					$_b->move($scn, $a);
					$_b->refreshCacheAll();
				}
			}
			$sc->delete();
		}
		if (!$scu->isError()) {
			$scu->delete();
		}
		//add the new collection attribute keys
		$cak=CollectionAttributeKey::getByHandle('header_extra_content');
		if(!is_object($cak)) {
			CollectionAttributeKey::add('header_extra_content', t('Header Extra Content'), true, null, 'TEXT');
		}
		$cak=CollectionAttributeKey::getByHandle('exclude_search_index');
		if (!is_object($cak)) {
			CollectionAttributeKey::add('exclude_search_index', t('Exclude From Search Index'), true, null, 'BOOLEAN');
		}
		
		//convert file tags to new format, cleaned up with leading and trailing line breaks  
		$fileVersionsData=$db->GetAll('SELECT fID, fvID, fvTags FROM FileVersions');
		foreach($fileVersionsData as $fvData){
			$vals=array( FileVersion::cleanTags($fvData['fvTags']) , $fvData['fID'] , $fvData['fvID'] );
			$db->query('UPDATE FileVersions SET fvTags=? WHERE fID=? AND fvID=?',  $vals );
		}
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:55,代码来源:version_530.php

示例4: 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;
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:52,代码来源:block.php

示例5: 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());
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:17,代码来源:model.php

示例6: 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

示例7: getByID

 public static function getByID($bID, $c = null, $a = null)
 {
     if ($c == null && $a == null) {
         $cID = 0;
         $arHandle = "";
         $cvID = 0;
         $b = CacheLocal::getEntry('block', $bID);
     } else {
         if (is_object($a)) {
             $arHandle = $a->getAreaHandle();
         } else {
             if ($a != null) {
                 $arHandle = $a;
                 $a = Area::getOrCreate($c, $a);
             }
         }
         $cID = $c->getCollectionID();
         $cvID = $c->getVersionID();
         $b = CacheLocal::getEntry('block', $bID . ':' . $cID . ':' . $cvID . ':' . $arHandle);
     }
     if ($b instanceof Block) {
         return $b;
     }
     $db = Loader::db();
     $b = new Block();
     if ($c == null && $a == null) {
         // just grab really specific block stuff
         $q = "select bID, bIsActive, BlockTypes.btID, Blocks.btCachedBlockRecord, BlockTypes.btHandle, BlockTypes.pkgID, BlockTypes.btName, bName, bDateAdded, bDateModified, bFilename, Blocks.uID from Blocks inner join BlockTypes on (Blocks.btID = BlockTypes.btID) where bID = ?";
         $b->isOriginal = 1;
         $v = array($bID);
     } else {
         $b->arHandle = $arHandle;
         $b->a = $a;
         $b->cID = $cID;
         $b->c = $c ? $c : '';
         $vo = $c->getVersionObject();
         $cvID = $vo->getVersionID();
         $v = array($b->arHandle, $cID, $cvID, $bID);
         $q = "select CollectionVersionBlocks.isOriginal, Blocks.btCachedBlockRecord, BlockTypes.pkgID, CollectionVersionBlocks.cbOverrideAreaPermissions, CollectionVersionBlocks.cbDisplayOrder, Blocks.bIsActive, Blocks.bID, Blocks.btID, bName, bDateAdded, bDateModified, bFilename, btHandle, Blocks.uID from CollectionVersionBlocks inner join Blocks on (CollectionVersionBlocks.bID = Blocks.bID) inner join BlockTypes on (Blocks.btID = BlockTypes.btID) where CollectionVersionBlocks.arHandle = ? and CollectionVersionBlocks.cID = ? and (CollectionVersionBlocks.cvID = ? or CollectionVersionBlocks.cbIncludeAll=1) and CollectionVersionBlocks.bID = ?";
     }
     $r = $db->query($q, $v);
     $row = $r->fetchRow();
     if (is_array($row)) {
         $b->setPropertiesFromArray($row);
         $r->free();
         $bt = BlockType::getByID($b->getBlockTypeID());
         $class = $bt->getBlockTypeClass();
         if ($class == false) {
             // we can't find the class file, so we return
             return false;
         }
         $b->instance = new $class($b);
         if ($c != null || $a != null) {
             CacheLocal::set('block', $bID . ':' . $cID . ':' . $cvID . ':' . $arHandle, $b);
         } else {
             $ca = new Cache();
             CacheLocal::set('block', $bID, $b);
         }
         return $b;
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:61,代码来源:block.php

示例8: array

     // 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 = $ob->duplicate($nvc);
         $b->deleteBlock();
         $b =& $nb;
     }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:31,代码来源:process.php

示例9: rescanAreaPermissions

 public function rescanAreaPermissions()
 {
     $db = Loader::db();
     $arHandles = $db->GetCol('select arHandle from Areas where cID = ?', $this->getCollectionID());
     foreach ($arHandles as $arHandle) {
         $a = Area::getOrCreate($this, $arHandle);
         $a->rescanAreaPermissionsChain();
     }
     $blocks = $this->getBlocks();
     foreach ($blocks as $b) {
         $b->refreshCache();
     }
     parent::refreshCache();
 }
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:14,代码来源:page.php

示例10: rename_block

 public function rename_block()
 {
     $bID = intval($_REQUEST['bID']);
     $globalScrapbookC = $this->getCollectionObject();
     $scrapbookName = $_REQUEST['scrapbookName'];
     $globalScrapbookArea = Area::getOrCreate($globalScrapbookC, $scrapbookName);
     $block = Block::getById($bID, $globalScrapbookC, $globalScrapbookArea);
     if ($block && strlen($_POST['bName'])) {
         //&& $block->getAreaHandle()=='Global Scrapbook'
         //this is needed so the cache clears correctly
         $bp = new Permissions($block);
         if ($bp->canAdmin()) {
             $block->setBlockAreaObject($globalScrapbookArea);
             $block->updateBlockName($_POST['bName'], 1);
         }
     }
     $this->view();
 }
开发者ID:homer6,项目名称:concrete5-mirror,代码行数:18,代码来源:controller.php

示例11: migrateAreaPermissions

 protected function migrateAreaPermissions()
 {
     if (PERMISSIONS_MODEL == 'simple') {
         return;
     }
     $db = Loader::db();
     $tables = $db->MetaTables();
     if (!in_array('AreaGroups', $tables)) {
         return false;
     }
     // permissions
     $permissionMap = array('r' => array(PermissionKey::getByHandle('view_area')), 'wa' => array(PermissionKey::getByHandle('edit_area_contents'), PermissionKey::getByHandle('add_layout_to_area'), PermissionKey::getByHandle('edit_area_design'), PermissionKey::getByHandle('edit_area_contents')), 'db' => array(PermissionKey::getByHandle('edit_area_permissions'), PermissionKey::getByHandle('schedule_area_contents_guest_access'), PermissionKey::getByHandle('delete_area_contents')));
     $r = $db->Execute('select * from AreaGroups order by cID asc');
     while ($row = $r->FetchRow()) {
         $pe = $this->migrateAccessEntity($row);
         if (!$pe) {
             continue;
         }
         $permissions = $this->getPermissionsArray($row['agPermissions']);
         $co = Page::getByID($row['cID']);
         if (!is_object($co) || $co->getCollectionID() <= 0) {
             continue;
         }
         $ax = Area::getOrCreate($co, $row['arHandle']);
         foreach ($permissions as $p) {
             $permissionsToApply = $permissionMap[$p];
             foreach ($permissionsToApply as $pko) {
                 $pko->setPermissionObject($ax);
                 $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, AreaPermissionKey::ACCESS_TYPE_INCLUDE);
                 $pt->assignPermissionAccess($pa);
             }
         }
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:43,代码来源:version_560.php

示例12: getByID

 public static function getByID($bID, $c = null, $a = null)
 {
     if ($c == null && $a == null) {
         $cID = 0;
         $arHandle = "";
         $cvID = 0;
         $b = Cache::get('block', $bID);
     } else {
         if (is_object($a)) {
             $arHandle = $a->getAreaHandle();
         } else {
             if ($a != null) {
                 $arHandle = $a;
                 $a = Area::getOrCreate($c, $a);
             }
         }
         $cID = $c->getCollectionID();
         $cvID = $c->getVersionID();
         $b = Cache::get('block', $bID . ':' . $cID . ':' . $cvID . ':' . $arHandle);
         if ($b instanceof Block) {
             return $b;
         }
     }
     if ($b instanceof Block) {
         return $b;
     }
     $db = Loader::db();
     $b = new Block();
     if ($c == null && $a == null) {
         // just grab really specific block stuff
         $q = "select bID, bIsActive, BlockTypes.btID, BlockTypes.btHandle, BlockTypes.pkgID, BlockTypes.btName, bName, bDateAdded, bDateModified, bFilename, Blocks.uID from Blocks inner join BlockTypes on (Blocks.btID = BlockTypes.btID) where bID = ?";
         $b->isOriginal = 1;
         $v = array($bID);
     } else {
         $b->arHandle = $arHandle;
         $b->a = $a;
         $b->cID = $cID;
         $b->c = $c ? $c : '';
         $vo = $c->getVersionObject();
         $cvID = $vo->getVersionID();
         $v = array($b->arHandle, $cID, $cvID, $bID);
         $q = "select CollectionVersionBlocks.isOriginal, BlockTypes.pkgID, CollectionVersionBlocks.cbOverrideAreaPermissions, CollectionVersionBlocks.cbDisplayOrder,\n\t\t\tBlocks.bIsActive, Blocks.bID, Blocks.btID, bName, bDateAdded, bDateModified, bFilename, btHandle, Blocks.uID from CollectionVersionBlocks inner join Blocks on (CollectionVersionBlocks.bID = Blocks.bID)\n\t\t\tinner join BlockTypes on (Blocks.btID = BlockTypes.btID) where CollectionVersionBlocks.arHandle = ? and CollectionVersionBlocks.cID = ? and (CollectionVersionBlocks.cvID = ? or CollectionVersionBlocks.cbIncludeAll=1) and CollectionVersionBlocks.bID = ?";
     }
     $r = $db->query($q, $v);
     $row = $r->fetchRow();
     if (is_array($row)) {
         $b->setPropertiesFromArray($row);
         $b->csrID = $db->GetOne('select csrID from CollectionVersionBlockStyles where cID = ? and cvID = ? and arHandle = ? and bID = ?', array($cID, $cvID, $b->arHandle, $bID));
         $r->free();
         $bt = BlockType::getByID($b->getBlockTypeID());
         $class = $bt->getBlockTypeClass();
         if ($class == false) {
             // we can't find the class file, so we return
             return false;
         }
         $b->instance = new $class($b);
         $b->populateIsGlobal();
         if ($c != null) {
             $ct = CollectionType::getByID($c->getCollectionTypeID());
             if (is_object($ct)) {
                 if ($ct->isCollectionTypeIncludedInComposer()) {
                     if ($c->isMasterCollection()) {
                         $ctID = $c->getCollectionTypeID();
                         $ccbID = $bID;
                     } else {
                         $tempBID = $b->getBlockID();
                         while ($tempBID != false && $tempBID != 0) {
                             $originalBID = $tempBID;
                             $tempBID = $db->GetOne('select distinct br.originalBID from BlockRelations br inner join CollectionVersionBlocks cvb on cvb.bID = br.bID where br.bID = ? and cvb.cID = ?', array($tempBID, $cID));
                         }
                         if ($originalBID && is_object($c)) {
                             $ctID = $c->getCollectionTypeID();
                             $ccbID = $originalBID;
                         }
                     }
                     if ($ctID && $ccbID) {
                         $cb = $db->GetRow('select bID, ccFilename from ComposerContentLayout where ctID = ? and bID = ?', array($ctID, $ccbID));
                         if (is_array($cb) && $cb['bID'] == $ccbID) {
                             $b->bIncludeInComposer = 1;
                             $b->cbFilename = $cb['ccFilename'];
                         }
                     }
                 }
             }
         }
         if ($c != null || $a != null) {
             $ca = new Cache();
             $ca->set('block', $bID . ':' . $cID . ':' . $cvID . ':' . $arHandle, $b);
         } else {
             $ca = new Cache();
             $ca->set('block', $bID, $b);
         }
         return $b;
     }
 }
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:95,代码来源:block.php

示例13: display

	function display(&$c, $alternateBlockArray = null) {

		if(!intval($c->cID)){
			//Invalid Collection
			return false;
		}
		
		$currentPage = Page::getCurrentPage();
		$ourArea = Area::getOrCreate($c, $this->arHandle);
		if (count($this->customTemplateArray) > 0) {
			$ourArea->customTemplateArray = $this->customTemplateArray;
		}
		if (count($this->attributes) > 0) {
			$ourArea->attributes = $this->attributes;
		}
		if ($this->maximumBlocks > -1) {
			$ourArea->maximumBlocks = $this->maximumBlocks;
		}
		$ap = new Permissions($ourArea);
		$blocksToDisplay = ($alternateBlockArray) ? $alternateBlockArray : $ourArea->getAreaBlocksArray($c, $ap);
		$this->totalBlocks = $ourArea->getTotalBlocksInArea();
		$u = new User();
		
		$bv = new BlockView();
		
		// now, we iterate through these block groups (which are actually arrays of block objects), and display them on the page
		
		if (($this->showControls) && ($c->isEditMode() && ($ap->canAddBlocks() || $u->isSuperUser()))) {
			$bv->renderElement('block_area_header', array('a' => $ourArea));	
		}

		$bv->renderElement('block_area_header_view', array('a' => $ourArea));	

		//display layouts tied to this area 
		//Might need to move this to a better position  
		$areaLayouts = $this->getAreaLayouts($c);
		if(is_array($areaLayouts) && count($areaLayouts)){ 
			foreach($areaLayouts as $layout){
				$layout->display($c,$this);  
			}
			if($this->showControls && ($c->isArrangeMode() || $c->isEditMode())) {
				echo '<div class="ccm-layouts-block-arrange-placeholder ccm-block-arrange"></div>';
			}
		}


		foreach ($blocksToDisplay as $b) {
			$bv = new BlockView();
			$bv->setAreaObject($ourArea); 
			
			// this is useful for rendering areas from one page
			// onto the next and including interactive elements
			if ($currentPage->getCollectionID() != $c->getCollectionID()) {
				$b->setBlockActionCollectionID($c->getCollectionID());
			}
			$p = new Permissions($b);
			if (($p->canWrite() || $p->canDeleteBlock()) && $c->isEditMode() && $this->showControls) {
				$includeEditStrip = true;
			}

			if ($p->canRead()) {
				if (!$c->isEditMode()) {
					echo $this->enclosingStart;
				}
				if ($includeEditStrip) {
					$bv->renderElement('block_controls', array(
						'a' => $ourArea,
						'b' => $b,
						'p' => $p
					));
					$bv->renderElement('block_header', array(
						'a' => $ourArea,
						'b' => $b,
						'p' => $p
					));
				}

				$bv->render($b);
				if ($includeEditStrip) {
					$bv->renderElement('block_footer');
				}
				if (!$c->isEditMode()) {
					echo $this->enclosingEnd;
				}
			}
		}

		$bv->renderElement('block_area_footer_view', array('a' => $ourArea));	

		if (($this->showControls) && ($c->isEditMode() && ($ap->canAddBlocks() || $u->isSuperUser()))) {
			$bv->renderElement('block_area_footer', array('a' => $ourArea));	
		}
	}
开发者ID:remkoj,项目名称:concrete5,代码行数:93,代码来源:area.php

示例14:

&cID=<?php 
echo $page_id;
?>
&areaHandle=Features&projectID=<?php 
echo $c->getCollectionHandle();
?>
&domainHandle=home&volumeHandle=feature&partHandle=na&chapterHandle=na">
							<m class="glyphicon glyphicon-circle-plus"></m>
						</a>
					</span>
				</h1>
			</header>
			<section class="container-fluid">
				<div class="row">
<?php 
$a = Area::getOrCreate($c, 'Features');
$blocks = $c->getBlocks('Features');
foreach ($blocks as $block) {
    echo '<section class="col-sm-12 col-md-6">';
    $block->display();
    echo '</section>';
}
?>
				</div>
			</section>
		</section>

		<section class="container-fluid">
			<div class="row">
			<header>
				<h1><?php 
开发者ID:rratcliffe,项目名称:fsen,代码行数:31,代码来源:project_homepage.php

示例15: submit

 public function submit()
 {
     if ($this->validateAction() && $this->canAccess()) {
         $c = $this->page;
         $a = \Area::get($this->page, $_REQUEST['arHandle']);
         $ax = $a;
         $cx = $c;
         if ($a->isGlobalArea()) {
             $ax = STACKS_AREA_NAME;
             $cx = \Stack::getByName($_REQUEST['arHandle']);
         }
         $b = \Block::getByID($_REQUEST['bID'], $cx, $ax);
         $pr = new \Concrete\Core\Page\EditResponse();
         $pr->setPage($this->page);
         $bi = $b->getInstance();
         if ($b->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
             $_b = \Block::getByID($bi->getOriginalBlockID());
             $bi = $_b->getInstance();
             // for validation
         }
         $e = $bi->validate($_POST);
         $pr->setAdditionalDataAttribute('aID', $a->getAreaID());
         $pr->setAdditionalDataAttribute('arHandle', $a->getAreaHandle());
         $pr->setError($e);
         if (!is_object($e) || $e instanceof \Concrete\Core\Error\Error && !$e->has()) {
             $bt = BlockType::getByHandle($b->getBlockTypeHandle());
             if (!$bt->includeAll()) {
                 // we make sure to create a new version, if necessary
                 $nvc = $cx->getVersionToModify();
             } else {
                 $nvc = $cx;
                 // keep the same one
             }
             if ($a->isGlobalArea()) {
                 $xvc = $c->getVersionToModify();
                 // we need to create a new version of THIS page as well.
                 $xvc->relateVersionEdits($nvc);
             }
             $ob = $b;
             // replace the block with the version of the block in the later version (if applicable)
             $b = \Block::getByID($_REQUEST['bID'], $nvc, $ax);
             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 = $ob->duplicate($nvc);
                     $b->deleteBlock();
                     $b =& $nb;
                 }
             }
             $pr->setAdditionalDataAttribute('bID', $b->getBlockID());
             // we can update the block that we're submitting
             $b->update($_POST);
         }
         $pr->outputJSON();
     }
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:82,代码来源:edit.php


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