Erstellt eine Datei namens portal_advent.php und fügt folgenden Code ein:
Code: Select all
<?php
/**
*
* @package - Board3portal Advent Calendar
* @copyright (c) 2009 Wuerzi http://www.spieleresidenz.de
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* @package Advent Calendar
*/
class portal_advent_module
{
/**
* Allowed columns: Just sum up your options (Exp: left + right = 10)
* top 1
* left 2
* center 4
* right 8
* bottom 16
*/
public $columns = 21;
/**
* Default modulename
*/
public $name = 'PORTAL_ADVENT';
/**
* Default module-image:
* file must be in "{T_THEME_PATH}/images/portal/"
*/
public $image_src = '';
/**
* module-language file
* file must be in "language/{$user->lang}/mods/portal/"
*/
public $language = 'portal_advent';
/**
* custom acp template
* file must be in "adm/style/portal/"
*/
public $custom_acp_tpl = '';
/**
* hide module name in ACP configuration page
*/
public $hide_name = false;
public function get_template_center($module_id)
{
global $config, $template, $user, $phpbb_root_path, $phpEx;
// Numbersize
$class_size = array(
'20',
'30',
'40'
);
// Font
$class_font = array(
'font-family: Times New Roman, Georgia, Times;',
'font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular;'
);
// Fontcolor
$class_color = array(
'white',
'yellow',
'silver',
'red'
);
// Fontweight
$class_weight = array(
'font-weight: bold;'
);
// Font
$class_style = array(
'font-style: italic;',
'font-style: normal;'
);
$ak_hover_size = 45;
$ak_hover_color = '#00FF00';
$tuer_tag_style = 'font-size: 50px; font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular; color: white; font-weight: bold';
// Do noting change after this line!
$user->add_lang('mods/advent');
$tag_link = request_var('t', 0);
$a_path = (defined('ADVENT_PATH')) ? ADVENT_PATH : 'advent/';
$heute = mktime(date("H")+0, date("i"), date("s"), date("m"), date("d"));
$heute_m = date("m", $heute);
$heute_t = date("d", $heute);
$ak_verz = @opendir($a_path . 'images/back');
while($ak_bg_file = readdir($ak_verz))
{
if($ak_bg_file != '.' && $ak_bg_file != '..')
{
$ak_bg_files[] = $ak_bg_file;
}
}
$ka_bild = $a_path . 'images/back/' . $ak_bg_files[rand(0, count($ak_bg_files)-1)];
$tuer = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24);
shuffle ($tuer);
$p_v = array('top', 'middle', 'bottom');
$p_h = array('left', 'center', 'right');
$kalender = '';
$pos=0;
for ($z = 1; $z <= 4; $z++)
{
$kalender .= '<tr>';
for ($s = 1; $s <= 6; $s++)
{
if ($tuer[$pos] < $heute_t && $heute_m == 12)
{
$tuerbild = $a_path . 'images/t_a_60.gif';
}
else
{
$tuerbild = $a_path . 'images/t_60.gif';
}
$class_color_rand = rand(0, count($class_color) - 1);
$class_size_rand = rand(0, count($class_size) - 1);
$kalender .= '<td align="' . $p_h[rand(0, 2)] . '" valign="' . $p_v[rand(0, 2)] . '">
<table width="60" height="60" cellspacing="0" cellpadding="0" background="' . $tuerbild . '">
<tr>
<td align="center" valign="middle"><a href="' . append_sid("{$phpbb_root_path}advent.$phpEx", 't=' . $tuer[$pos]) . '" id="a' . $pos . '" style="font-size: ' . $class_size[$class_size_rand] . 'px; ' . $class_font[rand(0, count($class_font) - 1)] . 'color: ' . $class_color[$class_color_rand] . '; ' . $class_weight[rand(0, count($class_weight) - 1)] . $class_style[rand(0, count($class_style) - 1)] . 'text-decoration: none" onmouseover="ka_over(\'a' . $pos . '\');" onmouseout="ka_out(\'a' . $pos. '\', \'' . $class_color[$class_color_rand] . '\', \'' . $class_size[$class_size_rand] . '\');">' . $tuer[$pos] . '</a></td>
</tr>
</table></td>';
$pos = $pos + 1;
}
$kalender .= '</tr>';
}
$template->assign_block_vars('kalender', array(
'KALENDER' => $kalender,
'IMG' => $ka_bild,
));
$template->assign_vars(array(
'S_ADVENT' => date("m") == 12 && date ("d") < 27,
'AK_HOVER_SIZE' => $ak_hover_size,
'AK_HOVER_COLOR' => $ak_hover_color
));
return 'advent.html';
}
public function get_template_acp($module_id)
{
return array(
'title' => 'PORTAL_ADVENT',
'vars' => array(),
);
}
/**
* API functions
*/
public function install($module_id)
{
return true;
}
public function uninstall($module_id)
{
return true;
}
}
Als nächtes kommt die Sprachdatei, erstelle einen Ordner namens portal_advent.php und fügt folgenden Code ein:
Code: Select all
<?php
/**
*
* @author Adventskalender for phpbb3 © 2008 Wuerzi www.spieleresidenz.de
*
* @package phpbb3advent
* @version 0.1.0
* @copyright (c) 2008
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
'PORTAL_ADVENT' => 'Adventskalender',
));
?>
Diese Datei kopiert ihr dann nach root/language/de/mods/portal
Zum Schluß erstellt ihr noch eine Datei namens advent.html und fügt folgenden Code ein:
Für prosilver:
Code: Select all
<!-- IF S_ADVENT -->
<script type="text/javascript">
function ka_over(link)
{
document.getElementById(link).style.color = "{AK_HOVER_COLOR}";
document.getElementById(link).style.fontSize = {AK_HOVER_SIZE};
}
function ka_out(link, farbe, groesse)
{
document.getElementById(link).style.color = farbe;
document.getElementById(link).style.fontSize = groesse;
}
</script>
{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
<ul class="topiclist forums">
<li>
<dl>
<dd style="width: 100%; text-align: center; border-left:0px;">
<table width="100%">
<!-- BEGIN kalender -->
<tr>
<td align="center">
<table width="500" background="{kalender.IMG}" height="400">
{kalender.KALENDER}
</table>
</td>
</tr>
<!-- END kalender -->
</table>
</dd>
</dl>
</li>
</ul>
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
<!-- ENDIF -->
Code: Select all
<!-- IF S_ADVENT -->
<script type="text/javascript">
function ka_over(link)
{
document.getElementById(link).style.color = "{AK_HOVER_COLOR}";
document.getElementById(link).style.fontSize = {AK_HOVER_SIZE};
}
function ka_out(link, farbe, groesse)
{
document.getElementById(link).style.color = farbe;
document.getElementById(link).style.fontSize = groesse;
}
</script>
{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
<table class="tablebg" cellspacing="1" width="100%">
<!-- BEGIN kalender -->
<tr>
<td class="row1" align="center"><br />
<table width="500" border="0" cellspacing="0" cellpadding="5" background="{kalender.IMG}" height="400">
{kalender.KALENDER}
</table><br />
</td>
</tr>
<!-- END kalender -->
</table>
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
<!-- ENDIF -->
Wechselt nun in´s ACP/Mods/PORTAL/Portal Module, klickt dort auf Modul Hinzufügen und wähl in der Liste
Adventskalender aus und klickt auf Absenden danach könnt ihr noch die Berechtigungen für dieses Modul einstellen.
Nicht vergessen den Cache zu leeren.
Anmerkung:
Dieses Portalmodul bekommst du nur angezeigt vom 1.12 - 26.12
Wenn du es dennoch angezeigt haben willst, dann lösche in der advent.html in der ersten Zeile das hier:
Code: Select all
<!-- IF S_ADVENT -->
Code: Select all
<!-- ENDIF -->