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


PHP Layout::getById方法代码示例

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


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

示例1: array

    $jsonData = array();
    $jsonData['msg'] = t('Access Denied.');
    echo $json->encode($jsonData);
    exit;
}
$valt = Loader::helper('validation/token');
$token = '&' . $valt->getParameter();
if ($_GET['task'] == 'deletePreset') {
    $layoutPreset = LayoutPreset::getByID($_REQUEST['lpID']);
    if (is_object($layoutPreset)) {
        $layout = $layoutPreset->getLayoutObject();
        $layoutID = $layout->layoutID;
    }
} else {
    $layoutID = intval($_REQUEST['layoutID']);
    $layout = Layout::getById($layoutID);
    $layoutPreset = $layoutPreset = $layout->getLayoutPresetObj();
}
$jsonData = array('success' => '0', 'msg' => '', 'layoutID' => intval($layoutID));
//security checks: make sure this layout belongs to this area & collection
if (is_object($layout) && is_object($a) && is_object($c)) {
    $db = Loader::db();
    $vals = array($layoutID, $a->getAreaHandle(), intval($nvc->cID), intval($nvc->getVersionID()));
    $areaLayoutData = $db->getRow('SELECT * FROM CollectionVersionAreaLayouts WHERE layoutID=? AND arHandle=? AND cID=? AND cvID=?', $vals);
    $layout->setAreaNameNumber($areaLayoutData['areaNameNumber']);
    $validLayout = intval($areaLayoutData['layoutID']) > 0 || is_object($layoutPreset) ? true : false;
    if ($validLayout) {
        $cvalID = intval($areaLayoutData['cvalID']);
    }
}
if (!$validLayout || !$cp->canEditPageContents() || !$ap->canAddLayoutToArea()) {
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:31,代码来源:layout_services.php

示例2: getAreaLayouts

 /** 
  * Gets all layout grid objects for a collection
  * @param Page|Collection $c
  * @return Layout[]
  */
 public function getAreaLayouts($c)
 {
     if (!intval($c->cID)) {
         //Invalid Collection
         return false;
     }
     if (!$c->hasLayouts()) {
         return array();
     }
     $db = Loader::db();
     $vals = array(intval($c->cID), $c->getVersionID(), $this->getAreaHandle());
     $sql = 'SELECT * FROM CollectionVersionAreaLayouts WHERE cID=? AND cvID=? AND arHandle=? ORDER BY position ASC, cvalID ASC';
     $rows = $db->getArray($sql, $vals);
     $layouts = array();
     $i = 0;
     if (is_array($rows)) {
         foreach ($rows as $row) {
             $layout = Layout::getById(intval($row['layoutID']));
             if (is_object($layout)) {
                 $i++;
                 //check position is correct, update if not
                 if ($i != $row['position'] || $renumbering) {
                     $renumbering = 1;
                     $db->query('UPDATE CollectionVersionAreaLayouts SET position=? WHERE cvalID=?', array($i, $row['cvalID']));
                 }
                 $layout->position = $i;
                 $layout->cvalID = intval($row['cvalID']);
                 $layout->setAreaObj($this);
                 $layout->setAreaNameNumber(intval($row['areaNameNumber']));
                 $layouts[] = $layout;
             }
         }
     }
     return $layouts;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:40,代码来源:area.php

示例3: getLayoutObject

 public function getLayoutObject()
 {
     return Layout::getById($this->layoutID);
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:4,代码来源:layout_preset.php

示例4: intval

						$layoutPreset = LayoutPreset::getByID($lpID);
						if($layoutPreset) $layout = $layoutPreset->getLayoutObject();
						if(!$layout || !intval($layout->layoutID)) throw new Exception(t('Layout preset not found'));
						$layoutID = intval($layout->layoutID);
						if($layoutID!=$originalLayoutID) $updateLayoutId=1;
					} 
					
					//is this an existing layout?  
					if($layoutID){  
						//security check: make sure this layout belongs to this area & collection
						$db = Loader::db();
						$vals = array( $layoutID, $area->getAreaHandle(), intval($nvc->cID), intval($c->getVersionID()), intval($nvc->getVersionID())  ); 
						$layoutExistsInArea = intval($db->getOne('SELECT count(*) FROM CollectionVersionAreaLayouts WHERE layoutID=? AND arHandle=? AND cID=? AND cvID IN (?,?)',$vals))?1:0;
						$validLayout = ($layoutExistsInArea)?1:0;

						if(!$layout) $layout = Layout::getById($layoutID); 
						
						if( is_object($layout) && (in_array($_POST['layoutPresetAction'],array('update_existing_preset','create_new_preset')) || $validLayout) ){ 
							
							$layout->fill( $params );
							
							// if there's no unique layout record for this collection version, and it's not a preset, then treat this as a new record 
							// bypassed if editing a preset or creating a new one 
							if( (!$layoutPreset && !$layout->isUniqueToCollectionVersion($nvc)) || $_POST['layoutPresetAction']=='create_new_preset' || $_POST['layoutPresetAction']=='save_as_custom'){ 
								$updateLayoutId=1;
								$layout->layoutID=0;
							} 
							
							$layout->save( $nvc ); 
							//if($oldLayoutId) $nvc->updateAreaLayoutId($area, $oldLayoutId, $layout->layoutID);  
						}else{
开发者ID:rii-J,项目名称:concrete5-de,代码行数:31,代码来源:process.php

示例5: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
if (ENABLE_AREA_LAYOUTS == false) {
    die(t('Area layouts have been disabled.'));
}
global $c;
$form = Loader::helper('form');
//Loader::model('layout');
if (intval($_REQUEST['lpID'])) {
    $layoutPreset = LayoutPreset::getByID($_REQUEST['lpID']);
    if (is_object($layoutPreset)) {
        $layout = $layoutPreset->getLayoutObject();
    }
} elseif (intval($_REQUEST['layoutID'])) {
    $layout = Layout::getById(intval($_REQUEST['layoutID']));
} else {
    $layout = new Layout(array('type' => 'table', 'rows' => 1, 'columns' => 3));
}
if (!$layout) {
    echo t('Error: Layout not found');
} else {
    $layoutPresets = LayoutPreset::getList();
    if (intval($layout->lpID)) {
        $layoutPreset = LayoutPreset::getById($layout->lpID);
    }
    ?>


<?php 
    if (!$_REQUEST['refresh']) {
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:31,代码来源:block_area_layout.php


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