ultimix
report_1_0_0 Class Reference

Public Member Functions

 __construct ()
 pre_generation ($Options)
 compile_report_template_list (&$Settings)
 compile_report_template (&$Settings, $Data)
 compile_report_query (&$Settings)
 compile_report_button (&$Settings)
 get_report_template ($PackageName, $PackageVersion, $ReportTemplate, $Subfolder)
 generate_report (&$Options)
 view (&$Options)

Data Fields

 $CachedMultyFS = false
 $Database = false
 $PageJS = false
 $ReportUtilities = false
 $Security = false
 $String = false
 $Utilities = false
 $Templates = array()
 $Output = ''

Detailed Description

Working with reports.

Author
Dodonov A.A.

Definition at line 26 of file report.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 84 of file report.php.

{
try
{
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->Database = get_package( 'database' , 'last' , __FILE__ );
$this->PageJS = get_package( 'page::page_js' , 'last' , __FILE__ );
$this->ReportUtilities = get_package( 'report::report_utilities' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->String = get_package( 'string' , 'last' , __FILE__ );
$this->Utilities = get_package( 'utilities' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

compile_report_button ( $Settings)

Function compiles macro 'report_query'.

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

Definition at line 354 of file report.php.

{
try
{
$Settings->set_undefined( 'id' , md5( microtime( true ) ) );
$Settings->set_undefined( 'package_version' , 'last' );
$Code = $this->CachedMultyFS->get_template( __FILE__ , 'report_button.tpl' );
$Code = $this->String->print_record( $Code , $Settings->get_raw_settings() );
return( $Code );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_report_query ( $Settings)

Function compiles macro 'report_query'.

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

Definition at line 302 of file report.php.

{
try
{
$RawTemplate = $this->get_raw_template( $Settings );
$Records = $this->Utilities->get_records();
$Code = '';
foreach( $Records as $k => $r )
{
$Template = $RawTemplate;
$Template = $this->String->print_record( $Template , $r );
$Template = str_replace(
array( '{rowid}' , '{recid}' , '{odd_factor}' ) ,
array( $k + 1 , $k , $k % 2 ? 'odd' : 'even' ) , $Template
);
$Code .= $Template;
}
return( $Code );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_report_template ( $Settings,
  $Data 
)

Function compiles macro 'report_template'.

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

Definition at line 216 of file report.php.

{
try
{
$Name = $Settings->get_setting( 'name' );
$this->Templates [ $Name ] = $Data;
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_report_template_list ( $Settings)

Function compiles macro 'report_template_list'.

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

Definition at line 158 of file report.php.

{
try
{
$Reports = $this->ReportUtilities->get_reports_list( $Settings );
$Ids = array();
$Titles = array();
foreach( $Reports as $i => $r )
{
$Ids [] = $i;
$Titles [] = basename( $r , '.rep' );
}
$Subfolder = $Settings->get_setting( 'subfolder' , '' );
if( $Subfolder != '' )
{
$Subfolder = '<input type="hidden" name="subfolder" value="'.$Subfolder.'">';
}
$Code = "$Subfolder{select:class=width_320 flat;".$Settings->get_all_settings().';first='.
implode( '|' , $Ids ).';second='.implode( '|' , $Titles ).'}';
return( $Code );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
generate_report ( $Options)

Function generates report.

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

Definition at line 583 of file report.php.

{
try
{
$Package = $this->get_report_generator( $Options );
if( $Package === false )
{
return;
}
// TODO close reports with permits
$FunctionName = $this->Security->get_gp( 'func_name' , 'string' , 'report' );
$FunctionName = $Options->get_setting( 'func_name' , $FunctionName );
if( method_exists( $Package , $FunctionName ) )
{
$this->compile_report( $Package , $FunctionName , $Options );
return;
}
$Message = "Method \"$FunctionName\" does not exists in the package \"".get_class( $Package )."\"";
throw( new Exception( $Message ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_report_template (   $PackageName,
  $PackageVersion,
  $ReportTemplate,
  $Subfolder 
)

Function returns report template by it's id.

Parameters
$PackageName- Report template.
$PackageVersion- Package version.
$ReportTemplate- Id of the report's template.
$Subfolder- Template subdirectory.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 403 of file report.php.

{
try
{
$ReportsPath = _get_package_path_ex( $PackageName , $PackageVersion )."/res/reports/";
if( $Subfolder != '' )
{
$ReportsPath .= $Subfolder.'/';
}
/* getting list of reports */
$Reports = $this->Utilities->get_files_from_directory( $ReportsPath , '/\.rep/' );
$Report = $Reports[ $ReportTemplate ];
return( $this->CachedMultyFS->file_get_contents( $Report ) );
}
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 120 of file report.php.

{
try
{
$PackagePath = _get_package_relative_path_ex( 'report' , '1.0.0' );
$this->PageJS->add_javascript( "{http_host}/$PackagePath/include/js/report.js" );
$Lang = get_package( 'lang' , 'last' , __FILE__ );
$Lang->include_strings_js( 'report' );
}
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 636 of file report.php.

{
try
{
$this->generate_report( $Options );
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 38 of file report.php.

$Database = false

Definition at line 39 of file report.php.

$Output = ''

Generated reports.

Author
Dodonov A.A.

Definition at line 68 of file report.php.

$PageJS = false

Definition at line 40 of file report.php.

$ReportUtilities = false

Definition at line 41 of file report.php.

$Security = false

Definition at line 42 of file report.php.

$String = false

Definition at line 43 of file report.php.

$Templates = array()

Templates.

Author
Dodonov A.A.

Definition at line 56 of file report.php.

$Utilities = false

Definition at line 44 of file report.php.


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