| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * Description: client for the SOAP Calendar Server |
|---|
| 4 | */ |
|---|
| 5 | if ( version_compare(phpversion(), "5.0.0", ">") ) { |
|---|
| 6 | die('PHP 5 has problems with PEAR::SOAP Client (8.0RC3) |
|---|
| 7 | - remove @ before include below to see why'); |
|---|
| 8 | } |
|---|
| 9 | |
|---|
| 10 | if (!@include('SOAP'.DIRECTORY_SEPARATOR.'Client.php')) { |
|---|
| 11 | die('You must have PEAR::SOAP installed'); |
|---|
| 12 | } |
|---|
| 13 | |
|---|
| 14 | // Just to save manaul modification... |
|---|
| 15 | $basePath = explode('/', $_SERVER['SCRIPT_NAME']); |
|---|
| 16 | array_pop($basePath); |
|---|
| 17 | $basePath = implode('/', $basePath); |
|---|
| 18 | $url = 'http://'.$_SERVER['SERVER_NAME'].$basePath.'/7.php?wsdl'; |
|---|
| 19 | |
|---|
| 20 | if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|---|
| 21 | if (!isset($_GET['m'])) $_GET['m'] = date('n'); |
|---|
| 22 | |
|---|
| 23 | $wsdl = new SOAP_WSDL ($url); |
|---|
| 24 | |
|---|
| 25 | echo ( '<pre>'.$wsdl->generateProxyCode().'</pre>' ); |
|---|
| 26 | |
|---|
| 27 | $calendarClient = $wsdl->getProxy(); |
|---|
| 28 | |
|---|
| 29 | $month = $calendarClient->getMonth((int)$_GET['y'],(int)$_GET['m']); |
|---|
| 30 | |
|---|
| 31 | if ( PEAR::isError($month) ) { |
|---|
| 32 | die ( $month->toString() ); |
|---|
| 33 | } |
|---|
| 34 | ?> |
|---|
| 35 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
|---|
| 36 | <html> |
|---|
| 37 | <head> |
|---|
| 38 | <title> Calendar over the Wire </title> |
|---|
| 39 | </head> |
|---|
| 40 | <body> |
|---|
| 41 | <h1>Calendar Over the Wire (featuring PEAR::SOAP)</h1> |
|---|
| 42 | <table> |
|---|
| 43 | <caption><b><?php echo ( $month->monthname );?></b></caption> |
|---|
| 44 | <tr> |
|---|
| 45 | <th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th> |
|---|
| 46 | </tr> |
|---|
| 47 | <?php |
|---|
| 48 | foreach ( $month->days as $day ) { |
|---|
| 49 | |
|---|
| 50 | if ( $day->isFirst === 1 ) |
|---|
| 51 | echo ( "<tr>\n" ); |
|---|
| 52 | if ( $day->isEmpty === 1 ) { |
|---|
| 53 | echo ( "<td></td>" ); |
|---|
| 54 | } else { |
|---|
| 55 | echo ( "<td>".$day->day."</td>" ); |
|---|
| 56 | } |
|---|
| 57 | if ( $day->isLast === 1 ) |
|---|
| 58 | echo ( "</tr>\n" ); |
|---|
| 59 | } |
|---|
| 60 | ?> |
|---|
| 61 | <tr> |
|---|
| 62 | </table> |
|---|
| 63 | <p>Enter Year and Month to View:</p> |
|---|
| 64 | <form action="<?php echo ( $_SERVER['PHP_SELF'] ); ?>" method="get"> |
|---|
| 65 | Year: <input type="text" size="4" name="y" value="<?php echo ( $_GET['y'] ); ?>"> |
|---|
| 66 | Month: <input type="text" size="2" name="m" value="<?php echo ( $_GET['m'] ); ?>"> |
|---|
| 67 | <input type="submit" value="Fetch Calendar"> |
|---|
| 68 | </form> |
|---|
| 69 | </body> |
|---|
| 70 | </html> |
|---|