hello

i know there is already a issue about this topic but i cant find it anymore :(
sorry for openening a new one!

i need the fullcalendar to show 3 Month instead of only 1 Month.
The default output is just 1 month, right?
Or can i change it by simple configure the fullcalendar module?
at the moment iam pretty sure its only possible by e.g. hacking some php code
into the body field of a node like this:

// 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++)
  {
// i created a view with a cck date field and placed it into a contentype
  $view = views_get_view('calendar');
  $view->set_display('block');

  $view->set_arguments(array($today["year"].'-'.$today["mon"]));
print $view->preview();

  $today["mon"]++;
  if ($today["mon"] == 13)
    { $today["year"]++;
      $today["mon"] = 1;
    }
  }


this work's fine eccept i get 3 times the same month
because i dont get the right Contextual filters settings!

$view->set_arguments(array($today["year"].'-'.$today["mon"]));

how do i have to setup the context.filter
so that will match this argument ?

what i tryed:

->Provide default value Type 'Raw value from URL' (?)
okay but then wich 'Path component' numbering do i have to choose?
the url to the calendar is
/calendar
so i would guess it's the 2nd one
but it did not work!
well, i get 3 month displayed but all of some containing the same data of
the currend month...

now iam stuck ..
someone an idea?

happy about any advice!!

Comments

cocq’s picture

Hi,

Here is the solution I found in this forum some weeks ago

// Set number of months to display
$amount = 3; // number of displayed months

$today = getdate();
// To debug, view the array
// print_r($today);
$debut_mois = $today[mon];
$amount = $debut_mois + 3;

// 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=$debut_mois;$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;
    }
  }

this work fine but I would like to update the "next" link (and obviously the "previous" : by default, the "next" jump to the following month, but I would like to jump from 3 to 3....

So, I would like to find this code again in order to ask the question, but i did not succeed...

if you have an idea!

rgds

mmtt’s picture

Where to put this code? How are the 3 month displayed? one after the other? Are there other solutions to get a 3-month-display or maybe more month displayed?

dddave’s picture

It seems that you would put this code into the body of a node using the php filter. Caution: This is very far from being best practice.

izmeez’s picture

So this code should be put into a custom module.

Spanners’s picture

I tried creating a simple custom module with the above code in #1, but as soon as I enable the module I get a 500 error.

I looked in my log and the following notice was there...

Notice: Use of undefined constant mon - assumed 'mon' in include_once() (line 8 of path_to_website/sites/all/modules/fullcalendar_extend/fullcalendar_extend.module).

I just created a folder sites/all/modules/fullcalendar_extend and added the following two files (attached).

It looks like there is French in there. My website is English. Do I need to update this module to use an English version of the FullCalendar module and library?

$debut_mois = $today[mon];
$amount = $debut_mois + 3;

Any help would be greatly appreciated.

timellemeet’s picture

Isnt this a matter of patching fullcalendars Javascript instead of php, as Views essentially outputs all items and fullcalendars Javascript displays it in whatever format?