Download & Extend

Display term or semester week numbers instead of year weeks

Project:Calendar
Version:6.x-2.2
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Is there a way to modify the week numbers that appear down the left side of the calendar month view so that rather than being numbered weeks 1-52 they are numbered based on some other criteria?
This way the weeks could be labeled by the week number of the relevant term or semester, for an educational institution.

Comments

#1

You should change it from modules/calendar/incldes/calendar.inc file.

Function name is calendar_build_week(&$curday, $view, $items, $check_month = FALSE)

$rows[$week][] = array(
'data' => $weekno, // left side number is displaying from here.
'id' => $view->name . '-weekno-' . $curday_date,
'class' => 'week');

#2

Ok, thanks, that helps!

Now my only problem is I'd like to use content to generate the dates.
I could use CCK to create a content type that has fields for the start and end dates of the terms, so that the administrator could change the dates without having to edit the actual code.

How would I make the calendar_build_week function load this data (e.g. the first node of that content type) for use in the php code?

#3

Interested in this too.

#4

I'm also interested in this function. For me, I would like this as option that is displayed similar to "time ago" as it is currently in the Date module as a display option (e.g. "2 weeks, 1 day ago"). Having an option that is something like a week counter display option would be great. In my case, I would like to have a certain date that is the start of a term, and then the display will show "Week 1", "Week 2", etc. based on the starting date.

Perhaps this is something for another module, as the simplest solution for me would be to have the Date module allow this as a display option. I will plan to open a request there, but I'm also interested in possibly using the Calendar module in this way.

#5

Issue opened here http://drupal.org/node/672934