Merge pull request #123 from marc1706/ticket/122
[ticket/122] Correctly display days in calendar
This commit is contained in:
@@ -58,6 +58,11 @@ class portal_calendar_module
|
||||
*/
|
||||
private $mini_cal_fdow;
|
||||
|
||||
/**
|
||||
* User datetime object
|
||||
*/
|
||||
private $time;
|
||||
|
||||
/**
|
||||
* constants
|
||||
*/
|
||||
@@ -89,8 +94,8 @@ class portal_calendar_module
|
||||
}
|
||||
|
||||
// initialise some variables
|
||||
$time = $user->create_datetime();
|
||||
$now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
|
||||
$this->time = $user->create_datetime();
|
||||
$now = phpbb_gmgetdate($this->time->getTimestamp() + $this->time->getOffset());
|
||||
$today_timestamp = $now[0];
|
||||
$mini_cal_today = date('Ymd', $today_timestamp - date('Z'));
|
||||
$this->stamp = $today_timestamp;
|
||||
@@ -105,8 +110,8 @@ class portal_calendar_module
|
||||
// output our general calendar bits
|
||||
$down = $this->mini_cal_month - 1;
|
||||
$up = $this->mini_cal_month + 1;
|
||||
$prev_month = '<a href="' . append_sid("{$phpbb_root_path}portal.$phpEx", "m$module_id=$down#minical$module_id") . '"><img src="' . $portal_root_path . 'styles/' . $user->style['style_path'] . '/theme/images/portal/cal_icon_left_arrow.png' . '" title="' . $user->lang['VIEW_PREVIOUS_MONTH'] . '" height="16" width="16" alt="<<" /></a>';
|
||||
$next_month = '<a href="' . append_sid("{$phpbb_root_path}portal.$phpEx", "m$module_id=$up#minical$module_id") . '"><img src="' . $portal_root_path . 'styles/' . $user->style['style_path'] . '/theme/images/portal/cal_icon_right_arrow.png' . '" title="' . $user->lang['VIEW_NEXT_MONTH'] . '" height="16" width="16" alt=">>" /></a>';
|
||||
$prev_month = '<a href="' . append_sid("{$phpbb_root_path}app.$phpEx", "controller=portal&m$module_id=$down#minical$module_id") . '"><img src="' . $portal_root_path . 'styles/' . $user->style['style_path'] . '/theme/images/portal/cal_icon_left_arrow.png' . '" title="' . $user->lang['VIEW_PREVIOUS_MONTH'] . '" height="16" width="16" alt="<<" /></a>';
|
||||
$next_month = '<a href="' . append_sid("{$phpbb_root_path}app.$phpEx", "controller=portal&m$module_id=$up#minical$module_id") . '"><img src="' . $portal_root_path . 'styles/' . $user->style['style_path'] . '/theme/images/portal/cal_icon_right_arrow.png' . '" title="' . $user->lang['VIEW_NEXT_MONTH'] . '" height="16" width="16" alt=">>" /></a>';
|
||||
|
||||
$template->assign_block_vars('minical', array(
|
||||
'S_SUNDAY_FIRST' => ($config['board3_sunday_first_' . $module_id]) ? true : false,
|
||||
@@ -169,6 +174,15 @@ class portal_calendar_module
|
||||
}
|
||||
}
|
||||
|
||||
// fill table with empty strings
|
||||
while ($mini_cal_count <= self::DAYS_PER_WEEK)
|
||||
{
|
||||
$template->assign_block_vars('minical.mini_cal_row.mini_cal_days', array(
|
||||
'MINI_CAL_DAY' => ' ')
|
||||
);
|
||||
$mini_cal_count++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Let's start displaying the events
|
||||
* make sure we only display events in the future
|
||||
@@ -577,7 +591,7 @@ class portal_calendar_module
|
||||
**/
|
||||
private function makeTimestamp($date)
|
||||
{
|
||||
$this->stamp = (empty($this->stamp)) ? strtotime($date) : $this->stamp;
|
||||
$this->stamp = strtotime($date);
|
||||
return ($this->stamp);
|
||||
}
|
||||
|
||||
@@ -592,7 +606,9 @@ class portal_calendar_module
|
||||
// last or first day of some months need to be treated in a special way
|
||||
if (!empty($this->mini_cal_month))
|
||||
{
|
||||
$today_timestamp = time() + $user->timezone + $user->dst;
|
||||
$time = $user->create_datetime();
|
||||
$now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
|
||||
$today_timestamp = $now[0];
|
||||
$cur_month = date("n", $today_timestamp);
|
||||
$correct_month = $cur_month + $this->mini_cal_month;
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
<!-- IF minical.MODULE_ID eq $MODULE_ID -->
|
||||
<a id="minical{minical.MODULE_ID}" style="float: right;"></a>
|
||||
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" /> <!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
|
||||
<table width="100%" cellspacing="1">
|
||||
<table style="width: 100%;">
|
||||
<tr>
|
||||
<td align="left" colspan="2"><!-- IF S_CONTENT_DIRECTION eq 'rtl' -->{minical.U_NEXT_MONTH}<!-- ELSE -->{minical.U_PREV_MONTH}<!-- ENDIF --></td>
|
||||
<td colspan="3" align="center"><span class="genmed">{minical.L_MINI_CAL_MONTH}</span></td>
|
||||
<td align="right" colspan="2"><!-- IF S_CONTENT_DIRECTION eq 'rtl' -->{minical.U_PREV_MONTH}<!-- ELSE -->{minical.U_NEXT_MONTH}<!-- ENDIF --></td>
|
||||
<td style="text-align: left;" colspan="2"><!-- IF S_CONTENT_DIRECTION eq 'rtl' -->{minical.U_NEXT_MONTH}<!-- ELSE -->{minical.U_PREV_MONTH}<!-- ENDIF --></td>
|
||||
<td colspan="3" style="text-align: center;"><span class="genmed">{minical.L_MINI_CAL_MONTH}</span></td>
|
||||
<td style="text-align: right;" colspan="2"><!-- IF S_CONTENT_DIRECTION eq 'rtl' -->{minical.U_PREV_MONTH}<!-- ELSE -->{minical.U_NEXT_MONTH}<!-- ENDIF --></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<!-- IF minical.S_SUNDAY_FIRST -->
|
||||
@@ -26,7 +26,7 @@
|
||||
<!-- IF minical.mini_cal_row.MODULE_ID eq $MODULE_ID -->
|
||||
<tr>
|
||||
<!-- BEGIN mini_cal_days -->
|
||||
<td class="row1" align="center"><span class="gensmall">{minical.mini_cal_row.mini_cal_days.MINI_CAL_DAY}</span></td>
|
||||
<td style="width: 14%; text-align: center;"><span class="gensmall">{minical.mini_cal_row.mini_cal_days.MINI_CAL_DAY}</span></td>
|
||||
<!-- END mini_cal_days -->
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
|
||||
Reference in New Issue
Block a user