$refobjid = null; } else { $refobjid = ($_POST['refobjid'] == "0") ? $_POST['refcourse'] : $_POST['refobjid']; $visibility = null; } $start = $_POST['startdate']; $duration = $_POST['duration']; if (!empty($_POST['id'])) { //existing event $id = intval($_POST['id']); $recursion = null; if (!empty($_POST['frequencyperiod']) && intval($_POST['frequencynumber']) > 0 && !empty($_POST['enddate'])) { $recursion = array('unit' => $_POST['frequencyperiod'], 'repeat' => $_POST['frequencynumber'], 'end' => $_POST['enddate']); } if (is_null($visibility)) { if(isset($_POST['rep']) && $_POST['rep'] == 'yes'){ $resp = Calendar_Events::update_recursive_event($id, $newTitle, $start, $duration, $newContent, $recursion, $refobjid); } else { $resp = Calendar_Events::update_event($id, $newTitle, $start, $duration, $newContent, false, $recursion, $refobjid); } } else { $resp = Calendar_Events::update_admin_event($id, $newTitle, $start, $duration, $newContent, $visibility, $recursion); if(isset($_POST['rep']) && $_POST['rep'] == 'yes'){ $resp = Calendar_Events::update_recursive_admin_event($id, $newTitle, $start, $duration, $newContent, $visibility, $recursion); } else { $resp = Calendar_Events::update_admin_event($id, $newTitle, $start, $duration, $newContent, $visibility, $recursion); } } if ($resp['success']) { Session::Messages($langEventModify, 'alert-success'); } else {