Regardless of the date, the node $title displays as
l, December, j, Y-1

where the only variable that corresponds to the correct date is j and Y

egs :

http://trishturliuk.ca/blog/2006/10/30
http://trishturliuk.ca/blog/2007/04/6

CommentFileSizeAuthor
#6 calendar.theme_.txt15.39 KBtkgafs
#5 theme_3.patch1.58 KBtkgafs
#3 Untitled-2_1.jpg29.02 KBtkgafs
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brst t’s picture

Er uh, egs :

http://trishturliuk.ca/archive/2006/10/30
http://trishturliuk.ca/archive/2007/04/6

Had to rename the calendar view url as it was conflicting with my blog view.

brst t’s picture

Able to fix this mismatch of node title and date by commenting out lines 75-79 in calendar.theme, corresponding to DAY and for me, only because it's irrelevant to my purposes, WEEK.

tkgafs’s picture

FileSize
29.02 KB

I can confirm this behaviour see attached screen shot

tkgafs’s picture

having put some print statements into function theme_calendar_nav_title the problem seems to be that $view->mon is not set when field_type is DAY

please see the following output from a debug run, the date being used is 10th May 2007

if you hard code $view->mon = 5 in the DAY switch section the date is then displayed correctly

field_type is YEAR value is 2007 query is 2007
YEAR case
view->year is 2007
field_type is MONTH value is 5 query is 05
MONTH case
view->mon is 5
stamp is 1177977600
MONTH date_gmdate is May 2007
field_type is DAY value is 10 query is 10
DAY case
year is 2007
month is
mday is 10
DAY date_gmdate is Sunday December 10 2006
field_type is YEAR value is 2007 query is 2007
YEAR case
view->year is 2007
field_type is YEAR value is 2007 query is 2007
YEAR case
view->year is 2007
field_type is MONTH value is 5 query is 05
MONTH case
view->mon is 5
stamp is 1177977600
MONTH date_gmdate is May 2007
field_type is YEAR value is 2007 query is 2007
YEAR case
view->year is 2007
field_type is MONTH value is 5 query is 05
MONTH case
view->mon is 5
stamp is 1177977600
MONTH date_gmdate is May 2007
field_type is DAY value is 0 query is all
in empty if

here is the amended function I have been messing about with

function theme_calendar_arg_title($field_type, $value, $query) {
        $view = $GLOBALS['current_view'];
        calendar_load_date_api();
        $value = intval(check_plain($value));
print "field_type is $field_type value is $value query is $query<br>";
        if (empty($value)) {
print "in empty if<br>";
    if ($view->mon) {
        $stamp = date_gmmktime(array('year' => $view->year, 'mon' => $view->mon, 'mday' => 1));
      print "if view->mon date_gmdate is " . date_gmdate('F Y',$stamp) . "<br>";
      return date_gmdate('F Y', $stamp);
    }
    elseif ($view->year) {
     return $view->year;
    }
        }
        else {
 switch ($field_type) {
    case 'YEAR':
print "YEAR case<br>";
      $view->year = $value;
print "view->year is $view->year<br>";
      return $view->year;
    case 'MONTH':
print "MONTH case<br>";
      $view->mon = $value;
      $stamp = date_gmmktime(array('year' => $view->year, 'mon' => $view->mon, 'mday' => 1));
print "view->mon is $view->mon<br>";
print "stamp is $stamp<br>";
      print "MONTH date_gmdate is " . date_gmdate('F Y',$stamp) . "<br>";
      return date_gmdate('F Y',$stamp);
    case 'DAY':
print "DAY case<br>";
        print "year is $view->year<br>";
        print "month is $view->mon<br>";
        print "mday is $value<br>";
      $stamp = date_gmmktime(array('year' => $view->year, 'mon' => $view->mon, 'mday' => $value));
      print "DAY date_gmdate is " . date_gmdate('l F j Y',$stamp) . "<br>";
 return date_gmdate('l, F j Y', $stamp);
    case 'WEEK':
        return t('Week @week @year', array('@year' => $view->year, '@week' => $value));
   }
        }
}

I have also noticed that later on in the file in the function theme_calendar_nav_title

$view->month is used rather than $view->mon

I have tried changing these but without any success

so if anyone can point out where the value of $view->mon is getting unset I'd be very grateful

tkgafs

tkgafs’s picture

FileSize
1.58 KB

Ok worked it out

the $view->mon in function theme_calendar_arg_title should in fact be $view->month

there is another problem that becomes apparent after fixing this one if you go for the year view the title always comes up one year less than the year being displayed

i have attached a patch which fixes both problems

the patch is against $Id: calendar.theme,v 1.1.2.15 2007/04/03 13:02:43
from calendar-5.x-1.x-dev.tar.gz dated April 20th

I have not created a patch before so the attached may not be quite correct but heres hoping

I will also upload an entire new copy of calendar.theme in case my patch is not quite in the right format

Tkgafs

tkgafs’s picture

FileSize
15.39 KB

a new version of calendar.theme renamed to calendar.theme.txt to allow it to be uploaded

Tkgafs

thrlls33kr’s picture

Ran into the same thing, ended up with the same solution. All it takes is replacing $view->mon with $view->month all through theme_calendar_arg_title.
H.

Shane Birley’s picture

I will confirm this error is also fixed via #6 solution of correcting the calendar.theme file.

KarenS’s picture

Status: Active » Fixed

I missed this earlier issue when fixing http://drupal.org/node/163552. This is a duplicate and that fix should also fix this. Sorry to take so long getting to this!

KarenS’s picture

Oops, just noticed your fix for $view->month == 'all', just committed that, too. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)