ultimix
gallery_algorithms_1_0_0 Class Reference

Public Member Functions

 __construct ()
 object_exists ($id)
 get_by_id ($id)
 get_gallery_files ($gid)
 attach_file ($gid, $fid)
 detach_file ($gid, $fid)

Data Fields

 $FileInputAccess = false
 $GalleryAccess = false
 $Link = false
 $Security = false

Detailed Description

Class provides galeries manipulation routine.

Author
Dodonov A.A.

Definition at line 26 of file gallery_algorithms.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Author
Dodonov A.A.

Definition at line 53 of file gallery_algorithms.php.

{
try
{
$this->FileInputAccess = get_package( 'file_input::file_input_access' , 'last' , __FILE__ );
$this->GalleryAccess = get_package( 'gallery::gallery_access' , 'last' , __FILE__ );
$this->Link = get_package( 'link' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

attach_file (   $gid,
  $fid 
)

Function adds file to the gallery.

Parameters
$gid- Gallery's id.
$fid- File's id.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 218 of file gallery_algorithms.php.

{
try
{
$gid = $this->Security->get( $gid , 'integer' );
$fid = $this->Security->get( $fid , 'integer' );
$this->Link->create_link( $gid, $fid , 'gallery' , 'file' );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
detach_file (   $gid,
  $fid 
)

Function deletes file from the gallery.

Parameters
$gid- Gallery's id.
$fid- File's id.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 255 of file gallery_algorithms.php.

{
try
{
$gid = $this->Security->get( $gid , 'integer' );
$fid = $this->Security->get( $fid , 'integer' );
$this->Link->delete_link( $gid, $fid , 'gallery' , 'file' );
$FileInputAccess = get_package( 'file_input::file_input_access' , 'last' , __FILE__ );
$FileInputAccess->delete( $fid );
}
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
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 128 of file gallery_algorithms.php.

{
try
{
$id = $this->Security->get( $id , 'integer' );
$Records = $this->GalleryAccess->unsafe_select( $this->GalleryAccess->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_gallery_files (   $gid)

Function returns gallery's files.

Parameters
$gid- Gallery's id.
Returns
List of gallery files.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 171 of file gallery_algorithms.php.

{
try
{
$gid = $this->Security->get( $gid , 'integer' );
$Links = $this->Link->get_links( $gid , false , 'gallery' , 'file' );
$Ids = get_field_ex( $Links , 'object2_id' );
if( isset( $Ids[ 0 ] ) )
{
return( $this->FileInputAccess->unsafe_select( 'id IN ( '.implode( ',' , $Ids ).' )' ) );
}
else
{
return( array() );
}
}
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
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 90 of file gallery_algorithms.php.

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

Field Documentation

$FileInputAccess = false

Cached objects.

Author
Dodonov A.A.

Definition at line 38 of file gallery_algorithms.php.

$GalleryAccess = false

Definition at line 39 of file gallery_algorithms.php.

$Link = false

Definition at line 40 of file gallery_algorithms.php.

$Security = false

Definition at line 41 of file gallery_algorithms.php.


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