ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
menu_access_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| set_add_limitations ($theAddLimitation)
| unsafe_select ($Condition)
| select ($Start, $Limit, $Field=false, $Order=false, $Condition= '1=1')
| get_by_id ($id)
| create ($Record)
| get_menu_list ($Start, $Limit)
| get_menu_items ($Menu)
| get_menu ($Menu)
| update_menu ($OldMenuLocator, $NewMenuLocator)
| delete_menu ($Menu)

## Data Fields
| $NativeTable = '`umx_menu`'
| $DatabaseAlgorithms = false
| $SecurityParser = false
| $AddLimitations = '1 = 1'

## Detailed Description

Menu class.

Author
  Dodonov A.A.

Definition at line 26 of file menu_access.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Author
  Dodonov A.A.

Definition at line 63 of file menu_access.php.

{
try
{
$this->DatabaseAlgorithms = get_package( 'database::database_algorithms' , '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 | ( |  | $Record | ) |

Creating record.

Parameters

  $Record | - Example for creation.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 280 of file menu_access.php.

{
try
{
$Record = $this->SecurityParser->parse_parameters( $Record , 'name:string' );
list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
$id = $this->DatabaseAlgorithms->create( $this->NativeTable , $Fields , $Values );
return( $id );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

delete_menu | ( |  | $Menu | ) |

Function deletes menu.

Parameters

  $Menu | - Deleting menu locator.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 503 of file menu_access.php.

{
try
{
$Security = get_package( 'security' , 'last' , __FILE__ );
$Menu = $Security->get( $Menu , 'command' );
$Database = get_package( 'database' , 'last' , __FILE__ );
$Database->delete( 'umx_menu' , "( $this->AddLimitations ) AND name LIKE '$Menu'" );
$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 240 of file menu_access.php.

{
try
{
$Security = get_package( 'security' , 'last' , __FILE__ );
$id = $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 );
}
}

get_menu | ( |  | $Menu | ) |

Function returns menu description.

Parameters

  $Menu | - menu's locator.

Returns
  Menu description

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 418 of file menu_access.php.

{
try
{
$Security = & get_package( 'security' , 'last' , __FILE__ );
$Menu = $Security->get( $Menu , 'command' );
$Databse = get_package( 'database' , 'last' , __FILE__ );
$Result = $Databse->select( '*' , 'umx_menu' , "( $this->AddLimitations ) AND name LIKE '$Menu'" );
if( count( $Result ) !== 1 )
{
throw( new Exception( "An error occured while selecting menu" ) );
}
else
{
return( $Result[ 0 ] );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_menu_items | ( |  | $Menu | ) |

Getting items for menu.

Parameters

  $Menu | - Menu locator.

Returns
  List of menu items

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 374 of file menu_access.php.

{
try
{
$Security = get_package( 'security' , 'last' , __FILE__ );
$Menu = $Security->get( $Menu , 'command' );
$Counter = 0;
$MenuItemAccess = get_package( 'menu::menu_item_access' , 'last' , __FILE__ );
$Result = $MenuItemAccess->select(
false , false , false , false , "( $this->AddLimitations ) AND menu LIKE '$Menu'"
);
return( $Result );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_menu_list | ( |  | $Start,
|  |  | $Limit
| ) |  |

Function returns list of available menues.

Parameters

  $Start | - Cursor of the first selected record.
  $Limit | - Count of the selected records.

Returns
  List of registred menues. Data is returned in next format array( 0 => 'menu number' , 1 => 'menu title' , 'menu_file_path' => 'path to menu file' )

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 329 of file menu_access.php.

{
try
{
$Security = get_package( 'security' , 'last' , __FILE__ );
$Start = $Security->get( $Start , 'integer' );
$Limit = $Security->get( $Limit , 'integer' );
$Databse = get_package( 'database' , 'last' , __FILE__ );
$Result = $Databse->select( '*' , 'umx_menu' , "$this->AddLimitations LIMIT $Start , $Limit" );
foreach( $Result as $i => $r )
{
$Result[ $i ] = array_merge( array( 'n' => $i + 1 ) , $Result );
}
return( $Result );
}
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 | - Records selection condition.

Returns
  List of records.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 202 of file menu_access.php.

{
try
{
$Condition = $this->DatabaseAlgorithms->select_condition(
$Start , $Limit , $Field , $Order , $Condition , $this->NativeTable
);
return( $this->unsafe_select( $Condition ) );
}
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 106 of file menu_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 | ) |

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 147 of file menu_access.php.

{
try
{
$Database = get_package( 'database' , 'last' , __FILE__ );
$Database->query_as( DB_OBJECT );
$Records = $Database->select( '*' , $this->NativeTable , "( $this->AddLimitations ) AND $Condition" );
return( $Records );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

update_menu | ( |  | $OldMenuLocator,
|  |  | $NewMenuLocator
| ) |  |

Function updates menu.

Parameters

  $OldMenuLocator | - Old menu locator.
  $NewMenuLocator | - New menu locator.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Додонов А.А.

Definition at line 464 of file menu_access.php.

{
try
{
$Security = get_package( 'security' , 'last' , __FILE__ );
$OldMenuLocator = $Security->get( $OldMenuLocator , 'command' );
$NewMenuLocator = $Security->get( $NewMenuLocator , 'command' );
$Databse = get_package( 'database' , 'last' , __FILE__ );
$Databse->update(
'umx_menu' , array( 'name' ) , array( $NewMenuLocator ) ,
"( $this->AddLimitations ) AND name LIKE '$OldMenuLocator'"
);
$Databse->commit();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Field Documentation

$AddLimitations = '1 = 1'

Definition at line 86 of file menu_access.php.

$DatabaseAlgorithms = false

Cached objects.

Author
  Dodonov A.A.

Definition at line 50 of file menu_access.php.

$NativeTable = '`umx_menu`'

Table name in wich objects of this entity are stored.

Author
  Dodonov A.A.

Definition at line 38 of file menu_access.php.

$SecurityParser = false

Definition at line 51 of file menu_access.php.

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

- packages/menu/packages/menu_access/menu_access.php