Ir para conteúdo
Fórum Script Brasil
  • 0

Calendário


»»Luk@S««

Pergunta

Tenho este script de calendário:

<?php

$yr = "2004";

$dbh = "1";

$dbw = "20";

$ctbc = "2";

$ctfs = "11";

  //Set the months of the year into an array.

  $month[1] = "Janeiro";

  $month[2] = "Fevereiro";

  $month[3] = "Março";

  $month[4] = "Abril";

  $month[5] = "Maio";

  $month[6] = "Junho";

  $month[7] = "Julho";

  $month[8] = "Agosto";

  $month[9] = "Setembro";

  $month[10] = "Outubro";

  $month[11] = "Novembro";

  $month[12] = "Dezembro";

  //Set week title names for the days of the week.

  if ($wk) {

    //Use full names for week days

    $week[0] = "Domingo";  // Sunday

    $week[1] = "Segunda";  // Monday

    $week[2] = "Terça";  // Tuesday

    $week[3] = "Quarta";  // Wednesday

    $week[4] = "Quinta";  // Thursday

    $week[5] = "Sexta";  // Friday

    $week[6] = "Sábado";  // Saturday

  }

  else {

    //Use short names for week days

    $week[0] = "D";  // Sunday

    $week[1] = "S";  // Monday

    $week[2] = "T";  // Tuesday

    $week[3] = "Q";  // Wednesday

    $week[4] = "Q";  // Thursday

    $week[5] = "S";  // Friday

    $week[6] = "S";  // Saturday

  }

  //Get current month, returned in numeric format 1-12

  if (!$mn) { $current_month = date("n"); } else { $current_month = $mn; }

  //Set Calendar to Next Month

  if ($nm) {

    if ($current_month == 12) { $current_month=1; } else { $current_month++; }

$mt=1; //Turn off the today mark

  }

 

  //Set Calendar to Last Month

  if ($lm) {

    if ($current_month == 1) { $current_month=12; } else { $current_month--; }

$mt=1;  //Turn off the today mark

  }

  //Get current day, returned in numeric format 1-31

  if (!$dy) { $current_day = date("j"); } else { $current_day = $dy; }

  //Get current year, returned in four digit numeric format

  if (!$yr) { $current_year = date("Y"); } else { $current_year = $yr; }

  //Get Days in this month, returned in numeric format 28-31

  $days_in_month = date("t", mktime(0,0,0, $current_month, $current_day, $current_year));

  //Get the day of the week that the first day of the month falls on, returned numeric format 0-6

  // (same numbering for days of week as the $week array above)

  $first_day = date("w", mktime(0,0,0,$current_month,1,$current_year));

  //Table Properties

  if (!$tcs) { $tcs = 1; }  //Cell Spacing

  if (!$tcp) { $tcp = 0; }  //Cell Padding

  if (!$tbd) { $tbd = 0; }  //Border

 

  //Set Day Box Height

  //If no value is passed, then default to mini calendar settings.

  if (!$dbh) { $dbh = "20"; }

 

  //Set Day Box Width

  //If no value is passed, then default to mini calendar settings.

  if (!$dbw) { $dbw = "25"; }

 

  //Set Weekday Box Height

  //If no value is passed, then default to mini calendar settings.

  if (!$wbh) { $wbh = "0"; }

 

  //Set to NOT mark Today

  if (!$mt) { $mt = 0; }

  //Calendar Title Options

  //********************

  if (!$ctfs) { $ctfs = 16; }  //Set Font Size

  if (!$ctfw) { $ctfw = "bold"; }  //Set Font Weight

  if (!$ctfc) { $ctfc = "#0099cc"; } //Set Font Color

  if (!$ctbc) { $ctbc = ""; }  //Set Cell Background Color

  if (!$ctal) { $ctal = "center"; }  //Set Alignment

 

  //Normal Day Options

  //********************

  if (!$ndfs) { $ndfs = 10; }  //Font Size

  if (!$ndfc) { $ndfc = "#009966"; } //Font Color

  if (!$ndbc) { $ndbc = "#ECF8FF"; } //Background Color

  if (!$ndal) { $ndal = "center"; }  //Text Alignment

  if (!$ndva) { $ndva = "middle"; }  //Vertical Alignment

  //Mark Day Options

  //********************

  if (!$mdfc) { $mdfc = "#ffffff"; } //Font Color

  if (!$mdbc) { $mdbc = "#FF9900"; } //Background Color

 

  //Blank Day Options

  //********************

  if (!$bdbc) { $bdbc = "#ffffff"; } //Background Color

 

  //Weekday Title Options

  //********************

  if (!$wtfs) { $wtfs = 10; }  //Font Size

  if (!$wtfc) { $wtfc = "#0099cc"; } //Font Color

  if (!$wtbc) { $wtbc = "#FFFFE8"; } //Background Color

  if (!$wtal) { $wtal = "center"; }  //Text Alignment

  if (!$wtva) { $wtva = "middle"; }  //Vertical Alignment

 

