Merge pull request #156 from marc1706/birthday/ahead_date
[birthday/ahead_date] Add span title with date to birthday ahead list
This commit is contained in:
@@ -105,6 +105,7 @@ class portal_birthday_list_module
|
||||
$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) . ')' : '',
|
||||
'DATE' => $this->format_birthday($user, $row['user_birthday'], 'd M'),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -154,4 +155,25 @@ class portal_birthday_list_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format birthday for span title
|
||||
*
|
||||
* @param object $user phpBB user object
|
||||
* @param string $birthday User's birthday from database
|
||||
* @param string $date_settings Settings for date() function
|
||||
*/
|
||||
protected function format_birthday($user, $birthday, $date_settings)
|
||||
{
|
||||
if (!preg_match('/(?:[0-9])+-+(?:[0-9]{2})+-+(?:[0-9]{4})/', $birthday, $match))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$date = explode('-', $birthday);
|
||||
$time = mktime(0, 0, 0, $date[1], $date[0], $date[2]);
|
||||
$lang_dates = $user->lang['datetime'];
|
||||
|
||||
return strtr(date($date_settings, $time), $lang_dates);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<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 title="{board3_birthday_ahead_list.DATE}">{board3_birthday_ahead_list.USER}</span>
|
||||
</span>
|
||||
<span style="float: right;">
|
||||
<!-- IF board3_birthday_ahead_list.AGE -->{board3_birthday_ahead_list.AGE}<!-- ENDIF -->
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<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 title="{board3_birthday_ahead_list.DATE}">{board3_birthday_ahead_list.USER}</span>
|
||||
</span>
|
||||
<span style="float: right;">
|
||||
<!-- IF board3_birthday_ahead_list.AGE -->{board3_birthday_ahead_list.AGE}<!-- ENDIF -->
|
||||
|
||||
Reference in New Issue
Block a user