[horde] Small modification to Upcoming Events block

Michael J Rubinsky mrubinsk at horde.org
Tue Jan 5 21:03:27 UTC 2021


Quoting Todd Aiken <taiken at mvtech.ca>:

> Greetings,
>
> I am trying to make a small modification to the Horde portal's  
> "Upcoming Events" block.  On my main portal page, I have several of  
> them configured, with one showing "All Visible" calendars, and  
> others only showing one specific calendar.  I'm trying to get the  
> title of the specific calendar blocks to display the name of the  
> calendar configured in the block settings.  So far I've patched the  
> file horde/kronolith/lib/Block/Monthlist.php to display the calendar  
> ID by changing the protected function _title() to the following:
>
>     protected function _title()
>     {
>         $url = Horde::url($GLOBALS['registry']->getInitialPage(), true);
>         if (isset($this->_params['calendar']) &&
>             $this->_params['calendar'] != '__all') {
>             $url->add('display_cal', $this->_params['calendar']);
>             $title = $url->link() . _("Upcoming Events - " .  
> $this->_params['calendar']) . '</a>';
>         }
>         else {
>             $title = $url->link() . _("Upcoming Events") . '</a>';
>         }
>         return $title;
>     }
>
> Just wondering how the name of the calendar could be displayed  
> instead of the ID?

Something like this should work (taken from one of the other kronolith  
Blocks):

             $calendars = Kronolith::listCalendars();
             if (isset($calendars[$this->_params['calendar']])) {
                 $title =  
htmlspecialchars($calendars[$this->_params['calendar']]->name());
             } else {
                 $title = _("Calendar not found");
             }


>
> Thanks in advance.
>
>
>
>
>
> CU L8R...
>
> Todd Aiken
>
> "V8!  Return to base, immediately!"
>   - The Last V8 as spoken on the Commodore 64
>
> Even in the 21st century, HTML in email is
> still like putting an air conditioner on a motorcycle.
>
>
> -- 
> Horde mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 9272 bytes
Desc: PGP Public Key
URL: <https://lists.horde.org/archives/horde/attachments/20210105/0f9e62a4/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 851 bytes
Desc: PGP Digital Signature
URL: <https://lists.horde.org/archives/horde/attachments/20210105/0f9e62a4/attachment-0001.sig>


More information about the horde mailing list