*/ // various copy includes require_once "../../config.gen.inc.php"; require_once "data/data.inc.php"; // records stats require_once "../page_builder/page_header.php"; // sets up adapter class $adapter = ModuleAdapter::find(); require_once "adapters/".$adapter."/adapter.php"; // libs require_once "lib/calendar.lib.php"; require_once "lib/textformat.lib.php"; $search_terms = $_REQUEST['filter']; $search_options = SearchOptions::get_options(); $timeframe = isset($_REQUEST['timeframe']) ? $_REQUEST['timeframe'] : 0; $dates = SearchOptions::search_dates($timeframe); $eventFeed = CalendarAdapter::searchEvents($search_terms,$dates['start'],$dates['end']); require "templates/$prefix/search.html"; $page->output(); ?>
<?php /** * Copyright (c) 2010 West Virginia University * * Licensed under the MIT License * Redistributions of files must retain the above copyright notice. * */ /** * This script is simply used to provide customized search results for the federated search module */ // sets up adapter class require_once "../page_builder/adapter.php"; $adapter = ModuleAdapter::find('calendar'); require_once "../calendar/adapters/" . $adapter . "/adapter.php"; // libs require_once "lib/calendar.lib.php"; require_once "lib/textformat.lib.php"; $dates = SearchOptions::search_dates(3); // next 30 days $results = CalendarAdapter::searchEvents($filter, $dates['start'], $dates['end']); $total = count($results); require "../calendar/templates/{$prefix}/federated.html";
public function post($request) { // to Receive POST Params (use $this->params) parent::post($request); $user_id = $this->getUserId(); $tz_offset = $this->getTimezoneOffset(); if ($this->isLoggedIn()) { $date_start = $this->getParam('dateStart'); $date_end = $this->getParam('dateEnd'); // check the dates parameters formats (ex: 31/12/2012 23:59:59, but the time is optional) $regex_date = '/^(0[1-9]|[12][0-9]|3[01])\\/(0[1-9]|1[0-2])\\/([12][0-9]{3})( ([01][0-9]|2[0-3])(:[0-5][0-9]){2})?$/'; if (!preg_match($regex_date, $date_start)) { Errors::runException("CALENDAR_INVALID_START_DATE"); } if (!preg_match($regex_date, $date_end)) { Errors::runException("CALENDAR_INVALID_END_DATE"); } // get the start timestamp UNIX from the parameter $start_arr = explode(' ', $date_start); $start_date_arr = explode('/', $start_arr[0]); $start_time_arr = !empty($start_arr[1]) ? explode(':', $start_arr[1]) : array('00', '00', '00'); $rangeStart = mktime($start_time_arr[0], $start_time_arr[1], $start_time_arr[2], $start_date_arr[1], $start_date_arr[0], $start_date_arr[2]) - $tz_offset; // get the end timestamp UNIX from the parameter $end_arr = explode(' ', $date_end); $end_date_arr = explode('/', $end_arr[0]); $end_time_arr = !empty($end_arr[1]) ? explode(':', $end_arr[1]) : array('23', '59', '59'); $rangeEnd = mktime($end_time_arr[0], $end_time_arr[1], $end_time_arr[2], $end_date_arr[1], $end_date_arr[0], $end_date_arr[2]) - $tz_offset; $rangeStart = $rangeStart * 1000; $rangeEnd = $rangeEnd * 1000; $concept = "schedulable"; $id = false; $criteria = array(); $criteria['order'] = "startTime"; $criteria['deepness'] = 2; $criteria['timezones'] = array(); $criteria['timezones'][1] = 'America/Sao_Paulo'; $criteria['timezones'][3] = 'America/Sao_Paulo'; $criteria['filter'] = array(); $criteria['filter'][0] = "AND"; $criteria['filter'][1] = array(); $criteria['filter'][1][0] = "OR"; $criteria['filter'][1][1] = array(); $criteria['filter'][1][1][0] = "AND"; $criteria['filter'][1][1][1] = array(); $criteria['filter'][1][1][1][0] = ">="; $criteria['filter'][1][1][1][1] = "rangeEnd"; $criteria['filter'][1][1][1][2] = $rangeStart; //START $criteria['filter'][1][1][2] = array(); $criteria['filter'][1][1][2][0] = "=<"; $criteria['filter'][1][1][2][1] = "rangeEnd"; $criteria['filter'][1][1][2][2] = $rangeEnd; //END $criteria['filter'][1][2] = array(); $criteria['filter'][1][2][0] = "AND"; $criteria['filter'][1][2][1] = array(); $criteria['filter'][1][2][1][0] = ">="; $criteria['filter'][1][2][1][1] = "rangeStart"; $criteria['filter'][1][2][1][2] = $rangeStart; //START $criteria['filter'][1][2][2] = array(); $criteria['filter'][1][2][2][0] = "=<"; $criteria['filter'][1][2][2][1] = "rangeStart"; $criteria['filter'][1][2][2][2] = $rangeEnd; //END $criteria['filter'][1][3] = array(); $criteria['filter'][1][3][0] = "AND"; $criteria['filter'][1][3][1] = array(); $criteria['filter'][1][3][1][0] = "<="; $criteria['filter'][1][3][1][1] = "rangeStart"; $criteria['filter'][1][3][1][2] = $rangeStart; //START $criteria['filter'][1][3][2] = array(); $criteria['filter'][1][3][2][0] = ">="; $criteria['filter'][1][3][2][1] = "rangeEnd"; $criteria['filter'][1][3][2][2] = $rangeEnd; //END $criteria['filter'][2] = array("IN", "calendar", array(1)); $properties = $criteria && isset($criteria['properties']) ? $criteria['properties'] : false; $service = $criteria && isset($criteria['service']) ? $criteria['service'] : false; $res = Controller::call('find', Controller::URI($concept), false, $criteria); $arrEvents = array(); foreach ($res as $event) { $timeZone = new DateTimeZone($event['timezone']); $timeStart = new DateTime('@' . (int) ($event['startTime'] / 1000), $timeZone); $timeEnd = new DateTime('@' . (int) ($event['endTime'] / 1000), $timeZone); $timeStart->setTimezone($timeZone); $timeEnd->setTimezone($timeZone); $newEvent = array(); $newEvent['eventID'] = "" . $event['id']; $newEvent['eventName'] = "" . $event['summary']; $newEvent['eventDescription'] = "" . $event['description']; $newEvent['eventLocation'] = "" . $event['location']; $newEvent['eventStartDate'] = "" . $timeStart->format('d/m/Y H:i:s'); $newEvent['eventEndDate'] = "" . $timeEnd->format('d/m/Y H:i:s'); //$newEvent['eventTimeZone'] = "" . $event['timezone']; $newEvent['eventAllDay'] = "" . $event['allDay']; $arrEvents[] = $newEvent; } $result = array('events' => $arrEvents); $this->setResult($result); } //to Send Response (JSON RPC format) return $this->getResponse(); }
// various copy includes require_once "../../config.gen.inc.php"; require_once "data/data.inc.php"; // records stats require_once "../page_builder/page_header.php"; // sets up adapter class $adapter = ModuleAdapter::find(); require_once "adapters/" . $adapter . "/adapter.php"; // defines all the variables related to being today require_once "lib/calendar.lib.php"; require_once "lib/textformat.lib.php"; $time = $_REQUEST['time']; $current = day_info($time); $next = day_info($time, 1); $prev = day_info($time, -1); $eventFeed = CalendarAdapter::getDayEvents($current['gdate'], $next['gdate']); // this is the switch for requests from the main page for the number of events for today if ($_REQUEST['countonly'] == true) { if ($error == false) { $i = 0; foreach ($eventFeed as $event) { $i++; } echo $i; } else { echo 0; } } else { require "templates/{$prefix}/day.html"; $page->output(); }
/** * Copyright (c) 2008 Massachusetts Institute of Technology * * Licensed under the MIT License * Redistributions of files must retain the above copyright notice. * */ // various copy includes require_once "../../config.gen.inc.php"; require_once "data/data.inc.php"; // records stats require_once "../page_builder/page_header.php"; // sets up adapter class $adapter = ModuleAdapter::find(); require_once "adapters/" . $adapter . "/adapter.php"; // libs require_once "lib/calendar.lib.php"; require_once "lib/textformat.lib.php"; $id = $_REQUEST['id']; $calkey = $_REQUEST['cal']; $eventFeed = CalendarAdapter::getEvent($id, $calkey); $event = $eventFeed[0]; // drop the event out of the overall array for use in the templates if ($error == true) { // need to create an error handler class echo "<div class='error'>Error for details" . $url . "</div>" . $e; exit; } require "templates/{$prefix}/detail.html"; $page->output();
<?php /** * Copyright (c) 2008 Massachusetts Institute of Technology * * Licensed under the MIT License * Redistributions of files must retain the above copyright notice. * */ // various copy includes require_once "../../config.gen.inc.php"; require_once "data/data.inc.php"; // records stats require_once "../page_builder/page_header.php"; // sets up adapter class $adapter = ModuleAdapter::find(); require_once "adapters/" . $adapter . "/adapter.php"; // libs require_once "lib/calendar.lib.php"; require_once "lib/textformat.lib.php"; $id = $_REQUEST['id']; $eventFeed = CalendarAdapter::getCategoryEvents($id); require "templates/{$prefix}/category.html"; $page->output();