ultimix
calendar_1_0_0 Class Reference

Public Member Functions

 __construct ()
 pre_generation (&$Options)
 get_templates ()
 compile_header ($DisplayTime)
 get_toolbar ($DisplayTime)
 compile_calendar (&$Settings)
 view (&$Options)

Data Fields

 $CachedMultyFS = false
 $Security = false

Detailed Description

Class displays calendar.

Author
Dodonov A.A.

Definition at line 26 of file calendar.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Author
Dodonov A.A.

Definition at line 52 of file calendar.php.

{
try
{
$this->CachedMultyFS = get_package_object( 'cached_multy_fs' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

compile_calendar ( $Settings)

Calendar compilation.

Parameters
$Settings- Settings.
Returns
HTML code of the calendar.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 513 of file calendar.php.

{
try
{
$DisplayTime = $this->Settings->get_setting( 'calendar_time' , time() );
$DisplayTime = $this->Security->get_gp( 'calendar_time' , 'integer' , $DisplayTime );
list( $Start , $End , $RowStart , $RowEnd , $HeaderCell , $Cell ) =
$this->get_templates();
$FirstDay = mktime( 0 , 0 , 0 , date( 'n', $DisplayTime ) , 1 , date( 'Y' , $DisplayTime ) );
$Code = $Start.$this->get_toolbar( $DisplayTime );
$Code .= $this->compile_header( $DisplayTime );
$DayOfWeek = date( 'w' , $FirstDay );
$Code .= $this->compile_rows( $DisplayTime , $DayOfWeek , $FirstDay , $DisplayTime );
return( $Code.$End );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_header (   $DisplayTime)

Function compiles calendar header.

Parameters
$DisplayTime- Time of the displaiing month.
Returns
Calendar's template.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 265 of file calendar.php.

{
try
{
list( $CalendarStart , $CalendarEnd , $RowStart , $RowEnd , $HeaderCell , $Cell ) =
$this->get_templates();
$HolidayHeaderCell = str_replace( '{holiday}' , ' holiday' , $HeaderCell );
return(
$RowStart.$this->compile_header_cells( $DisplayTime , $HeaderCell , $HolidayHeaderCell ).$RowEnd
);
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_templates ( )

Getting templates.

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

Definition at line 115 of file calendar.php.

{
try
{
//TODO: refactor it to get_templates( $TemplateNames )
return(
array(
$this->CachedMultyFS->get_template( __FILE__ , 'calendar_start.tpl' ) ,
$this->CachedMultyFS->get_template( __FILE__ , 'calendar_end.tpl' ) ,
$this->CachedMultyFS->get_template( __FILE__ , 'calendar_row_start.tpl' ) ,
$this->CachedMultyFS->get_template( __FILE__ , 'calendar_row_end.tpl' ) ,
$this->CachedMultyFS->get_template( __FILE__ , 'calendar_header_cell.tpl' ) ,
$this->CachedMultyFS->get_template( __FILE__ , 'calendar_cell.tpl' )
)
);
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_toolbar (   $DisplayTime)

Toolbar compilation.

Parameters
$DisplayTime- Time of the displaiing month.
Returns
HTML code of the toolbar.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 306 of file calendar.php.

{
try
{
$Code = $this->CachedMultyFS->get_template( __FILE__ , 'calendar_toolbar.tpl' );
$MonthYear = date( 'm} Y' , $DisplayTime );
$MonthPrev = strtotime( '-1 month' , $DisplayTime );
$Code = str_replace(
'{toolbar}' , "{href:page=?calendar_time[eq]$MonthPrev;text=month_prev}{toolbar}" , $Code
);
$Code = str_replace(
'{toolbar}' , " {lang:month_name_$MonthYear {toolbar}" , $Code
);
$MonthNext = strtotime( '+1 month' , $DisplayTime );
$Code = str_replace( '{toolbar}' , "{href:page=?calendar_time[eq]$MonthNext;text=month_next}" , $Code );
return( $Code );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
pre_generation ( $Options)

Function executes before any page generating actions took place.

Parameters
$Options- Settings.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 83 of file calendar.php.

{
try
{
$PackagePath = _get_package_relative_path_ex( 'gui::calendar' , 'last' );
$PageCSS = get_package( 'page::page_css' , 'last' , __FILE__ );
$PageCSS->add_stylesheet( "{http_host}/$PackagePath/res/css/calendar.css" );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
view ( $Options)

Function draws component.

Parameters
$Options- Settings.
Returns
HTML code of the компонента.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 561 of file calendar.php.

{
try
{
if( $Options->get_setting( 'calendar' , false ) )
{
$CalendarTime = $this->Security->get_gp( 'calendar_time' , 'integer' , false );
$this->Output = $this->compile_calendar( $CalendarTime );
}
return( $this->Output );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$CachedMultyFS = false

Cached objects.

Author
Dodonov A.A.

Definition at line 39 of file calendar.php.

$Security = false

Definition at line 40 of file calendar.php.


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