Problem:
We need to show annual holidays on our calendar without creating a bunch of nodes.

Suggestion:
A single line of code would add a class to each td of the calendar, which could be very flexibly targeted with css.

Examples:
1. to target a single day:
.calendar-calendar td.Jan-12 {}
2. to target a single day only on a mini-calendar view:
.calendar-calendar td.mini.Jan-12 {}
3. to target the fourth Thursday in a month would be more difficult but still possible:
td.Nov-22.thu, td.Nov-23.thu, td.Nov-24.thu, td.Nov-25.thu, td.Nov-26.thu, td.Nov-27.thu, td.Nov-28.thu {}

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dnotes’s picture

Well, half a year later I realize that my patch was made from the wrong folder and wouldn't apply with drush make... chagrin. Here's one that should.

dnotes’s picture

I realized today that the author's intention was to use lowercase css, so I've re-rolled. This has the added benefit of being less than one line of change, so there's no chance of messing up other patches along the way.

dnotes’s picture

FileSize
14.8 KB

If you'd like a sample of what this allows one to do with CSS, this folder should give you all the US national holidays. I didn't spend much time on it, and it's not that pretty, but it'll give you an idea.

jessico’s picture

Does anyone have a similar update for Drupal 7? Thank you for your time!

buddakid’s picture

Title: a distinct class for each day - for styling annual holidays » Add Holidays to Pretty Calendar
Project: Calendar » Pretty Calendar
Version: 6.x-2.x-dev » 7.x-1.x-dev
Priority: Normal » Major
Status: Needs review » Active

I need to add holidays to Pretty Calendar that is used for employment purpose. Content Type is void with Pretty Calendar. Since a few of the designated holidays are year by year case, it would be better to add a class to each cell of the calendar, which could be very flexibly targeted with css. It will allow me to modify the holidays year to year. Idially, there is a background image shown, or font color changed on a holiday. (standard.css)

The code on this page is for the Standard Calendar which is different from that of the Pretty Calendar. http://drupal.org/node/679496#comment-6669698

My guess is to add lines in between this portion, but I'm not sure how to do that.:

  $days = array();
    for ($i = 0; $i < count($week); $i++) {
    for ($j = 0; $j < 7; $j++) {
      $day = !empty($week[$i][$j]) ? $week[$i][$j] : '';
      $cls = '';
      // Define cell classes.
      if ($j > 4) {
        $cls = 'pretty-calendar-weekend';
      }
      else {
        $cls = 'pretty-calendar-day';
      }
      if ($j == 6) {
        $cls .= ' pretty-calendar-last';
      }
      if ($day == date('d') && date('m.Y') == date('m.Y', $month)) {
        $cls .= ' pretty-calendar-today';
      }

Can someone give me a hand, with the css too? Thanks.

buddakid’s picture

Oop. I thought I would have opened a new issue, not under an old issue. I'm sorry I mess it up. Can admin delete this one for me? I'm going to try opening a new thread. Thanks.

buddakid’s picture

Title: Add Holidays to Pretty Calendar » a distinct class for each day - for styling annual holidays
Project: Pretty Calendar » Calendar
Version: 7.x-1.x-dev » 6.x-2.x-dev
Priority: Major » Normal
Status: Active » Needs review

Here I change back the issue title. Sorry for the mess. I'm not familiar with posting.

apaderno’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

I am closing this issue, since it's for a Drupal version no longer supported.