[ Index ]
 

Code source de WebCalendar 1.0.5

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables | Statistiques

title

Body

[fermer]

/ -> month.php (source)

   1  <?php
   2  include_once  'includes/init.php';
   3  
   4  if (($user != $login) && $is_nonuser_admin) {
   5    load_user_layers ($user);
   6  } else {
   7    load_user_layers ();
   8  }
   9  
  10  load_user_categories ();
  11  
  12  $next = mktime ( 3, 0, 0, $thismonth + 1, 1, $thisyear );
  13  $nextyear = date ( "Y", $next );
  14  $nextmonth = date ( "m", $next );
  15  //$nextdate = date ( "Ymd" );
  16  
  17  $prev = mktime ( 3, 0, 0, $thismonth - 1, 1, $thisyear );
  18  $prevyear = date ( "Y", $prev );
  19  $prevmonth = date ( "m", $prev );
  20  //$prevdate = date ( "Ymd" );
  21  
  22  if ( ! empty ( $bold_days_in_year ) && $bold_days_in_year == 'Y' ) {
  23    $boldDays = true;
  24    $startdate = sprintf ( "%04d%02d01", $prevyear, $prevmonth );
  25    $enddate = sprintf ( "%04d%02d31", $nextyear, $nextmonth );
  26  } else {
  27    $boldDays = false;
  28    $startdate = sprintf ( "%04d%02d01", $thisyear, $thismonth );
  29    $enddate = sprintf ( "%04d%02d31", $thisyear, $thismonth );
  30  }
  31  
  32  $HeadX = '';
  33  if ( $auto_refresh == "Y" && ! empty ( $auto_refresh_time ) ) {
  34    $refresh = $auto_refresh_time * 60; // convert to seconds
  35    $HeadX = "<meta http-equiv=\"refresh\" content=\"$refresh; url=month.php?$u_url" .
  36      "year=$thisyear&amp;month=$thismonth$caturl" . 
  37      ( ! empty ( $friendly ) ? "&amp;friendly=1" : "") . "\" />\n";
  38  }
  39  $INC = array('js/popups.php');
  40  print_header($INC,$HeadX);
  41  
  42  /* Pre-Load the repeated events for quicker access */
  43  $repeated_events = read_repeated_events (
  44    ( ! empty ( $user ) && strlen ( $user ) ) ? $user : $login, $cat_id, $startdate );
  45  
  46  /* Pre-load the non-repeating events for quicker access */
  47  $events = read_events ( ( ! empty ( $user ) && strlen ( $user ) )
  48    ? $user : $login, $startdate, $enddate, $cat_id );
  49  
  50  if ( ! empty ( $cat_id ) )
  51    $monthURL = "month.php?cat_id=$cat_id&amp;";
  52  else
  53    $monthURL = 'month.php?';
  54  display_small_month ( $prevmonth, $prevyear, true, true, "prevmonth",
  55    $monthURL );
  56  display_small_month ( $nextmonth, $nextyear, true, true, "nextmonth",
  57    $monthURL );
  58  ?>
  59  <div class="title">
  60  <span class="date"><br /><?php
  61    echo date_to_str ( sprintf ( "%04d%02d01", $thisyear, $thismonth ),
  62      $DATE_FORMAT_MY, false, false );
  63  ?></span>
  64  <span class="user"><?php
  65    if ( $single_user == "N" ) {
  66      echo "<br />\n";
  67      echo $user_fullname;
  68    }
  69    if ( $is_nonuser_admin ) {
  70      echo "<br />-- " . translate("Admin mode") . " --";
  71    }
  72    if ( $is_assistant ) {
  73      echo "<br />-- " . translate("Assistant mode") . " --";
  74    }
  75  ?></span>
  76  <?php
  77    if ( $categories_enabled == "Y" && (!$user || ($user == $login || $is_assistant ))) {
  78      echo "<br /><br />\n";
  79      print_category_menu('month',sprintf ( "%04d%02d01",$thisyear, $thismonth ),$cat_id );
  80    }
  81  ?>
  82  </div>
  83  
  84  <table class="main" style="clear:both;" cellspacing="0" cellpadding="0">
  85  <tr>
  86   <?php if ( $WEEK_START == 0 ) { ?>
  87    <th><?php etranslate("Sun")?></th>
  88   <?php } ?>
  89   <th><?php etranslate("Mon")?></th>
  90   <th><?php etranslate("Tue")?></th>
  91   <th><?php etranslate("Wed")?></th>
  92   <th><?php etranslate("Thu")?></th>
  93   <th><?php etranslate("Fri")?></th>
  94   <th><?php etranslate("Sat")?></th>
  95   <?php if ( $WEEK_START == 1 ) { ?>
  96    <th><?php etranslate("Sun")?></th>
  97   <?php } ?>
  98  </tr>
  99  <?php
 100  
 101  // We add 2 hours on to the time so that the switch to DST doesn't
 102  // throw us off.  So, all our dates are 2AM for that day.
 103  //$sun = get_sunday_before ( $thisyear, $thismonth, 1 );
 104  if ( $WEEK_START == 1 ) {
 105    $wkstart = get_monday_before ( $thisyear, $thismonth, 1 );
 106  } else {
 107    $wkstart = get_sunday_before ( $thisyear, $thismonth, 1 );
 108  }
 109  // generate values for first day and last day of month
 110  $monthstart = mktime ( 3, 0, 0, $thismonth, 1, $thisyear );
 111  $monthend = mktime ( 3, 0, 0, $thismonth + 1, 0, $thisyear );
 112  
 113  // debugging
 114  //echo "<p>sun = " . date ( "D, m-d-Y", $sun ) . "</p>\n";
 115  //echo "<p>monthstart = " . date ( "D, m-d-Y", $monthstart ) . "</p>\n";
 116  //echo "<p>monthend = " . date ( "D, m-d-Y", $monthend ) . "</p>\n";
 117  
 118  // NOTE: if you make HTML changes to this table, make the same changes
 119  // to the example table in pref.php.
 120  for ( $i = $wkstart; date ( "Ymd", $i ) <= date ( "Ymd", $monthend );
 121    $i += ( 24 * 3600 * 7 ) ) {
 122    print "<tr>\n";
 123    for ( $j = 0; $j < 7; $j++ ) {
 124      $date = $i + ( $j * 24 * 3600 );
 125      if ( date ( "Ymd", $date ) >= date ( "Ymd", $monthstart ) &&
 126        date ( "Ymd", $date ) <= date ( "Ymd", $monthend ) ) {
 127        $thiswday = date ( "w", $date );
 128        $is_weekend = ( $thiswday == 0 || $thiswday == 6 );
 129        if ( empty ( $WEEKENDBG ) ) {
 130          $is_weekend = false;
 131        }
 132        print "<td";
 133        $class = "";
 134        if ( date ( "Ymd", $date  ) == date ( "Ymd", $today ) ) {
 135          $class = "today";
 136        }
 137        if ( $is_weekend ) {
 138          if ( strlen ( $class ) ) {
 139            $class .= " ";
 140          }
 141          $class .= "weekend";
 142        }
 143        if ( strlen ( $class ) )  {
 144        echo " class=\"$class\"";
 145        }
 146        echo ">";
 147        //echo date ( "D, m-d-Y H:i:s", $date ) . "<br />";
 148        print_date_entries ( date ( "Ymd", $date ),
 149          ( ! empty ( $user ) ) ? $user : $login, false );
 150        print "</td>\n";
 151      } else {
 152        print "<td>&nbsp;</td>\n";
 153      }
 154    }
 155    print "</tr>\n";
 156  }
 157  ?></table>
 158  <br />
 159  <?php
 160   if ( ! empty ( $eventinfo ) ) echo $eventinfo;
 161  
 162   display_unapproved_events ( ( $is_assistant || $is_nonuser_admin ? $user : $login ) );
 163  ?>
 164  
 165  <br />
 166  <a title="<?php etranslate("Generate printer-friendly version")?>" 
 167  class="printer" href="month.php?<?php
 168     if ( $thisyear ) {
 169      echo "year=$thisyear&amp;month=$thismonth&amp;";
 170     }
 171     if ( ! empty ( $user ) ) {
 172       echo "user=$user&amp;";
 173     }
 174     if ( ! empty ( $cat_id ) ) {
 175       echo "cat_id=$cat_id&amp;";
 176     }
 177    ?>friendly=1" target="cal_printer_friendly" 
 178  onmouseover="window.status = '<?php etranslate("Generate printer-friendly version")
 179    ?>'">[<?php etranslate("Printer Friendly")?>]</a>
 180  <?php
 181   print_trailer ();
 182  ?>
 183  </body>
 184  </html>


Généré le : Fri Nov 30 19:09:19 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics