Newer
Older
* @author www.pcsg.de (Henning Leutz)
*/
class Utils
{
/**
*
* @param String $file
* @return array
*/
{
if ( !file_exists( $file ) ) {
return array();
}
$Dom = XML::getDomFromXml( $file );
$Path = new \DOMXPath( $Dom );
$list[] = self::parseAreaToArray( $Brick, $Path );
* @param string|bool $layoutType - optional, return only the bricks for the specific layout type
static function getTemplateAreasFromXML($file, $layoutType=false)
{
if ( !file_exists( $file ) ) {
return array();
}
$Dom = XML::getDomFromXml( $file );
$Path = new \DOMXPath( $Dom );
$globalAreas = $Path->query( "//quiqqer/bricks/templateAreas/areas/area" );
"//quiqqer/bricks/templateAreas/layouts/layout[@layout='{$layoutType}']/area"
);
} else
{
$typeAreas = $Path->query( "//quiqqer/bricks/templateAreas/layouts/layout/area" );
foreach ( $globalAreas as $Area ) {
$list[] = self::parseAreaToArray( $Area, $Path );
foreach ( $typeAreas as $Area ) {
$list[] = self::parseAreaToArray( $Area, $Path );
return $list;
}
static function getGlobalTemplateAreasFromXML()
{
}
static function getTypeTemplateAreasFromXML($file, $siteType)
{
}
/**
static function parseAreaToArray(\DOMElement $Brick, \DOMXPath $Path)
$control = $Brick->getAttribute( 'control' );
$name = $Brick->getAttribute( 'name' );
$titleLocale = $Path->query( './title/locale', $Brick );
$descLocale = $Path->query( './description/locale', $Brick );
if ( $titleLocale->length )
{
$title = array(
'group' => $titleLocale->item( 0 )->getAttribute( 'group' ),
'var' => $titleLocale->item( 0 )->getAttribute( 'var' )
if ( $descLocale->length )
{
$description = array(
'group' => $descLocale->item( 0 )->getAttribute( 'group' ),
'var' => $descLocale->item( 0 )->getAttribute( 'var' )
);
}
return array(
'control' => $control,
'name' => $name,
'title' => $title,
'description' => $description,
'inheritance' => $Brick->getAttribute( 'inheritance' )
/**
*
* @param Project $Project
* @param String $areaName
* @return bool
*/
static function hasInheritance(Project $Project, $areaName)
{
$template = $Project->getAttribute( 'template' );
// getAreasByProject
$brickXML = realpath( OPT_DIR . $template .'/bricks.xml' );
$bricks = self::getTemplateAreasFromXML( $brickXML );
foreach ( $bricks as $brickData )
{
QUI\Log::writeRecursive( $brickData );
}
return true;
}