[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/public/ -> calendar.php (source)

   1  <?php /* $Id: calendar.php 137 2008-04-04 16:12:02Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/public/calendar.php $ */
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not call this file directly.');
   4  }
   5  
   6  require_once ($AppUI->getSystemClass('ui'));
   7  require_once ($AppUI->getModuleClass('calendar'));
   8  
   9  $callback = isset($_GET['callback']) ? w2PgetParam($_GET, 'callback', '') : 0;
  10  $date = w2PgetParam($_GET, 'date', null);
  11  $prev_date = w2PgetParam($_GET, 'uts', null);
  12  
  13  // if $date is empty, set to null

  14  $date = $date !== '' ? $date : null;
  15  
  16  $this_month = new CDate($date);
  17  
  18  $uistyle = $AppUI->getPref('UISTYLE') ? $AppUI->getPref('UISTYLE') : w2PgetConfig('host_style');
  19  ?>
  20  <a href="javascript: void(0);" onclick="clickDay('', '');">clear date</a>
  21  <?php
  22  $cal = new CMonthCalendar($this_month);
  23  $cal->setStyles('poptitle', 'popcal');
  24  $cal->showWeek = false;
  25  $cal->callback = $callback;
  26  $cal->setLinkFunctions('clickDay');
  27  
  28  if (isset($prev_date)) {
  29      $highlights = array($prev_date => '#FF8888');
  30      $cal->setHighlightedDays($highlights);
  31      $cal->showHighlightedDays = true;
  32  }
  33  
  34  echo $cal->show();
  35  ?>
  36  <script language="javascript">
  37  /**

  38   *    @param string Input date in the format YYYYMMDD

  39   *    @param string Formatted date

  40   */
  41  	function clickDay( idate, fdate ) {
  42          window.opener.<?php echo $callback; ?>(idate,fdate);
  43          window.close();
  44      }
  45  </script>
  46  <table border="0" cellspacing="0" cellpadding="3" width="100%">
  47      <tr>
  48  <?php
  49  $s = '';
  50  for ($i = 0; $i < 12; $i++) {
  51      $this_month->setMonth($i + 1);
  52      $s .= '<td width="8%"><a href="index.php?m=public&a=calendar&dialog=1&callback=' . $callback . '&date=' . $this_month->format(FMT_TIMESTAMP_DATE) . '&uts=' . $prev_date . '" class="">' . substr($this_month->format('%b'), 0, 1) . '</a></td>';
  53  }
  54  echo $s;
  55  ?>
  56      </tr>
  57      <tr>
  58  <?php
  59  echo '<td colspan="6" align="left">';
  60  echo "<a href=\"index.php?m=public&a=calendar&dialog=1&callback=$callback&date=" . $cal->prev_year->format(FMT_TIMESTAMP_DATE) . "&uts=$prev_date\" class=\"\">" . $cal->prev_year->getYear() . '</a>';
  61  echo '</td><td colspan="6" align="right">';
  62  echo "<a href=\"index.php?m=public&a=calendar&dialog=1&callback=$callback&date=" . $cal->next_year->format(FMT_TIMESTAMP_DATE) . "&uts=$prev_date\" class=\"\">" . $cal->next_year->getYear() . '</a>';
  63  echo '</td>';
  64  ?>
  65      </tr>
  66  </table>


Generated: Fri Jan 9 03:00:02 2009 Cross-referenced by PHPXref 0.7