diff --git a/config/modules.yml b/config/modules.yml index 4b219a24..77e11098 100644 --- a/config/modules.yml +++ b/config/modules.yml @@ -59,6 +59,9 @@ services: board3.portal.module.clock: class: board3\portal\modules\clock + arguments: + - @config + - @template tags: - { name: board3.portal.module } diff --git a/modules/clock.php b/modules/clock.php index a0a74c3e..aff0be3b 100644 --- a/modules/clock.php +++ b/modules/clock.php @@ -41,11 +41,33 @@ class clock extends module_base */ public $language = 'portal_clock_module'; + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\template\template */ + protected $template; + + /** + * Constructor for clock module + * + * @param \phpbb\config\config $config phpBB config + * @param \phpbb\template\template $template phpBB template + */ + public function __construct($config, $template) + { + $this->config = $config; + $this->template = $template; + } + /** * {@inheritdoc} */ public function get_template_side($module_id) { + if (isset($this->config['board3_clock_src_' . $module_id]) && !empty($this->config['board3_clock_src_' . $module_id])) + { + $this->template->assign_var('B3P_CLOCK_SRC', $this->config['board3_clock_src_' . $module_id]); + } return 'clock_side.html'; } @@ -56,7 +78,28 @@ class clock extends module_base { return array( 'title' => 'ACP_PORTAL_CLOCK_SETTINGS', - 'vars' => array(), + 'vars' => array( + 'legend1' => 'ACP_PORTAL_CLOCK_SETTINGS', + 'board3_clock_src_' . $module_id => array('lang' => 'ACP_PORTAL_CLOCK_SRC', 'validate' => 'string', 'type' => 'text:50:200', 'explain' => true, 'submit_type' => 'custom', 'submit' => 'check_file_src'), + ), ); } + + /** + * {@inheritdoc} + */ + public function install($module_id) + { + $this->config->set('board3_clock_src_' . $module_id, ''); + return true; + } + + /** + * {@inheritdoc} + */ + public function uninstall($module_id, $db) + { + $this->config->delete('board3_clock_src_' . $module_id); + return true; + } } diff --git a/styles/prosilver/template/portal/modules/clock_side.html b/styles/prosilver/template/portal/modules/clock_side.html index db28ca6a..8ffa536e 100644 --- a/styles/prosilver/template/portal/modules/clock_side.html +++ b/styles/prosilver/template/portal/modules/clock_side.html @@ -1,4 +1,5 @@ {$LR_BLOCK_H_L} {$TITLE}{$LR_BLOCK_H_R} +
@@ -29,4 +30,13 @@
+ +
+
+ + + + +
+ {$LR_BLOCK_F_L}{$LR_BLOCK_F_R} diff --git a/styles/subsilver2/template/portal/modules/clock_side.html b/styles/subsilver2/template/portal/modules/clock_side.html index 3f6d3834..f750757a 100644 --- a/styles/subsilver2/template/portal/modules/clock_side.html +++ b/styles/subsilver2/template/portal/modules/clock_side.html @@ -1,6 +1,7 @@ {$LR_BLOCK_H_L} {$TITLE}{$LR_BLOCK_H_R} + + + +
@@ -29,8 +30,19 @@
+
+ + + + +
+ + {$LR_BLOCK_F_L}{$LR_BLOCK_F_R} diff --git a/tests/unit/acp/move_module_test.php b/tests/unit/acp/move_module_test.php index d2f1c2e4..b8e13d31 100644 --- a/tests/unit/acp/move_module_test.php +++ b/tests/unit/acp/move_module_test.php @@ -34,7 +34,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data $config = new \phpbb\config\config(array()); $phpbb_container->set('board3.portal.module_collection', array( - new \board3\portal\modules\clock(), + new \board3\portal\modules\clock($config, $template), new \board3\portal\modules\birthday_list($config, $template, $this->db, $user), new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $phpbb_root_path, $phpEx), new \board3\portal\modules\donation($config, $template, $user),