} function removeCalendar($id) { $ret = array(); $ret['IsSuccess'] = true; $ret['Msg'] = 'Succefully'; return $ret; } header('Content-type:text/javascript;charset=UTF-8'); $method = $_GET["method"]; switch ($method) { case "add": $ret = addCalendar($_POST["CalendarStartTime"], $_POST["CalendarEndTime"], $_POST["CalendarTitle"], $_POST["IsAllDayEvent"]); break; case "list": $ret = listCalendar($_POST["showdate"], $_POST["viewtype"]); break; case "update": $ret = updateCalendar($_POST["calendarId"], $_POST["CalendarStartTime"], $_POST["CalendarEndTime"]); break; case "remove": $ret = removeCalendar($_POST["calendarId"]); break; case "adddetails": $id = $_GET["id"]; $st = $_POST["stpartdate"] . " " . $_POST["stparttime"]; $et = $_POST["etpartdate"] . " " . $_POST["etparttime"]; if ($id) { $ret = updateDetailedCalendar($id, $st, $et, $_POST["Subject"], $_POST["IsAllDayEvent"] ? 1 : 0, $_POST["Description"], $_POST["Location"], $_POST["colorvalue"], $_POST["timezone"]); } else { $ret = addDetailedCalendar($st, $et, $_POST["Subject"], $_POST["IsAllDayEvent"] ? 1 : 0, $_POST["Description"], $_POST["Location"], $_POST["colorvalue"], $_POST["timezone"]);
} } catch (Exception $e) { $ret['IsSuccess'] = false; $ret['Msg'] = $e->getMessage(); } return $ret; } header('Content-type:text/javascript;charset=UTF-8'); $method = $_GET["method"]; switch ($method) { case "add": $ret = addCalendar($_POST["CalendarStartTime"], $_POST["CalendarEndTime"], $_POST["CalendarTitle"], $_POST["IsAllDayEvent"], $_POST["Guru"], $_POST["id_sekolah"], $_POST["id_mengajar"]); break; case "list": //$ret = listCalendar($_POST["showdate"], $_POST["viewtype"]); $ret = listCalendar('2/12/2013', 'week'); break; case "update": $ret = updateCalendar($_POST["calendarId"], $_POST["CalendarStartTime"], $_POST["CalendarEndTime"]); break; case "remove": $ret = removeCalendar($_POST["calendarId"]); break; case "adddetails": $st = $_POST["stpartdate"] . " " . $_POST["stparttime"]; $et = $_POST["etpartdate"] . " " . $_POST["etparttime"]; if (isset($_GET["id"])) { $ret = updateDetailedCalendar($_GET["id"], $st, $et, $_POST["Subject"], isset($_POST["IsAllDayEvent"]) ? 1 : 0, $_POST["Description"], $_POST["Location"], $_POST["colorvalue"], $_POST["timezone"], $_POST["id_sekolah"], $_POST["id_kelas"], $_POST["id_mengajarpegawai"]); } else { $ret = addDetailedCalendar($st, $et, $_POST["Subject"], isset($_POST["IsAllDayEvent"]) ? 1 : 0, $_POST["Description"], $_POST["Location"], $_POST["colorvalue"], $_POST["timezone"]); }
$ret['Msg'] = 'Succefully'; } } catch (Exception $e) { $ret['IsSuccess'] = false; $ret['Msg'] = $e->getMessage(); } return $ret; } header('Content-type:text/javascript;charset=UTF-8'); $method = $get["method"]; switch ($method) { case "add": $ret = addCalendar($post["CalendarStartTime"], $post["CalendarEndTime"], $post["CalendarTitle"], $post["IsAllDayEvent"]); break; case "list": $ret = listCalendar($post["showdate"], $post["viewtype"]); break; case "update": $ret = updateCalendar($post["calendarId"], $post["CalendarStartTime"], $post["CalendarEndTime"]); break; case "remove": $ret = removeCalendar($post["calendarId"]); break; case "adddetails": $st = $post["stpartdate"] . " " . $post["stparttime"]; $et = $post["etpartdate"] . " " . $post["etparttime"]; if (isset($get["id"])) { $ret = updateDetailedCalendar($get["id"], $st, $et, $post["Subject"], isset($post["IsAllDayEvent"]) ? 1 : 0, $post["Description"], $post["Location"], $post["colorvalue"], $post["timezone"]); } else { $ret = addDetailedCalendar($st, $et, $post["Subject"], isset($post["IsAllDayEvent"]) ? 1 : 0, $post["Description"], $post["Location"], $post["colorvalue"], $post["timezone"]); }
public function process() { if ("ajax_calendar" == $_REQUEST['_process'] && module_calendar::can_i('view', 'Calendar')) { // ajax functions from wdCalendar. copied from the datafeed.php sample files. header('Content-type: text/javascript'); $ret = array(); $method = isset($_REQUEST['method']) ? $_REQUEST['method'] : false; switch ($method) { case "quick_add": if (module_calendar::can_i('create', 'Calendar')) { $ret = addCalendar($_POST["CalendarStartTime"], $_POST["CalendarEndTime"], $_POST["CalendarTitle"], $_POST["IsAllDayEvent"]); } break; case "list": $ret = listCalendar($_POST["showdate"], $_POST["viewtype"]); break; case "quick_update": if (module_calendar::can_i('edit', 'Calendar')) { $ret = updateCalendar($_POST["calendarId"], $_POST["CalendarStartTime"], $_POST["CalendarEndTime"]); } break; case "quick_remove": if (module_calendar::can_i('delete', 'Calendar')) { $ret = removeCalendar($_POST["calendarId"]); } break; } echo json_encode($ret); exit; } if ("save_calendar_entry" == $_REQUEST['_process']) { header('Content-type: text/javascript'); $calendar_id = isset($_REQUEST['calendar_id']) ? (int) $_REQUEST['calendar_id'] : 0; $response = array(); if ($calendar_id && module_calendar::can_i('edit', 'Calendar') || !$calendar_id && module_calendar::can_i('create', 'Calendar')) { $data = $_REQUEST; if (isset($data['start'])) { $start_time = $data['start']; if (isset($data['start_time']) && (!isset($data['is_all_day']) || !$data['is_all_day'])) { $data['is_all_day'] = 0; $time_hack = $data['start_time']; $time_hack = str_ireplace(_l("am"), '', $time_hack); $time_hack = str_ireplace(_l("pm"), '', $time_hack); $bits = explode(':', $time_hack); if (strpos($data['end_time'], _l("pm"))) { if ($bits[0] < 12) { $bits[0] += 12; } } // add the time if it exists $start_time .= ' ' . implode(':', $bits) . ':00'; $data['start'] = strtotime(input_date($start_time, true)); } else { $data['start'] = strtotime(input_date($start_time)); } } if (isset($data['end'])) { $end_time = $data['end']; if (isset($data['end_time']) && (!isset($data['is_all_day']) || !$data['is_all_day'])) { $data['is_all_day'] = 0; $time_hack = $data['end_time']; $time_hack = str_ireplace(_l("am"), '', $time_hack); $time_hack = str_ireplace(_l("pm"), '', $time_hack); $bits = explode(':', $time_hack); if (strpos($data['end_time'], _l("pm"))) { if ($bits[0] < 12) { $bits[0] += 12; } } // add the time if it exists $end_time .= ' ' . implode(':', $bits) . ':00'; //echo $end_time; $data['end'] = strtotime(input_date($end_time, true)); } else { $data['end'] = strtotime(input_date($end_time)); } } if (!$data['start'] || !$data['end']) { $response['message'] = 'Missing Date'; } else { //print_r($_REQUEST); print_r($data); exit; $calendar_id = update_insert('calendar_id', $calendar_id, 'calendar', $data); if ($calendar_id) { // save staff members. $staff_ids = isset($_REQUEST['staff_ids']) && is_array($_REQUEST['staff_ids']) ? $_REQUEST['staff_ids'] : array(); delete_from_db('calendar_user_rel', 'calendar_id', $calendar_id); foreach ($staff_ids as $staff_id) { if ((int) $staff_id > 0) { $sql = "INSERT INTO `" . _DB_PREFIX . "calendar_user_rel` SET calendar_id = " . (int) $calendar_id . ", user_id = " . (int) $staff_id; query($sql); } } $response['calendar_id'] = $calendar_id; $response['message'] = 'Success'; } else { $response['message'] = 'Error Saving'; } } } else { $response['message'] = 'Access Denied'; } echo json_encode($response); exit; } }
header('Content-type: text/calendar; charset=utf-8'); header('Content-Disposition: inline; filename="calfull.ics"'); $calendar_entries = array(); $login = false; // is this a calendar event for a specific staff member? if (isset($options['staff_id']) && (int) $options['staff_id'] > 0 && isset($options['staff_hash']) && !empty($options['staff_hash'])) { // check hash matches again. even though this is already done in the external hook part of calednar.php if ($options['staff_hash'] == module_calendar::staff_hash($options['staff_id'])) { // correct! log this user in, temporarily for the query and then log them out again. module_security::user_id_temp_set($options['staff_id']); $login = true; } } // get 4 months either side of todays date. for ($x = -4; $x <= 4; $x++) { $ret = listCalendar(date('m/d/Y', strtotime('+' . $x . ' months')), 'month'); if (is_array($ret) && isset($ret['events']) && count($ret['events'])) { $calendar_entries = array_merge($calendar_entries, $ret['events']); } } if ($login) { module_security::user_id_temp_restore(); } echo 'BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Ultimate Client Manager/Calendar Plugin v1.0//EN CALSCALE:GREGORIAN X-WR-CALNAME:' . _l('CRM Calendar') . ' X-WR-TIMEZONE:' . module_config::c('timezone', 'America/New_York') . ' '; //$local_timezone_string = date('e');