Merge pull request #132 from marc1706/ticket/120

[ticket/120] Move birthday block HTML to template files
This commit is contained in:
Marc Alexander
2013-06-09 07:42:06 -07:00
3 changed files with 58 additions and 17 deletions

View File

@@ -61,7 +61,8 @@ class portal_birthday_list_module
while ($cache_days > 0)
{
$day = getdate(time() + 86400 * $cache_days + $user->timezone + $user->dst - date('Z'));
$sql_days .= " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $day['mday'], $day['mon'])) . "%'";
$like_expression = $db->sql_like_expression($db->any_char . (sprintf('%2d-%2d-', $day['mday'], $day['mon'])) . $db->any_char);
$sql_days .= " OR u.user_birthday " . $like_expression . "";
$cache_days--;
}
@@ -92,21 +93,19 @@ class portal_birthday_list_module
{
if (substr($row['user_birthday'], 0, 6) == $today)
{
$birthday_list .= '<span style="float:left;"><img src="' . $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;">' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) . '</span><span style="float: right;">';
if ($age = (int) substr($row['user_birthday'], -4))
{
$birthday_list .= ' (' . ($now['year'] - $age) . ')';
}
$birthday_list .= '</span><br style="clear: both" />';
$birthday_list = true;
$template->assign_block_vars('board3_birthday_list', array(
'USER' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'AGE' => ($age = (int) substr($row['user_birthday'], -4)) ? ' (' . ($now['year'] - $age) . ')' : '',
));
}
elseif ($config['board3_birthdays_ahead_' . $module_id] > 0)
{
$birthday_ahead_list .= '<span style="float:left;"><img src="' . $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><span title="' . format_birthday($row['user_birthday'], 'd M') . '">' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) . '</span></span><span style="float: right;">';
if ($age = (int) substr($row['user_birthday'], -4))
{
$birthday_ahead_list .= ' (' . ($now['year'] - $age) . ')';
}
$birthday_ahead_list .= '</span><br style="clear: both" />';
$birthday_ahead_list = true;
$template->assign_block_vars('board3_birthday_ahead_list', array(
'USER' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'AGE' => ($age = (int) substr($row['user_birthday'], -4)) ? ' (' . ($now['year'] - $age) . ')' : '',
));
}
}
$db->sql_freeresult($result);

View File

@@ -1,6 +1,17 @@
{$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 BIRTHDAY_LIST -->
<strong>{L_CONGRATULATIONS}:</strong><br /> {BIRTHDAY_LIST}
<strong>{L_CONGRATULATIONS}:</strong><br />
<!-- BEGIN board3_birthday_list -->
<span style="float:left;">
<img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" />
</span>
<span style="float:left; padding-left:5px; padding-top:2px;">
{board3_birthday_list.USER}
</span>
<span style="float: right;">
<!-- IF board3_birthday_list.AGE -->{board3_birthday_list.AGE}<!-- ENDIF -->
</span><br style="clear: both" />
<!-- END board3_birthday_list -->
<!-- ELSE -->
{L_NO_BIRTHDAYS}
<!-- ENDIF -->
@@ -9,7 +20,17 @@
<strong>{L_BIRTHDAYS_AHEAD}</strong>
<br />
<!-- IF BIRTHDAYS_AHEAD_LIST -->
{BIRTHDAYS_AHEAD_LIST}
<!-- BEGIN board3_birthday_ahead_list -->
<span style="float:left;">
<img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" />
</span>
<span style="float:left; padding-left:5px; padding-top:2px;">
{board3_birthday_ahead_list.USER}
</span>
<span style="float: right;">
<!-- IF board3_birthday_ahead_list.AGE -->{board3_birthday_ahead_list.AGE}<!-- ENDIF -->
</span><br style="clear: both" />
<!-- END board3_birthday_ahead_list -->
<!-- ELSE -->
{L_NO_BIRTHDAYS_AHEAD}
<!-- ENDIF -->

View File

@@ -3,7 +3,18 @@
<tr class="row1">
<td>
<!-- IF BIRTHDAY_LIST -->
<strong>{L_CONGRATULATIONS}:</strong><br />{BIRTHDAY_LIST}
<strong>{L_CONGRATULATIONS}:</strong><br />
<!-- BEGIN board3_birthday_list -->
<span style="float:left;">
<img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" />
</span>
<span style="float:left; padding-left:5px; padding-top:2px;">
{board3_birthday_list.USER}
</span>
<span style="float: right;">
<!-- IF board3_birthday_list.AGE -->{board3_birthday_list.AGE}<!-- ENDIF -->
</span><br style="clear: both" />
<!-- END board3_birthday_list -->
<!-- ELSE -->
{L_NO_BIRTHDAYS}
<!-- ENDIF -->
@@ -15,7 +26,17 @@
<strong>{L_BIRTHDAYS_AHEAD}:</strong>
<br />
<!-- IF BIRTHDAYS_AHEAD_LIST -->
{BIRTHDAYS_AHEAD_LIST}
<!-- BEGIN board3_birthday_ahead_list -->
<span style="float:left;">
<img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" />
</span>
<span style="float:left; padding-left:5px; padding-top:2px;">
{board3_birthday_ahead_list.USER}
</span>
<span style="float: right;">
<!-- IF board3_birthday_ahead_list.AGE -->{board3_birthday_ahead_list.AGE}<!-- ENDIF -->
</span><br style="clear: both" />
<!-- END board3_birthday_ahead_list -->
<!-- ELSE -->
{L_NO_BIRTHDAYS_AHEAD}
<!-- ENDIF -->