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


PHP Area::getAreaHandleFromID方法代码示例

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


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

示例1: Permissions

					$doProcessArrangement = true;
					if (PERMISSIONS_MODEL == 'advanced') {
						// first, we check to see if we have permissions to edit the area contents for the source area.
						$arHandle = Area::getAreaHandleFromID($_POST['sourceBlockAreaID']);
						$ar = Area::getOrCreate($nvc, $arHandle);
						$ap = new Permissions($ar);
						if (!$ap->canEditAreaContents()) {
							$r = new stdClass;
							$r->error = true;
							$doProcessArrangement = false;
							$r->message = t('You may not arrange the contents of area %s.', $arHandle);
						} else {
							// now we get further in. We check to see if we're dealing with both a source AND a destination area.
							// if so, we check the area permissions for the destination area.
							if ($_POST['sourceBlockAreaID'] != $_POST['destinationBlockAreaID']) {
								$destAreaHandle = Area::getAreaHandleFromID($_POST['destinationBlockAreaID']);
								$destArea = Area::getOrCreate($nvc, $destAreaHandle);
								$destAP = new Permissions($destArea);
								if (!$destAP->canEditAreaContents()) {
									$r = new stdClass;
									$r->error = true;
									$doProcessArrangement = false;
									$r->message = t('You may not arrange the contents of area %s.', $destAreaHandle);
								} else {
									// we're not done yet. Now we have to check to see whether this user has permission to add
									// a block of this type to the destination area.
									$b = Block::getByID($_REQUEST['sourceBlockID'], $nvc, $arHandle);
									$bt = $b->getBlockTypeObject();
									if (!$destAP->canAddBlock($bt)) {
										$doProcessArrangement = false;
										$r = new stdClass;
开发者ID:ronlobo,项目名称:concrete5,代码行数:31,代码来源:process.php

示例2: processArrangement

 /** 
  * Takes an array of area/block values and makes that the arrangement for this page's version
  * Format is like: $area[10][0] = 2, $area[10][1] = 8, $area[15][0] = 27, with the area ID being the 
  * key and the block IDs being 1-n values inside it
  * @param array $areas
  * @param array $affectedAreaIDs
  *		IDs of the areas affected by the process arrangement (source and destination when moving blocks between areas, only source if moving in the same area).
  *		If specified, we'll sort out only the blocks in the specified areas.
  *		If not specified, $areas must contain all the blocks from all the areas of the current collection.
  */
 public function processArrangement($areas, $affectedAreaIDs = array())
 {
     // this function is called via ajax, so it's a bit wonky, but the format is generally
     // a{areaID} = array(b1, b2, b3) (where b1, etc... are blocks with ids appended.)
     $db = Loader::db();
     $s = 'delete from CollectionVersionBlockStyles where cID = ? and cvID = ?';
     $q = array($this->getCollectionID(), $this->getVersionID());
     $onlySpecificAreas = false;
     if (!empty($affectedAreaIDs)) {
         foreach ($affectedAreaIDs as $arID) {
             if (!$onlySpecificAreas) {
                 $onlySpecificAreas = true;
                 $s .= ' and (';
             } else {
                 $s .= ' or ';
             }
             $s .= 'arHandle = ?';
             $q[] = Area::getAreaHandleFromID($arID);
         }
     }
     if ($onlySpecificAreas) {
         $s .= ')';
     }
     $db->Execute($s, $q);
     foreach ($areas as $arID => $blocks) {
         if (intval($arID) > 0) {
             // this is a serialized area;
             $arHandle = Area::getAreaHandleFromID($arID);
             $startDO = 0;
             foreach ($blocks as $bIdentifier) {
                 $bID = 0;
                 $csrID = 0;
                 $bd2 = explode('-', $bIdentifier);
                 $bID = $bd2[0];
                 $csrID = $bd2[1];
                 if (intval($bID) > 0) {
                     $v = array($startDO, $arHandle, $bID, $this->getCollectionID(), $this->getVersionID());
                     try {
                         $db->query("update CollectionVersionBlocks set cbDisplayOrder = ?, arHandle = ? where bID = ? and cID = ? and (cvID = ? or cbIncludeAll = 1)", $v);
                         if ($csrID > 0) {
                             $db->query("insert into CollectionVersionBlockStyles (csrID, arHandle, bID, cID, cvID) values (?, ?, ?, ?, ?)", array($csrID, $arHandle, $bID, $this->getCollectionID(), $this->getVersionID()));
                         }
                         // update the style for any of these blocks
                     } catch (Exception $e) {
                     }
                     $startDO++;
                 }
             }
         }
     }
 }
开发者ID:Mihail9575,项目名称:concrete5,代码行数:61,代码来源:page.php

示例3: Permissions

 }
 if (PERMISSIONS_MODEL == 'advanced') {
     // first, we check to see if we have permissions to edit the area contents for the source area.
     $arHandle = Area::getAreaHandleFromID($sourceAreaID);
     $ar = Area::getOrCreate($nvc, $arHandle);
     $ap = new Permissions($ar);
     if (!$ap->canEditAreaContents()) {
         $r = new stdClass();
         $r->error = true;
         $doProcessArrangement = false;
         $r->message = t('You may not arrange the contents of area %s.', $arHandle);
     } else {
         // now we get further in. We check to see if we're dealing with both a source AND a destination area.
         // if so, we check the area permissions for the destination area.
         if ($sourceAreaID != $destinationAreaID) {
             $destAreaHandle = Area::getAreaHandleFromID($destinationAreaID);
             $destArea = Area::getOrCreate($nvc, $destAreaHandle);
             $destAP = new Permissions($destArea);
             if (!$destAP->canEditAreaContents()) {
                 $r = new stdClass();
                 $r->error = true;
                 $doProcessArrangement = false;
                 $r->message = t('You may not arrange the contents of area %s.', $destAreaHandle);
             } else {
                 // we're not done yet. Now we have to check to see whether this user has permission to add
                 // a block of this type to the destination area.
                 $b = Block::getByID($_REQUEST['sourceBlockID'], $nvc, $arHandle);
                 $bt = $b->getBlockTypeObject();
                 if (!$destAP->canAddBlock($bt)) {
                     $doProcessArrangement = false;
                     $r = new stdClass();
开发者ID:Zyqsempai,项目名称:amanet,代码行数:31,代码来源:process.php


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