| 1 |
<?php
|
| 2 |
// $Id: rsvp_eventconnector.module,v 1.1.2.1 2008/12/05 06:56:59 ulf1 Exp $
|
| 3 |
|
| 4 |
class RsvpEventConnectorImpl extends RsvpConnectorImpl {
|
| 5 |
|
| 6 |
//returns a unix date (int) as String. (and already converted to the correct timezone).
|
| 7 |
// function print_unixDateAsString($unixdate)
|
| 8 |
// {
|
| 9 |
// return $unixdate;
|
| 10 |
// }
|
| 11 |
|
| 12 |
function get_datecount($node, $field) {
|
| 13 |
return 1;
|
| 14 |
}
|
| 15 |
|
| 16 |
//returns startdate as unix timestamp in utc
|
| 17 |
function get_startdate($node, $field, $pos) {
|
| 18 |
$eventstart = $node->event['start'];
|
| 19 |
$unixutc = strtotime($eventstart);
|
| 20 |
|
| 21 |
return $unixutc;
|
| 22 |
}
|
| 23 |
|
| 24 |
//startdate as string in local timezone
|
| 25 |
function get_startdateAsString($node, $field, $pos) {
|
| 26 |
|
| 27 |
return $node->event['start'];
|
| 28 |
}
|
| 29 |
|
| 30 |
//returns enddate as unix timestamp in utc
|
| 31 |
function get_enddate($node, $field, $pos) {
|
| 32 |
$eventend = $node->event['end'];
|
| 33 |
$unixutc = strtotime($eventend);
|
| 34 |
$r1 = date('r', $unixutc);
|
| 35 |
return $unixutc;
|
| 36 |
}
|
| 37 |
|
| 38 |
/*
|
| 39 |
* PRIVATE METHOD. Do not use outside. Return type is based on used connector.
|
| 40 |
* returns time zone offset according to Event API.
|
| 41 |
*/
|
| 42 |
function get_offset($node, $field, $pos) {
|
| 43 |
return $node->event['offset'];
|
| 44 |
}
|
| 45 |
|
| 46 |
//returns the position for a particular hash, or -1 if invalid hash
|
| 47 |
function get_posByHash($node, $field, $hash) {
|
| 48 |
//event node has only one start_date
|
| 49 |
return 0;
|
| 50 |
}
|
| 51 |
|
| 52 |
function is_event_enabled($contenttype) {
|
| 53 |
|
| 54 |
$rsvp_content_types = variable_get('rsvp_content_types', array());
|
| 55 |
if (!isset ($rsvp_content_types['event'])) {
|
| 56 |
return false;
|
| 57 |
}
|
| 58 |
|
| 59 |
return event_is_enabled($contenttype);
|
| 60 |
}
|
| 61 |
|
| 62 |
function isTypesAreSelectable() {
|
| 63 |
return false;
|
| 64 |
}
|
| 65 |
|
| 66 |
//returns true if the connector supports multiple dates per field per content-type. (e.g. Repeatable dates in Date API).
|
| 67 |
function hasMultipleDatesPerField() {
|
| 68 |
return false;
|
| 69 |
}
|
| 70 |
|
| 71 |
}
|
| 72 |
|
| 73 |
function rsvp_eventconnector_getconnector() {
|
| 74 |
return new RsvpEventConnectorImpl();
|
| 75 |
}
|