ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
page_parts_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| throw_method_was_not_found_exception ($p, $FunctionName)
| get_settings_for_package ($PackageName, $PackageVersion)
| get_controller ($PackageName, $PackageVersion)
| get_view ($PackageName, $PackageVersion)
| get_package_appliance ($Page, $PageName, $PageOptions)
| load_settings_for_package (&$Package, &$Template)
| fetch_packages (&$Packages, &$Template)
| execute_generators (&$Packages, $Type, &$Template)
| compile_controllers (&$Packages)
| compile_views (&$Packages, &$Template)

## Data Fields
| $Cache = false
| $CachedMultyFS = false
| $PageComposer = false
| $PageMarkupUtilities = false
| $Settings = false
| $String = false
| $Trace = false

## Detailed Description

Page composer utilities.

Author
  Dodonov A.A.

Definition at line 26 of file page_parts.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Author
  Dodonov A.A.

Definition at line 56 of file page_parts.php.

{
try
{
$this->Cache = get_package( 'cache' , 'last' , __FILE__ );
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->PageMarkupUtilities = get_package(
'page::page_markup::page_markup_utilities' , 'last' , __FILE__
);
$this->Settings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$this->String = get_package( 'string' , 'last' , __FILE__ );
$this->Trace = get_package( 'trace' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Member Function Documentation

compile_controllers | ( | & | $Packages | ) |

Function processes controllers.

Parameters

  $Packages | - Packages.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 603 of file page_parts.php.

{
try
{
$this->Trace->start_group( "controllers" );
foreach( $Packages as $i => $p )
{
if( $p[ 'settings' ]->get_setting( 'controller' , false ) )
{
if( method_exists( $p[ 'fetched_package' ] , 'controller' ) )
{
$this->run_single_controller( $p );
}
else
{
$this->throw_method_was_not_found_exception( $p , 'controller' );
}
}
}
$this->Trace->end_group();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_views | ( | & | $Packages,
|  | & | $Template
| ) |  |

Function processes views.

Parameters

  $Packages | - Packages.
  $Template | - Template.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 708 of file page_parts.php.

{
try
{
$this->Trace->start_group( "views" );
foreach( $Packages as $i => $p )
{
if( $p[ 'placeholder' ] != '' )
{
if( $p[ 'settings' ]->get_setting( 'view' , false ) )
{
if( $p[ 'fetched_package' ] !== false && method_exists( $p[ 'fetched_package' ] , 'view' ) )
{
$this->run_single_view( $p , $Template );
}
else
{
$this->throw_method_was_not_found_exception( $p , 'view' );
}
}
}
}
$this->Trace->end_group();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

execute_generators | ( | & | $Packages,
|  |  | $Type,
|  | & | $Template
| ) |  |

Function runs generators.

Parameters

  $Packages | - Packages.
  $Type | - Generator type.
  $Template | - Template.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 517 of file page_parts.php.

{
try
{
$this->Trace->start_group( $Type );
$Changed = false;
$Template->add_stylesheets();
$counter = 0;
foreach( $Packages as $i => $p )
{
if( $p[ 'settings' ]->get_setting( $Type , false ) )
{
if( method_exists( $p[ 'fetched_package' ] , $Type ) )
{
$Caller = array( $p[ 'fetched_package' ] , $Type );
$Settings = $p[ 'settings' ];
call_user_func( $Caller , $Settings );
continue;
}
$this->throw_method_was_not_found_exception( $p , $Type );
}
}
$this->Trace->end_group();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

fetch_packages | ( | & | $Packages,
|  | & | $Template
| ) |  |

Function fetches packages for the generating page.

Parameters

  $Packages | - Packages.
  $Template | - Template.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 466 of file page_parts.php.

{
try
{
foreach( $Packages as $i => $p )
{
$this->load_settings_for_package( $Packages[ $i ] , $Template );
if( $Packages[ $i ][ 'settings' ]->get_setting( 'meta' , false ) !== false )
{
$PackagePath = _get_package_relative_path_ex( $p[ 'package' ] , $p[ 'package_version' ] );
$MetaFileName = $Packages[ $i ][ 'settings' ]->get_setting( 'meta' );
$MetaSettings = $this->CachedMultyFS->file_get_contents( "$PackagePath/meta/$MetaFileName" );
$Packages[ $i ][ 'settings' ]->append_settings( $MetaSettings );
}
$this->get_package_for_description( $Packages[ $i ] );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_controller | ( |  | $PackageName,
|  |  | $PackageVersion
| ) |  |

Function returns controller.

Parameters

  $PackageName | - package name.
  $PackageVersion | - package version.

Returns
  controller object.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 184 of file page_parts.php.

{
try
{
$Package = get_package( $PackageName , $PackageVersion , __FILE__ );
if( $Package === false )
{
$Package = get_package_object( 'page::auto_controller' , 'last' , __FILE__ );
$Package->set_path( _get_package_relative_path_ex(
$PackageName , $PackageVersion ).'/unexisting_controller.php'
);
}
return( $Package );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_package_appliance | ( |  | $Page,
|  |  | $PageName,
|  |  | $PageOptions
| ) |  |

Function returns list of packages.

Parameters

  $Page | - Object of the page::page_access class.
  $PageName | - Name of the composing page.
  $PageOptions | - Generation options.

Returns
  HTML code of the composed page.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 340 of file page_parts.php.

{
try
{
$PagePackages = $Page->get_package_appliance( $PageName );
$PredefinedPackages = $this->get_predefined_packages( $PageOptions );
return( array_merge( $PredefinedPackages , $PagePackages ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_settings_for_package | ( |  | $PackageName,
|  |  | $PackageVersion
| ) |  |

Getting global settings of the package.

Parameters

  $PackageName | - Package name.
  $PackageVersion | - Package version.

Returns
  string with settings.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 137 of file page_parts.php.

{
try
{
$PackageDirectory = _get_package_relative_path_ex( $PackageName , $PackageVersion );
if( $this->CachedMultyFS->file_exists( "$PackageDirectory/conf/cf_global_settings" ) )
{
return( $this->CachedMultyFS->file_get_contents( "$PackageDirectory/conf/cf_global_settings" ) );
}
else
{
return( '' );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_view | ( |  | $PackageName,
|  |  | $PackageVersion
| ) |  |

Function returns view.

Parameters

  $PackageName | - package name.
  $PackageVersion | - package version.

Returns
  view object.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 232 of file page_parts.php.

{
try
{
$Package = get_package( $PackageName , $PackageVersion , __FILE__ );
if( $Package === false )
{
$Package = get_package_object( 'page::auto_view' , 'last' , __FILE__ );
$Package->set_path(
_get_package_relative_path_ex( $PackageName , $PackageVersion ).'/unexisting_view.php'
);
}
return( $Package );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

load_settings_for_package | ( | & | $Package,
|  | & | $Template
| ) |  |

Function loads package's settings.

Parameters

  $Package | - Package.
  $Template | - Template.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 377 of file page_parts.php.

{
try
{
$Package[ 'settings' ] = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$GlobalSettings = $this->get_settings_for_package(
$Package[ 'package' ] , $Package[ 'package_version' ]
);
$Package[ 'settings' ]->load_settings( $GlobalSettings );
$Package[ 'settings' ]->append_settings( $Package[ 'options' ] );
$PlaceHolderParameters = $Template->get_placeholder_parameters( $Package[ 'placeholder' ] );
if( $PlaceHolderParameters !== false )
{
$Package[ 'settings' ]->append_settings( $PlaceHolderParameters );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

throw_method_was_not_found_exception | ( |  | $p,
|  |  | $FunctionName
| ) |  |

Function throws exception that method was not found.

Parameters

  $p | - Package data.
  $FunctionName | - Function name.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 97 of file page_parts.php.

{
$ClassName = $p[ 'fetched_package' ] !== false ? get_class( $p[ 'fetched_package' ] ) : 'false';
$PackageFullName = $p[ 'package' ].'.'.$p[ 'package_version' ];
throw(
new Exception(
'Function "'.$FunctionName.'" was not found in class "'.$ClassName.
'" from package '.$PackageFullName
)
);
}

## Field Documentation

$Cache = false

Cached object.

Author
  Dodonov A.A.

Definition at line 38 of file page_parts.php.

$CachedMultyFS = false

Definition at line 39 of file page_parts.php.

$PageComposer = false

Definition at line 40 of file page_parts.php.

$PageMarkupUtilities = false

Definition at line 41 of file page_parts.php.

$Settings = false

Definition at line 42 of file page_parts.php.

$String = false

Definition at line 43 of file page_parts.php.

$Trace = false

Definition at line 44 of file page_parts.php.

The documentation for this class was generated from the following file:

- packages/page/packages/page_parts/page_parts.php