ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
system_structure_access_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| set_add_limitations ($theAddLimitation)
| unsafe_select ($Condition=" 1 = 1 ")
| select ($Start, $Limit, $Field=false, $Order=false, $Condition= '1=1')
| get_by_id ($id)
| create_system_structure ($Page, $RootPage, $Navigation)
| delete ($id)
| update ($id, $Record)
| select_list ($id)

## Data Fields
| $NativeTable = '`umx_system_structure`'
| $Database = false
| $DatabaseAlgorithms = false
| $Security = false
| $SecurityParser = false
| $AddLimitations = '1 = 1'

## Detailed Description

Class provides main entities manipulation routine.

Author
  Dodonov A.A.

Definition at line 26 of file system_structure_access.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Author
  Dodonov A.A.

Definition at line 65 of file system_structure_access.php.

{
try
{
$this->Database = get_package( 'database' , 'last' , __FILE__ );
$this->DatabaseAlgorithms = get_package( 'database::database_algorithms' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->SecurityParser = get_package( 'security::security_parser' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Member Function Documentation

create_system_structure | ( |  | $Page,
|  |  | $RootPage,
|  |  | $Navigation
| ) |  |

Creating record.

Parameters

  $Page | - Page name.
  $RootPage | - Root page.
  $Navigation | - Navigation information.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 308 of file system_structure_access.php.

{
try
{
$Params = $this->SecurityParser->parse_parameters(
func_get_args() , '0:string,alias_page;1:string,alias_root_page;2:string,alias_navigation'
);
$this->Database->insert(
$this->NativeTable ,
'page , root_page , navigation' ,
"'".$Params->page."' , '".$Params->root_page."' , '".$Params->navigation."'"
);
$this->Database->commit();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

delete | ( |  | $id | ) |

Deleting record from database.

Parameters

  $id | - Comma separated list of record's id.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

deleting record

Definition at line 347 of file system_structure_access.php.

{
try
{
$id = $this->Security->get( $id , 'integer_list' );
$this->Database->delete( $this->NativeTable , "( $this->AddLimitations ) AND id IN ( $id )" );
$this->Database->commit();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_by_id | ( |  | $id | ) |

Function returns record by it's id.

Parameters

  $id | - Record's id.

Returns
  Record.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 261 of file system_structure_access.php.

{
try
{
$id = $this->Security->get( $id , 'integer' );
$Records = $this->unsafe_select( $this->NativeTable.".id = $id" );
if( count( $Records ) == 0 )
{
throw( new Exception( 'Record was not found' ) );
}
return( $Records[ 0 ] );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

select | ( |  | $Start,
|  |  | $Limit,
|  |  | $Field = `false`,
|  |  | $Order = `false`,
|  |  | $Condition = `'1 = 1'`
| ) |  |

Function returns list of records.

Parameters

  $Start | - Number of the first record.
  $Limit | - Count of records limitation.
  $Field | - Field to sort by.
  $Order | - Sorting order.
  $Condition | - Record filtration condition.

Returns
  List of records.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 215 of file system_structure_access.php.

{
try
{
$Condition = $this->DatabaseAlgorithms->select_condition(
$Start , $Limit , $Field , $Order , $Condition , $this->NativeTable
);
$Items = $this->unsafe_select( $Condition );
foreach( $Items as $k => $i )
{
$Items[ $k ]->navigation = str_replace( '{' , '[lfb]' , $Items[ $k ]->navigation );
$Items[ $k ]->navigation = str_replace( '}' , '[rfb]' , $Items[ $k ]->navigation );
}
return( $Items );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

select_list | ( |  | $id | ) |

Function selects list of objects.

Parameters

  $id | - list of identificators.

Returns
  Array of records.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 433 of file system_structure_access.php.

{
try
{
$id = $this->Security->get( $id , 'integer_list' );
return( $this->unsafe_select( $this->NativeTable.".id IN ( $id )" ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

set_add_limitations | ( |  | $theAddLimitation | ) |

Function sets additional limitations.

Parameters

  $theAddLimitation | - Additional limitations.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 110 of file system_structure_access.php.

{
try
{
if( $this->AddLimitations === '1 = 1' )
{
$this->AddLimitations = $theAddLimitation;
}
else
{
throw( new Exception( '"AddLimitations" was already set' ) );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

unsafe_select | ( |  | $Condition = `" 1 = 1 "` | ) |

Selecting records.

Parameters

  $Condition | records selection condition.

Returns
  Array of objects.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 151 of file system_structure_access.php.

{
try
{
$this->Database->query_as( DB_OBJECT );
$Records = $this->Database->select(
'*' , $this->NativeTable , "( $this->AddLimitations ) AND $Condition"
);
foreach( $Records as $k => $v )
{
$Records[ $k ]->page = htmlspecialchars_decode( $Records[ $k ]->page , ENT_QUOTES );
$Records[ $k ]->root_page = htmlspecialchars_decode( $Records[ $k ]->root_page , ENT_QUOTES );
$Records[ $k ]->navigation = htmlspecialchars_decode( $Records[ $k ]->navigation , ENT_QUOTES );
$Records[ $k ]->navigation = htmlspecialchars_decode( $Records[ $k ]->navigation , ENT_QUOTES );
}
return( $Records );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

update | ( |  | $id,
|  |  | $Record
| ) |  |

Function updates record.

Parameters

  $id | - Record's id.
  $Record | - Data to be updated with.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 386 of file system_structure_access.php.

{
try
{
$id = $this->Security->get( $id , 'integer_list' );
$Record = $this->SecurityParser->parse_parameters(
$Record , 'page:command;root_page:command;navigation:raw' , 'allow_not_set'
);
list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
if( isset( $Fields[ 0 ] ) )
{
$this->Database->update(
$this->NativeTable , $Fields , $Values , "( $this->AddLimitations ) AND id IN ( $id )"
);
$this->Database->commit();
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Field Documentation

$AddLimitations = '1 = 1'

Definition at line 90 of file system_structure_access.php.

$Database = false

Cached objects.

Author
  Dodonov A.A.

Definition at line 50 of file system_structure_access.php.

$DatabaseAlgorithms = false

Definition at line 51 of file system_structure_access.php.

$NativeTable = '`umx_system_structure`'

Table name in wich objects of this entity are stored.

Author
  Dodonov A.A.

Definition at line 38 of file system_structure_access.php.

$Security = false

Definition at line 52 of file system_structure_access.php.

$SecurityParser = false

Definition at line 53 of file system_structure_access.php.

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

- packages/system_structure/packages/system_structure_access/system_structure_access.php