Example #1
0
function cal($month, $year)
{
    global $weekstarts, $display_day;
    $display_day="1111111";
    if (!isset($weekstarts)) $weekstarts = 0;
    $s = "";
    $daysInMonth = getDaysInMonth($month, $year);
    $date = mktime(12, 0, 0, $month, 1, $year);
    $first = (strftime("%w",$date) + 7 - $weekstarts) % 7;
    $monthName = utf8_strftime("%B",$date);
    $s .= "<table class=\"calendar2\" border=\"1\" cellspacing=\"3\">\n";
    $s .= "<tr>\n";
    $s .= "<td class=\"calendarHeader2\" colspan=\"7\">$monthName&nbsp;$year</td>\n";
    $s .= "</tr>\n";
    $d = 1 - $first;
    $is_ligne1 = 'y';
    while ($d <= $daysInMonth)
    {
        $s .= "<tr>\n";
        for ($i = 0; $i < 7; $i++)
        {
            $basetime = mktime(12,0,0,6,11+$weekstarts,2000);
            $show = $basetime + ($i * 24 * 60 * 60);
            $nameday = utf8_strftime('%A',$show);
            $temp = mktime(0,0,0,$month,$d,$year);
            if ($i==0) $s .= "<td class=\"calendar2\" style=\"vertical-align:bottom;\"><b>S".numero_semaine($temp)."</b></td>\n";
            $s .= "<td class=\"calendar2\" align=\"center\" valign=\"top\">";
            if ($is_ligne1 == 'y') $s .=  '<b>'.ucfirst(substr($nameday,0,1)).'</b><br />';
            if ($d > 0 && $d <= $daysInMonth)
            {
                $s .= $d;
                $day = grr_sql_query1("SELECT day FROM ".TABLE_PREFIX."_calendrier_jours_cycle WHERE day='$temp'");
                $s .= "<br /><input type=\"checkbox\" name=\"$temp\" value=\"$nameday\" ";
                if (!($day < 0)) $s .= "checked=\"checked\" ";
                $s .= " />";
            } else {
                $s .= "&nbsp;";
            }
            $s .= "</td>\n";
            $d++;
        }
        $s .= "</tr>\n";
        $is_ligne1 = 'n';
    }
    $s .= "</table>\n";
    return $s;
}
Example #2
0
    function getHTML()
    {
        global $weekstarts, $vocab, $type_month_all, $display_day, $nb_display_day;
        // Calcul de la date courante
        $date_today = mktime(12, 0, 0, $this->month, $this->day, $this->year);
        // Calcul du numéro de semaine courante
        $week_today = numero_semaine($date_today);
        if (!isset($weekstarts)) $weekstarts = 0;
        $s = "";
        $daysInMonth = getDaysInMonth($this->month, $this->year);
        // Calcul de la date au 1er du mois de la date courante
        $date = mktime(12, 0, 0, $this->month, 1, $this->year);
        $first = (strftime("%w",$date) + 7 - $weekstarts) % 7;
        $monthName = utf8_strftime("%B",$date);
        $prevMonth = $this->getCalendarLink($this->month - 1 >   0 ? $this->month - 1 : 12, $this->month - 1 >   0 ? $this->year : $this->year - 1);
        $nextMonth = $this->getCalendarLink($this->month + 1 <= 12 ? $this->month + 1 :  1, $this->month + 1 <= 12 ? $this->year : $this->year + 1);
        $s .= "<table border = \"0\" class=\"calendar\">\n";
        $s .= "<tr><td></td>\n";
        if (($this->h) and (($this->dmy=='month') or ($this->dmy=='month_all') or ($this->dmy=='month_all2') )) $bg_lign = "week"; else $bg_lign = 'calendarHeader';
        $s .= "<td align=\"center\" valign=\"top\" class=\"$bg_lign\" colspan=\"".$nb_display_day."\">";
            #Permet de récupérer le numéro de la 1ere semaine affichée par le mini calendrier.
//            $week = number_format(strftime("%W",$date),0);
            $week = numero_semaine($date);
   			$weekd = $week;
        // on ajoute un lien vers le mois précédent
        if ($this->mois_precedent == 1) {
          $tmp = mktime(0, 0, 0, ($this->month)-1, 1, $this->year);
          $lastmonth = date("m",$tmp);
          $lastyear= date("Y",$tmp);
          if (($this->dmy!='day') and ($this->dmy!='week_all') and ($this->dmy!='month_all') and ($this->dmy!='month_all2'))
           $s .= "<a title=\"".grr_htmlSpecialChars(get_vocab("see_month_for_this_room"))."\" href=\"month.php?year=$lastyear&amp;month=$lastmonth&amp;day=1&amp;area=$this->area&amp;room=$this->room\">&lt;&lt;</a>&nbsp;&nbsp;&nbsp;";
          else
           $s .= "<a title=\"".grr_htmlSpecialChars(get_vocab("see_all_the_rooms_for_the_month"))."\" href=\"".$type_month_all.".php?year=$lastyear&amp;month=$lastmonth&amp;day=1&amp;area=$this->area\">&lt;&lt;</a>&nbsp;&nbsp;&nbsp;";
        }

            if (($this->dmy!='day') and ($this->dmy!='week_all') and ($this->dmy!='month_all') and ($this->dmy!='month_all2'))
         $s .= "<a title=\"".grr_htmlSpecialChars(get_vocab("see_month_for_this_room"))."\" href=\"month.php?year=$this->year&amp;month=$this->month&amp;day=1&amp;area=$this->area&amp;room=$this->room\">$monthName&nbsp;$this->year</a>";
            else
         $s .= "<a title=\"".grr_htmlSpecialChars(get_vocab("see_all_the_rooms_for_the_month"))."\" href=\"".$type_month_all.".php?year=$this->year&amp;month=$this->month&amp;day=1&amp;area=$this->area\">$monthName&nbsp;$this->year</a>";
        // on ajoute un lien vers le mois suivant
        if ($this->mois_suivant == 1) {
          $tmp = mktime(0, 0, 0, ($this->month)+1, 1, $this->year);
          $nextmonth = date("m",$tmp);
          $nextyear= date("Y",$tmp);
          if (($this->dmy!='day') and ($this->dmy!='week_all') and ($this->dmy!='month_all') and ($this->dmy!='month_all2'))
           $s .= "&nbsp;&nbsp;&nbsp;<a title=\"".grr_htmlSpecialChars(get_vocab("see_month_for_this_room"))."\" href=\"month.php?year=$nextyear&amp;month=$nextmonth&amp;day=1&amp;area=$this->area&amp;room=$this->room\">&gt;&gt;</a>";
          else
           $s .= "&nbsp;&nbsp;&nbsp;<a title=\"".grr_htmlSpecialChars(get_vocab("see_all_the_rooms_for_the_month"))."\" href=\"".$type_month_all.".php?year=$nextyear&amp;month=$nextmonth&amp;day=1&amp;area=$this->area\">&gt;&gt;</a>";
        }
        $s .= "</td>\n";
        $s .= "</tr>\n";
        $s .= "<tr><td></td>\n";
        $s .= getFirstDays();
        $s .= "</tr>\n";
        $d = 1 - $first;
        $temp = 1;
        while ($d <= $daysInMonth)
        {
//            if (($date_today <= $date) and ($this->h) and (($this->dmy=='week_all') or ($this->dmy=='week') )) $bg_lign = " class=\"week\""; else $bg_lign = '';
            if (($week_today == $week) and ($this->h) and (($this->dmy=='week_all') or ($this->dmy=='week') )) $bg_lign = " class=\"week\""; else $bg_lign = '';
            $s .= "<tr ".$bg_lign."><td class=\"calendarcol1\" align=\"right\" valign=\"top\">";
            #Affichage du numéro de la semaine en cours à droite du calendrier et génère un lien sur la semaine voulue.
            if (($this->dmy!='day') and ($this->dmy!='week_all') and ($this->dmy!='month_all') and ($this->dmy!='month_all2'))
               $s .="<a title=\"".grr_htmlSpecialChars(get_vocab("see_week_for_this_room"))."\" href=\"week.php?year=$this->year&amp;month=$this->month&amp;day=$temp&amp;area=$this->area&amp;room=$this->room\">s".sprintf("%02d",$week)."</a>";
            else
                $s .="<a title=\"".grr_htmlSpecialChars(get_vocab("see_week_for_this_area"))."\" href=\"week_all.php?year=$this->year&amp;month=$this->month&amp;day=$temp&amp;area=$this->area\">s".sprintf("%02d",$week)."</a>";
            $temp=$temp+7;
            while ((!checkdate($this->month, $temp, $this->year)) and ($temp > 0))  $temp--;


            #Nouveau affichage, affiche le numéro de la semaine dans l'année.Incrémentation de ce numéro à chaque nouvelle semaine.
            $date = mktime(12, 0, 0, $this->month, $temp, $this->year);
            $week = numero_semaine($date);

            $s .= "</td>\n";
            for ($i = 0; $i < 7; $i++)
            {
                $j = ($i + 7 + $weekstarts) % 7;
                if ($display_day[$j] == "1") {// début condition "on n'affiche pas tous les jours de la semaine"
				if (($this->dmy == 'day') and ($d == $this->day) and ($this->h))
					$s .= "<td class=\"week\" align=\"right\" valign=\"top\">";
				else
	                $s .= "<td class=\"calendar\" align=\"right\" valign=\"top\">";
                if ($d > 0 && $d <= $daysInMonth)
                {
                    $link = $this->getDateLink($d, $this->month, $this->year);
                    if ($link == "")
                        $s .= $d;
                        #Permet de colorer la date affichée sur la page
                    elseif (($d == $this->day) and ($this->h))
                        $s .= $link."><span class=\"cal_current_day\">$d</span></a>";
                    else
                        $s .= $link.">$d</a>";
                }
                else
                    $s .= "&nbsp;";
                  $s .= "</td>\n";
                }// fin condition "on n'affiche pas tous les jours de la semaine"
                $d++;
            }
            $s .= "</tr>\n";
        }
        if ($week-$weekd<6) $s .= "<tr><td>&nbsp;</td></tr>";
        $s .= "</table>\n";
        return $s;
    }
