[ticket/334] Allow specifying flash clock instead of using the standard clock

B3P-334
This commit is contained in:
Marc Alexander
2014-11-26 14:53:29 +01:00
parent 333ee274b5
commit 420d389c27
5 changed files with 70 additions and 2 deletions

View File

@@ -59,6 +59,9 @@ services:
board3.portal.module.clock:
class: board3\portal\modules\clock
arguments:
- @config
- @template
tags:
- { name: board3.portal.module }

View File

@@ -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;
}
}

View File

@@ -1,4 +1,5 @@
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" />&nbsp;<!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
<!-- IF not B3P_CLOCK_SRC -->
<div class="portal-clock-wrapper">
<div class="portal-clock">
<div class="portal-clock-back">
@@ -29,4 +30,13 @@
</div>
<!-- INCLUDEJS portal/assets/jquery_easing_1_3.js -->
<!-- INCLUDEJS portal/assets/portal_clock.js -->
<!-- ELSE -->
<div style="text-align: center;">
<br />
<object type="application/x-shockwave-flash" data="{T_THEME_PATH}/images/portal/{B3P_CLOCK_SRC}" width="140">
<param name="wmode" value="transparent" />
<param name="movie" value="{T_THEME_PATH}/images/portal/{B3P_CLOCK_SRC}" />
</object>
</div>
<!-- ENDIF -->
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}

View File

@@ -1,6 +1,7 @@
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" />&nbsp;<!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
<table class="tablebg" cellspacing="1" width="100%">
<tr class="row1" style="height: 5em;">
<!-- IF not B3P_CLOCK_SRC -->
<td style="text-align: center; height: 5em; margin: 0 auto;">
<div id="portal-clock">
<div id="portal-clock-back">
@@ -29,8 +30,19 @@
</div>
</div>
</td>
<!-- ELSE -->
<td style="text-align:center;">
<br />
<object type="application/x-shockwave-flash" data="{T_THEME_PATH}/images/portal/{B3P_CLOCK_SRC}" width="140">
<param name="wmode" value="transparent" />
<param name="movie" value="{T_THEME_PATH}/images/portal/{B3P_CLOCK_SRC}" />
</object>
</td>
<!-- ENDIF -->
</tr>
</table>
<!-- IF not B3P_CLOCK_SRC -->
<!-- INCLUDEJS portal/modules/jquery_easing_1_3.js -->
<!-- INCLUDEJS portal/modules/portal_clock.js -->
<!-- ENDIF -->
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}

View File

@@ -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),