ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
review_algorithms_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| object_exists ($id)
| get_by_id ($id)
| get_records_for_object ($MasterId, $MasterType)
| create (&$Record, &$Options)
| get_reviews_newer_than ($Author, $Time)

## Data Fields
| $FileInputAccess = false
| $LinkUtilities = false
| $ReviewAccess = false
| $Security = false
| $UserAlgorithms = false
| $Cache = array()

## Detailed Description

Class provides algorithms.

Author
  Dodonov A.A.

Definition at line 26 of file review_algorithms.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Author
  Dodonov A.A.

Definition at line 66 of file review_algorithms.php.

{
try
{
$this->FileInputAccess = get_package( 'file_input::file_input_access' , 'last' , __FILE__ );
$this->LinkUtilities = get_package( 'link::link_utilities' , 'last' , __FILE__ );
$this->ReviewAccess = get_package( 'review::review_access' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->UserAlgorithms = get_package( 'user::user_algorithms' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Member Function Documentation

create | ( | & | $Record,
|  | & | $Options
| ) |  |

Creating record.

Parameters

  $Record | Example for creation.
  $Options | - Settings.

Returns
  id of the created record.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 236 of file review_algorithms.php.

{
try
{
$MasterId = $Options->get_setting( 'master_id' );
$MasterType = $Options->get_setting( 'master_type' );
return( $this->ReviewAccess->create( $Record ) );
}
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 142 of file review_algorithms.php.

{
try
{
$id = $this->Security->get( $id , 'integer' );
$Records = $this->ReviewAccess->unsafe_select( $this->ReviewAccess->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_records_for_object | ( |  | $MasterId,
|  |  | $MasterType
| ) |  |

Function fetches comments.

Parameters

  $MasterId | - Master object's id.
  $MasterType | - Master object's type.

Returns
  Records.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 189 of file review_algorithms.php.

{
try
{
if( isset( $this->Cache[ "$MasterId.$MasterType" ] ) )
{
return( $this->Cache[ "$MasterId.$MasterType" ] );
}
$this->Cache[ "$MasterId.$MasterType" ] = $this->LinkUtilities->get_dependent_objects(
$MasterId , $MasterType , 'review' , $this->ReviewAccess
);
return( $this->Cache[ "$MasterId.$MasterType" ] );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_reviews_newer_than | ( |  | $Author,
|  |  | $Time
| ) |  |

Function fetches reviews.

Parameters

  $Author | - Author.
  $Time | - Period limit (in seconds).

Returns
  Records.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 277 of file review_algorithms.php.

{
try
{
$Author = $this->Security->get( $Author , 'integer' );
$Time = $this->Security->get( $Time , 'integer' );
$Records = $this->ReviewAccess->unsafe_select(
$this->ReviewAccess->NativeTable.".author = $Author AND ".
"DATE_ADD( creation_date , INTERVAL $Time SECOND ) > NOW()"
);
return( $Records );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

object_exists | ( |  | $id | ) |

Function validates object's existense.

Parameters

  $id | - Record's id.

Returns
  true if the object exists.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 104 of file review_algorithms.php.

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

## Field Documentation

$Cache = array()

Cached reviews.

Author
  Dodonov A.A.

Definition at line 54 of file review_algorithms.php.

$FileInputAccess = false

Cached objects.

Author
  Dodonov A.A.

Definition at line 38 of file review_algorithms.php.

$LinkUtilities = false

Definition at line 39 of file review_algorithms.php.

$ReviewAccess = false

Definition at line 40 of file review_algorithms.php.

$Security = false

Definition at line 41 of file review_algorithms.php.

$UserAlgorithms = false

Definition at line 42 of file review_algorithms.php.

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

- packages/review/packages/review_algorithms/review_algorithms.php