ultimix
comment_markup_1_0_0 Class Reference

Public Member Functions

 __construct ()
 compile_comments (&$Settings)
 get_comments_for_object (&$Settings)
 compile_comment_link (&$Settings)
 compile_comment_form ($Parameters)

Data Fields

 $Settings = false
 $CachedMultyFS = false
 $CommentAlgorithms = false
 $Link = false
 $String = false

Detailed Description

Class processes macro.

Author
Dodonov A.A.

Definition at line 26 of file comment_markup.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

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

Definition at line 58 of file comment_markup.php.

{
try
{
$this->Settings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->CommentAlgorithms = get_package( 'comment::comment_algorithms' , 'last' , __FILE__ );
$this->Link = get_package( 'link' , '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

compile_comment_form (   $Parameters)

Function compiles macro 'comment_form'.

Parameters
$Parameters- Compilation parameters.
Returns
Widget.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 230 of file comment_markup.php.

{
try
{
$this->Settings->load_settings( $Parameters );
list( $MasterType , $MasterId )= $this->Settings->get_settings( 'master_type,master_id' );
$NeedRun = $this->Settings->get_setting( 'need_run' , 1 );
$Code = '{direct_controller:package_name=comment::comment_controller;meta=meta_create_comment;'.
"master_type=$MasterType;master_id=$MasterId;direct_create=1;need_run=$NeedRun}".
'{direct_view:package_name=comment::comment_view;meta=meta_create_comment_form;'.
"master_type=$MasterType;master_id=$MasterId;direct_create=1;need_run=$NeedRun}";
return( $Code );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_comment_link ( $Settings)

Function compiles macro 'comment_link'.

Parameters
$Settings- Compilation parameters.
Returns
Widget.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 186 of file comment_markup.php.

{
try
{
$MasterId = $Settings->get_setting( 'master_id' );
$MasterType = $Settings->get_setting( 'master_type' );
$CommentsCount = $this->Link->get_links_count( $MasterId , false , $MasterType , 'comment' );
$Page = $Settings->get_setting( 'page' );
$Template = $this->CachedMultyFS->get_template( __FILE__ , 'comment_link.tpl' );
$PlaceHolders = array( '{page}' , '{comment_count}' );
return( str_replace( $PlaceHolders , array( $Page , $CommentsCount ) , $Template ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
compile_comments ( $Settings)

Function compiles comment list.

Parameters
$Settings- Compilation parameters.
Returns
Comment line's HTML code.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 96 of file comment_markup.php.

{
try
{
$Comments = $this->get_comments_for_object( $Settings );
if( isset( $Comments[ 0 ] ) )
{
$CommentLine = '';
$TemplatePath = dirname( __FILE__ ).'/res/templates/default_comment_template.tpl';
foreach( $Comments as $i => $Comment )
{
$CommentLine .= $this->CachedMultyFS->file_get_contents( $TemplatePath );
$CommentLine = $this->String->print_record( $CommentLine , $Comment );
}
return( $CommentLine );
}
else
{
return( '{lang:comments_were_not_found}' );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
get_comments_for_object ( $Settings)

Function returns all comments for the object.

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

Definition at line 149 of file comment_markup.php.

{
try
{
$MasterId = $Settings->get_setting( 'master_id' );
$MasterType = $Settings->get_setting( 'master_type' );
return( $this->CommentAlgorithms->get_records_for_object( $MasterId , $MasterType ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$CachedMultyFS = false

Definition at line 39 of file comment_markup.php.

$CommentAlgorithms = false

Definition at line 40 of file comment_markup.php.

$Link = false

Definition at line 41 of file comment_markup.php.

$Settings = false

Cached packages.

Author
Dodonov A.A.

Definition at line 38 of file comment_markup.php.

$String = false

Definition at line 42 of file comment_markup.php.


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