Skip to content

Commit

Permalink
Loads more examples added.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgisby committed Feb 19, 2011
1 parent 726bfec commit 5c643a9
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
35 changes: 35 additions & 0 deletions classes/controller/kcalexamples.php
Expand Up @@ -23,5 +23,40 @@ public function action_index()
// Using a custom date; // Using a custom date;
$date_cal = new kCal(12, 5, 2014); // Notice how the month is an integer, not a string! $date_cal = new kCal(12, 5, 2014); // Notice how the month is an integer, not a string!
$this->template->date_calendar = $date_cal; $this->template->date_calendar = $date_cal;

// With events;
$event_cal = new kCal(1, 2, 2011);

// The two strings are the start and end dates and should be in a strtotime friendly format.
$event_cal->add_event('1 February 2011 08:30', '1 February 2011 09:30', array(
// This array can contain absolutely anything. The data will be passed to the template
// so you can display the correct information.
'title' => 'Early Morning Run',
'url' => '/events/early-morning-run',
'style' => 'red',
));

// Events can span several days;
$event_cal->add_event('14 February 2011 12:35', '18 February 2011 12:00', array(
'title' => 'Camp Crunchalot',
'url' => '/events/camp-crunchalot',
'style' => 'green',
));

// They can even go outside the 'bounds' of the month;
$event_cal->add_event('26 February 2011 12:35', '10 March 2011 12:00', array(
'title' => 'Bike Tour',
'url' => '/events/bike-tour',
'style' => 'blue',
));

// And finally, you can of course have multiple events per day;
$event_cal->add_event('17 February 2011 10:00', '17 February 2011 15:00', array(
'title' => 'Gym Session',
'url' => '/events/gym-session',
'style' => 'red',
));

$this->template->event_calendar = $event_cal;
} }
} }
2 changes: 1 addition & 1 deletion views/kcal/cell.html
Expand Up @@ -4,7 +4,7 @@
{% if cell.has_events %} {% if cell.has_events %}
<div class="events"> <div class="events">
{% for event in cell.events %} {% for event in cell.events %}
<a href="{{ event.url }}" title="{{ event.long_title }}" id="tip_trigger_{{ cell.idx }}" class="tip_trigger calendar_event {{ event.style }}">{{ event.title }}</a> <a href="{{ event.url }}" class="calendar_event {{ event.style }}">{{ event.title }}</a>
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
Expand Down
5 changes: 5 additions & 0 deletions views/kcalexamples/index.html
Expand Up @@ -13,4 +13,9 @@ <h1>With a specific date</h1>
{{ date_calendar }} {{ date_calendar }}
{% endautoescape %} {% endautoescape %}


<h1>With events</h1>
{% autoescape off %}
{{ event_calendar }}
{% endautoescape %}

{% endblock %} {% endblock %}
22 changes: 21 additions & 1 deletion views/kcalexamples/kcalpage.html
Expand Up @@ -21,11 +21,31 @@
padding: 5px; padding: 5px;
} }


.calendar td {
border: 1px solid #ccc;
width: 14%;
}

.calendar td.today { .calendar td.today {
background-color: #F0CA9F; background-color: #F0CA9F;
} }


/* .calendar td.*/ .calendar .calendar_event {
display: block;
padding: 3px 6px;
}

.calendar .calendar_event.red {
background-color: #fcc;
}

.calendar .calendar_event.green {
background-color: #cfc;
}

.calendar .calendar_event.blue {
background-color: #ccf;
}


</style> </style>
</head> </head>
Expand Down

0 comments on commit 5c643a9

Please sign in to comment.