function sched_conf_sync_event_for_conference($conf, $event = NULL) { if (!$event) { $event = new ElggObject(); $event->subtype = 'event_calendar'; $event->owner_guid = $conf->owner_guid; $event->container_guid = $conf->container_guid; $new_event = TRUE; } else { $new_event = FALSE; } $event->access_id = $conf->access_id; $event->title = $conf->title; $event->description = $conf->description; $event->venue = elgg_echo('sched_conf:venue', array($conf->application)); $event->start_date = $conf->start_date; $event->end_date = ''; $event->start_time = $conf->start_time; $event->tags = $conf->tags; if (elgg_plugin_exists('event_calendar')) { elgg_load_library('elgg:event_calendar'); $event->real_end_time = event_calendar_get_end_time($event); } $event->save(); // TODO - need to do something with BBB if an existing event is changed as well if ($new_event && $conf->application == 'bbb') { sched_conf_create_bbb_conf($conf, $event); } return $event; }
function event_calendar_has_collision($event_id, $user_id) { $no_collisions = elgg_get_plugin_setting('no_collisions', 'event_calendar'); if ($no_collisions == 'yes') { $event = get_entity($event_id); if ($event) { $start_time = $event->start_date; $end_time = event_calendar_get_end_time($event); // look to see if the user already has events within this period $count = event_calendar_get_events_for_user_between2($start_time, $end_time, TRUE, 10, 0, $user_id); if ($count > 0) { return TRUE; } else { return FALSE; } } } return FALSE; }