6.0.0-beta1
7/12/25

[#3905] Add maxevents parameter to monthlist Block
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

History
05/09/2006 09:48:26 PM Jan Schneider Comment #2
State ⇒ Resolved
Reply to this comment
Committed, thanks.
05/09/2006 03:43:49 PM dorm (at) dorm (dot) org Comment #1
State ⇒ New
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ Add maxevents parameter to monthlist Block
Queue ⇒ Kronolith
Reply to this comment
The following patch adds a maxevents parameter to the monthlist Block, 
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++;

              }

          }

Saved Queries