home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / public / calendar.php < prev    next >
Encoding:
PHP Script  |  2003-05-08  |  1.8 KB  |  55 lines

  1. <?php /* PUBLIC $Id: calendar.php,v 1.2 2003/05/08 06:43:54 eddieajau Exp $ */
  2. require_once( "./classes/ui.class.php" );
  3. require_once( "./modules/calendar/calendar.class.php" );
  4.  
  5. $callback = isset( $_GET['callback'] ) ? $_GET['callback'] : 0;
  6. $date = dpGetParam( $_GET, 'date', null );
  7.  
  8. // if $date is empty, set to null
  9. $date = $date !== '' ? $date : null;
  10.  
  11. $this_month = new CDate( $date );
  12.  
  13. $uistyle = $AppUI->getPref( 'UISTYLE' ) ? $AppUI->getPref( 'UISTYLE' ) : $AppUI->cfg['host_style'];
  14.  
  15. $cal = new CMonthCalendar( $this_month );
  16. $cal->setStyles( 'poptitle', 'popcal' );
  17. $cal->showWeek = false;
  18. $cal->callback = $callback;
  19. $cal->setLinkFunctions( 'clickDay' );
  20.  
  21. echo $cal->show();
  22. ?>
  23. <script language="javascript">
  24. /**
  25.  *    @param string Input date in the format YYYYMMDD
  26.  *    @param string Formatted date
  27.  */
  28.     function clickDay( idate, fdate ) {
  29.         window.opener.<?php echo $callback;?>(idate,fdate);
  30.         window.close();
  31.     }
  32. </script>
  33.  
  34. <table border="0" cellspacing="0" cellpadding="3" width="100%">
  35.     <tr>
  36. <?php
  37.     for ($i=0; $i < 12; $i++) {
  38.         $this_month->setMonth( $i+1 );
  39.         echo "\n\t<td width=\"8%\">"
  40.             ."<a href=\"index.php?m=public&a=calendar&dialog=1&callback=$callback&date=".$this_month->format( FMT_TIMESTAMP_DATE ).'" class="">'.substr( $this_month->format( "%b" ), 0, 1)."</a>"
  41.             ."</td>";
  42.     }
  43. ?>
  44.     </tr>
  45.     <tr>
  46. <?php
  47.     echo "\n\t<td colspan=\"6\" align=\"left\">";
  48.     echo "<a href=\"index.php?m=public&a=calendar&dialog=1&callback=$callback&date=".$cal->prev_year->format( FMT_TIMESTAMP_DATE ).'" class="">'.$cal->prev_year->getYear()."</a>";
  49.     echo "</td>";
  50.     echo "\n\t<td colspan=\"6\" align=\"right\">";
  51.     echo "<a href=\"index.php?m=public&a=calendar&dialog=1&callback=$callback&date=".$cal->next_year->format( FMT_TIMESTAMP_DATE ).'" class="">'.$cal->next_year->getYear()."</a>";
  52.     echo "</td>";
  53. ?>
  54.     </tr>
  55. </table>