ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
category_view_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| pre_generation ($Options)
| get_category_id ($Options)
| draw_categories_catalogue_rec ($Records, $RootId, $Templates=false)
| draw_categories_catalogue ($Name, $Templates=false)
| draw_categories_catalogue_view ($Options)
| draw_categories_catalogue_part ($Options, $Records, $Templates=false)
| draw_categories_catalogue_part_view ($Options)
| draw_categories_path ($Options)
| draw_categories_structure_rec ($RootId, $DisplayTemplates=false)
| draw_categories_tree (&$Options)
| view ($Options)

## Data Fields
| $Output
| $CachedMultyFS = false
| $CategoryAccess = false
| $CategoryAlgorithms = false
| $CategoryViewTemplates = false
| $Security = false
| $String = false

## Detailed Description

Component's view.

Author
  Dodonov A.A.

Definition at line 26 of file category_view.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Author
  Dodonov A.A.

Definition at line 67 of file category_view.php.

{
try
{
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->CategoryAccess = get_package( 'category::category_access' , 'last' , __FILE__ );
$this->CategoryAlgorithms = get_package( 'category::category_algorithms' , 'last' , __FILE__ );
$this->CategoryViewTemplates = get_package(
'category::category_view::category_view_templates' , 'last' , __FILE__
);
$this->Security = get_package( 'security' , '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

draw_categories_catalogue | ( |  | $Name,
|  |  | $Templates = `false`
| ) |  |

Component's view.

Parameters

  $Name | - Name of the category.
  $Templates | - Templates.

Returns
  HTML code.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 308 of file category_view.php.

{
try
{
$id = $this->CategoryAccess->get_category_id( $Name );
$Items = $this->CategoryAccess->select_categories_list( $id );
return( $this->draw_categories_catalogue_rec( $Items , $id , $Templates ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

draw_categories_catalogue_part | ( |  | $Options,
|  |  | $Records,
|  |  | $Templates = `false`
| ) |  |

Component's view.

Parameters

  $Options | - Settings.
  $Records | - Records.
  $Templates | - Templates.

Returns
  HTML code.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 388 of file category_view.php.

{
try
{
$DisplayTemplates = $this->CategoryViewTemplates->get_categories_catalogue_part_templates(
$Options , $Templates
);
$RetCode = '';
foreach( $Records as $k => $v )
{
$SubcategoriesCount = $this->CategoryAccess->get_children_count( get_field( $v , 'id' ) );
if( $SubcategoriesCount )
{
$RetCode .= get_field( $DisplayTemplates , 'item' );
}
else
{
$RetCode .= get_field( $DisplayTemplates , 'leaf' );
}
$RetCode = $this->String->print_record( $RetCode , $v );
}
return( $RetCode );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

draw_categories_catalogue_part_view | ( |  | $Options | ) |

Function draws part of the catalogue.

Parameters

  $Options | - Settings.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 438 of file category_view.php.

{
try
{
if( $this->Security->get_gp( 'cid' , 'set' ) )
{
$id = $this->Security->get_gp( 'cid' , 'integer' );
}
else
{
$id = $this->get_category_id( $Options );
}
$Items = $this->CategoryAccess->get_children( $id );
$this->Output = $this->draw_categories_catalogue_part( $Options , $Items );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

draw_categories_catalogue_rec | ( |  | $Records,
|  |  | $RootId,
|  |  | $Templates = `false`
| ) |  |

Component's view.

Parameters

  $Records | - Records.
  $RootId | - Root id.
  $Templates | - Templates.

Returns
  HTML code.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 254 of file category_view.php.

{
try
{
$Templates = $this->CategoryViewTemplates->get_categories_catalogue_templates( $Templates );
$Children = $this->CategoryAlgorithms->get_children( $RootId , $Records );
if( isset( $Children[ 0 ] ) )
{
$RetCode = get_field( $Templates , 'start_tag' );
foreach( $Children as $k => $v )
{
$RetCode = $this->draw_categories_catalogue_subtree( $Records , $RetCode , $v , $Templates );
}
$RetCode .= get_field( $Templates , 'end_tag' );
return( $RetCode );
}
return( '' );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

draw_categories_catalogue_view | ( |  | $Options | ) |

Component's view.

Parameters

  $Options | - Settings.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 342 of file category_view.php.

{
try
{
$id = $this->get_category_id( $Options );
$Items = $this->CategoryAccess->select_categories_list( $id );
$this->Output = $this->draw_categories_catalogue_rec( $Items , $id );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

draw_categories_path | ( |  | $Options | ) |

Component's view.

Parameters

  $Options | - Settings.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 479 of file category_view.php.

{
try
{
$Items = $this->CategoryAccess->select_categories_list( $id = $this->get_category_id( $Options ) );
$cid = $this->Security->get_gp( 'cid' , 'integer' , $id );
$Path = $this->CategoryAlgorithms->get_previous_items( $Items , $cid );
$RetCode = array();
foreach( $Path as $i => $Item )
{
$Template = $this->CachedMultyFS->get_template( __FILE__ , 'categories_path.tpl' );
$PlaceHolders = array( '{id}' , '{title}' );
$Template = str_replace( $PlaceHolders , array( $Item->id , $Item->title ) , $Template );
}
$RetCode = implode( '&nbsp;&gt;&nbsp;' , $RetCode );
$this->Output = $RetCode;
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

draw_categories_structure_rec | ( |  | $RootId,
|  |  | $DisplayTemplates = `false`
| ) |  |

Function creates tree.

Parameters

  $RootId | - Id of the tree's root.
  $DisplayTemplates | - Display templates.

Returns
  HTML code of the tree.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 582 of file category_view.php.

{
try
{
$Children = $this->CategoryAccess->get_children( $RootId );
$RetCode = '';
if( isset( $Children[ 0 ] ) )
{
$RetCode .= get_field( $DisplayTemplates , 'start_tag' );
foreach( $Children as $k => $v )
{
$RetCode = $this->draw_categories_structure_subtree( $RetCode , $v , $DisplayTemplates );
}
$RetCode .= get_field( $DisplayTemplates , 'end_tag' );
}
return( $RetCode );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

draw_categories_tree | ( | & | $Options | ) |

Component's view.

Parameters

  $Options | - Settings.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 675 of file category_view.php.

{
try
{
$id = $this->get_category_id( $Options );
$DisplayTemplates = $this->CategoryViewTemplates->get_default_category_structure_templates( $Options );
$this->Output = $this->draw_categories_structure_rec( $id , $DisplayTemplates );
$this->output_root( $Options , $id );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_category_id | ( |  | $Options | ) |

Function returns category id from the settings.

Parameters

  $Options | - Settings.

Returns
  Category id.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 140 of file category_view.php.

{
try
{
$DirectCategoryName = false;
if( $Options->get_setting( 'direct_category_name' , false ) !== false )
{
$DirectCategoryName = $Options->get_setting( 'direct_category_name' );
}
elseif( $Options->get_setting( 'category_name' , false ) !== false )
{
$DirectCategoryName = $Options->get_setting( 'category_name' );
}
if( $DirectCategoryName === false )
{
return( $Options->get_setting( 'direct_category' , 0 ) );
}
else
{
return( $this->CategoryAccess->get_category_id( $DirectCategoryName ) );
}
}
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

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 104 of file category_view.php.

{
try
{
$Lang = get_package( 'lang' , 'last' , __FILE__ );
$Lang->include_strings_js( 'category::category_view' );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

view | ( |  | $Options | ) |

Component's view.

Parameters

  $Options | - Settings.

Returns
  HTML code of the component.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 715 of file category_view.php.

{
try
{
$ContextSet = get_package_object( 'gui::context_set' , 'last' , __FILE__ );
$PackagePath = dirname( __FILE__ );
$ContextSet->add_context( $PackagePath.'/conf/cfcx_categories_tree' );
$ContextSet->add_context( $PackagePath.'/conf/cfcx_categories_catalogue' );
$ContextSet->add_context( $PackagePath.'/conf/cfcx_categories_catalogue_part' );
$ContextSet->add_context( $PackagePath.'/conf/cfcx_categories_path' );
$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 category_view.php.

$CategoryAccess = false

Definition at line 51 of file category_view.php.

$CategoryAlgorithms = false

Definition at line 52 of file category_view.php.

$CategoryViewTemplates = false

Definition at line 53 of file category_view.php.

$Output

HTML code of the component.

Author
  Dodonov A.A.

Definition at line 38 of file category_view.php.

$Security = false

Definition at line 54 of file category_view.php.

$String = false

Definition at line 55 of file category_view.php.

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

- packages/category/packages/category_view/category_view.php