Exemplo n.º 1
0
 public static function init($url)
 {
     if (self::$url) {
         throw new Exception("MIT_Calendar already initialized");
     } else {
         self::$url = $url;
         self::$php_client = new SoapClientWrapper($url);
     }
 }
  public static function TodaysEventsHeaders($date=NULL) {
    $today_date = date('Y/m/d');
    if ($date === NULL)
      $date = $today_date;

    if (($events = self::$today_events) !== NULL
	&& ($today_date == $date)) {
      return $events;
    }

    $hard_cache = 'day_' . str_replace('/', '', $date);
    if ($events = self::read_cache($hard_cache)) {
      return $events;
    }

    // Get all today's events including exhibits
    $all_events = self::$php_client->getDayEventsHeaders($date);
    
    // Get only exhibits
    $exhibitions = self::TodaysExhibitsHeaders($date);
   
    $without_exhibitions = array(); //Initalize empty array
    
    //Remove the exhibitions form the list of today's events
    foreach($all_events as $event) {

      $found = false; //Initialize $found flag
      $id = $event->id;
      // Search through the list of exhibits to see if it matches the event id
      foreach($exhibitions as $exhibition) {
        if($exhibition->id == $id) {
          $found = true;
        }
      }

      if(!$found) {
        // Not an exhibition so add it to the list
        $without_exhibitions[] = $event;
      }
    }

    if (count($without_exhibitions)) {
      if ($today_date == $date) {
	self::$today_events = $without_exhibitions;
      }

      self::write_cache($hard_cache, $without_exhibitions);
    }

    return $without_exhibitions;
  }     
Exemplo n.º 3
0
<?php
$docRoot = getenv("DOCUMENT_ROOT");

require_once $docRoot . "/mobi-config/mobi_web_constants.php";
require WEBROOT . "page_builder/page_header.php";
require LIBDIR . "mit_calendar.php";
require WEBROOT . "calendar/calendar_lib.php";

$category = MIT_Calendar::Category($_REQUEST['id']);
$categorys = MIT_Calendar::subCategorys($category);

if(count($categorys) == 0) {
  header("Location: " . categoryURL($category));
}

require "$page->branch/sub-categorys.html";
$page->output();

?>
Exemplo n.º 4
0
$search_terms = isset($_REQUEST['filter']) ? $_REQUEST['filter'] : "";

if($search_terms) {
  $dates = SearchOptions::search_dates($timeframe);
  $events = MIT_Calendar::fullTextSearch($search_terms, $dates['start'], $dates['end'], $category);
} else {
  if (isset($_REQUEST['timeframe'])) {
    $dates = SearchOptions::search_dates($timeframe);
    $start = $dates['start'];
    $end = $dates['end'];
  } else {
    $today = day_info(time());
    $start = $today['date'];
    $end = NULL;
  }
  $events = MIT_Calendar::CategoryEventsHeaders($category, $start, $end);
}

$content = new ResultsContent(
  "items", "calendar", $page,
  array(
    "id" => $category->catid,
    "timeframe" => $timeframe
  )
);

$form = new CalendarForm($page, SearchOptions::get_options($timeframe), $category->catid);
$content->set_form($form);

require "$page->branch/category.html";
$page->output();
Exemplo n.º 5
0
<?php
$docRoot = getenv("DOCUMENT_ROOT");

require_once $docRoot . "/mobi-config/mobi_web_constants.php";
require WEBROOT . "page_builder/page_header.php";
require LIBDIR . "mit_calendar.php";
require WEBROOT . "calendar/calendar_lib.php";

$categorys = MIT_Calendar::Categorys();

require "$page->branch/categorys.html";
$page->output();

?>
<?php

require_once "../config/mobi_web_constants.php";
require PAGE_HEADER;
require LIBDIR . "/mit_calendar.php";
require "calendar_lib.php";
$category = MIT_Calendar::Category($_REQUEST['id']);
$timeframe = isset($_REQUEST['timeframe']) ? $_REQUEST['timeframe'] : 0;
$search_terms = isset($_REQUEST['filter']) ? $_REQUEST['filter'] : "";
if (isset($_REQUEST['filter'])) {
    $dates = SearchOptions::search_dates($timeframe);
    $events = MIT_Calendar::fullTextSearch($search_terms, $dates['start'], $dates['end'], $category);
} else {
    $today = day_info(time());
    $events = MIT_Calendar::CategoryEventsHeaders($category, $today['date']);
}
$content = new ResultsContent("items", "calendar", $page, array("id" => $category->catid, "timeframe" => $timeframe));
$form = new CalendarForm($page, SearchOptions::get_options($timeframe), $category->catid);
$content->set_form($form);
require "{$page->branch}/category.html";
$page->output();
Exemplo n.º 7
0
<?php
$docRoot = getenv("DOCUMENT_ROOT");

