Detailed Description
Class provides access to site materials.
- Author
- Dodonov A.A.
Definition at line 26 of file content_access.php.
Constructor & Destructor Documentation
Constructor.
- Author
- Dodonov A.A.
Definition at line 66 of file content_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__ );
$this->UserAccess =
get_package(
'user::user_access' ,
'last' , __FILE__ );
}
catch( Exception $e )
{
}
}
Member Function Documentation
Creating record.
- Parameters
-
| $Record | Example for creation. |
- Returns
- id of the created record.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 456 of file content_access.php.
{
try
{
list( $Fields , $Values ) = $this->fetch_create_data( $Record );
$id = $this->DatabaseAlgorithms->create( $this->NativeTable , $Fields , $Values );
$EventManager =
get_package(
'event_manager' ,
'last' , __FILE__ );
$EventManager->trigger_event( 'on_after_create_content' , array( 'id' => $id ) );
return( $id );
}
catch( Exception $e )
{
}
}
Function deletes record.
- Parameters
-
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 376 of file content_access.php.
{
try
{
$id = $this->Security->get( $id , 'integer_list' );
$this->Database->delete( $this->NativeTable , "( $this->AddLimitations ) AND id IN ( $id )" );
}
catch( Exception $e )
{
}
}
| get_content_for_date |
( |
|
$Year, |
|
|
|
$Month, |
|
|
|
$CategoryIds |
|
) |
| |
Function returns contents.
- Parameters
-
| $Year | - Year. |
| $Month | - Month. |
| $CategoryIds | - ids of the categories. |
- Returns
- Content.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 589 of file content_access.php.
{
try
{
$Year = $this->Security->get( $Year , 'integer' );
$Month = $this->Security->get( $Month , 'integer' );
$CategoryIds = $this->Security->get( $CategoryIds , 'integer' );
return(
"YEAR( publication_date ) = $Year AND MONTH( publication_date ) = $Month AND ".
'category IN ( '.implode( ',' , $CategoryIds ).' ) ORDER BY publication_date ASC'
)
);
}
catch( Exception $e )
{
}
}
| get_publication_structure |
( |
|
$CategoryIds | ) |
|
Function returns publication structure.
- Parameters
-
| $CategoryIds | - ids of the categories. |
- Returns
- Publication structure.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 537 of file content_access.php.
{
try
{
$CategoryIds = $this->Security->get( $CategoryIds , 'integer' );
return(
$this->Database->select(
'YEAR( publication_date ) AS publication_year , MONTH( publication_date ) AS publication_month'.
' , COUNT( * ) AS publication_count' ,
$this->NativeTable ,
'category IN ( '.implode( ',' , $CategoryIds ).
' ) GROUP BY publication_year , publication_month ORDER BY publication_date ASC'
)
);
}
catch( Exception $e )
{
}
}
| search |
( |
|
$Start, |
|
|
|
$SearchString |
|
) |
| |
Searching records.
- Parameters
-
| $Start | - Search limitations. |
| $SearchString | - Search string. |
- Returns
- Records.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 762 of file content_access.php.
{
try
{
$Start = $this->Security->get( $Start , 'integer' );
$Records = $this->Database->select(
$this->search_fields( $SearchString ) , $this->NativeTable ,
"( $this->AddLimitations ) ORDER BY relevation DESC LIMIT $Start , 10"
);
return( $Records );
}
catch( Exception $e )
{
}
}
| select |
( |
|
$Start = false, |
|
|
|
$Limit = false, |
|
|
|
$Field = false, |
|
|
|
$Order = false, |
|
|
|
$Condition = '1 = 1', |
|
|
|
$Options = false |
|
) |
| |
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 | - Additional conditions. |
| $Options | - Additional options. |
- Returns
- List of records.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 173 of file content_access.php.
{
try
{
$AddCondition = '';
if( $Options !== false && $Options->get_setting( 'category_name' , false ) )
{
$Category =
get_package(
'category::category_algorithms' ,
'last' , __FILE__ );
$AddCondition = 'AND category IN ( '.implode(
',' , $Category->get_category_ids( $Options->get_setting( 'category_name' ) )
).' )';
}
$Condition = $this->DatabaseAlgorithms->select_condition(
$Start , $Limit , $Field , $Order , $Condition , $this->NativeTable
);
}
catch( Exception $e )
{
}
}
| select_content_by_category |
( |
|
$CategoryIds | ) |
|
Function returns a list of contents.
- Parameters
-
| $CategoryIds | - ids of the categories. |
- Returns
- Array of content objects.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 497 of file content_access.php.
{
try
{
$CategoryIds = $this->Security->get( $CategoryIds , 'integer' );
return(
'category IN ( '.implode( ',' , $CategoryIds ).' ) ORDER BY publication_date ASC'
)
);
}
catch( Exception $e )
{
}
}
Function selects list of objects.
- Parameters
-
| $id | - Comma separated list of record's id. |
- Returns
- Array of records.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 344 of file content_access.php.
{
try
{
$id = $this->Security->get( $id , 'integer_list' );
return( $this->
unsafe_select( $this->NativeTable.
".id IN ( $id )" ) );
}
catch( Exception $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 112 of file content_access.php.
{
try
{
if( $this->AddLimitations === '1 = 1' )
{
$this->AddLimitations = $theAddLimitation;
}
else
{
throw( new Exception( '"AddLimitations" was already set' ) );
}
}
catch( Exception $e )
{
}
}
| unsafe_select |
( |
|
$Condition = ' 1 = 1 ' | ) |
|
Function returns list of records.
- Returns
- List of available records.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 300 of file content_access.php.
{
try
{
$Content = $this->Database->select(
$this->NativeTable.'.* , umx_category.title AS category_title , user.login AS author_name' ,
$this->NativeTable.' , umx_category , '.$this->UserAccess->NativeTable.' AS user' ,
"author = user.id AND ( $this->AddLimitations ) AND umx_category.id = category AND $Condition"
);
$this->compile_selected_content( $Content );
return( $Content );
}
catch( Exception $e )
{
}
}
Updating record.
- Parameters
-
| $id | - Comma separated list of record's id. |
| $Record | - Example for update. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 666 of file content_access.php.
{
try
{
$id = $this->Security->get( $id , 'integer_list' );
$this->compile_record( $Record );
list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
if( isset( $Fields[ 0 ] ) )
{
$Fields [] = 'modification_date';
$Values [] = 'now()';
$Condition = "( $this->AddLimitations ) AND id IN ( $id )";
$this->Database->update( $this->NativeTable , $Fields , $Values , $Condition );
$this->Database->commit();
}
}
catch( Exception $e )
{
}
}
Field Documentation
| $AddLimitations = '1 = 1' |
| $DatabaseAlgorithms = false |
| $NativeTable = '`umx_content`' |
Table name in wich objects of this entity are stored.
- Author
- Dodonov A.A.
Definition at line 38 of file content_access.php.
The documentation for this class was generated from the following file: