function calendar_plugin_style::calendar_build_mini_week in Calendar 7.3
Build one week row.
1 call to calendar_plugin_style::calendar_build_mini_week()
- calendar_plugin_style::calendar_build_mini_month in includes/
calendar_plugin_style.inc - Build one mini month.
File
- includes/
calendar_plugin_style.inc, line 925 - Views style plugin for the Calendar module.
Class
- calendar_plugin_style
- Default style plugin to render an iCal feed.
Code
function calendar_build_mini_week($check_month = TRUE) {
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
$weekdays = calendar_untranslated_days($this->items, $this->view);
$today = date_format(date_now(date_default_timezone()), DATE_FORMAT_DATE);
$month = date_format($this->curday, 'n');
$week = date_week($curday_date);
$first_day = variable_get('date_first_day', 0);
// move backwards to the first day of the week
$day_wday = date_format($this->curday, 'w');
date_modify($this->curday, '-' . strval((7 + $day_wday - $first_day) % 7) . ' days');
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
if (!empty($this->date_info->style_with_weekno)) {
$path = calendar_granularity_path($this->view, 'week');
if (!empty($path)) {
$url = $path . '/' . $this->date_info->year . '-W' . $week;
$weekno = l($week, $url, array(
'query' => !empty($this->date_info->append) ? $this->date_info->append : '',
));
}
else {
// Do not link week numbers, if Week views are disabled.
$weekno = $week;
}
$rows[$week][] = array(
'data' => $weekno,
'class' => 'mini week',
'id' => $this->view->name . '-weekno-' . $curday_date,
);
}
for ($i = 0; $i < 7; $i++) {
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
$class = strtolower($weekdays[$i] . ' mini');
if ($check_month && ($curday_date < $this->date_info->min_date_date || $curday_date > $this->date_info->max_date_date || date_format($this->curday, 'n') != $month)) {
$class .= ' empty';
$variables = array(
'curday' => $curday_date,
'view' => $this->view,
);
$content = array(
'date' => '',
'datebox' => '',
'empty' => theme('calendar_empty_day', $variables),
'link' => '',
'all_day' => array(),
'items' => array(),
);
}
else {
$content = $this
->calendar_build_day();
$class .= ($curday_date == $today ? ' today' : '') . ($curday_date < $today ? ' past' : '') . ($curday_date > $today ? ' future' : '') . (empty($this->items[$curday_date]) ? ' has-no-events' : ' has-events');
}
$rows[$week][] = array(
'data' => $content,
'class' => $class,
'id' => $this->view->name . '-' . $curday_date,
);
date_modify($this->curday, '+1 day');
}
return $rows;
}