Skip to content
Code-Schnipsel Gruppen Projekte
Commit b0708032 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

layout trennung

Übergeordneter b006129a
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -8,19 +8,19 @@
* Returns the feed list
*
* @param string $project - json array, Project Data
* @param string $siteType - siteType
* @param string $layout - layout type
* @return array
*/
function package_quiqqer_bricks_ajax_project_getAreas($project, $siteType)
function package_quiqqer_bricks_ajax_project_getAreas($project, $layout)
{
$Project = QUI::getProjectManager()->decode( $project );
$BrickManager = new QUI\Bricks\Manager();
return $BrickManager->getAreasByProject( $Project, $siteType );
return $BrickManager->getAreasByProject( $Project, $layout );
}
QUI::$Ajax->register(
'package_quiqqer_bricks_ajax_project_getAreas',
array( 'project', 'siteType' ),
array( 'project', 'layout' ),
'Permission::checkAdminUser'
);
......@@ -152,7 +152,7 @@ define('package/quiqqer/bricks/bin/Site/Category', [
QUIAjax.get('package_quiqqer_bricks_ajax_project_getAreas', callback, {
'package' : 'quiqqer/bricks',
project : Project.encode(),
siteType : Site.getAttribute( 'type' )
layout : Site.getAttribute( 'layout' )
});
},
......
......@@ -96,6 +96,23 @@ public function __construct($params=array())
}
}
/**
* Check, if control canbe created
*
* @throws QUI\Exception
* @return QUI\Bricks\Brick
*/
public function check()
{
$Control = $this->_getControl();
if ( !$Control ) {
throw new QUI\Exception( 'Control not found. Brick could not be created' );
}
return $Control;
}
/**
* Return the HTML of the Brick
*
......@@ -133,7 +150,7 @@ protected function _getControl()
/* @var $Control \QUI\Control */
$Control = new $Ctrl( $this->getSettings() );
if ( !($Control instanceof QUI\Control) ) {
if ( !($Control instanceof QUI\Control) || !$Control ) {
return false;
}
......
......@@ -86,10 +86,10 @@ public function deleteBrick($brickId)
* Return the areas which are available in the project
*
* @param Project $Project
* @param string|bool $siteType - optional, returns only the areas for the specific site type (default = false)
* @param string|bool $layoutType - optional, returns only the areas for the specific layout type (default = false)
* @return array
*/
public function getAreasByProject(Project $Project, $siteType=false)
public function getAreasByProject(Project $Project, $layoutType=false)
{
$templates = array();
$bricks = array();
......@@ -125,7 +125,7 @@ public function getAreasByProject(Project $Project, $siteType=false)
$bricks = array_merge(
$bricks,
Utils::getTemplateAreasFromXML( $brickXML, $siteType )
Utils::getTemplateAreasFromXML( $brickXML, $layoutType )
);
}
......@@ -308,11 +308,13 @@ public function getBricksByArea($brickArea, Site $Site)
try
{
$result[] = $this->getBrickById( $brickId );
$result[] = $this->getBrickById( $brickId )->check();
} catch ( QUI\Exception $Exception )
{
QUI\System\Log::addWarning(
$Exception->getMessage() .' Brick-ID:'. $brickId
);
}
}
......
......@@ -53,10 +53,10 @@ static function getBricksFromXML($file)
* Return the template bricks from a xml file
*
* @param string $file - path to xm file
* @param string|bool $siteType - optional, return only the bricks for the specific site type
* @param string|bool $layoutType - optional, return only the bricks for the specific layout type
* @return array
*/
static function getTemplateAreasFromXML($file, $siteType=false)
static function getTemplateAreasFromXML($file, $layoutType=false)
{
if ( !file_exists( $file ) ) {
return array();
......@@ -67,15 +67,15 @@ static function getTemplateAreasFromXML($file, $siteType=false)
$globalAreas = $Path->query( "//quiqqer/bricks/templateAreas/areas/area" );
if ( $siteType )
if ( $layoutType )
{
$typeAreas = $Path->query(
"//quiqqer/bricks/templateAreas/types/type[@type='{$siteType}']/area"
"//quiqqer/bricks/templateAreas/layouts/layout[@layout='{$layoutType}']/area"
);
} else
{
$typeAreas = $Path->query( "//quiqqer/bricks/templateAreas/types/type/area" );
$typeAreas = $Path->query( "//quiqqer/bricks/templateAreas/layouts/layout/area" );
}
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren