Rev 1161 | Rev 1163 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1161 | Rev 1162 | ||
|---|---|---|---|
| Line 12... | Line 12... | ||
| 12 | echo getMeetingsRestOfDay($_GET["shortname"]); |
12 | echo getMeetingsRestOfDay($_GET["shortname"]); |
| 13 | } |
13 | } |
| 14 | break; |
14 | break; |
| 15 | 15 | ||
| 16 | case "bookMeeting": |
16 | case "bookMeeting": |
| - | 17 | if (isset($_GET["from"]) && isset($_GET["to"])) |
|
| - | 18 | { |
|
| - | 19 | ||
| - | 20 | } |
|
| 17 | break; |
21 | break; |
| 18 | 22 | ||
| 19 | //case "": |
23 | //case "": |
| 20 | // |
24 | // |
| 21 | //break; |
25 | //break; |
| 22 | } |
26 | } |
| 23 | } |
27 | } |
| 24 | 28 | ||
| 25 | function getMeetingsRestOfDay($shortname) |
29 | function getMeetingsRestOfDay($shortname) |
| 26 | { |
30 | { |
| 27 | global $Calender; |
31 | global $Calender; |
| 28 | global $wsdl; |
32 | global $wsdl; |
| 29 | $founditem = false; |
33 | $founditem = false; |
| 30 | 34 | ||
| 31 | foreach($Calender as $item) |
35 | foreach($Calender as $item) |
| 32 | { |
36 | { |
| 33 | if ($item->Shortname == $shortname) |
37 | if ($item->Shortname == $shortname) |
| 34 | { |
38 | { |
| 35 | $founditem = $item; |
39 | $founditem = $item; |
| 36 | break; |
40 | break; |
| 37 | } |
41 | } |
| Line 40... | Line 44... | ||
| 40 | if ($founditem !== false) |
44 | if ($founditem !== false) |
| 41 | { |
45 | { |
| 42 | $FindItem->Traversal = "Shallow"; |
46 | $FindItem->Traversal = "Shallow"; |
| 43 | $FindItem->ItemShape->BaseShape = "AllProperties"; |
47 | $FindItem->ItemShape->BaseShape = "AllProperties"; |
| 44 | $FindItem->ParentFolderIds->DistinguishedFolderId->Id = "calendar"; |
48 | $FindItem->ParentFolderIds->DistinguishedFolderId->Id = "calendar"; |
| - | 49 | /* Dont forget to use the proper timezone and setting for daylight saving time (php handles this fine) */ |
|
| 45 | $FindItem->CalendarView->StartDate = |
50 | $FindItem->CalendarView->StartDate = date("c"); //"2009-04-07T08:00:00Z"; |
| 46 | $FindItem->CalendarView->EndDate = |
51 | $FindItem->CalendarView->EndDate = date("c", strtotime("+9 hour")); //"2009-04-08T00:00:00Z"; |
| - | 52 | //echo date("c")." ".date("c", strtotime("+8 hour"))." ".date("c", strtotime("18:00"))."\n"; |
|
| 47 | 53 | ||
| 48 | stream_wrapper_unregister('https'); |
54 | stream_wrapper_unregister('https'); |
| 49 | stream_wrapper_register('https', 'NTLMStream') or die("Failed to register protocol"); |
55 | stream_wrapper_register('https', 'NTLMStream') or die("Failed to register protocol"); |
| 50 | 56 | ||
| 51 |
|
57 | $returndata = ""; |
| 52 | try |
58 | try |
| 53 | { |
59 | { |
| 54 | $client = new ExchangeNTLMSoapClient($wsdl); |
60 | $client = new ExchangeNTLMSoapClient($wsdl); |
| 55 | $client->user = $founditem->UserName; |
61 | $client->user = $founditem->UserName; |
| 56 | $client->pass = $founditem->Password; |
62 | $client->pass = $founditem->Password; |
| Line 59... | Line 65... | ||
| 59 | { |
65 | { |
| 60 | //print_array($result); |
66 | //print_array($result); |
| 61 | $calendaritems = $result->ResponseMessages->FindItemResponseMessage->RootFolder->Items->CalendarItem; |
67 | $calendaritems = $result->ResponseMessages->FindItemResponseMessage->RootFolder->Items->CalendarItem; |
| 62 | //print_array($calendaritems); |
68 | //print_array($calendaritems); |
| 63 | $returndata = ""; |
69 | $returndata = ""; |
| 64 |
|
70 | for ($i = 0; $i < count($calendaritems); $i++) |
| 65 | { |
71 | { |
| - | 72 | if (count($calendaritems) > 1) |
|
| - | 73 | { |
|
| - | 74 | $item = $calendaritems[$i]; |
|
| 66 | 75 | } |
|
| - | 76 | else |
|
| - | 77 | { |
|
| - | 78 | $item = $calendaritems; |
|
| - | 79 | } |
|
| 67 | $returndata .= "<meeting>\n"; |
80 | $returndata .= "<meeting>\n"; |
| 68 | $returndata .= "\t<organizer>".$item->Organizer->Mailbox->Name."</organizer>\n"; |
81 | $returndata .= "\t<organizer>".$item->Organizer->Mailbox->Name."</organizer>\n"; |
| 69 | $returndata .= "\t<start>".date("G: |
82 | $returndata .= "\t<start>".date("G:i", strtotime($item->Start))."</start>\n"; |
| 70 | $returndata .= "\t<end>".date("G: |
83 | $returndata .= "\t<end>".date("G:i", strtotime($item->End))."</end>\n"; |
| 71 | $returndata .= "</meeting>\n"; |
84 | $returndata .= "</meeting>\n"; |
| 72 | } |
85 | } |
| 73 | } |
86 | } |
| 74 | 87 | ||
| 75 | } |
88 | } |
| 76 | catch (SoapFault $exception) |
89 | catch (SoapFault $exception) |
| 77 | { |
90 | { |
| Line 83... | Line 96... | ||
| 83 | } |
96 | } |
| 84 | else |
97 | else |
| 85 | { |
98 | { |
| 86 | return "<error>Unknown shortname</error>"; |
99 | return "<error>Unknown shortname</error>"; |
| 87 | } |
100 | } |
| 88 | - | ||
| 89 | - | ||
| 90 | //echo "<br>OBS tidszon+sommartid?? nu sommartid, ett möte som ovan gav start 13:00 var egentligen 15:00<br>OBS utf? teckenkodning<br>"; |
- | |
| 91 | } |
101 | } |
| 92 | 102 | ||
| 93 | 103 | ||
| 94 | function print_array($var) |
104 | function print_array($var) |
| 95 | { |
105 | { |