require_once $docRoot . "/mobi-config/mobi_web_constants.php";
require WEBROOT . "page_builder/page_header.php";
require_once LIBDIR . "mit_calendar.php";
require WEBROOT . "calendar/calendar_lib.php";

$event = MIT_Calendar::getEvent($_REQUEST['id']);
$time_of_day = MIT_Calendar::timeText($event);

$day_num = (string)(int)$event->start->day;
$date_str = "{$event->start->weekday}, {$event->start->monthname} {$day_num}, {$event->start->year}"; 

$event->urlize = URLize($event->infourl);

function phoneURL($number) {
  if($number) {
    $number = preg_replace('/\W/', '', map_mit_phone($number));
    return "tel:1$number";
  }
}

function URLize($web_address) {
  if(preg_match('/^http\:\/\//', $web_address)) {
    return $web_address;
  } else {
    return 'http://' . $web_address;
  }
}
function timeText($event) {
  $out = substr($event->start->weekday, 0, 3) . ' ';
  $out .= substr($event->start->monthname, 0, 3) . ' ';
  $out .= (int)$event->start->day . ' ';

  $out .= MIT_Calendar::timeText($event);
  return $out;
}
Exemplo n.º 9
0
<?php

require_once "../config/mobi_web_constants.php";
require PAGE_HEADER;
require LIBDIR . "mit_calendar.php";
require "calendar_lib.php";
$search_terms = $_REQUEST['filter'];
$timeframe = isset($_REQUEST['timeframe']) ? $_REQUEST['timeframe'] : 0;
$dates = SearchOptions::search_dates($timeframe);
$events = MIT_Calendar::fullTextSearch($search_terms, $dates['start'], $dates['end']);
$content = new ResultsContent("items", "calendar", $page, array("timeframe" => $timeframe));
$form = new CalendarForm($page, SearchOptions::get_options($timeframe));
$content->set_form($form);
require "{$page->branch}/search.html";
$page->output();
Exemplo n.º 10
0
   }

   $data['events'] = $event_data;

   break;

 case 'categories': // get full listing of categories
   // this structure just reflects what the web looks like
   // final structure will depend on how we present the UI
   $categories = MIT_Calendar::Categorys();
   foreach ($categories as $categoryObject) {
     $name = ucwordswrapper($categoryObject->name);
     $catid = $categoryObject->catid;
     $catData = array('name' => $name,
		      'catid' => $catid);
     $subcategories = MIT_Calendar::subCategorys($categoryObject);
     if (count($subcategories) > 0) {
       $catData['subcategories'] = array();
       foreach ($subcategories as $subcatObject) {
	 $catData['subcategories'][] = array('name' => ucwordswrapper($subcatObject->name),
					     'catid' => $subcatObject->catid);
       }
     }
     $data[] = $catData;
   }
   break;

 case 'holidays': case 'academic':
   // TODO: see whether any of this code can be consolidated with
   // mobi-web/calendar/academic.php and mobi-web/calendar/holidays.php
   require_once LIBDIR . "AcademicCalendar.php";
Exemplo n.º 11
0
<?php
$docRoot = getenv("DOCUMENT_ROOT");

require_once $docRoot . "/mobi-config/mobi_web_constants.php";
require WEBROOT . "page_builder/page_header.php";
require LIBDIR . "mit_calendar.php";

require WEBROOT . "calendar/calendar_lib.php";

$search_terms = $_REQUEST['filter'];

$timeframe = isset($_REQUEST['timeframe']) ? $_REQUEST['timeframe'] : 0;
$dates = SearchOptions::search_dates($timeframe);

if ($search_terms) {
  $events = MIT_Calendar::fullTextSearch($search_terms, $dates['start'], $dates['end']);
} else {
  $events = MIT_Calendar::eventsInDateRange($dates['start'], $dates['end']);
}


$content = new ResultsContent("items", "calendar", $page, array("timeframe" => $timeframe));

$form = new CalendarForm($page, SearchOptions::get_options($timeframe));
$content->set_form($form);

require "$page->branch/search.html";
$page->output();

?>