69 $this->Database =
get_package(
'database' ,
'last' , __FILE__ );
70 $this->DatabaseAlgorithms =
get_package(
'database::database_algorithms' ,
'last' , __FILE__ );
71 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
72 $this->SecurityParser =
get_package(
'security::security_parser' ,
'last' , __FILE__ );
114 if( $this->AddLimitations ===
'1 = 1' )
116 $this->AddLimitations = $theAddLimitation;
120 throw(
new Exception(
'"AddLimitations" was already set' ) );
123 catch( Exception $e )
157 $Records = $this->Database->select(
158 '*' , $this->NativeTable ,
"( $this->AddLimitations ) AND $Condition"
163 catch( Exception $e )
207 function select( $Start =
false , $Limit =
false , $Field =
false ,
208 $Order =
false , $Condition =
'1 = 1' )
212 $Condition = $this->DatabaseAlgorithms->select_condition(
213 $Start , $Limit , $Field , $Order , $Condition , $this->NativeTable
218 catch( Exception $e )
250 $Record = $this->SecurityParser->parse_parameters( $Record ,
'title:string' );
252 list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
254 $id = $this->DatabaseAlgorithms->create( $this->NativeTable , $Fields , $Values );
256 $EventManager =
get_package(
'event_manager' ,
'last' , __FILE__ );
257 $EventManager->trigger_event(
'on_after_create_ad_campaign' , array(
'id' => $id ) );
261 catch( Exception $e )
285 function delete( $id )
289 $id = $this->Security->get( $id ,
'integer_list' );
293 $this->Database->delete( $this->NativeTable ,
"( $this->AddLimitations ) AND id IN ( $id )" );
294 $this->Database->commit();
296 catch( Exception $e )
328 $id = $this->Security->get( $id ,
'integer_list' );
330 return( $this->
unsafe_select( $this->NativeTable.
".id IN ( $id )" ) );
332 catch( Exception $e )
362 foreach( $Records as $k => $v )
364 $Records[ $k ]->title =
'{lang:ad_title} '.$v->title;
369 catch( Exception $e )
401 $id = $this->Security->get( $id ,
'integer_list' );
402 $Record = $this->SecurityParser->parse_parameters( $Record ,
'title:string' ,
'allow_not_set' );
404 list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
406 if( isset( $Fields[ 0 ] ) )
408 $this->Database->update(
409 $this->NativeTable , $Fields , $Values ,
"( $this->AddLimitations ) AND id IN ( $id )"
411 $this->Database->commit();
414 catch( Exception $e )