Example #3
0
function cal($month, $year)
{
    global $weekstarts;
    if (!isset($weekstarts)) $weekstarts = 0;
    $s = "";
    $daysInMonth = getDaysInMonth($month, $year);
    $date = mktime(12, 0, 0, $month, 1, $year);
    $first = (strftime("%w",$date) + 7 - $weekstarts) % 7;
    $monthName = utf8_strftime("%B",$date);
    $s .= "<table class=\"calendar2\" border=\"1\" cellspacing=\"2\">\n";
    $s .= "<tr>\n";
    $s .= "<td class=\"calendarHeader2\" colspan=\"8\">$monthName&nbsp;$year</td>\n";
    $s .= "</tr>\n";
    $d = 1 - $first;
    $is_ligne1 = 'y';
    while ($d <= $daysInMonth)
    {
        $s .= "<tr>\n";
        for ($i = 0; $i < 7; $i++)
        {
            $basetime = mktime(12,0,0,6,11+$weekstarts,2000);
            $show = $basetime + ($i * 24 * 60 * 60);
            $nameday = utf8_strftime('%A',$show);
            $temp = mktime(0,0,0,$month,$d,$year);
            if ($i==0) $s .= "<td class=\"calendar2\" style=\"vertical-align:bottom;\"><b>S".numero_semaine($temp)."</b></td>\n";
            if ($d > 0 && $d <= $daysInMonth)
            {
                $temp = mktime(0,0,0,$month,$d,$year);
                $day = grr_sql_query1("SELECT day FROM ".TABLE_PREFIX."_calendrier_jours_cycle WHERE day='$temp'");
                $jour = grr_sql_query1("SELECT Jours FROM ".TABLE_PREFIX."_calendrier_jours_cycle WHERE DAY='$temp'");
				        if (intval($jour)>0) {
                  $alt=get_vocab('jour_cycle')." ".$jour;
                  $jour=ucfirst(substr(get_vocab("rep_type_6"),0,1)).$jour;
                } else {
                  $alt=get_vocab('jour_cycle').' '.$jour;
                  if (strlen($jour)>5)
                    $jour = substr($jour,0,3)."..";
                }
                if (!isset($_GET["pview"]))
                    if (($day < 0))
                        $s .= "<td class=\"calendar2\" valign=\"top\" style=\"background-color:#FF8585\">";
                    else
                        $s .= "<td class=\"calendar2\" valign=\"top\" style=\"background-color:#C0FF82\">";
                else
                    $s .= "<td style=\"text-align:center;\" valign=\"top\">";
                if ($is_ligne1 == 'y') $s .=  '<b>'.ucfirst(substr($nameday,0,1)).'</b><br />';
                $s .= "<b>".$d."</b>";
                // Pour aller checher la date ainsi que son Jour cycle
                $s .= "<br />";
                if (isset($_GET["pview"])) {
                    if (($day < 0))
                        $s .= "<img src=\"img_grr/stop.png\" class=\"image\" width=\"16\" height=\"16\" alt=\"no\"/>";
                    else
                        $s .= "<span class=\"jour-cycle\">".$jour."</span>";
                } else {
                    if (($day < 0))
                        $s .= "<a href=\"admin_calend_jour_cycle.php?page_calend=3&amp;date=".$temp."\"><img src=\"img_grr/stop.png\" class=\"image\" alt=\"(aucun)\"  width=\"16\" height=\"16\" /></a>";
                    else
                        $s .= "<a class=\"jour-cycle\" href=\"admin_calend_jour_cycle.php?page_calend=3&amp;date=".$temp."\" title=\"".$alt."\" >".$jour."</a>";
                }

            } else {
                if (!isset($_GET["pview"]))
                    $s .= "<td class=\"calendar2\" valign=\"top\">";
                else
                    $s .= "<td style=\"text-align:center;\" valign=\"top\">";
                if ($is_ligne1 == 'y') $s .=  '<b>'.ucfirst(substr($nameday,0,1)).'</b><br />';
                $s .= "&nbsp;";
            }
            $s .= "</td>\n";
            $d++;
        }
        $s .= "</tr>\n";
        $is_ligne1 = 'n';
    }
    $s .= "</table>\n";
    return $s;
}