ultimix
ad_banner_view_1_0_0 Class Reference

Public Member Functions

 __construct ()
 pre_generation ($Options)
 get_campaigns_and_banners ()
 compile_banners_for_campaign ($CampaignId, $Code, $Banners)
 common_view ($Options)
 view ($Options)

Data Fields

 $Output
 $CachedMultyFS = false
 $String = false

Detailed Description

This class provides component visualisation routine.

Author
Dodonov A.A.

Definition at line 26 of file ad_banner_view.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Author
Dodonov A.A.

Definition at line 63 of file ad_banner_view.php.

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

Member Function Documentation

common_view (   $Options)

Function draws component.

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

Definition at line 232 of file ad_banner_view.php.

{
try
{
list( $Campaigns , $Banners ) = $this->get_campaigns_and_banners();
foreach( $Campaigns as $i => $c )
{
$Code = $this->CachedMultyFS->get_template( __FILE__ , 'campaign.tpl' );
$Code = $this->String->print_record( $Code , $c );
$Code = str_replace( '{i}' , $i , $Code );
$this->Output .= $this->compile_banners_for_campaign( $c->id , $Code , $Banners );
}
$CampaignListTemplate = $this->CachedMultyFS->get_template( __FILE__ , 'campaign_list.tpl' );
$this->Output = str_replace( '{output}' , $this->Output , $CampaignListTemplate );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_banners_for_campaign (   $CampaignId,
  $Code,
  $Banners 
)

Function compiles banners list.

Parameters
$CampaignId- Campaign's id.
$Code- Campaign's list.
$Banners- Banners.
Returns
HTML code of the компонента.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 186 of file ad_banner_view.php.

{
try
{
foreach( $Banners as $j => $b )
{
if( $CampaignId == $b->campaign_id )
{
$BannerTemplate = $this->CachedMultyFS->get_template( __FILE__ , 'banner.tpl' );
$BannerTemplate = $this->String->print_record( $BannerTemplate , $b );
$Code = str_replace(
'{banners}' , $BannerTemplate.'{banners}' , $Code
);
}
}
return( $Code );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_campaigns_and_banners ( )

Function returns campaigns and banners.

Returns
Campaigns and banners.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 132 of file ad_banner_view.php.

{
try
{
$Campaigns = $this->AdCampaignAccess->unsafe_select(
'archived = 0 AND creator = '.$this->UserAlgorithms->get_id()
);
if( count( $Campaigns ) == 0 )
{
$Campaigns = array( array( 'id' => -1 ) );
}
$Banners = $this->AdBannerAccess->unsafe_select(
'archived = 0 AND campaign_id IN ( '.implode_ex( ',' , $Campaigns , 'id' ).' )'
);
return( array( $Campaigns , $Banners ) );
}
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 94 of file ad_banner_view.php.

{
try
{
$this->PageCSS->add_stylesheet(
'ad::ad_banner::ad_banner_view' , '1.0.0'
).'/res/css/ad_banner_view.css' ,
true
);
$Lang = get_package( 'lang' , 'last' , __FILE__ );
$Lang->include_strings_js( 'ad::ad_banner::ad_banner_view' );
}
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
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 279 of file ad_banner_view.php.

{
try
{
$ContextSet = get_package_object( 'gui::context_set' , 'last' , __FILE__ );
$ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_ad_banner_view_common_view' );
$ContextSet->execute( $Options , $this , __FILE__ );
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 50 of file ad_banner_view.php.

$Output

Display function's result.

Author
Dodonov A.A.

Definition at line 38 of file ad_banner_view.php.

$String = false

Definition at line 51 of file ad_banner_view.php.


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