ultimix
template_manager_1_0_0 Class Reference

Public Member Functions

 register_template ($TemplateName, $TemplateVersion)
 get_template_list ()
 draw_template_list ()
 get_default_template_name ()
 get_default_admin_template_name ()
 get_default_template_version ()
 get_template ($TemplateName, $TemplateVersion)
 get_template_path ($TemplateName, $TemplateVersion)

Detailed Description

Class for manipulating objects.

Author
Dodonov A.A.

Definition at line 26 of file template_manager.php.

Member Function Documentation

draw_template_list ( )

Function draws list of templates.

Returns
HTML code.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 190 of file template_manager.php.

{
try
{
if( ( $TemplateList = $this->get_template_list() ) === false )
{
return( false );
}
return( $this->compile_template_list( $Templates ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_default_admin_template_name ( )

Function returns name of the default admin template.

Returns
array( name => 'template name' , version => 'template version' ).
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 262 of file template_manager.php.

{
try
{
$Settings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$Settings->load_file( dirname( __FILE__ ).'/conf/cf_template_manager_settings' );
$Name = $Settings->get_setting( 'default_admin_template_name' );
$Version = $Settings->get_setting( 'default_admin_template_version' , 'last' );
return( array( 'name' => $Name , 'version' => $Version ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_default_template_name ( )

Function returns name of the default template.

Returns
array( name => 'template name' , version => 'template version' ).
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 225 of file template_manager.php.

{
try
{
$Settings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$Settings->load_file( dirname( __FILE__ ).'/conf/cf_template_manager_settings' );
$Name = $Settings->get_setting( 'default_template_name' );
$Version = $Settings->get_setting( 'default_template_version' , 'last' );
return( array( 'name' => $Name , 'version' => $Version ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_default_template_version ( )

Function returns version of the default template.

Returns
version of the default template.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 299 of file template_manager.php.

{
try
{
$TemplateList = $this->get_template_list();
foreach( $TemplateList as $tl )
{
if( $tl[ 'default' ] === 'default' )
{
return( $tl[ 'version' ] );
}
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_template (   $TemplateName,
  $TemplateVersion 
)

Function returns template package.

Parameters
$TemplateName- name of the template.
$TemplateVersion- version of the loading template.
Returns
Object of the template.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 345 of file template_manager.php.

{
try
{
$Template = get_package( "$TemplateName" , "$TemplateVersion" , __FILE__ );
if( $Template === false )
{
$PackageDirectory = $this->get_template_path( $TemplateName , $TemplateVersion );
$Template = get_package_object( 'template_manager::default_template_script' , 'last' , __FILE__ );
$Template->set_template_path( $PackageDirectory."/unexisting_script.php" );
return( $Template );
}
else
{
return( $Template );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_template_list ( )

Function returns a list of templates.

Returns
List of templates.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 95 of file template_manager.php.

{
try
{
$RawTemplateList = $this->CachedMultyFS->file_get_contents(
dirname( __FILE__ ).'/data/template_list' , 'exploded'
);
$TemplateList = array();
foreach( $RawTemplateList as $rtl )
{
$rtl = str_replace( "\r" , '' , $rtl );
$rtl = str_replace( "\n" , '' , $rtl );
$Trinity = explode( '#' , $rtl );
$TemplateList [] = array(
'name' => $Trinity[ 0 ] , 'version' => $Trinity[ 1 ] , 'default' => $Trinity[ 2 ]
);
}
return( $TemplateList );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_template_path (   $TemplateName,
  $TemplateVersion 
)

Function returns path to the template package.

Parameters
$TemplateName- name of the template.
$TemplateVersion- version of the loading template.
Returns
Path to the template.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 397 of file template_manager.php.

{
try
{
return( _get_package_relative_path_ex( $TemplateName , $TemplateVersion ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
register_template (   $TemplateName,
  $TemplateVersion 
)

Function registers new template.

Parameters
$TemplateName- template name.
$TemplateVersion- template version.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 50 of file template_manager.php.

{
try
{
$Security = get_package( 'security' , 'last' , __FILE__ );
$TemplateName = $Security->get( $TemplateName , 'string' );
$TemplateVersion = $Security->get( $TemplateVersion , 'string' );
$Handle = fopen( dirname( __FILE__ ).'/data/template_list' , 'a+' );
if( $Handle === false )
{
return( false );
}
$TemplateInfo = $TemplateName.'#'.$TemplateVersion."\r\n";
fwrite( $Handle , $TemplateInfo , strlen( $TemplateInfo ) );
fclose( $Handle );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

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