Summary | Add maxevents parameter to monthlist Block |
Queue | Kronolith |
Queue Version | FRAMEWORK_3 |
Type | Enhancement |
State | Resolved |
Priority | 1. Low |
Owners | |
Requester | dorm (at) dorm (dot) org |
Created | 05/09/2006 (7004 days ago) |
Due | |
Updated | 05/09/2006 (7004 days ago) |
Assigned | |
Resolved | 05/09/2006 (7004 days ago) |
Milestone | |
Patch | No |
State ⇒ Resolved
State ⇒ New
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ Add maxevents parameter to monthlist Block
Queue ⇒ Kronolith
which allows you to limit the total number of events displayed in the
block.
--- monthlist.php (revision 67)
+++ monthlist.php (working copy)
@@ -23,7 +23,10 @@
'default' => '__all'),
'months' => array('name' => _("Months Ahead"),
'type' => 'int',
- 'default' => 2));
+ 'default' => 2),
+ 'maxevents' => array('name' => _("Maximum
number of events to display (0 = no limit)"),
+ 'type' => 'int',
+ 'default' => 0));
$params['calendar']['values']['__all'] = _("All Visible");
foreach (Kronolith::listCalendars() as $id => $cal) {
$params['calendar']['values'][$id] = $cal->get('name');
@@ -79,6 +82,7 @@
$endDate->mday, $endDate->month,
$endDate->year);
/* Loop through the days. */
+ $totalevents = 0;
for ($i = 0; $i < $days; $i++) {
$day = &new Kronolith_Day($startDate->month, $today + $i);
$today_stamp = $day->getStamp();
@@ -86,6 +90,10 @@
continue;
}
+ if(($this->_params['maxevents'] > 0) && ($totalevents >=
$this->_params['maxevents'])) {
+ break;
+ }
+
$firstevent = true;
/* Output month header. */
@@ -156,6 +164,8 @@
$html .= '</strong>';
}
$html .= '</td></tr>';
+
+ $totalevents++;
}
}