• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP getDaysInMonth函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getDaysInMonth函数的典型用法代码示例。如果您正苦于以下问题:PHP getDaysInMonth函数的具体用法?PHP getDaysInMonth怎么用?PHP getDaysInMonth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getDaysInMonth函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: cal

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;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:47,代码来源:admin_config_calend2.php


示例2: slctDate

function slctDate()
{
    db_connect();
    #check what we have permission to
    $get_perm = "SELECT payroll_groups FROM users WHERE username = '{$_SESSION['USER_NAME']}' LIMIT 1";
    $run_perm = db_exec($get_perm) or errDie("Unable to get payroll groups permission information.");
    if (pg_numrows($run_perm) > 0) {
        $parr = pg_fetch_array($run_perm);
        if (strlen($parr['payroll_groups']) > 0) {
            $pay_grps = explode(",", $parr['payroll_groups']);
            if (is_array($pay_grps)) {
                $egsearch = " AND (emp_group = '" . implode("' OR emp_group = '", $pay_grps) . "')";
            }
        } else {
            $egsearch = "AND false";
        }
    }
    $sql = "SELECT enum,empnum, sname, fnames FROM employees WHERE div = '" . USER_DIV . "' {$egsearch} ORDER BY sname";
    $empRslt = db_exec($sql) or errDie("Unable to select employees from database.");
    if (pg_numrows($empRslt) < 1) {
        //	return "No employees found in database.<p>"
        //		.mkQuickLinks();
    }
    $employees = array("0" => "All");
    while ($d = pg_fetch_array($empRslt)) {
        $employees[$d["empnum"]] = "{$d['sname']}, {$d['fnames']} ({$d['enum']})";
    }
    $fields = array("empnum" => 0, "from_year" => DATE_YEAR, "from_month" => DATE_MONTH, "from_day" => 1, "to_year" => DATE_YEAR, "to_month" => DATE_MONTH, "to_day" => getDaysInMonth(DATE_MONTH, DATE_YEAR));
    foreach ($fields as $fname => $dflt) {
        if (!isset(${$fname})) {
            ${$fname} = $dflt;
        }
    }
    $OUT = "\n\t\t<h3>Select date range to view</h3>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<input type='hidden' name='key' value='slip'>\n\t\t\t<tr>\n\t\t\t\t<th>Employee</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center'>" . extlib_cpsel("empnum", $employees, $empnum) . "</td>\n\t\t\t</tr>\n\t\t\t<tr><th colspan='2'>Date Range</th></tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center'  colspan='2'>\n\t\t\t\t\t" . mkDateSelect("from", $from_year, $from_month, $from_day) . "\n\t\t\t\t\t&nbsp;&nbsp;&nbsp;TO&nbsp;&nbsp;&nbsp;\n\t\t\t\t\t" . mkDateSelect("to", $to_year, $to_month, $to_day) . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' align='right'><input type='submit' value='View &raquo;'></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>" . mkQuickLinks();
    return $OUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:36,代码来源:payslipsr.php


示例3: afterLastDayInMonth

function afterLastDayInMonth($curYear, $year, $month, $day)
{
    $days_in_month = getDaysInMonth($month);
    for ($i = $days_in_month; $i > $days_in_month - 8; $i--) {
        if (date("D", mktime(0, 0, 0, $month, $i)) == $day) {
            $last_day = $i;
            break;
        }
    }
    $curDay = gmdate("d");
    $curMonth = gmdate("m");
    $curHour = gmdate("H");
    $cur_stamp = mktime($curHour, 0, 0, $curMonth, $curDay, $curYear);
    $last_day_stamp = mktime(1, 0, 0, $month, $last_day, $year);
    if ($cur_stamp >= $last_day_stamp) {
        return true;
    }
    return false;
}
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:19,代码来源:timezone.inc.php


示例4: foreach

$catFirstChildren = $oCat->getFirstChildren($cat_id);
foreach ($catFirstChildren as $value) {
    $tabCat["{$value}"] = $oCat->getAllChildren($value);
}
// initialisation du tabeau pour le total de chaque année
foreach ($catFirstChildren as $value) {
    $name = $oCat->getName($value);
    $cat_fils_annee["{$name}"] = 0;
    // total pour l'année
}
// Boucle sur les mois
$cat_fils_mois_max = 0;
for ($i = 1; $i <= 12; $i++) {
    // Initialisation
    $date_debut = mktime(0, 0, 0, "{$i}", '01', '2008');
    $day = getDaysInMonth($i, 2008);
    $date_fin = mktime(0, 0, 0, "{$i}", "{$day}", '2008');
    foreach ($catFirstChildren as $value) {
        $name = $oCat->getName($value);
        $cat_fils_mois["{$name}"][$i] = 0;
    }
    $cat_annee[$i] = 0;
    $query = "SELECT * FROM transactions WHERE\r\n            date >= {$date_debut} AND\r\n            date <= {$date_fin}";
    $result = $mysql->query($query);
    while ($line = mysql_fetch_assoc($result)) {
        extract($line);
        if ($valeur > 0) {
            continue;
        }
        $valeur *= -1;
        foreach ($catFirstChildren as $value) {
开发者ID:relisher,项目名称:logiciel_de_compte,代码行数:31,代码来源:statsCompte.php


示例5: generateMonthView_small

function generateMonthView_small($month, $year, $view_diary)
{
    global $_GET;
    $OUTPUT = "\r\n\t\t<table width=190 cellspacing=0>\r\n\t\t\t<tr>\r\n\t\t\t\t<td height=20 align=center " . TMPL_calSmallMonthTitleStyle . "\r\n\t\t\t\t\t\tonClick='document.location.href=\"" . SELF . "?key=month&month={$month}&year={$year}\"'>\r\n\t\t\t\t\t<b>" . getMonthText($month) . " {$year}</b>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td align=center " . TMPL_calSmallMonthBodyStyle . ">";
    // generate the titles of the weekdays
    $OUTPUT .= "\r\n\t\t\t<table width='184' cellspacing=0>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td width=23>&nbsp;</td>\r\n\t\t\t\t\t<td width=23 align=center><b>M</b></td>\r\n\t\t\t\t\t<td width=23 align=center><b>T</b></td>\r\n\t\t\t\t\t<td width=23 align=center><b>W</b></td>\r\n\t\t\t\t\t<td width=23 align=center><b>T</b></td>\r\n\t\t\t\t\t<td width=23 align=center><b>F</b></td>\r\n\t\t\t\t\t<td width=23 align=center bgcolor=" . TMPL_calFillSaturday . "><b>S</b></td>\r\n\t\t\t\t\t<td width=23 align=center bgcolor=" . TMPL_calFillSunday . "><b>S</b></td>\r\n\t\t\t\t</tr>";
    // get the weekday number of the first of this month
    $first_wd = getWeekdayNum(1, $month, $year);
    // the following code will generate the first entries on the calendar, which is for the previous month (if any)
    // month and year of previous month
    if ($month == 1) {
        $tmp_month = 12;
        $tmp_year = $year - 1;
    } else {
        $tmp_month = $month - 1;
        $tmp_year = $year;
    }
    // date of last monday in previous month (where the entries will start)
    if ($first_wd > 1) {
        $tmp_day = getDaysInMonth($tmp_month, $tmp_year) - ($first_wd - 2);
    } else {
        $tmp_day = 1;
        $tmp_month = $month;
        $tmp_year = $year;
    }
    // create a view variables
    $selected_month = $_GET["month"];
    // create the previous month's entries
    $c_weeknum = getWeekNumber($tmp_day, $tmp_month, $tmp_year);
    $selected_weeknum = getWeekNumber($_GET["mday"], $_GET["month"], $_GET["year"]);
    // if today's week number = the current generated week's number, hightlight the row, as so with the selected week,
    if ($c_weeknum == getTodayWeekNumber() && $tmp_year == date("Y") && $month == date("m") || getTodayWeekNumber() == 0 && $month == date("m") && $year == date("Y")) {
        // today's week
        $OUTPUT .= "<tr bgcolor='" . TMPL_calSmallMonthCurrentWeek . "'>";
        $ROW_COLORED = 1;
    } else {
        if ($month == $_GET["month"] && $c_weeknum == $selected_weeknum && $month == $_GET["month"] || $c_weeknum == 52 && $selected_weeknum == 0) {
            // selected week, the last check is for the first week in jan
            $OUTPUT .= "<tr bgcolor='" . TMPL_calSmallMonthSelectedWeek . "'>";
            $ROW_COLORED = 1;
        } else {
            // other dates
            $OUTPUT .= "<tr>";
            $ROW_COLORED = 0;
        }
    }
    if ($first_wd != 1) {
        // only if there is a day in this week of previous month, print the week number
        $OUTPUT .= "<td width=23 " . TMPL_calSmallMonthWeekNumberStyle . " align=center>{$c_weeknum}</td>";
    }
    for ($c_wd = 1; $c_wd < $first_wd; $c_wd++, $tmp_day++) {
        // fill differently for saturday and sunday (only when row wasn't already highlighted)
        if ($c_wd == 6 && !$ROW_COLORED) {
            $dayfill = "bgcolor=" . TMPL_calFillSaturday;
        } else {
            if ($c_wd == 7) {
                $dayfill = "bgcolor=" . TMPL_calFillSunday;
            } else {
                $dayfill = "";
            }
        }
        $OUTPUT .= "<td {$dayfill} width=23 align=center>\r\n\t\t\t\t\t\t\t<a id='calSmallMonthOMLink' href='" . SELF . "?mday={$tmp_day}&month={$tmp_month}&year={$tmp_year}'>{$tmp_day}</a>\r\n\t\t\t\t\t\t</td>";
    }
    // start creating this month's entries
    $cm_days = getDaysInMonth($month, $year);
    for ($c_day = 1; $c_day <= $cm_days; $c_day++) {
        $c_weeknum = getWeekNumber($c_day, $month, $year);
        if ($c_wd == 1) {
            // start a new row (it's MONDAY!!!!!)
            // if today's week number = the current generated week's number, hightlight the row, as so with the selected week
            if ($c_weeknum == getTodayWeekNumber() && $year == date("Y") && $month == date("m")) {
                // today's week
                $OUTPUT .= "<tr bgcolor='" . TMPL_calSmallMonthCurrentWeek . "'>";
                $ROW_COLORED = 1;
            } else {
                if ($month == $_GET["month"] && $c_weeknum == $selected_weeknum) {
                    // selected week
                    $OUTPUT .= "<tr bgcolor='" . TMPL_calSmallMonthSelectedWeek . "'>";
                    $ROW_COLORED = 1;
                } else {
                    // other dates
                    $OUTPUT .= "<tr>";
                    $ROW_COLORED = 0;
                }
            }
            // attach the week number
            $OUTPUT .= "<td align=center width=23 " . TMPL_calSmallMonthWeekNumberStyle . ">{$c_weeknum}</td>";
        }
        // change the fill color if it it 2day's date we are printing, or the selected date
        if ($c_day == $_GET["mday"] && $month == $_GET["month"] && $year == $_GET["year"]) {
            // selected date
            $dayfill = "bgcolor=" . TMPL_calSmallMonthSelectedDay;
            $a_id = "calSmallMonthCMLinkSelected";
        } else {
            if (date("d") == $c_day && date("m") == $month && date("Y") == $year) {
                // 2day's date
                $dayfill = "bgcolor=" . TMPL_calSmallMonthCurrentDay;
                $a_id = "calSmallMonthCMLinkToday";
            } else {
                // other dates
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:diary-day.php


示例6: generateMonthView_large

function generateMonthView_large($month, $year, $view_diary)
{
    global $_GET;
    $valid_date = mktime(0, 0, 0, $month, 1, $year);
    $month = date("m", $valid_date);
    $year = date("Y", $valid_date);
    $select_month = "<select name=month>";
    for ($i = 1; $i <= 12; $i++) {
        if ($month == $i) {
            $sel = "selected";
        } else {
            $sel = "";
        }
        $select_month .= "<option {$sel} value='{$i}'>" . getMonthText($i) . "</option>";
    }
    $select_month .= "</select>";
    $select_year = "<select name=year>";
    for ($i = 1971; $i <= 2028; $i++) {
        if ($year == $i) {
            $sel = "selected";
        } else {
            $sel = "";
        }
        $select_year .= "<option {$sel} value={$i}>{$i}</option>";
    }
    $select_year .= "</select>";
    $OUTPUT = "\r\n\t<table width=600 cellspacing=0>\r\n\t<tr>\r\n\t\t<td align=center style='font-size: 14px; color: #ffffff; font-weight: bold;' colspan=3>\r\n\t\t\t<form method=post action='" . SELF . "'>\r\n\t\t\t<input type=hidden name=key value='month'>\r\n\t\t\tGoto: {$select_month} {$select_year} <input type=submit value='Go'>\r\n\t\t\t</form>\r\n\t\t</td>\r\n\t</tr>\r\n\t<tr><td>&nbsp;</td></tr>\r\n        <tr>\r\n        \t<td colspan=3 " . TMPL_calTimeStyle2 . ">\r\n        \t<table width=100%><tr>\r\n        \t<td width=30% align=center valign=middle>\r\n        \t\t<a href='" . SELF . "?key=month&month=" . ($month - 1) . "&year={$year}&view_diary={$view_diary}'>\r\n        \t\t\t<img src='left_day.gif' border=0>\r\n\t\t\t</a>\r\n\t\t</td>\r\n\t\t<td width=40% valign=middle align=center " . TMPL_calTimeStyleHeader . ">\r\n\t\t\t<b>" . getMonthText($month) . " {$year}</b>\r\n\t\t</td>\r\n\t\t<td width=30% align=center valign=middle>\r\n\t\t\t<a href='" . SELF . "?key=month&month=" . ($month + 1) . "&year={$year}&view_diary={$view_diary}'>\r\n\t\t\t\t<img src='right_day.gif' border=0>\r\n\t\t\t</a>\r\n\t\t</td>\r\n\t\t</tr></table>\r\n\t\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td align=center " . TMPL_calLargeMonthBodyStyle . " colspan=3>\r\n\t\t<table width='600' cellspacing=0>\r\n\t\t<tr>\r\n\t\t\t<td width=75 height=60>&nbsp;</td>\r\n\t\t\t<td width=75 height=60 align=center><h1>M</h1></td>\r\n\t\t\t<td width=75 height=60 align=center><h1>T</h1></td>\r\n\t\t\t<td width=75 height=60 align=center><h1>W</h1></td>\r\n\t\t\t<td width=75 height=60 align=center><h1>T</h1></td>\r\n\t\t\t<td width=75 height=60 align=center><h1>F</h1></td>\r\n\t\t\t<td width=75 height=60 align=center bgcolor=" . TMPL_calFillSaturday . "><h1>S</h1></td>\r\n\t\t\t<td width=75 height=60 align=center bgcolor=" . TMPL_calFillSunday . "><h1>S</h1></td>\r\n\t\t</tr>";
    // get the weekday number of the first of this month
    $first_wd = getWeekdayNum(1, $month, $year);
    // the following code will generate the first entries on the calendar, which is for the previous month (if any)
    // and year of previous month
    if ($month == 1) {
        $tmp_month = 12;
        $tmp_year = $year - 1;
    } else {
        $tmp_month = $month - 1;
        $tmp_year = $year;
    }
    // date of last monday in previous month (where the entries will start)
    if ($first_wd > 1) {
        $tmp_day = getDaysInMonth($tmp_month, $tmp_year) - ($first_wd - 2);
    } else {
        $tmp_day = 1;
        $tmp_month = $month;
        $tmp_year = $year;
    }
    // create a view variables
    $selected_month = $_GET["month"];
    // create the previous month's entries
    $c_weeknum = getWeekNumber($tmp_day, $tmp_month, $tmp_year);
    $selected_weeknum = getWeekNumber($_GET["mday"], $_GET["month"], $_GET["year"]);
    $OUTPUT .= "<tr>";
    if ($first_wd != 1) {
        // only if there is a day in this week of previous month, print the week number
        $OUTPUT .= "<td width=75 height=60 " . TMPL_calLargeMonthWeekNumberStyle . " align=center>{$c_weeknum}</td>";
    }
    for ($c_wd = 1; $c_wd < $first_wd; $c_wd++, $tmp_day++) {
        // fill differently for saturday and sunday (only when row wasn't already highlighted)
        if ($c_wd == 6) {
            $dayfill = "bgcolor=" . TMPL_calFillSaturday;
        } else {
            if ($c_wd == 7) {
                $dayfill = "bgcolor=" . TMPL_calFillSunday;
            } else {
                $dayfill = "";
            }
        }
        $OUTPUT .= "<td {$dayfill} width=75 style='border-bottom: 1px solid #000000;' height=60 align=center>\r\n\t\t\t\t<a id='calSmallMonthOMLink' href='" . SELF . "?mday={$tmp_day}&month={$tmp_month}&year={$tmp_year}'>{$tmp_day}</a>\r\n\t\t\t</td>";
    }
    // start creating this month's entries
    $cm_days = getDaysInMonth($month, $year);
    for ($c_day = 1; $c_day <= $cm_days; $c_day++) {
        $c_weeknum = getWeekNumber($c_day, $month, $year);
        if ($c_wd == 1) {
            // start a new row (it's MONDAY!!!!!)
            $OUTPUT .= "<tr>";
            // attach the week number
            $OUTPUT .= "<td align=center width=75 height=60 " . TMPL_calLargeMonthWeekNumberStyle . ">{$c_weeknum}</td>";
        }
        // change the fill color if it is 2day's date we are printing, or the selected date
        if (date("d") == $c_day && date("m") == $month && date("Y") == $year) {
            // 2day's date
            $dayfill = "bgcolor=" . TMPL_calLargeMonthSelectedDay;
            $a_id = "calSmallMonthCMLinkToday";
        } else {
            // other dates
            // fill differently for saturday and sunday (only when the row has not already been colored)
            if ($c_weeknum == getTodayWeekNumber() && $year == date("Y") && $month == date("m")) {
                $dayfill = "bgcolor='" . TMPL_calLargeMonthCurrentWeek . "'";
            } else {
                if ($c_wd == 6) {
                    $dayfill = "bgcolor=" . TMPL_calFillSaturday;
                } else {
                    if ($c_wd == 7) {
                        $dayfill = "bgcolor=" . TMPL_calFillSunday;
                    } else {
                        $dayfill = "";
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:diary-month.php


示例7: cal3

function cal3($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" . getWeekNumber($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;
}
开发者ID:nicolas-san,项目名称:GRRV4,代码行数:88,代码来源:admin_config_calend3.php


示例8: getHTML

    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++;
            }
//.........这里部分代码省略.........
开发者ID:rhertzog,项目名称:lcs,代码行数:101,代码来源:mincals.inc.php


示例9: cal

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 = ucfirst(utf8_strftime("%B", $date));
    $s .= '<table class="table calendar2">' . PHP_EOL;
    $s .= '<tr>' . PHP_EOL;
    $s .= '<td class="calendarHeader2" colspan="8">' . $monthName . ' ' . $year . '</td>' . PHP_EOL;
    $s .= '</tr>' . PHP_EOL;
    $d = 1 - $first;
    $is_ligne1 = 'y';
    while ($d <= $daysInMonth) {
        $s .= '<tr>' . PHP_EOL;
        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' . getWeekNumber($temp) . '</b></td>' . PHP_EOL;
            }
            $s .= '<td class="calendar2" align="center" valign="top">' . PHP_EOL;
            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 . "_calendar WHERE day='{$temp}'");
                $s .= '<br><input type="checkbox" name="' . $temp . '" value="' . $nameday . '" ';
                if (!($day < 0)) {
                    $s .= 'checked="checked" ';
                }
                $s .= '/>';
            } else {
                $s .= " ";
            }
            $s .= '</td>' . PHP_EOL;
            $d++;
        }
        $s .= '</tr>' . PHP_EOL;
        $is_ligne1 = 'n';
    }
    $s .= '</table>' . PHP_EOL;
    return $s;
}
开发者ID:JeromeDevome,项目名称:GRR,代码行数:51,代码来源:functions.inc.php


示例10: generateMonthView_small_mail

function generateMonthView_small_mail($view_diary)
{
    global $_GET;
    extract($_GET);
    $pyear = extractYear(mkdatet($year - 1, $month, 1));
    $pmonth = extractMonth(mkdatet($year, $month - 1, 1));
    $nyear = extractYear(mkdatet($year + 1, $month, 1));
    $nmonth = extractMonth(mkdatet($year, $month + 1, 1));
    $OUTPUT = "\n\t\t<table width=190 cellspacing=0>\n\t\t\t<tr>\n\t\t\t\t<td height=20 align=center " . TMPL_calSmallMonthTitleStyle . ">\n\t\t\t\t\t<a href='" . SELF . "?month={$month}&year={$pyear}'><img border='0' src='left_year.gif'></a>\n\t\t\t\t\t<a href='" . SELF . "?month={$pmonth}&year={$year}'><img border='0' src='left_month.gif'></a>\n\t\t\t\t\t<b><a class='month_text' href='javascript:ajaxLink(\"iframe.php\", \"script=diary-index.php&key=month&month={$month}&year={$year}\");'>" . getMonthName($month) . " {$year}</a></b>\n\t\t\t\t\t<a href='" . SELF . "?month={$nmonth}&year={$year}'><img border='0' src='right_month.gif'></a>\n\t\t\t\t\t<a href='" . SELF . "?month={$month}&year={$nyear}'><img border='0' src='right_year.gif'></a>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td align=center " . TMPL_calSmallMonthBodyStyle . " colspan='5'>";
    // generate the titles of the weekdays
    $OUTPUT .= "\n\t\t\t<table width='184' cellspacing=0>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width=23>&nbsp;</td>\n\t\t\t\t\t<td width=23 align=center><b>M</b></td>\n\t\t\t\t\t<td width=23 align=center><b>T</b></td>\n\t\t\t\t\t<td width=23 align=center><b>W</b></td>\n\t\t\t\t\t<td width=23 align=center><b>T</b></td>\n\t\t\t\t\t<td width=23 align=center><b>F</b></td>\n\t\t\t\t\t<td width=23 align=center bgcolor=" . TMPL_calFillSaturday . "><b>S</b></td>\n\t\t\t\t\t<td width=23 align=center bgcolor=" . TMPL_calFillSunday . "><b>S</b></td>\n\t\t\t\t</tr>";
    // get the weekday number of the first of this month
    $first_wd = getWeekdayNum(1, $month, $year);
    // the following code will generate the first entries on the calendar, which is for the previous month (if any)
    // month and year of previous month
    if ($month == 1) {
        $tmp_month = 12;
        $tmp_year = $year - 1;
    } else {
        $tmp_month = $month - 1;
        $tmp_year = $year;
    }
    // date of last monday in previous month (where the entries will start)
    if ($first_wd > 1) {
        $tmp_day = getDaysInMonth($tmp_month, $tmp_year) - ($first_wd - 2);
    } else {
        $tmp_day = 1;
        $tmp_month = $month;
        $tmp_year = $year;
    }
    // create a view variables
    $selected_month = $smonth;
    // create the previous month's entries
    $c_weeknum = getWeekNumber($tmp_day, $tmp_month, $tmp_year);
    $selected_weeknum = getWeekNumber($sday, $smonth, $syear);
    // if today's week number = the current generated week's number, hightlight the row, as so with the selected week,
    if ($c_weeknum == getTodayWeekNumber() && $tmp_year == date("Y") && $month == date("m") || getTodayWeekNumber() == 0 && $month == date("m") && $year == date("Y")) {
        // today's week
        $OUTPUT .= "<tr bgcolor='" . TMPL_calSmallMonthCurrentWeek . "'>";
        $ROW_COLORED = 1;
    } else {
        if ($month == $smonth && $c_weeknum == $selected_weeknum || $c_weeknum == 52 && $selected_weeknum == 0) {
            // selected week, the last check is for the first week in jan
            $OUTPUT .= "<tr bgcolor='" . TMPL_calSmallMonthSelectedWeek . "'>";
            $ROW_COLORED = 1;
        } else {
            // other dates
            $OUTPUT .= "<tr>";
            $ROW_COLORED = 0;
        }
    }
    if ($first_wd != 1) {
        // only if there is a day in this week of previous month, print the week number
        $OUTPUT .= "<td width=23 " . TMPL_calSmallMonthWeekNumberStyle . " align=center>{$c_weeknum}</td>";
    }
    for ($c_wd = 1; $c_wd < $first_wd; $c_wd++, $tmp_day++) {
        // fill differently for saturday and sunday (only when row wasn't already highlighted)
        if ($c_wd == 6 && !$ROW_COLORED) {
            $dayfill = "bgcolor=" . TMPL_calFillSaturday;
        } else {
            if ($c_wd == 7) {
                $dayfill = "bgcolor=" . TMPL_calFillSunday;
            } else {
                $dayfill = "";
            }
        }
        //		** 2006-05-08 **
        // 		$OUTPUT.="<td $dayfill width=23 align=center>
        // 							<a id='calSmallMonthOMLink' href='#' onClick='parent.rightframe.document.location.href=\"diary-index.php?mday=$tmp_day&month=$tmp_month&year=$tmp_year\"'>$tmp_day</a>
        // 						</td>";
        $OUTPUT .= "<td {$dayfill} width='23' align='center'>\n\t\t\t<a id='calSmallMonthOMLink' href='javascript:ajaxLink(\"iframe.php\", \"script=diary-index.php&mday={$tmp_day}&month={$tmp_month}&year={$tmp_year}\");'>{$tmp_day}</a></td>";
    }
    // start creating this month's entries
    $cm_days = getDaysInMonth($month, $year);
    for ($c_day = 1; $c_day <= $cm_days; $c_day++) {
        $c_weeknum = getWeekNumber($c_day, $month, $year);
        if ($c_wd == 1) {
            // start a new row (it's MONDAY!!!!!)
            // if today's week number = the current generated week's number, hightlight the row, as so with the selected week
            if ($c_weeknum == getTodayWeekNumber() && $year == date("Y") && $month == date("m")) {
                // today's week
                $OUTPUT .= "<tr bgcolor='" . TMPL_calSmallMonthCurrentWeek . "'>";
                $ROW_COLORED = 1;
            } else {
                if ($month == $smonth && $c_weeknum == $selected_weeknum) {
                    // selected week
                    $OUTPUT .= "<tr bgcolor='" . TMPL_calSmallMonthSelectedWeek . "'>";
                    $ROW_COLORED = 1;
                } else {
                    // other dates
                    $OUTPUT .= "<tr>";
                    $ROW_COLORED = 0;
                }
            }
            // attach the week number
            $OUTPUT .= "<td align=center width=23 " . TMPL_calSmallMonthWeekNumberStyle . ">{$c_weeknum}</td>";
        }
        // change the fill color if it it 2day's date we are printing, or the selected date
        if ($c_day == $sday && $month == $smonth && $year == $syear) {
            // selected date
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:index.php


示例11: getHoliday

/**
 * 祝日テーブルを作成
 * @param	int $year  西暦年(計算開始年)
 * @return	string 祝日の名称/FALSE=祝日ではない
*/
function getHoliday($year)
{
    static $youbi = array('日', '月', '火', '水', '木', '金', '土', '日');
    if ($year == FALSE) {
        return '';
    }
    $holidays = array();
    $flag = FALSE;
    //Google Calendar APIを使って祝日を取得
    for ($yyyy = $year; $yyyy < $year + 3; $yyyy++) {
        $n = getHoliday_by_Google($yyyy, $holidays);
        if ($n > 0) {
            $flag = TRUE;
        }
        if (!$flag) {
            break;
        }
    }
    if ($flag) {
        $msg = "<table border=\"1\">\n";
        for ($yyyy = $year; $yyyy < $year + 3; $yyyy++) {
            $cnt = 1;
            $msg .= sprintf("<tr><td colspan=\"3\">%04d年</td></tr>\n", $yyyy);
            for ($month = 1; $month <= 12; $month++) {
                $day_of_month = getDaysInMonth($yyyy, $month);
                for ($day = 1; $day <= $day_of_month; $day++) {
                    $key = sprintf("%04d-%02d-%02d", $year, $month, $day);
                    $name = isset($holidays[$key]) ? $holidays[$key] : FALSE;
                    $ww = getWeekNumber($yyyy, $month, $day);
                    if ($name != FALSE) {
                        $msg .= sprintf("<tr><td>%02d</td><td>%02d月%02d日(%s)</td><td>%s</td></tr>\n", $cnt, $month, $day, $youbi[$ww], $name);
                        $cnt++;
                    }
                }
            }
        }
        $msg .= "</table>\n";
    } else {
        $msg = 'error > Google Calendar APIから祝日を取得できません.';
    }
    return $msg;
}
开发者ID:aim-web-projects,项目名称:ann-cosme,代码行数:47,代码来源:getHolidayGoogle.php


示例12: display

function display($_POST)
{
    extract($_POST);
    global $PRDMON;
    #determine the date range based on period selection
    if (isset($year_to_process)) {
        switch ($year_to_process) {
            case "active":
                $fdate_year = getYearOfFinPrd(1);
                $fdate_month = $PRDMON[1];
                $fdate_day = "1";
                $tdate_year = getYearOfFinPrd(12);
                $tdate_month = $PRDMON[12];
                $tdate_day = date("d", mktime(0, 0, 0, $PRDMON[12] + 1, 0, $tdate_year));
                break;
            case "previous":
                $fdate_year = getYearOfFinPrd(1) - 1;
                $fdate_month = $PRDMON[1];
                $fdate_day = "1";
                $tdate_year = getYearOfFinPrd(12) - 1;
                $tdate_month = $PRDMON[12];
                $tdate_day = date("d", mktime(0, 0, 0, $PRDMON[12] + 1, 0, $tdate_year));
                break;
            default:
                $fdate_year = get 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getDb函数代码示例发布时间:2022-05-15
下一篇:
PHP getDatetime函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap