[feature/module_services] Move donation module to new module format

This commit is contained in:
Marc Alexander
2013-11-12 14:44:08 +01:00
parent 31b4fe1f96
commit 35fb3103f7
2 changed files with 54 additions and 20 deletions

View File

@@ -56,3 +56,12 @@ services:
class: \board3\portal\modules\clock class: \board3\portal\modules\clock
tags: tags:
- { name: board3.module } - { name: board3.module }
board3.module.donation:
class: \board3\portal\modules\donation
arguments:
- @config
- @template
- @user
tags:
- { name: board3.module }

View File

@@ -1,24 +1,18 @@
<?php <?php
/** /**
* *
* @package Board3 Portal v2 - Donation * @package Board3 Portal v2.1
* @copyright (c) Board3 Group ( www.board3.de ) * @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* *
*/ */
/** namespace board3\portal\modules;
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* @package Donation * @package Donation
*/ */
class portal_donation_module extends \board3\portal\modules\module_base class donation extends module_base
{ {
/** /**
* Allowed columns: Just sum up your options (Exp: left + right = 10) * Allowed columns: Just sum up your options (Exp: left + right = 10)
@@ -47,30 +41,58 @@ class portal_donation_module extends \board3\portal\modules\module_base
*/ */
public $language = 'portal_donation_module'; public $language = 'portal_donation_module';
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\template */
protected $template;
/** @var \phpbb\user */
protected $user;
/**
* Construct a stylechanger object
*
* @param \phpbb\config\config $config phpBB config
* @param \phpbb\template $template phpBB template
* @param \phpbb\user $user phpBB user object
*/
public function __construct($config, $template, $user)
{
$this->config = $config;
$this->template = $template;
$this->user = $user;
}
/**
* @inheritdoc
*/
public function get_template_center($module_id) public function get_template_center($module_id)
{ {
global $config, $template, $user; $this->template->assign_vars(array(
'PAY_ACC_CENTER' => $this->config['board3_pay_acc_' . $module_id],
$template->assign_vars(array( 'PAY_CUSTOM_CENTER' => (!empty($this->config['board3_pay_custom_' . $module_id])) ? $this->user->data['username_clean'] : false,
'PAY_ACC_CENTER' => $config['board3_pay_acc_' . $module_id],
'PAY_CUSTOM_CENTER' => (!empty($config['board3_pay_custom_' . $module_id])) ? $user->data['username_clean'] : false,
)); ));
return 'donation_center.html'; return 'donation_center.html';
} }
/**
* @inheritdoc
*/
public function get_template_side($module_id) public function get_template_side($module_id)
{ {
global $config, $template, $user; $this->template->assign_vars(array(
'PAY_ACC_SIDE' => $this->config['board3_pay_acc_' . $module_id],
$template->assign_vars(array( 'PAY_CUSTOM_SIDE' => (!empty($this->config['board3_pay_custom_' . $module_id])) ? $this->user->data['username_clean'] : false,
'PAY_ACC_SIDE' => $config['board3_pay_acc_' . $module_id],
'PAY_CUSTOM_SIDE' => (!empty($config['board3_pay_custom_' . $module_id])) ? $user->data['username_clean'] : false,
)); ));
return 'donation_side.html'; return 'donation_side.html';
} }
/**
* @inheritdoc
*/
public function get_template_acp($module_id) public function get_template_acp($module_id)
{ {
return array( return array(
@@ -84,7 +106,7 @@ class portal_donation_module extends \board3\portal\modules\module_base
} }
/** /**
* API functions * @inheritdoc
*/ */
public function install($module_id) public function install($module_id)
{ {
@@ -93,6 +115,9 @@ class portal_donation_module extends \board3\portal\modules\module_base
return true; return true;
} }
/**
* @inheritdoc
*/
public function uninstall($module_id) public function uninstall($module_id)
{ {
global $db; global $db;