10376 Posts in 2191 Topics by 1708 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 546 Views |
-
Event Calendar Suggestion: Make defaultFutureMonths configurable

29 March 2010 at 5:58am Last edited: 29 March 2010 6:00am
Hi!
I have a suggestion for the module event_calendar, namely to make $defaultFutureMonths configurable.
A patch that does this could look like this:
file: event_calendar/code/calendar.php9c9,10
< 'OtherDatesCount' => 'Int'
---
> 'OtherDatesCount' => 'Int',
> 'FutureMonths' => 'Int'
25c26,27
< 'OtherDatesCount' => '3'
---
> 'OtherDatesCount' => '3',
> 'FutureMonths' => '6'
33d34
< static $defaultFutureMonths = 6;
104c105,106
< new NumericField('OtherDatesCount', _t('Calendar.NUMBERFUTUREDATES','Number of future dates to show for repeating events'))
---
> new NumericField('OtherDatesCount', _t('Calendar.NUMBERFUTUREDATES','Number of future dates to show for repeating events')),
> new NumericField('FutureMonths', _t('Calendar.FUTUREMONTHS','Number of months events are shown in the future if no end date is specified'))
335c337
< $this->end_date = new sfDate($this->start_date->addMonth(Calendar::$defaultFutureMonths)->date());
---
> $this->end_date = new sfDate($this->start_date->addMonth($this->FutureMonths)->date());
394c396
< $start_date->subtractMonth(Calendar::$defaultFutureMonths),
---
> $start_date->subtractMonth($this->FutureMonths),
550c552
< $this->end_date = new sfDate($this->start_date->addMonth(Calendar::$defaultFutureMonths)->date());
---
> $this->end_date = null;
560c562
< $this->end_date = new sfDate($this->start_date->addMonth(Calendar::$defaultFutureMonths)->date());
---
> $this->end_date = null;
764a767
>Explanation: $defaultFutureMonths is not needed anywhere outside of Calendar. The accesses in Calendar_Controller can be replaced with end_date=null which has the same effect.
I renamed $defaultFutureMonths to FutureMonths and added the necessary code to allow configuration via the silverstripe backend.These changes are just a suggestion, nevertheless I think they would be an useful addition.
Of course the translation for the field FUTUREMONTHS would also have to be added to the language files (event_calendar/lang/en_US.php and de_DE.php).
-
Re: Event Calendar Suggestion: Make defaultFutureMonths configurable

29 March 2010 at 10:14am
You can just do it in your_config.php.
Calendar::$defaultFutureMonths = 10;
-
Re: Event Calendar Suggestion: Make defaultFutureMonths configurable

30 March 2010 at 11:16pm
Thanks, I wasn't aware of that, I am used to not being able to set class variables from the outside...
I still think that it would be good to expose this setting in the configuration backend. The reason I stumbled across this variable was because I was wondering why dates in the far future did not show up in the frontend.
| 546 Views | ||
|
Page:
1
|
Go to Top |

