View more than one month at a time
Lowell - March 13, 2007 - 01:39
| Project: | Calendar |
| Version: | 6.x-2.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
Please let me know if you think it is possible to view more than one month at a time with slight modifications to the code, for example:
When viewing a month view, you would scroll down and below that month would be the next month, and so on...
Even if it is not added as a feature, I would like to try to make this work anyway.
Maybe revisit the month view function after incrementing a counter?

#1
Another option that would help me would be to view more than one week at a time using the same concept.
It will help me to see 8 to 10 weeks of the calendar at a time :-)))
#2
With panels, you could load the view into 2 different panels on a page. And with this patch, #243264: Calendar ignore views' argument handling code in month view, you could change the arguments for the 2nd copy of the view.
Or if you want 2 calendar blocks, use the above patch and dupe your view to create a 2nd block.
#3
Automatically closed -- issue fixed for two weeks with no activity.
#4
I don't know where to start this request...but I think this is the right place since this is exactly what I want to do.
As #2 adviced I'm trying to put the monthly view into a panel. But all I can choose there under "add content" is the calendars block view (attachment 1 "calendar" (btw: what is Calendar Legend? It doesn't show up anything...)). Preview is available as attachment 2.
But how to add the monthly view with additional event information and so on? (?q=calendar)
The second problem is more panel specific but maybe you can tell me in one ore two sentences how to do:
Given the calendar block in a panel I have no way to give it any arguments as the month which should be shown. When clicking on the panel pages operation "Argument settings" it says "the path test has no arguments to configure."
Every advice is welcome!
#5
#6
@haggins -
You'll need the "views content panes" module (it's part of ctools) to get non-block views into panels.
Unfortunately, it won't help much becuase there's currently no way to change the arguments (?). I'm working on that same thing now. Will post what I find here.
#7
got it working. just add i.e. three monthly views to your pane and and set the arguments for the first view to "@0", "@1" for the second etc.
now you can access your pane via "yourpanepath/2009-01/2009-02/2009-3".
#8
At least it didn't working with panels for me. See #510234: Using more than 10 arguments does not work
My actual solution is with php-filter:
<?php
$amount = 12;
$date_now = substr(date_convert(time(), DATE_UNIX, DATE_ISO, $tz = 'UTC'), 0, 7);
$year_month = explode('-', $date_now);
for($i=1;$i<=$amount;$i++) {
$view = views_get_view('calendar');
$view->set_display('calendar_1');
$view->set_arguments(array($year_month[0].'-'.$year_month[1]));
print $view->preview();
$year_month[1]++;
if($year_month[1] == 13) {
$year_month[0]++;
$year_month[1] = 1;
}
}
?>
#9
subscribing
#10
I would like to be able to have a calendar view that is three months. Simply like a one month calendar but that shows three months one after the other. It sounds like you have got that working but I do not understand how you have done that. Can you explain? Is it possible to create or modify a Calendar view to do this?
Thanks,
Izzy
#11
Just enable "php filter"-module and create a new page/article. Paste my code above and select "php code" under input format. you can change the amount from 12 to 3 of course ;)
#12
Thanks for the suggestion. I went ahead and tried this by creating a page using php input. It does display a three month calendar but does not display events or other node titles with date fields pertaining to those months. I would like to be able to do this in a similar way to the one month view that comes with the calendar module that also works well with organic groups. I am wondering if I will need to combine your suggestion with a view and then possibly create it as a tab item to work with the other calendar views.
I guess this might be thought of as a feature request because I think a 3-month view would be a very useful addition to the calendar module, especially when one is nearing the end of the month being able to see ahead to the next month is very handy.
Thanks,
Izzy
#13
At my testinstallation my solution looks the same as the build in one month view. Maybe you have to edit your views filter? But I don't think so since you say the one month view looks at it should. Have no idea at the moment, sorry.
#14
@haggins, you are absolutely right it works exactly as you say. I didn't realize as only one node was showing at the time I tried your suggestion. Now I see it populated with several node update times.
This is where a view would come in handy to configure as needed. Is that possible?
Thanks,
Izzy
#15
Looks to me like this has been resolved....
#16
Maybe it is not clear what I am thinking and maybe what others might like. Also maybe it would be better to consider it as a feature request.
Yes, the method suggested by @haggins allows to create a 3-month page and it could be modified a bit to show the previous month if it is early in the current month, as follows:
<?php
$amount = 3;
$date_now = substr(date_convert(time(), DATE_UNIX, DATE_ISO, $tz = 'UTC'), 0, 7);
$year_month = explode('-', $date_now);
if($year_month[2] <=15)
{
$year_month[1]--;
if($year_month[1] == 0)
{ $year_month[0]--;
$year_month[1] = 12;
}
}
for($i=1;$i<=$amount;$i++)
{
$view = views_get_view('calendar');
$view->set_display('calendar_1');
$view->set_arguments(array($year_month[0].'-'.$year_month[1]));
print $view->preview();
$year_month[1]++;
if($year_month[1] == 13)
{ $year_month[0]++;
$year_month[1] = 1;
}
}
?>
But, this is not the same as a view which can be customized to display different content.
I think it would be very useful if the Calendar module included a three month view as there are many circumstances where a one month view is not sufficient, especially when it is near the end of the month.
Is there some way to make this code into a view?
Thanks,
Izzy
P.S. I have not changed the Category or Status of this issue; Maybe I should?
#17
Automatically closed -- issue fixed for 2 weeks with no activity.
#18
I am more than willing to be corrected by others if I should not be doing this, but as explained in #16, rather than letting this item drop I would like to submit this as a feature request.
I think it would be very useful if the calendar module could include a View to display more than one month. This would allow further customization through the view. I cannot figure out how to do this myself and was wondering if anyone else can suggest how to do this.
Thanks,
Izzy
#19
Oops, I now see that the array in #16 does not extend to the day of the month.
This works better
<?php
// Set number of months to display
$amount = 3;
$today = getdate();
// To debug, view the array
// print_r($today);
// Date elements now $today[year], $today[mon], $today[mday]
// Start with previous month if today is before the middle of current month
if ($today[mday] <= 15)
{
$today[mon]--;
if ($today[mon] == 0)
{ $today[year]--;
$today[mon] = 12;
}
}
// Display months, one by one
for ($i=1;$i<=$amount;$i++)
{
$view = views_get_view('calendar');
$view->set_display('calendar_1');
$view->set_arguments(array($today[year].'-'.$today[mon]));
print $view->preview();
$today[mon]++;
if ($today[mon] == 13)
{ $today[year]++;
$today[mon] = 1;
}
}
?>
Unfortunately, neither one works when clicking on previous or next month.
Izzy