Merge pull request #190 from marc1706/feature/module_services

Feature/module services
This commit is contained in:
Marc Alexander
2013-11-16 08:23:50 -08:00
4 changed files with 43 additions and 29 deletions

View File

@@ -179,6 +179,15 @@ services:
tags:
- { name: board3.module }
board3.module.search:
class: \board3\portal\modules\search
arguments:
- @template
- %core.php_ext%
- %core.root_path%
tags:
- { name: board3.module }
board3.module.stylechanger:
class: \board3\portal\modules\stylechanger
arguments:

View File

@@ -347,7 +347,7 @@ class v210_beta1 extends \phpbb\db\migration\migration
'module_status' => 1,
),
array(
'module_classname' => 'search',
'module_classname' => '\board3\portal\modules\search',
'module_column' => 1,
'module_order' => 5,
'module_name' => 'PORTAL_SEARCH',

View File

@@ -44,9 +44,6 @@ class link_us extends module_base
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\db\driver */
protected $db;
/** @var \phpbb\template */
protected $template;

View File

@@ -1,24 +1,18 @@
<?php
/**
*
* @package Board3 Portal v2 - Search
* @package Board3 Portal v2.1
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
namespace board3\portal\modules;
/**
* @package Search
*/
class portal_search_module extends \board3\portal\modules\module_base
class search extends module_base
{
/**
* Allowed columns: Just sum up your options (Exp: left + right = 10)
@@ -53,15 +47,42 @@ class portal_search_module extends \board3\portal\modules\module_base
*/
public $custom_acp_tpl = '';
/** @var \phpbb\template */
protected $template;
/** @var phpbb root path */
protected $phpbb_root_path;
/** @var php file extension */
protected $php_ext;
/**
* Construct a search object
*
* @param \phpbb\template $template phpBB template
* @param string $phpbb_root_path phpbb root path
* @param string $php_ext php file extension
*/
public function __construct($template, $phpbb_root_path, $php_ext)
{
$this->template = $template;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
}
/**
* @inheritdoc
*/
public function get_template_side($module_id)
{
global $template, $phpbb_root_path, $phpEx;
$template->assign_var('S_SEARCH_ACTION', append_sid("{$phpbb_root_path}search.$phpEx"));
$this->template->assign_var('S_SEARCH_ACTION', append_sid("{$this->phpbb_root_path}search.{$this->php_ext}"));
return 'search_side.html';
}
/**
* @inheritdoc
*/
public function get_template_acp($module_id)
{
return array(
@@ -69,17 +90,4 @@ class portal_search_module extends \board3\portal\modules\module_base
'vars' => array(),
);
}
/**
* API functions
*/
public function install($module_id)
{
return true;
}
public function uninstall($module_id, $db)
{
return true;
}
}