[feature/module_services] Turn clock and stylechanger into new modules only

This commit is contained in:
Marc Alexander
2013-11-12 13:41:05 +01:00
parent 145bfeb6e5
commit 8de0a01890
4 changed files with 64 additions and 185 deletions

View File

@@ -41,6 +41,38 @@ class clock extends module_base
*/
public $language = 'portal_clock_module';
/**
* @inheritdoc
*/
public function get_allowed_columns()
{
return $this->columns;
}
/**
* @inheritdoc
*/
public function get_name()
{
return $this->name;
}
/**
* @inheritdoc
*/
public function get_image()
{
return $this->image_src;
}
/**
* @inheritdoc
*/
public function get_language()
{
return $this->language;
}
/**
* @inheritdoc
*/

View File

@@ -51,6 +51,38 @@ class stylechanger extends module_base
$this->user = $user;
}
/**
* @inheritdoc
*/
public function get_allowed_columns()
{
return $this->columns;
}
/**
* @inheritdoc
*/
public function get_name()
{
return $this->name;
}
/**
* @inheritdoc
*/
public function get_image()
{
return $this->image_src;
}
/**
* @inheritdoc
*/
public function get_language()
{
return $this->language;
}
/**
* @inheritdoc
*/

View File

@@ -1,75 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2 - Clock
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* @package Clock
*/
class portal_clock_module extends \board3\portal\modules\module_base
{
/**
* Allowed columns: Just sum up your options (Exp: left + right = 10)
* top 1
* left 2
* center 4
* right 8
* bottom 16
*/
public $columns = 10;
/**
* Default modulename
*/
public $name = 'CLOCK';
/**
* Default module-image:
* file must be in "{T_THEME_PATH}/images/portal/"
*/
public $image_src = 'portal_clock.png';
/**
* module-language file
* file must be in "language/{$user->lang}/mods/portal/"
*/
public $language = 'portal_clock_module';
public function get_template_side($module_id)
{
return 'clock_side.html';
}
public function get_template_acp($module_id)
{
return array(
'title' => 'ACP_PORTAL_CLOCK_SETTINGS',
'vars' => array(),
);
}
/**
* API functions
*/
public function install($module_id)
{
return true;
}
public function uninstall($module_id)
{
return true;
}
}

View File

@@ -1,110 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2 - Stylechanger
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* @package Stylechanger
*/
class portal_stylechanger_module extends \board3\portal\modules\module_base
{
/**
* Allowed columns: Just sum up your options (Exp: left + right = 10)
* top 1
* left 2
* center 4
* right 8
* bottom 16
*/
public $columns = 10;
/**
* Default modulename
*/
public $name = 'BOARD_STYLE';
/**
* Default module-image:
* file must be in "{T_THEME_PATH}/images/portal/"
*/
public $image_src = 'portal_style.png';
/**
* module-language file
* file must be in "language/{$user->lang}/mods/portal/"
*/
public $language = 'portal_stylechanger_module';
public function get_template_side($module_id)
{
global $config, $template, $db, $phpEx, $phpbb_root_path, $user;
$style_count = 0;
$style_select = '';
$sql = 'SELECT style_id, style_name
FROM ' . STYLES_TABLE . '
WHERE style_active = 1
ORDER BY LOWER(style_name) ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$style = request_var('style', 0);
if (!empty($style))
{
$url = str_replace('style=' . $style, 'style=' . $row['style_id'], append_sid("{$phpbb_root_path}app.$phpEx/portal"));
}
else
{
$url = append_sid("{$phpbb_root_path}app.$phpEx/portal", 'style=' . $row['style_id']);
}
++$style_count;
$style_select .= '<option value="' . $url . '"' . ($row['style_id'] == $user->style['style_id'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($row['style_name']) . '</option>';
}
$db->sql_freeresult($result);
if(strlen($style_select))
{
$template->assign_var('STYLE_SELECT', $style_select);
}
// Assign specific vars
$template->assign_vars(array(
'S_STYLE_OPTIONS' => ($config['override_user_style'] || $style_count < 2) ? '' : style_select($user->data['user_style']),
));
return 'stylechanger_side.html';
}
public function get_template_acp($module_id)
{
return array(
'title' => 'BOARD_STYLE',
'vars' => array(),
);
}
/**
* API functions
*/
public function install($module_id)
{
return true;
}
public function uninstall($module_id)
{
return true;
}
}