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 @@ ...@@ -8,19 +8,19 @@
* Returns the feed list * Returns the feed list
* *
* @param string $project - json array, Project Data * @param string $project - json array, Project Data
* @param string $siteType - siteType * @param string $layout - layout type
* @return array * @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 ); $Project = QUI::getProjectManager()->decode( $project );
$BrickManager = new QUI\Bricks\Manager(); $BrickManager = new QUI\Bricks\Manager();
return $BrickManager->getAreasByProject( $Project, $siteType ); return $BrickManager->getAreasByProject( $Project, $layout );
} }
QUI::$Ajax->register( QUI::$Ajax->register(
'package_quiqqer_bricks_ajax_project_getAreas', 'package_quiqqer_bricks_ajax_project_getAreas',
array( 'project', 'siteType' ), array( 'project', 'layout' ),
'Permission::checkAdminUser' 'Permission::checkAdminUser'
); );
...@@ -152,7 +152,7 @@ define('package/quiqqer/bricks/bin/Site/Category', [ ...@@ -152,7 +152,7 @@ define('package/quiqqer/bricks/bin/Site/Category', [
QUIAjax.get('package_quiqqer_bricks_ajax_project_getAreas', callback, { QUIAjax.get('package_quiqqer_bricks_ajax_project_getAreas', callback, {
'package' : 'quiqqer/bricks', 'package' : 'quiqqer/bricks',
project : Project.encode(), project : Project.encode(),
siteType : Site.getAttribute( 'type' ) layout : Site.getAttribute( 'layout' )
}); });
}, },
......
...@@ -96,6 +96,23 @@ public function __construct($params=array()) ...@@ -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 * Return the HTML of the Brick
* *
...@@ -133,7 +150,7 @@ protected function _getControl() ...@@ -133,7 +150,7 @@ protected function _getControl()
/* @var $Control \QUI\Control */ /* @var $Control \QUI\Control */
$Control = new $Ctrl( $this->getSettings() ); $Control = new $Ctrl( $this->getSettings() );
if ( !($Control instanceof QUI\Control) ) { if ( !($Control instanceof QUI\Control) || !$Control ) {
return false; return false;
} }
......
...@@ -86,10 +86,10 @@ public function deleteBrick($brickId) ...@@ -86,10 +86,10 @@ public function deleteBrick($brickId)
* Return the areas which are available in the project * Return the areas which are available in the project
* *
* @param Project $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 * @return array
*/ */
public function getAreasByProject(Project $Project, $siteType=false) public function getAreasByProject(Project $Project, $layoutType=false)
{ {
$templates = array(); $templates = array();
$bricks = array(); $bricks = array();
...@@ -125,7 +125,7 @@ public function getAreasByProject(Project $Project, $siteType=false) ...@@ -125,7 +125,7 @@ public function getAreasByProject(Project $Project, $siteType=false)
$bricks = array_merge( $bricks = array_merge(
$bricks, $bricks,
Utils::getTemplateAreasFromXML( $brickXML, $siteType ) Utils::getTemplateAreasFromXML( $brickXML, $layoutType )
); );
} }
...@@ -308,11 +308,13 @@ public function getBricksByArea($brickArea, Site $Site) ...@@ -308,11 +308,13 @@ public function getBricksByArea($brickArea, Site $Site)
try try
{ {
$result[] = $this->getBrickById( $brickId ); $result[] = $this->getBrickById( $brickId )->check();
} catch ( QUI\Exception $Exception ) } catch ( QUI\Exception $Exception )
{ {
QUI\System\Log::addWarning(
$Exception->getMessage() .' Brick-ID:'. $brickId
);
} }
} }
......
...@@ -53,10 +53,10 @@ static function getBricksFromXML($file) ...@@ -53,10 +53,10 @@ static function getBricksFromXML($file)
* Return the template bricks from a xml file * Return the template bricks from a xml file
* *
* @param string $file - path to xm 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 * @return array
*/ */
static function getTemplateAreasFromXML($file, $siteType=false) static function getTemplateAreasFromXML($file, $layoutType=false)
{ {
if ( !file_exists( $file ) ) { if ( !file_exists( $file ) ) {
return array(); return array();
...@@ -67,15 +67,15 @@ static function getTemplateAreasFromXML($file, $siteType=false) ...@@ -67,15 +67,15 @@ static function getTemplateAreasFromXML($file, $siteType=false)
$globalAreas = $Path->query( "//quiqqer/bricks/templateAreas/areas/area" ); $globalAreas = $Path->query( "//quiqqer/bricks/templateAreas/areas/area" );
if ( $siteType ) if ( $layoutType )
{ {
$typeAreas = $Path->query( $typeAreas = $Path->query(
"//quiqqer/bricks/templateAreas/types/type[@type='{$siteType}']/area" "//quiqqer/bricks/templateAreas/layouts/layout[@layout='{$layoutType}']/area"
); );
} else } 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