- ชื่อ: TodaysBirthday
- ผู้เขียน: Bulakbol
- นำเสนอโดย: DexMoreGroup
- ประเภท: Feature Enhancement
- รองรับ: SMF 1.1.xx, 2.0.xx
- ปรับปรุงล่าสุด: 2 มิถุนายน 2552
- ต้นฉบับ: TodaysBirthday
รายละเอียด ดูตัวอย่างของ MOD ตัวนี้ได้ที่หน้าแรกบอร์ด ด้านล่างศูนย์กลางข้อมูลนะครับ ตั้งค่าในปฏิทิน ให้แสดงวันเกิดล่วงหน้ากี่วัน ที่สำคัญจะต้องมีสมาชิกที่มีวันเกิดในช่วงเวลาที่กำหนด ถ้าให้แสดงวันเกิดวันนี้ก็ต้องมีสมาชิกที่เกิดวันนี้
ตัวอย่าง
แก้ไขไฟล์:file Sources/BoardIndex.php
ค้นหา -->>
$context['calendar_holidays'] = array();
for ($i = $now; $i < $now + $days_for_index; $i += 86400)
{
if (isset($holidays[strftime('%Y-%m-%d', $i)]))
$context['calendar_holidays'] = array_merge($context['calendar_holidays'], $holidays[strftime('%Y-%m-%d', $i)]);
}
แก้เป็น -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Comค้นหา -->>
for ($i = 0, $n = count($context['calendar_birthdays']); $i < $n; $i++)
$context['calendar_birthdays'][$i]['is_last'] = !isset($context['calendar_birthdays'][$i + 1]);
เพิ่มไว้หลัง -->>
// separate todays from upcoming birthdays
if (!empty($context['calendar_birthdays']))
{
$context['bdays'] = array(
'today' => array(),
'soon' => array(),
);
foreach ($context['calendar_birthdays'] as $member)
{
if ($member['is_today'])
$context['bdays']['today'][] = '<a href="'. $scripturl. '?action=profile;u='. $member['id']. '">'.
(!empty($member['color']) ? '<span style="color: '. $member['color']. ';">' : '') . '<b>' .$member['name'] . '</b>' .
(isset($member['age']) ? '(' . $member['age'] . ')' : '') . (!empty($member['color']) ? '</span>' : '') . '</a>';
else
$context['bdays']['soon'][] = '<a href="'. $scripturl. '?action=profile;u='. $member['id']. '">' .
(!empty($member['color']) ? '<span style="color: '. $member['color']. ';">' : ''). $member['name'] .
(isset($member['age']) ? '(' . $member['age'] . ')' : '') . (!empty($member['color']) ? '</span>' : '') . '</a>';
}
}
ค้นหา -->>
for ($i = 0, $n = count($context['calendar_events']); $i < $n; $i++)
$context['calendar_events'][$i]['is_last'] = !isset($context['calendar_events'][$i + 1]);
เพิ่มไว้หลัง -->>
// separate Todays from upcoming events
if (!empty($context['calendar_events']))
{
$context['events'] = array(
'today' => array(),
'soon' => array(),
);
foreach ($context['calendar_events'] as $event)
{
if ($event['is_today'])
$context['events']['today'][] = ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ' : '').
($event['href'] == '' ? '' : '<a href="' . $event['href'] . '">') . '<strong>' . $event['title'] . '</strong>' . ($event['href'] == '' ? '' : '</a>');
else
$context['events']['soon'][] = ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ' : '').
($event['href'] == '' ? '' : '<a href="' . $event['href'] . '">') . $event['title'] . ($event['href'] == '' ? '' : '</a>');
}
}
file Themes/default/BoardIndex.template.php
ค้นหา -->>
<td class="windowbg2" width="100%">
<span class="smalltext">';
// Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P.
if (!empty($context['calendar_holidays']))
echo '
<span style="color: #', $modSettings['cal_holidaycolor'], ';">', $txt['calendar5'], ' ', implode(', ', $context['calendar_holidays']), '</span><br />';
// People's birthdays. Like mine. And yours, I guess. Kidding.
if (!empty($context['calendar_birthdays']))
{
echo '
<span style="color: #', $modSettings['cal_bdaycolor'], ';">', $context['calendar_only_today'] ? $txt['calendar3'] : $txt['calendar3b'], '</span> ';
/* Each member in calendar_birthdays has:
id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) */
แก้เป็น -->>
<td class="windowbg2" width="100%">';
echo '
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="smalltext">';
// Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P.
if (!empty($context['holidays']))
{
if (!empty($context['holidays']['today']))
echo count($context['holidays']['today']) == 1 ? $txt['todays_holiday'] : $txt['todays_holidays'], ' <span style="color: #', $modSettings['cal_holidaycolor'], ';"><strong>', implode(', ', $context['holidays']['today']), '</strong></span><br />';
// upcoming holiday
if (!empty($context['holidays']['soon']))
echo count($context['holidays']['soon']) == 1 ? $txt['upcoming_holiday'] : $txt['upcoming_holidays'], ' <span style="color: #', $modSettings['cal_holidaycolor'], ';">', implode(', ', $context['holidays']['soon']), '</span><br />';
}
// People's birthdays. Like mine. And yours, I guess. Kidding.
if (!empty($context['calendar_birthdays']))
{
echo '<span class="smalltext" style="color: #', $modSettings['cal_bdaycolor'], ';">';
if (!empty($context['bdays']['today']))
echo count($context['bdays']['today']) == 1 ? $txt['todays_birthday'] : $txt['todays_birthdays'], ' ', implode(', ', $context['bdays']['today']), '<br />';
// upcoming birthdays
if (!empty($context['bdays']['soon']))
echo count($context['bdays']['soon']) == 1 ? $txt['upcoming_birthday'] : $txt['upcoming_birthdays'], ' ', implode(', ', $context['bdays']['soon']), '<br />';
echo '</span>';
}
// Events like community get-togethers.
if (!empty($context['calendar_events']))
{
echo '<span class="smalltext" style="color: #', $modSettings['cal_eventcolor'], ';">';
if (!empty($context['events']['today']))
echo count($context['events']['today']) == 1 ? $txt['todays_event'] : $txt['todays_events'], ' ', '<b>', implode(', ', $context['events']['today']), '</b><br />';
// upcoming events
if (!empty($context['events']['soon']))
echo count($context['events']['soon']) == 1 ? $txt['upcoming_event'] : $txt['upcoming_events'], ' ', implode(', ', $context['events']['soon']), '<br />';
// Show a little help text to help them along ;).
if ($context['calendar_can_edit'])
echo '(<a href="', $scripturl, '?action=helpadmin;help=calendar_how_edit" onclick="return reqWin(this.href);">', $txt['calendar_how_edit'], '</a>)';
echo '</span>';
}
echo '
</td>
</tr>
</table>
</td>
</tr>';
}
ค้นหา -->>
foreach ($context['calendar_birthdays'] as $member)
echo '
แก้เป็น -->>
/* please do not delete
ค้นหา -->>
}
// Events like community get-togethers.
if (!empty($context['calendar_events']))
{
echo '
<span style="color: #', $modSettings['cal_eventcolor'], ';">', $context['calendar_only_today'] ? $txt['calendar4'] : $txt['calendar4b'], '</span> ';
/* Each event in calendar_events should have:
title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. */
foreach ($context['calendar_events'] as $event)
echo '
', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<b>' . $event['title'] . '</b>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br />' : ', ';
// Show a little help text to help them along ;).
if ($context['calendar_can_edit'])
echo '
(<a href="', $scripturl, '?action=helpadmin;help=calendar_how_edit" onclick="return reqWin(this.href);">', $txt['calendar_how_edit'], '</a>)';
}
echo '
</span>
</td>
</tr>';
}
แก้เป็น -->>
TodaysBirthday mod ends */
file Themes/default/languages/index.thai-utf8.php
ค้นหา -->>
$txt['calendar4'] = 'กิจกรรม:';
เพิ่มไว้หลัง -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Comลิงค์หัวข้อ:
http://dexmore.com/topic/278