Sources/Calendar.php dosyasında

Bul:

[code]// If the month and year are not passed in, use today's date as a starting point.
$curPage = array( 'month' => isset($_REQUEST['month']) ? (int) $_REQUEST['month'] : $today['month'],
'year' => isset($_REQUEST['year']) ? (int) $_REQUEST['year'] : $today['year']
);[/code]

Sonrasına ekle:

[code]$curPagePrev = array(
'month' => isset($_REQUEST['month']) ? (int) $_REQUEST['month'] - 1 : $today['month'] - 1,
'year' => isset($_REQUEST['year']) ? (int) $_REQUEST['year'] : $today['year'],
);

$curPageNext = array(
'month' => isset($_REQUEST['month']) ? (int) $_REQUEST['month'] + 1 : $today['month'] + 1,
'year' => isset($_REQUEST['year']) ? (int) $_REQUEST['year'] : $today['year'],
);

if ($curPagePrev['month'] < 1)
{
$curPagePrev['month'] = 12;
$curPagePrev['year'] = $curPagePrev['year'] - 1;
}
else
$curPagePrev['year'] = $curPagePrev['year'];


if ($curPageNext['month'] > 12)
{
$curPageNext['month'] = 1;
$curPageNext['year'] = $curPageNext['year'] + 1;
}
else
$curPageNext['year'] = $curPageNext['year'];[/code]

Bul:

[code]// Get information about the first day of this month.
$firstDayOfMonth = array(
'dayOfWeek' => (int) strftime('%w', mktime(0, 0, 0, $curPage['month'], 1, $curPage['year'])),
'weekNum' => (int) strftime('%U', mktime(0, 0, 0, $curPage['month'], 1, $curPage['year']))
);[/code]

Sonrasına ekle:

[code]// Get information about the first day of tprevious month.
$firstDayOfPrevMonth = array(
'dayOfWeek' => (int) strftime('%w', mktime(0, 0, 0, $curPagePrev['month'], 1, $curPagePrev['year'])),
'weekNum' => (int) strftime('%U', mktime(0, 0, 0, $curPagePrev['month'], 1, $curPagePrev['year']))
);

// Get information about the first day of tprevious month.
$firstDayOfNextMonth = array(
'dayOfWeek' => (int) strftime('%w', mktime(0, 0, 0, $curPageNext['month'], 1, $curPageNext['year'])),
'weekNum' => (int) strftime('%U', mktime(0, 0, 0, $curPageNext['month'], 1, $curPageNext['year']))
);[/code]

Bul:

[code] // Find the last day of the month.
$nLastDay = (int) strftime('%d', mktime(0, 0, 0, $curPage['month'] == 12 ? 1 : $curPage['month'] + 1, 0, $curPage['month'] == 12 ? $curPage['year'] + 1 : $curPage['year']));

// The number of days the first row is shifted to the right for the starting day.
$nShift = $firstDayOfMonth['dayOfWeek'];[/code]

Değiştir:

[code]// Find the last day of the month.
$nLastDayPrev = (int) strftime('%d', mktime(0, 0, 0, $curPagePrev['month'] == 12 ? 1 : $curPage['month'], 0, $curPagePrev['month'] == 12 ? $curPagePrev['year'] : $curPagePrev['year'] - 1));
$nLastDay = (int) strftime('%d', mktime(0, 0, 0, $curPage['month'] == 12 ? 1 : $curPage['month'] + 1, 0, $curPage['month'] == 12 ? $curPage['year'] + 1 : $curPage['year']));
$nLastDayNext= (int) strftime('%d', mktime(0, 0, 0, $curPageNext['month'] == 12 ? 1 : $curPageNext['month'], 0, $curPageNext['year']));

// The number of days the first row is shifted to the right for the starting day.
$nShiftPrev = $firstDayOfPrevMonth['dayOfWeek'];
$nShift = $firstDayOfMonth['dayOfWeek'];
$nShiftNext = $firstDayOfNextMonth['dayOfWeek'];[/code]

Bul:

[code]if ($nShift < 0)
$nShift = 7 + $nShift;[/code]

Sonrasına ekle:

[code]$nShiftPrev -= $nStartDay;
if ($nShiftPrev < 0)
$nShiftPrev = 7 + $nShiftPrev;

$nShiftNext -= $nStartDay;
if ($nShiftNext < 0)
$nShiftNext = 7 + $nShiftNext;[/code]

Bul:

[code]if (($nLastDay + $nShift) % 7)
$nRows++;[/code]

Sonrasına ekle:


[code]// Number of rows required to fit the prev month.
$nRowsPrev = floor(($nLastDayPrev + $nShiftPrev) / 7);
if (($nLastDayPrev + $nShiftPrev) % 7)
$nRowsPrev++;

// Number of rows required to fit the next month.
$nRowsNext = floor(($nLastDayNext + $nShiftNext) / 7);
if (($nLastDayNext + $nShiftNext) % 7)
$nRowsNext++;[/code]

Bul:

[code]$low = $curPage['year'] . '-' . sprintf('%02d', $curPage['month']) . '-01';
$high = $curPage['year'] . '-' . sprintf('%02d', $curPage['month']) . '-' . $nLastDay;[/code]

Sonrasına Ekle:

[code]$lowPrev = $curPage['year'] . '-' . sprintf('%02d', $curPagePrev['month']) . '-01';
$highPrev = $curPage['year'] . '-' . sprintf('%02d', $curPagePrev['month']) . '-' . $nLastDay;

$lowNext = $curPage['year'] . '-' . sprintf('%02d', $curPageNext['month']) . '-01';
$highNext = $curPage['year'] . '-' . sprintf('%02d', $curPageNext['month']) . '-' . $nLastDay;[/code]

Bul:

[code]$context['current_month'] = $curPage['month'];
$context['current_year'] = $curPage['year'];[/code]

Sonrasına Ekle:

[code]$context['last_day_prev'] = $nLastDayPrev;
$context['current_month_prev'] = $curPagePrev['month'];
$context['current_year_prev'] = $curPagePrev['year'];

$context['last_day_next'] = $nLastDayNext;
$context['current_month_next'] = $curPageNext['month'];
$context['current_year_next'] = $curPageNext['year'];[/code]

Bul:

[code] // Start off the week - and don't let it go above 52, since that's the number of weeks in a year.
$context['weeks'][$nRow] = array(
'days' => array(),
'number' => $firstDayOfMonth['weekNum'] + $nRow + $nWeekAdjust
);
// Handle the dreaded "week 53", it can happen, but only once in a blue moon ;)
if ($context['weeks'][$nRow]['number'] == 53 && $nShift != 4)
$context['weeks'][$nRow]['number'] = 1;[/code]

Değiştir:

[code]// This is the week number assigned as a key to limit results to a certain week.
$number = $firstDayOfMonth['weekNum'] + $nRow + $nWeekAdjust;

// Start off the week - and don't let it go above 52, since that's the number of weeks in a year.
$context['weeks'][$number] = array(
'days' => array(),
'number' => $firstDayOfMonth['weekNum'] + $nRow + $nWeekAdjust,
'week' => $scripturl . '?action=calendar;year=' . $curPage['year'] . ';month=' . $curPage['month'] . ';week=' . $number,

);
// Handle the dreaded "week 53", it can happen, but only once in a blue moon ;)
if ($context['weeks'][$number]['number'] == 53 && $nShift != 4)
$context['weeks'][$number]['number'] = 1;[/code]

Bul:

[code]$context['weeks'][$nRow]['days'][$nCol] = array([/code]

Değiştir:

[code]$context['weeks'][$number]['days'][$nCol] = array([/code]

Bul:

[code] 'birthdays' => !empty($bday[$date]) ? $bday[$date] : array()
);
}
}[/code]

Sonrasına ekle:

[code]// Iterate through each week.
$context['prevMonthWeeks'] = array();
for ($nRowPrev = 0; $nRowPrev < $nRowsPrev; $nRowPrev++)
{
// This is the week number assigned as a key to limit results to a certain week.
$number = $firstDayOfPrevMonth['weekNum'] + $nRowPrev + $nWeekAdjust + ($curPage['month'] == 1 ? -1 : 0);;

// Start off the week - and don't let it go above 52, since that's the number of weeks in a year.
$context['prevMonthWeeks'][$number] = array(
'days' => array(),
'number' => $firstDayOfPrevMonth['weekNum'] + $nRowPrev + $nWeekAdjust,
'week' => $scripturl . '?action=calendar;year=' . $curPagePrev['year'] . ';month=' . $curPagePrev['month'] . ';week=' . $number,
);
// Handle the dreaded "week 53", it can happen, but only once in a blue moon ;)
if ($context['prevMonthWeeks'][$number]['number'] == 53 && $nShiftPrev != 4)
$context['prevMonthWeeks'][$number]['number'] = 1;

// And figure out all the days.
for ($nCol = 0; $nCol < 7; $nCol++)
{
$nDay = ($nRowPrev * 7) + $nCol - $nShiftPrev + 1;

if ($nDay < 1 || $nDay > $context['last_day_prev'])
$nDay = 0;

$date = sprintf('%04d-%02d-%02d', $curPagePrev['year'], $curPagePrev['month'], $nDay);

$context['prevMonthWeeks'][$number]['days'][$nCol] = array(
'day' => $nDay,
'date' => $date,
'is_today' => $date == $today['date'],
'is_first_day' => !empty($modSettings['cal_showweeknum']) && (($firstDayOfPrevMonth['dayOfWeek'] + $nDay - 1) % 7 == $nStartDay),
);
}
}

$context['nextMonthWeeks'] = array();
for ($nRowNext = 0; $nRowNext < $nRowsNext; $nRowNext++)
{
// This is the week number assigned as a key to limit results to a certain week.
$number = $firstDayOfNextMonth['weekNum'] + $nRowNext + $nWeekAdjust + ($curPage['month'] == 12 ? 1 : 0);

// Start off the week - and don't let it go above 52, since that's the number of weeks in a year.
$context['nextMonthWeeks'][$number] = array(
'days' => array(),
'number' => $firstDayOfNextMonth['weekNum'] + $nRowNext + $nWeekAdjust,
'week' => $scripturl . '?action=calendar;year=' . $curPageNext['year'] . ';month=' . $curPageNext['month'] . ';week=' . $number,

);
// Handle the dreaded "week 53", it can happen, but only once in a blue moon ;)
if ($context['nextMonthWeeks'][$number]['number'] == 53 && $nShiftNext != 4)
$context['nextMonthWeeks'][$number]['number'] = 1;

// And figure out all the days.
for ($nCol = 0; $nCol < 7; $nCol++)
{
$nDay = ($nRowNext * 7) + $nCol - $nShiftNext + 1;

if ($nDay < 1 || $nDay > $context['last_day_prev'])
$nDay = 0;

$date = sprintf('%04d-%02d-%02d', $curPageNext['year'], $curPageNext['month'], $nDay);

$context['nextMonthWeeks'][$number]['days'][$nCol] = array(
'day' => $nDay,
'date' => $date,
'is_today' => $date == $today['date'],
'is_first_day' => !empty($modSettings['cal_showweeknum']) && (($firstDayOfNextMonth['dayOfWeek'] + $nDay - 1) % 7 == $nStartDay),
'week' => $scripturl . '?action=calendar;year=' . $curPageNext['year'] . ';month=' . $curPageNext['month'] . ';week=' . $number,
);
}
}[/code]


Kullandığın Tema/Calendar.template.php

Bul:

[code]



';[/code]

Değiştir:

[code]
', $txt['months_titles'][$context['current_month']], ' ', $context['current_year'], '



';

if (isset($context['next_calendar']))
{
echo '





';
}

echo'

';

// The previous month
if (isset($context['previous_calendar']))
{
echo '





';
}

// Current month
echo '

';
}

echo '
';
}

echo '






';

// Show each day of the week.
foreach ($context['week_days'] as $day)
echo '
';

echo '
';

/* Each week in weeks contains the following:
days (a list of days), number (week # in the year.) */
foreach ($context['prevMonthWeeks'] as $week)
{
echo '

';

/* Every day has the following:
day (# in month), is_today (is this day *today*?), is_first_day (first day of the week?),
holidays, events, birthdays. (last three are lists.) */
foreach ($week['days'] as $day)
{
// If this is today, make it a different color and show a border.
echo '
';
}

echo '
';
}

echo '

', $txt['months_titles'][$context['current_month_prev']], ' ', $context['current_year_prev'], '
  ', substr($txt['days'][$day], 0, 1), '
» ';

// Skip it if it should be blank - it's not a day if it has no number.
if (!empty($day['day']))
echo
$day['day'];

echo '

 

';
echo'




';[/code]

Bul:

[code]foreach ($context['week_days'] as $day)
echo '
';
echo '
';[/code]

Değiştir:

[code]foreach ($context['week_days'] as $day)
echo '
';

echo '
';[/code]

Bul:

