@@ -21,7 +21,6 @@ |
||
| 21 | 21 | /** |
| 22 | 22 | * Construct an above_header template location object |
| 23 | 23 | * |
| 24 | - * @param \phpbb\user $config User object |
|
| 25 | 24 | */ |
| 26 | 25 | public function __construct(\phpbb\user $user) |
| 27 | 26 | { |
@@ -13,40 +13,40 @@ |
||
| 13 | 13 | class above_header extends base |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * User object |
|
| 17 | - * @var \phpbb\user |
|
| 18 | - */ |
|
| 16 | + * User object |
|
| 17 | + * @var \phpbb\user |
|
| 18 | + */ |
|
| 19 | 19 | protected $user; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * Construct an above_header template location object |
|
| 23 | - * |
|
| 24 | - * @param \phpbb\user $config User object |
|
| 25 | - */ |
|
| 22 | + * Construct an above_header template location object |
|
| 23 | + * |
|
| 24 | + * @param \phpbb\user $config User object |
|
| 25 | + */ |
|
| 26 | 26 | public function __construct(\phpbb\user $user) |
| 27 | 27 | { |
| 28 | 28 | $this->user = $user; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * {@inheritDoc} |
|
| 33 | - */ |
|
| 32 | + * {@inheritDoc} |
|
| 33 | + */ |
|
| 34 | 34 | public function get_id() |
| 35 | 35 | { |
| 36 | 36 | return 'above_header'; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * {@inheritDoc} |
|
| 41 | - */ |
|
| 40 | + * {@inheritDoc} |
|
| 41 | + */ |
|
| 42 | 42 | public function get_name() |
| 43 | 43 | { |
| 44 | 44 | return $this->user->lang('AD_ABOVE_HEADER'); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * {@inheritDoc} |
|
| 49 | - */ |
|
| 48 | + * {@inheritDoc} |
|
| 49 | + */ |
|
| 50 | 50 | public function get_desc() |
| 51 | 51 | { |
| 52 | 52 | return $this->user->lang('AD_ABOVE_HEADER_DESC'); |
@@ -16,34 +16,34 @@ |
||
| 16 | 16 | interface type_interface |
| 17 | 17 | { |
| 18 | 18 | /** |
| 19 | - * Returns the unique ID of the location. |
|
| 20 | - * |
|
| 21 | - * @return string ID of location. |
|
| 22 | - */ |
|
| 19 | + * Returns the unique ID of the location. |
|
| 20 | + * |
|
| 21 | + * @return string ID of location. |
|
| 22 | + */ |
|
| 23 | 23 | public function get_id(); |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * Returns the name of the location. |
|
| 27 | - * |
|
| 28 | - * @return string Name of location. |
|
| 29 | - */ |
|
| 26 | + * Returns the name of the location. |
|
| 27 | + * |
|
| 28 | + * @return string Name of location. |
|
| 29 | + */ |
|
| 30 | 30 | public function get_name(); |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * Returns the description of the location. |
|
| 34 | - * |
|
| 35 | - * @return string Description of location. |
|
| 36 | - */ |
|
| 33 | + * Returns the description of the location. |
|
| 34 | + * |
|
| 35 | + * @return string Description of location. |
|
| 36 | + */ |
|
| 37 | 37 | public function get_desc(); |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * Returns whether or not this location type will be displayed on a current page. |
|
| 41 | - * |
|
| 42 | - * Generally, you can always return true, but if you can narrow down the usage |
|
| 43 | - * without adding extra load to server, this will further enhance the extension's |
|
| 44 | - * performance. |
|
| 45 | - * |
|
| 46 | - * @return bool True when location type will be displayed on a current page and false if not. |
|
| 47 | - */ |
|
| 40 | + * Returns whether or not this location type will be displayed on a current page. |
|
| 41 | + * |
|
| 42 | + * Generally, you can always return true, but if you can narrow down the usage |
|
| 43 | + * without adding extra load to server, this will further enhance the extension's |
|
| 44 | + * performance. |
|
| 45 | + * |
|
| 46 | + * @return bool True when location type will be displayed on a current page and false if not. |
|
| 47 | + */ |
|
| 48 | 48 | public function will_display(); |
| 49 | 49 | } |
@@ -13,40 +13,40 @@ |
||
| 13 | 13 | class below_header extends base |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * User object |
|
| 17 | - * @var \phpbb\user |
|
| 18 | - */ |
|
| 16 | + * User object |
|
| 17 | + * @var \phpbb\user |
|
| 18 | + */ |
|
| 19 | 19 | protected $user; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * Construct an above_header template location object |
|
| 23 | - * |
|
| 24 | - * @param \phpbb\user $config User object |
|
| 25 | - */ |
|
| 22 | + * Construct an above_header template location object |
|
| 23 | + * |
|
| 24 | + * @param \phpbb\user $config User object |
|
| 25 | + */ |
|
| 26 | 26 | public function __construct(\phpbb\user $user) |
| 27 | 27 | { |
| 28 | 28 | $this->user = $user; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * {@inheritDoc} |
|
| 33 | - */ |
|
| 32 | + * {@inheritDoc} |
|
| 33 | + */ |
|
| 34 | 34 | public function get_id() |
| 35 | 35 | { |
| 36 | 36 | return 'below_header'; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * {@inheritDoc} |
|
| 41 | - */ |
|
| 40 | + * {@inheritDoc} |
|
| 41 | + */ |
|
| 42 | 42 | public function get_name() |
| 43 | 43 | { |
| 44 | 44 | return $this->user->lang('AD_BELOW_HEADER'); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * {@inheritDoc} |
|
| 49 | - */ |
|
| 48 | + * {@inheritDoc} |
|
| 49 | + */ |
|
| 50 | 50 | public function get_desc() |
| 51 | 51 | { |
| 52 | 52 | return $this->user->lang('AD_BELOW_HEADER_DESC'); |
@@ -21,7 +21,6 @@ |
||
| 21 | 21 | /** |
| 22 | 22 | * Construct an above_header template location object |
| 23 | 23 | * |
| 24 | - * @param \phpbb\user $config User object |
|
| 25 | 24 | */ |
| 26 | 25 | public function __construct(\phpbb\user $user) |
| 27 | 26 | { |
@@ -16,8 +16,8 @@ |
||
| 16 | 16 | abstract class base implements \phpbb\admanagement\location\type\type_interface |
| 17 | 17 | { |
| 18 | 18 | /** |
| 19 | - * {@inheritDoc} |
|
| 20 | - */ |
|
| 19 | + * {@inheritDoc} |
|
| 20 | + */ |
|
| 21 | 21 | public function will_display() |
| 22 | 22 | { |
| 23 | 23 | return true; |
@@ -13,31 +13,31 @@ discard block |
||
| 13 | 13 | class m3_template_locations_schema extends \phpbb\db\migration\migration |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * {@inheritDoc} |
|
| 17 | - */ |
|
| 16 | + * {@inheritDoc} |
|
| 17 | + */ |
|
| 18 | 18 | public function effectively_installed() |
| 19 | 19 | { |
| 20 | 20 | return $this->db_tools->sql_table_exists($this->table_prefix . 'ad_locations'); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * {@inheritDoc} |
|
| 25 | - */ |
|
| 24 | + * {@inheritDoc} |
|
| 25 | + */ |
|
| 26 | 26 | static public function depends_on() |
| 27 | 27 | { |
| 28 | 28 | return array('\phpbb\admanagement\migrations\v10x\m2_acp_module'); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Add the ad_locations table schema to the database: |
|
| 33 | - * ad_locations: |
|
| 34 | - * ad_location_id |
|
| 35 | - * ad_id |
|
| 36 | - * location_id |
|
| 37 | - * |
|
| 38 | - * @return array Array of table schema |
|
| 39 | - * @access public |
|
| 40 | - */ |
|
| 32 | + * Add the ad_locations table schema to the database: |
|
| 33 | + * ad_locations: |
|
| 34 | + * ad_location_id |
|
| 35 | + * ad_id |
|
| 36 | + * location_id |
|
| 37 | + * |
|
| 38 | + * @return array Array of table schema |
|
| 39 | + * @access public |
|
| 40 | + */ |
|
| 41 | 41 | public function update_schema() |
| 42 | 42 | { |
| 43 | 43 | return array( |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * Drop the ad_locations table schema from the database |
|
| 58 | - * |
|
| 59 | - * @return array Array of table schema |
|
| 60 | - * @access public |
|
| 61 | - */ |
|
| 57 | + * Drop the ad_locations table schema from the database |
|
| 58 | + * |
|
| 59 | + * @return array Array of table schema |
|
| 60 | + * @access public |
|
| 61 | + */ |
|
| 62 | 62 | public function revert_schema() |
| 63 | 63 | { |
| 64 | 64 | return array( |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | protected $errors = array(); |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * Constructor |
|
| 52 | - * |
|
| 53 | - * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
| 54 | - * @param \phpbb\template\template $template Template object |
|
| 55 | - * @param \phpbb\user $user User object |
|
| 56 | - * @param \phpbb\request\request $request Request object |
|
| 57 | - * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
| 58 | - * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
| 59 | - * @param string $php_ext PHP extension |
|
| 60 | - * @param string $ext_path Path to this extension |
|
| 61 | - */ |
|
| 51 | + * Constructor |
|
| 52 | + * |
|
| 53 | + * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
| 54 | + * @param \phpbb\template\template $template Template object |
|
| 55 | + * @param \phpbb\user $user User object |
|
| 56 | + * @param \phpbb\request\request $request Request object |
|
| 57 | + * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
| 58 | + * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
| 59 | + * @param string $php_ext PHP extension |
|
| 60 | + * @param string $ext_path Path to this extension |
|
| 61 | + */ |
|
| 62 | 62 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\request\request $request, \phpbb\admanagement\ad\manager $manager, \phpbb\admanagement\location\manager $location_manager, $php_ext, $ext_path) |
| 63 | 63 | { |
| 64 | 64 | $this->db = $db; |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * Process user request |
|
| 76 | - * |
|
| 77 | - * @return void |
|
| 78 | - */ |
|
| 75 | + * Process user request |
|
| 76 | + * |
|
| 77 | + * @return void |
|
| 78 | + */ |
|
| 79 | 79 | public function main() |
| 80 | 80 | { |
| 81 | 81 | $this->user->add_lang_ext('phpbb/admanagement', 'acp'); |
@@ -92,31 +92,31 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * Set page url |
|
| 96 | - * |
|
| 97 | - * @param string $u_action Custom form action |
|
| 98 | - * @return void |
|
| 99 | - */ |
|
| 95 | + * Set page url |
|
| 96 | + * |
|
| 97 | + * @param string $u_action Custom form action |
|
| 98 | + * @return void |
|
| 99 | + */ |
|
| 100 | 100 | public function set_page_url($u_action) |
| 101 | 101 | { |
| 102 | 102 | $this->u_action = $u_action; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * Get ACP page title for Ads module |
|
| 107 | - * |
|
| 108 | - * @return string Language string for Ads ACP module |
|
| 109 | - */ |
|
| 106 | + * Get ACP page title for Ads module |
|
| 107 | + * |
|
| 108 | + * @return string Language string for Ads ACP module |
|
| 109 | + */ |
|
| 110 | 110 | public function get_page_title() |
| 111 | 111 | { |
| 112 | 112 | return $this->user->lang('ACP_ADMANAGEMENT_TITLE'); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * Add an advertisement |
|
| 117 | - * |
|
| 118 | - * @return void |
|
| 119 | - */ |
|
| 116 | + * Add an advertisement |
|
| 117 | + * |
|
| 118 | + * @return void |
|
| 119 | + */ |
|
| 120 | 120 | public function action_add() |
| 121 | 121 | { |
| 122 | 122 | add_form_key('phpbb/admanagement/add'); |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * Edit an advertisement |
|
| 151 | - * |
|
| 152 | - * @return void |
|
| 153 | - */ |
|
| 150 | + * Edit an advertisement |
|
| 151 | + * |
|
| 152 | + * @return void |
|
| 153 | + */ |
|
| 154 | 154 | public function action_edit() |
| 155 | 155 | { |
| 156 | 156 | $ad_id = $this->request->variable('id', 0); |
@@ -201,30 +201,30 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | - * Enable an advertisement |
|
| 205 | - * |
|
| 206 | - * @return void |
|
| 207 | - */ |
|
| 204 | + * Enable an advertisement |
|
| 205 | + * |
|
| 206 | + * @return void |
|
| 207 | + */ |
|
| 208 | 208 | public function action_enable() |
| 209 | 209 | { |
| 210 | 210 | $this->ad_enable(true); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | - * Disable an advertisement |
|
| 215 | - * |
|
| 216 | - * @return void |
|
| 217 | - */ |
|
| 214 | + * Disable an advertisement |
|
| 215 | + * |
|
| 216 | + * @return void |
|
| 217 | + */ |
|
| 218 | 218 | public function action_disable() |
| 219 | 219 | { |
| 220 | 220 | $this->ad_enable(false); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
| 224 | - * Delete an advertisement |
|
| 225 | - * |
|
| 226 | - * @return void |
|
| 227 | - */ |
|
| 224 | + * Delete an advertisement |
|
| 225 | + * |
|
| 226 | + * @return void |
|
| 227 | + */ |
|
| 228 | 228 | public function action_delete() |
| 229 | 229 | { |
| 230 | 230 | $ad_id = $this->request->variable('id', 0); |
@@ -258,10 +258,10 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | - * Display the ads |
|
| 262 | - * |
|
| 263 | - * @return void |
|
| 264 | - */ |
|
| 261 | + * Display the ads |
|
| 262 | + * |
|
| 263 | + * @return void |
|
| 264 | + */ |
|
| 265 | 265 | public function list_ads() |
| 266 | 266 | { |
| 267 | 267 | foreach ($this->manager->get_all_ads() as $row) |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
| 289 | - * Enable/disable an advertisement |
|
| 290 | - * |
|
| 291 | - * @param bool $enable Enable or disable the advertisement? |
|
| 292 | - * @return void |
|
| 293 | - */ |
|
| 289 | + * Enable/disable an advertisement |
|
| 290 | + * |
|
| 291 | + * @param bool $enable Enable or disable the advertisement? |
|
| 292 | + * @return void |
|
| 293 | + */ |
|
| 294 | 294 | protected function ad_enable($enable) |
| 295 | 295 | { |
| 296 | 296 | $ad_id = $this->request->variable('id', 0); |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
| 324 | - * Get admin form data. |
|
| 325 | - * |
|
| 326 | - * @return array Form data |
|
| 327 | - */ |
|
| 324 | + * Get admin form data. |
|
| 325 | + * |
|
| 326 | + * @return array Form data |
|
| 327 | + */ |
|
| 328 | 328 | protected function get_form_data() |
| 329 | 329 | { |
| 330 | 330 | return array( |
@@ -337,12 +337,12 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
| 340 | - * Validate form data. |
|
| 341 | - * |
|
| 342 | - * @param array $data The form data. |
|
| 343 | - * @param string $form_name The form name. |
|
| 344 | - * @return void |
|
| 345 | - */ |
|
| 340 | + * Validate form data. |
|
| 341 | + * |
|
| 342 | + * @param array $data The form data. |
|
| 343 | + * @param string $form_name The form name. |
|
| 344 | + * @return void |
|
| 345 | + */ |
|
| 346 | 346 | protected function validate($data, $form_name) |
| 347 | 347 | { |
| 348 | 348 | if (!check_form_key($form_name)) |
@@ -361,11 +361,11 @@ discard block |
||
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
| 364 | - * Assign form data to the template. |
|
| 365 | - * |
|
| 366 | - * @param array $data The form data. |
|
| 367 | - * @return void |
|
| 368 | - */ |
|
| 364 | + * Assign form data to the template. |
|
| 365 | + * |
|
| 366 | + * @param array $data The form data. |
|
| 367 | + * @return void |
|
| 368 | + */ |
|
| 369 | 369 | protected function assign_form_data($data) |
| 370 | 370 | { |
| 371 | 371 | $this->template->assign_vars(array( |
@@ -380,11 +380,11 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /** |
| 383 | - * Assign template locations data to the template. |
|
| 384 | - * |
|
| 385 | - * @param mixed $data The form data or nothing. |
|
| 386 | - * @return void |
|
| 387 | - */ |
|
| 383 | + * Assign template locations data to the template. |
|
| 384 | + * |
|
| 385 | + * @param mixed $data The form data or nothing. |
|
| 386 | + * @return void |
|
| 387 | + */ |
|
| 388 | 388 | protected function assign_locations($data = false) |
| 389 | 389 | { |
| 390 | 390 | foreach ($this->location_manager->get_all_locations() as $location_id => $location_data) |
@@ -399,20 +399,20 @@ discard block |
||
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | /** |
| 402 | - * Print success message. |
|
| 403 | - * |
|
| 404 | - * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 405 | - */ |
|
| 402 | + * Print success message. |
|
| 403 | + * |
|
| 404 | + * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 405 | + */ |
|
| 406 | 406 | protected function success() |
| 407 | 407 | { |
| 408 | 408 | trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action)); |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
| 412 | - * Print error message. |
|
| 413 | - * |
|
| 414 | - * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 415 | - */ |
|
| 412 | + * Print error message. |
|
| 413 | + * |
|
| 414 | + * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 415 | + */ |
|
| 416 | 416 | protected function error() |
| 417 | 417 | { |
| 418 | 418 | trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action), E_USER_WARNING); |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | protected $ad_locations_table; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * Constructor |
|
| 26 | - * |
|
| 27 | - * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
| 28 | - * @param string $ads_table Ads table |
|
| 29 | - * @param string $ad_locations_table Ad locations table |
|
| 30 | - */ |
|
| 25 | + * Constructor |
|
| 26 | + * |
|
| 27 | + * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
| 28 | + * @param string $ads_table Ads table |
|
| 29 | + * @param string $ad_locations_table Ad locations table |
|
| 30 | + */ |
|
| 31 | 31 | public function __construct(\phpbb\db\driver\driver_interface $db, $ads_table, $ad_locations_table) |
| 32 | 32 | { |
| 33 | 33 | $this->db = $db; |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * Get specific ad |
|
| 40 | - * |
|
| 41 | - * @param int $ad_id Advertisement ID |
|
| 42 | - * @return array Advertisement data |
|
| 43 | - */ |
|
| 39 | + * Get specific ad |
|
| 40 | + * |
|
| 41 | + * @param int $ad_id Advertisement ID |
|
| 42 | + * @return array Advertisement data |
|
| 43 | + */ |
|
| 44 | 44 | public function get_ad($ad_id) |
| 45 | 45 | { |
| 46 | 46 | $sql = 'SELECT * |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * Get one ad per every location |
|
| 58 | - * |
|
| 59 | - * @param array $ad_locations List of ad locations to fetch ads for |
|
| 60 | - * @return array List of ad codes for each location |
|
| 61 | - */ |
|
| 57 | + * Get one ad per every location |
|
| 58 | + * |
|
| 59 | + * @param array $ad_locations List of ad locations to fetch ads for |
|
| 60 | + * @return array List of ad codes for each location |
|
| 61 | + */ |
|
| 62 | 62 | public function get_ads($ad_locations) |
| 63 | 63 | { |
| 64 | 64 | $sql = 'SELECT location_id, ad_code |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | - * Get all advertisements |
|
| 84 | - * |
|
| 85 | - * @return array List of all ads |
|
| 86 | - */ |
|
| 83 | + * Get all advertisements |
|
| 84 | + * |
|
| 85 | + * @return array List of all ads |
|
| 86 | + */ |
|
| 87 | 87 | public function get_all_ads() |
| 88 | 88 | { |
| 89 | 89 | $sql = 'SELECT ad_id, ad_name, ad_enabled |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * Insert new advertisement to the database |
|
| 100 | - * |
|
| 101 | - * @param array $data New ad data |
|
| 102 | - * @return int New advertisement ID |
|
| 103 | - */ |
|
| 99 | + * Insert new advertisement to the database |
|
| 100 | + * |
|
| 101 | + * @param array $data New ad data |
|
| 102 | + * @return int New advertisement ID |
|
| 103 | + */ |
|
| 104 | 104 | public function insert_ad($data) |
| 105 | 105 | { |
| 106 | 106 | $data = $this->intersect_ad_data($data); |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | - * Update advertisement |
|
| 116 | - * |
|
| 117 | - * @param int $ad_id Advertisement ID |
|
| 118 | - * @param array $data List of data to update in the database |
|
| 119 | - * @return int Number of affected rows. Can be used to determine if any ad has been udated. |
|
| 120 | - */ |
|
| 115 | + * Update advertisement |
|
| 116 | + * |
|
| 117 | + * @param int $ad_id Advertisement ID |
|
| 118 | + * @param array $data List of data to update in the database |
|
| 119 | + * @return int Number of affected rows. Can be used to determine if any ad has been udated. |
|
| 120 | + */ |
|
| 121 | 121 | public function update_ad($ad_id, $data) |
| 122 | 122 | { |
| 123 | 123 | $data = $this->intersect_ad_data($data); |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | - * Delete advertisement |
|
| 135 | - * |
|
| 136 | - * @param int $ad_id Advertisement ID |
|
| 137 | - * @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
|
| 138 | - */ |
|
| 134 | + * Delete advertisement |
|
| 135 | + * |
|
| 136 | + * @param int $ad_id Advertisement ID |
|
| 137 | + * @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
|
| 138 | + */ |
|
| 139 | 139 | public function delete_ad($ad_id) |
| 140 | 140 | { |
| 141 | 141 | $sql = 'DELETE FROM ' . $this->ads_table . ' |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | - * Get all locations for specified advertisement |
|
| 150 | - * |
|
| 151 | - * @param int $ad_id Advertisement ID |
|
| 152 | - * @return int List of template locations for specified ad |
|
| 153 | - */ |
|
| 149 | + * Get all locations for specified advertisement |
|
| 150 | + * |
|
| 151 | + * @param int $ad_id Advertisement ID |
|
| 152 | + * @return int List of template locations for specified ad |
|
| 153 | + */ |
|
| 154 | 154 | public function get_ad_locations($ad_id) |
| 155 | 155 | { |
| 156 | 156 | $ad_locations = array(); |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * Insert advertisement locations |
|
| 173 | - * |
|
| 174 | - * @param int $ad_id Advertisement ID |
|
| 175 | - * @param array $ad_locations List of template locations for this ad |
|
| 176 | - * @return void |
|
| 177 | - */ |
|
| 172 | + * Insert advertisement locations |
|
| 173 | + * |
|
| 174 | + * @param int $ad_id Advertisement ID |
|
| 175 | + * @param array $ad_locations List of template locations for this ad |
|
| 176 | + * @return void |
|
| 177 | + */ |
|
| 178 | 178 | public function insert_ad_locations($ad_id, $ad_locations) |
| 179 | 179 | { |
| 180 | 180 | $sql_ary = array(); |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * Delete advertisement locations |
|
| 193 | - * |
|
| 194 | - * @param int $ad_id Advertisement ID |
|
| 195 | - * @return void |
|
| 196 | - */ |
|
| 192 | + * Delete advertisement locations |
|
| 193 | + * |
|
| 194 | + * @param int $ad_id Advertisement ID |
|
| 195 | + * @return void |
|
| 196 | + */ |
|
| 197 | 197 | public function delete_ad_locations($ad_id) |
| 198 | 198 | { |
| 199 | 199 | $sql = 'DELETE FROM ' . $this->ad_locations_table . ' |
@@ -202,11 +202,11 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | - * Make sure only necessary data make their way to SQL query |
|
| 206 | - * |
|
| 207 | - * @param array $data List of data to query the database |
|
| 208 | - * @return array Cleaned data that contain only valid keys |
|
| 209 | - */ |
|
| 205 | + * Make sure only necessary data make their way to SQL query |
|
| 206 | + * |
|
| 207 | + * @param array $data List of data to query the database |
|
| 208 | + * @return array Cleaned data that contain only valid keys |
|
| 209 | + */ |
|
| 210 | 210 | protected function intersect_ad_data($data) |
| 211 | 211 | { |
| 212 | 212 | return array_intersect_key($data, array( |
@@ -218,10 +218,10 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | - * Get the random statement for this database layer |
|
| 222 | - * |
|
| 223 | - * @return string Random statement for current database layer |
|
| 224 | - */ |
|
| 221 | + * Get the random statement for this database layer |
|
| 222 | + * |
|
| 223 | + * @return string Random statement for current database layer |
|
| 224 | + */ |
|
| 225 | 225 | protected function sql_random() |
| 226 | 226 | { |
| 227 | 227 | switch ($this->db->get_sql_layer()) |
@@ -13,30 +13,30 @@ discard block |
||
| 13 | 13 | class manager |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * Array that contains all available template location types which are passed |
|
| 17 | - * via the service container |
|
| 18 | - * @var array |
|
| 19 | - */ |
|
| 16 | + * Array that contains all available template location types which are passed |
|
| 17 | + * via the service container |
|
| 18 | + * @var array |
|
| 19 | + */ |
|
| 20 | 20 | protected $template_locations; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * Construct an template locations manager object |
|
| 24 | - * |
|
| 25 | - * @param array $template_locations Template location types passed via the service container |
|
| 26 | - */ |
|
| 23 | + * Construct an template locations manager object |
|
| 24 | + * |
|
| 25 | + * @param array $template_locations Template location types passed via the service container |
|
| 26 | + */ |
|
| 27 | 27 | public function __construct($template_locations) |
| 28 | 28 | { |
| 29 | 29 | $this->register_template_locations($template_locations); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * Get a list of all template location types |
|
| 34 | - * |
|
| 35 | - * Returns an associated array where key is the location id |
|
| 36 | - * and value is array of location name and location description. |
|
| 37 | - * |
|
| 38 | - * @return array Array containing a list of all template locations |
|
| 39 | - */ |
|
| 33 | + * Get a list of all template location types |
|
| 34 | + * |
|
| 35 | + * Returns an associated array where key is the location id |
|
| 36 | + * and value is array of location name and location description. |
|
| 37 | + * |
|
| 38 | + * @return array Array containing a list of all template locations |
|
| 39 | + */ |
|
| 40 | 40 | public function get_all_locations() |
| 41 | 41 | { |
| 42 | 42 | $location_types = array(); |
@@ -53,20 +53,20 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * Get a list of all template location IDs |
|
| 57 | - * |
|
| 58 | - * @return array Array containing a list of all template location IDs |
|
| 59 | - */ |
|
| 56 | + * Get a list of all template location IDs |
|
| 57 | + * |
|
| 58 | + * @return array Array containing a list of all template location IDs |
|
| 59 | + */ |
|
| 60 | 60 | public function get_all_location_ids() |
| 61 | 61 | { |
| 62 | 62 | return array_keys($this->template_locations); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * Register template locations |
|
| 67 | - * |
|
| 68 | - * @param array $template_locations Template location types passed via the service container |
|
| 69 | - */ |
|
| 66 | + * Register template locations |
|
| 67 | + * |
|
| 68 | + * @param array $template_locations Template location types passed via the service container |
|
| 69 | + */ |
|
| 70 | 70 | protected function register_template_locations($template_locations) |
| 71 | 71 | { |
| 72 | 72 | if (!empty($template_locations)) |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | protected $location_manager; |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * {@inheritdoc} |
|
| 40 | - */ |
|
| 39 | + * {@inheritdoc} |
|
| 40 | + */ |
|
| 41 | 41 | static public function getSubscribedEvents() |
| 42 | 42 | { |
| 43 | 43 | return array( |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * Constructor |
|
| 50 | - * |
|
| 51 | - * @param \phpbb\request\request $request Request object |
|
| 52 | - * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
| 53 | - * @param \phpbb\template\template $template Template object |
|
| 54 | - * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
| 55 | - * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
| 56 | - */ |
|
| 49 | + * Constructor |
|
| 50 | + * |
|
| 51 | + * @param \phpbb\request\request $request Request object |
|
| 52 | + * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
| 53 | + * @param \phpbb\template\template $template Template object |
|
| 54 | + * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
| 55 | + * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
| 56 | + */ |
|
| 57 | 57 | public function __construct(\phpbb\request\request $request, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\admanagement\ad\manager $manager, \phpbb\admanagement\location\manager $location_manager) |
| 58 | 58 | { |
| 59 | 59 | $this->request = $request; |