function TestEventRead() { $this->UnitTestCase('Dia Event Read'); $api = DIA_API::create(null, $this->dia_account); $now = time(); $now -= $now % 60; //round to nearest minute $event = array('Status' => 'Active', 'Event_Name' => 'my cool event', 'Start' => dia_formatdate($now), 'End' => dia_formatdate($now + 360), 'This_Event_Costs_Money' => true, 'Ticket_Price' => 5, 'Contact_Email' => '*****@*****.**', 'Directions' => 'take a left at the tree', 'Address' => '123 sesame st', 'City' => 'san francisco', 'State' => 'CA', 'Zip' => 94110, 'Description' => 'this is the description', 'distributed_event_KEY' => 142); $this->event_key = $api->addEvent($event); $this->event = $api->getEvent($this->event_key); }
function _makeDIAdatetime($date_value, $time_value) { $base_time = strtotime($date_value . ' ' . $time_value); if (!$base_time || -1 == $base_time) { $base_time = strtotime($date_value); } if ($base_time && -1 != $base_time) { return dia_formatdate($base_time); } }
function translate_from_amp($data) { $translation = $this->translation; foreach ($data as $key => $value) { if (isset($translation[$key])) { $return[$translation[$key]] = $value; } else { //$return[$key] = $value; } } if (isset($data['recurring_options'])) { $recurring_options = array(0 => 'None', 4 => 'YEARLY', 3 => 'MONTHLY', 1 => 'DAILY'); if ($data['recurring_options'] == 2) { $return['Recurrence_Interval'] = 7; $return['Recurrence_Frequency'] = 'DAILY'; } else { $return['Recurrence_Frequency'] = $recurring_options[$data['recurring_options']]; } } if (isset($data['publish'])) { if ($data['publish']) { $return['Status'] = 'Active'; } else { $return['Status'] = 'Inactive'; } } if (!isset($data['date'])) { $data['date'] = ''; } if (!isset($data['time'])) { $data['time'] = ''; } if (!isset($data['enddate'])) { $data['enddate'] = ''; } if (!isset($data['endtime'])) { $data['endtime'] = ''; } $start = strtotime($data['date'] . ' ' . $data['time']); if (!$start || -1 == $start) { $start = strtotime($data['date']); } if ($start && -1 != $start) { $return['Start'] = dia_formatdate($start); } $simple_end = strtotime($data['enddate']); if ($simple_end < $start) { $end = strtotime($data['date'] . ' ' . $data['endtime']); if (!$end || -1 == $end) { $end = strtotime($data['date']); } } else { $end = strtotime($data['enddate'] . ' ' . $data['endtime']); if (!$end || -1 == $end) { $end = $simple_end; } } if ($end && -1 != $end) { $return['End'] = dia_formatdate($end); } if (isset($return['Ticket_Price'])) { $return['This_Event_Costs_Money'] = true; } if (isset($data['typeid'])) { $type_lookup = AMPSystem_Lookup::instance('DistributedEvent'); if ($key = $type_lookup[$data['typeid']]) { $return['distributed_event_KEY'] = $key; } } if (isset($data['dia_key'])) { $return['key'] = $data['dia_key']; } if (isset($this->capacity)) { $return['Maximum_Attendees'] = $this->capacity; } if (isset($this->rsvp_request_fields)) { $return['Request'] = $this->rsvp_request_fields; } if (isset($this->rsvp_required_fields)) { $return['Required'] = $this->rsvp_required_fields; } return $return; }