?>

<html>

 

<head>

<style type="text/css">

<!--

.CalendarTitle {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: <?php print $ctfs; ?>px;

font-weight: <?php print $ctfw; ?>;

color: <?php print $ctfc; ?>;

background-color: <?php print $ctbc; ?>;

text-align: <?php print $ctal; ?>;

}

.NormalDay {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: <?php print $ndfs; ?>px;

color: <?php print $ndfc; ?>;

background-color: <?php print $ndbc; ?>;

text-align: <?php print $ndal; ?>;

vertical-align: <?php print $ndva; ?>;

}

.MarkDay {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: <?php print $ndfs; ?>px;

color: <?php print $mdfc; ?>;

background-color: <?php print $mdbc; ?>;

text-align: <?php print $ndal; ?>;

vertical-align: <?php print $ndva; ?>;

}

.BlankDay {

background-color: <?php print $bdbc; ?>;

}

.WeekdayTitle {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: <?php print $wtfs; ?>px;

color: <?php print $wtfc; ?>;

background-color: <?php print $wtbc; ?>;

text-align: <?php print $wtal; ?>;

vertical-align: <?php print $wtva; ?>;

}

-->

</style>

</head>

<body>

<table border="<?php print $tbd; ?>" cellpadding="<?php print $tcp; ?>" cellspacing="<?php print $tcs; ?>" width="<?php print $dbw * 7; ?>">

    <tr>

      <td class="CalendarTitle">

<?php

print "$month[$current_month] $current_year";

?>

      </td>

    </tr>

  </table>

  <table border="<?php print $tbd; ?>" cellpadding="<?php print $tcp; ?>" cellspacing="<?php print $tcs; ?>" width="<?php print $dbw * 7; ?>">

   

  <tr>

    <?php

  //Loop through days of the week and display the short names above the columns in the calendar

  for ($i=0;$i<7;$i++) {

    print "      <td width=\"$dbw\" height=\"$wbh\" class=\"WeekdayTitle\">$week[$i]</td>\n";

  }

?>

  </tr>

  <?php

  //Set the day counter to the first day, 1.

  $day_counter = 1;

  //This line continues running the loop until all the days of the month have been displayed.

  while($day_counter <= $days_in_month) {

    print "  <tr>\n";

    //Loop through the days of the week to display each day number.

    for($i = 0; $i < 7; $i++) {

      //This line makes sure that a day should be drawn on this particular calendar spot.

  //To draw a day for this spot, there must be one of two cases true:

  // 1 - The day counter is still within the amount of days for this month and the first

  //day is not set to 0 and the first day is set to this spot.

  // 2 - The day counter is still within the amount of days for this month and the first

  //day is equal to 0.

  if ((($day_counter <= $days_in_month) && ($first_day != 0) && ($first_day == $i)) || (($day_counter <= $days_in_month) && ($first_day == 0))) {

        //check to see if the current day counter is today's day

  if (($day_counter == $current_day) && (!$mt)) {

        print "      <td width=\"$dbw\" height=\"$dbh\" class=\"MarkDay\">$day_counter</td>\n";

  }

  else {

        print "      <td width=\"$dbw\" height=\"$dbh\" class=\"NormalDay\">$day_counter</td>\n";

  }

        //Resetting first_day tells us that the first day of the month has already been drawn.

        $first_day = 0;

        $day_counter++;

      }

      else {

    //No day number should be drawn on this calendar spot, therefore draw a blank spot.

        print "      <td width=\"$dbw\" height=\"$dbh\" class=\"BlankDay\">&nbsp;</td>\n";

      }

    }

    print "  </tr>\n";

  }

?>

</table>

</body>

</html>

como faco pra colocar um link para ir no próximo mes?

OBRIGADO

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...