[code]foreach ($context['weeks'] as $week)
{
echo '
';[/code]

Değiştir:

[code]foreach ($context['weeks'] as $week)
{
// This is used to highlight the current week.
$currentWeek = isset($_REQUEST['week']) && $_REQUEST['week'] == $week['number'];

echo '

';[/code]

Bul:

[code]// If this is today, make it a different color and show a border.
echo '
';
}

echo '
';
}

echo '

', $txt['months_titles'][$context['current_month']], ' ', $context['current_year'], '
  ', $txt['days'][$day], '
', substr($txt['days'][$day], 0, 1), '
» ';

// Skip it if it should be blank - it's not a day if it has no number.
if (!empty($day['day']))
{
// Should the day number be a link?
if (!empty($modSettings['cal_daysaslink']) && $context['can_post'])
echo '
', $day['day'], '';
else
echo '
', $day['day'];

// Is this the first day of the week? (and are we showing week numbers?)
if ($day['is_first_day'])
echo ' - ', $txt['calendar51'], ' ', $week['number'], '';

// Are there any holidays?
if (!empty($day['holidays']))
echo '
', $txt['calendar5'], ' ', implode([/swf2][swf3], $day['holidays']), '
';

// Show any birthdays...
if (!empty($day['birthdays']))
{
echo '

', $txt['calendar3'], ' ';

/* Each of the birthdays has:
id, name (person), age (if they have one set?), and is_last. (last in list?) */
foreach ($day['birthdays'] as $member)
echo '
', $member['name'], isset($member['age']) ? ' (' . $member['age'] . ')' : '[/swf2][swf3]', $member['is_last'] ? '' : [/swf2][swf3];
echo '
';
}

// Any special posted events?
if (!empty($day['events']))
{
echo '

', $txt['calendar4'], '';
/* The events are made up of:
title, href, is_last, can_edit (are they allowed to?), and modify_href. */
foreach ($day['events'] as $event)
{
// If they can edit the event, show a star they can click on....
if ($event['can_edit'])
echo '
* ';

echo '
', $event['link'], $event['is_last'] ? '' : [/swf2][swf3];
}
echo '
';
}
}

echo '
[/code]

Değiştir:

[code]// If this is today, make it a different color and show a border.
echo '
';

// Skip it if it should be blank - it's not a day if it has no number.
if (!empty($day['day']))
echo
$day['day'];

echo '

 

';
echo'




';

// Show each day of the week.
foreach ($context['week_days'] as $day)
echo '
';

echo '
';

/* Each week in weeks contains the following:
days (a list of days), number (week # in the year.) */
foreach ($context['nextMonthWeeks'] as $week)
{
echo '

';

/* Every day has the following:
day (# in month), is_today (is this day *today*?), is_first_day (first day of the week?),
holidays, events, birthdays. (last three are lists.) */
foreach ($week['days'] as $day)
{
// If this is today, make it a different color and show a border.
echo '
';
}

echo '
';
}

echo '

', $txt['months_titles'][$context['current_month_next']], ' ', $context['current_year_next'], '
  ', substr($txt['days'][$day], 0, 1), '
» ';

// Skip it if it should be blank - it's not a day if it has no number.
if (!empty($day['day']))
echo
$day['day'];

echo '




';

if (isset($_REQUEST['week']) && (int) $_REQUEST['week'] <= 53 && (int)$_REQUEST['week'] > 0)
{
// Set the vars used for prev and next week vars
if ($_REQUEST['week'] == 1 && isset($context['prevMonthWeeks'][53]['week']))
{
$prevWeek = 53;
$prevWeeks = isset($context['weeks'][$prevWeek]['week']) ? 'weeks' : 'prevMonthWeeks';
}
elseif ($_REQUEST['week'] == 1 && isset($context['weeks'][52]['week']))
{
$prevWeek = 52;
$prevWeeks = isset($context['weeks'][$prevWeek]['week']) ? 'weeks' : 'prevMonthWeeks';
}
else
{
$prevWeek = $_REQUEST['week'] - 1;
$prevWeeks = isset($context['weeks'][$prevWeek]['week']) ? 'weeks' : 'prevMonthWeeks';
}

// Next week vars
if ($_REQUEST['week'] == 52 && isset($context['weeks'][53]['week']))
{
$nextWeek = 53;
$nextWeeks = 'weeks';
}
elseif ($_REQUEST['week'] == 53)
{
$nextWeek = 1;
$nextWeeks = isset($context['weeks'][$nextWeek]['week']) ? 'weeks' : 'nextMonthWeeks';
}
else
{
$nextWeek = $_REQUEST['week'] + 1;
$nextWeeks = isset($context['weeks'][$nextWeek]['week']) ? 'weeks' : 'nextMonthWeeks';
}

echo '


';

// This var is used to determine if the first day of week is sunday or monday
$weekOffset = !empty($options['calendar_start_day']) ? $options['calendar_start_day'] : 0;
foreach ($context['weeks'][$_REQUEST['week']]['days'] as $day)
{
echo '

';

echo '
';

echo '



';

if ($context['last_day'] == $day['day'])
echo '


';

// This is used to set the offset between days depending if a week starts on sunday or monday
$weekOffset++;
if ($weekOffset == 7)
$weekOffset = 0;
}
}
else
{
echo '
';

// Show each day of the week.
foreach ($context['week_days'] as $day)
echo '
';
echo '
';

/* Each week in weeks contains the following:
days (a list of days), number (week # in the year.) */
foreach ($context['weeks'] as $week)
{
echo '
';

/* Every day has the following:
day (# in month), is_today (is this day *today*?), is_first_day (first day of the week?),
holidays, events, birthdays. (last three are lists.) */
foreach ($week['days'] as $day)
{
// If this is today, make it a different color and show a border.
echo '
';
}

echo '
';
}
}
echo '

«
 ', $txt['months_titles'][$context['current_month']], ' ', $context['current_year'], ' 
»


', $txt['days'][$weekOffset], '
', !empty($day['day']) ? '' . $txt['calendar23'] . '' : '[/swf2][swf3]


', empty($day['day']) ? ' ' : $day['day'], '
';

// Are there any holidays?
if (!empty($day['holidays']))
echo '
', $txt['calendar5'], ' ', implode([/swf2][swf3], $day['holidays']), '
';

// Show any birthdays...
if (!empty($day['birthdays']))
{
echo '

', $txt['calendar3'], ' ';

/* Each of the birthdays has:
id, name (person), age (if they have one set?), and is_last. (last in list?) */
foreach ($day['birthdays'] as $member)
echo '
', $member['name'], isset($member['age']) ? ' (' . $member['age'] . ')' : '[/swf2][swf3]', $member['is_last'] ? '' : [/swf2][swf3];
echo '
';
}

// Any special posted events?
if (!empty($day['events']))
{
echo '

', $txt['calendar4'], '';

/* The events are made up of:
title, href, is_last, can_edit (are they allowed to?), and modify_href. */
foreach ($day['events'] as $event)
{
// If they can edit the event, show a star they can click on....
if ($event['can_edit'])
echo '
* ';

echo '
', $event['link'], $event['is_last'] ? '' : [/swf2][swf3];
}
echo '
';
}

echo '
', $txt['days'][$day], '
';

// Skip it if it should be blank - it's not a day if it has no number.
if (!empty($day['day']))
{
// Should the day number be a link?
if (!empty($modSettings['cal_daysaslink']) && $context['can_post'])
echo '
', $day['day'], '';
else
echo '
', $day['day'];

// Is this the first day of the week? (and are we showing week numbers?)
if ($day['is_first_day'])
echo '
- ', $txt['calendar51'], ' ', $week['number'], '';

// Are there any holidays?
if (!empty($day['holidays']))
echo '

', $txt['calendar5'], ' ', implode([/swf2][swf3], $day['holidays']), '
';

// Show any birthdays...
if (!empty($day['birthdays']))
{
echo '

', $txt['calendar3'], ' ';

/* Each of the birthdays has:
id, name (person), age (if they have one set?), and is_last. (last in list?) */
foreach ($day['birthdays'] as $member)
echo '
', $member['name'], isset($member['age']) ? ' (' . $member['age'] . ')' : '[/swf2][swf3]', $member['is_last'] ? '' : [/swf2][swf3];
echo '
';
}

// Any special posted events?
if (!empty($day['events']))
{
echo '

', $txt['calendar4'], '';

/* The events are made up of:
title, href, is_last, can_edit (are they allowed to?), and modify_href. */
foreach ($day['events'] as $event)
{
// If they can edit the event, show a star they can click on....
if ($event['can_edit'])
echo '
* ';

echo '
', $event['link'], $event['is_last'] ? '' : [/swf2][swf3];
}
echo '
';
}
}

echo '



[/code]

alıntıdır.


[/quote]

Beğeniler: 0
Favoriler: 0
İzlenmeler: 471
favori
like
share