示例#1
0
 function create_archive_nav_menu($arr)
 {
     // start the html
     $html = '<div id="archmenuWP">';
     $html .= '<ul class="archlev1 archmenu_list_years" id="archmenu">';
     $years = array_keys($arr);
     foreach ($years as $y) {
         $html .= '<li id="archmenu_li_y_' . $y . '">';
         $html .= make_link($y . ' (' . $arr[$y]['count'] . ')', make_url($y . '/'));
         $html .= '<span class="archmenu_ty archToggleButton" id="archmenu_ty_' . $y . '">+</span>';
         // handle clicks with JS
         $html .= '</li>';
         unset($arr[$y]['count']);
         $months = array_keys($arr[$y]);
         $html .= '<ul class="archlev2 archmenu_list_months hidden" id="archmenu_y_' . $y . '">';
         foreach ($months as $m) {
             $html .= '<li id="archmenu_li_y_' . $y . '_m_' . $m . '">';
             $html .= make_link(monthname($m) . ' (' . $arr[$y][$m]['count'] . ')', make_url($y . '/' . $m . '/'));
             $html .= '<span class="archmenu_tm archToggleButton" id="archmenu_ty_' . $y . '_tm_' . $m . '">+</span>';
             // handle clicks with JS
             $html .= '</li>';
             unset($arr[$y][$m]['count']);
             $entries = $arr[$y][$m];
             $html .= '<ul class="archlev3 archmenu_list_titles hidden" id="archmenu_y_' . $y . '_m_' . $m . '">';
             foreach ($entries as $id => $entry) {
                 $html .= '<li id="archmenu_li_id_' . $id . '">';
                 $html .= make_link($entry['title'], make_url($id));
                 $html .= '</li>';
             }
             $html .= '</ul>';
         }
         $html .= '</ul>';
     }
     $html .= '</ul></div>';
     return $html;
 }
示例#2
0
文件: jdf.php 项目: tavakkoli/tehlug
function jdate($type, $maket = "now")
{
    //set 1 if you want translate number to farsi or if you don't like set 0
    //$transnumber = 0;
    ///chosse your timezone
    $TZhours = 3;
    $TZminute = 30;
    $need = "";
    $result1 = "";
    $result = "";
    if ($maket == "now") {
        $year = date("Y");
        $month = date("m");
        $day = date("d");
        list($jyear, $jmonth, $jday) = gregorian_to_jalali($year, $month, $day);
        $maket = mktime(date("H") + $TZhours, date("i") + $TZminute, date("s"), date("m"), date("d"), date("Y"));
    } else {
        //$maket=0;
        $maket += $TZhours * 3600 + $TZminute * 60;
        $date = date("Y-m-d", $maket);
        list($year, $month, $day) = preg_split('/-/', $date);
        list($jyear, $jmonth, $jday) = gregorian_to_jalali($year, $month, $day);
    }
    $need = $maket;
    $year = date("Y", $need);
    $month = date("m", $need);
    $day = date("d", $need);
    $i = 0;
    $subtype = "";
    $subtypetemp = "";
    list($jyear, $jmonth, $jday) = gregorian_to_jalali($year, $month, $day);
    while ($i < strlen($type)) {
        $subtype = substr($type, $i, 1);
        if ($subtypetemp == "\\") {
            $result .= $subtype;
            $i++;
            continue;
        }
        switch ($subtype) {
            case "A":
                $result1 = date("a", $need);
                if ($result1 == "pm") {
                    $result .= "&#1576;&#1593;&#1583;&#1575;&#1586;&#1592;&#1607;&#1585;";
                } else {
                    $result .= "&#1602;&#1576;&#1604;&#8207;&#1575;&#1586;&#1592;&#1607;&#1585;";
                }
                break;
            case "a":
                $result1 = date("a", $need);
                if ($result1 == "pm") {
                    $result .= "&#1576;&#46;&#1592;";
                } else {
                    $result .= "&#1602;&#46;&#1592;";
                }
                break;
            case "d":
                if ($jday < 10) {
                    $result1 = "0" . $jday;
                } else {
                    $result1 = $jday;
                }
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "D":
                $result1 = date("D", $need);
                if ($result1 == "Thu") {
                    $result1 = "&#1662;";
                } else {
                    if ($result1 == "Sat") {
                        $result1 = "&#1588;";
                    } else {
                        if ($result1 == "Sun") {
                            $result1 = "&#1609;";
                        } else {
                            if ($result1 == "Mon") {
                                $result1 = "&#1583;";
                            } else {
                                if ($result1 == "Tue") {
                                    $result1 = "&#1587;";
                                } else {
                                    if ($result1 == "Wed") {
                                        $result1 = "&#1670;";
                                    } else {
                                        if ($result1 == "Thu") {
                                            $result1 = "&#1662;";
                                        } else {
                                            if ($result1 == "Fri") {
                                                $result1 = "&#1580;";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $result .= $result1;
                break;
            case "F":
                $result .= monthname($jmonth);
                break;
            case "g":
                $result1 = date("g", $need);
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "G":
                $result1 = date("G", $need);
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "h":
                $result1 = date("h", $need);
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "H":
                $result1 = date("H", $need);
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "i":
                $result1 = date("i", $need);
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "j":
                $result1 = $jday;
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "l":
                $result1 = date("l", $need);
                if ($result1 == "Saturday") {
                    $result1 = "شنبه";
                } else {
                    if ($result1 == "Sunday") {
                        $result1 = "یک‌شنبه";
                    } else {
                        if ($result1 == "Monday") {
                            $result1 = "دو‌شنبه";
                        } else {
                            if ($result1 == "Tuesday") {
                                $result1 = "سه‌شنبه";
                            } else {
                                if ($result1 == "Wednesday") {
                                    $result1 = "جهار‌شنبه";
                                } else {
                                    if ($result1 == "Thursday") {
                                        $result1 = "پنج‌شنبه";
                                    } else {
                                        if ($result1 == "Friday") {
                                            $result1 = "جمعه";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $result .= $result1;
                break;
            case "m":
                if ($jmonth < 10) {
                    $result1 = "0" . $jmonth;
                } else {
                    $result1 = $jmonth;
                }
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "M":
                $result .= short_monthname($jmonth);
                break;
            case "n":
                $result1 = $jmonth;
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "s":
                $result1 = date("s", $need);
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "S":
                $result .= "";
                break;
            case "t":
                $result .= lastday($month, $day, $year);
                break;
            case "w":
                $result1 = date("w", $need);
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "y":
                $result1 = substr($jyear, 2, 4);
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "Y":
                $result1 = $jyear;
                if ($transnumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "U":
                $result .= mktime();
                break;
            case "Z":
                $result .= days_of_year($jmonth, $jday, $jyear);
                break;
            case "L":
                list($tmp_year, $tmp_month, $tmp_day) = jalali_to_gregorian(1384, 12, 1);
                echo $tmp_day;
                /*if(lastday($tmp_month,$tmp_day,$tmp_year)=="31")
                			$result.="1";
                		else
                			$result.="0";
                			*/
                break;
            default:
                $result .= $subtype;
        }
        $subtypetemp = substr($type, $i, 1);
        $i++;
    }
    return $result;
}
示例#3
0
    $hodnota_stravenky = 70;
} else {
    $hodnota_stravenky = 80;
}
?>

<div class="content">
<h1>
Stravenky
</h1>

<h2>
Výdej stravenek a odečet ze mzdy
-
<?php 
echo monthname($_GET["month"]) . " " . $_GET["year"];
?>
</h2>

<table class="maxwidth">
<tr>
	<th>jméno</th>
	<th>vydat stravenek</th>
	<th>celková hodnota (<?php 
echo $hodnota_stravenky;
?>
Kč/ks)</th>
	<th>příspěvek zaměstnance (45%)</th>
	<th>převzal</th>
</tr>
<?php 
 function jdate($type, $maket = "now")
 {
     $result = "";
     if ($maket == "now") {
         $year = date("Y");
         $month = date("m");
         $day = date("d");
         list($jyear, $jmonth, $jday) = JalaliCalendar::gregorian_to_jalali($year, $month, $day);
         $maket = JalaliCalendar::jmaketime(date("h") + _JDF_TZhours, date("i") + _JDF_TZminute, date("s"), $jmonth, $jday, $jyear);
     } else {
         $maket += _JDF_TZhours * 3600 + _JDF_TZminute * 60;
         $date = date("Y-m-d", $maket);
         list($year, $month, $day) = preg_split('/-/', $date);
         list($jyear, $jmonth, $jday) = JalaliCalendar::gregorian_to_jalali($year, $month, $day);
     }
     $need = $maket;
     $year = date("Y", $need);
     $month = date("m", $need);
     $day = date("d", $need);
     $i = 0;
     while ($i < strlen($type)) {
         $subtype = substr($type, $i, 1);
         switch ($subtype) {
             case "A":
                 $result1 = date("a", $need);
                 if ($result1 == "pm") {
                     $result .= _JDF_PM_LONG;
                 } else {
                     $result .= _JDF_AM_LONG;
                 }
                 break;
             case "a":
                 $result1 = date("a", $need);
                 if ($result1 == "pm") {
                     $result .= _JDF_PM_SHORT;
                 } else {
                     $result .= _JDF_AM_SHORT;
                 }
                 break;
             case "d":
                 list($jyear, $jmonth, $jday) = JalaliCalendar::gregorian_to_jalali($year, $month, $day);
                 if ($jday < 10) {
                     $result1 = "0" . $jday;
                 } else {
                     $result1 = $jday;
                 }
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "D":
                 $result1 = date("D", $need);
                 if ($result1 == "Sat") {
                     $result1 = _JDF_Sat_SHORT;
                 } else {
                     if ($result1 == "Sun") {
                         $result1 = _JDF_Sun_SHORT;
                     } else {
                         if ($result1 == "Mon") {
                             $result1 = _JDF_Mon_SHORT;
                         } else {
                             if ($result1 == "Tue") {
                                 $result1 = _JDF_Tue_SHORT;
                             } else {
                                 if ($result1 == "Wed") {
                                     $result1 = _JDF_Wed_SHORT;
                                 } else {
                                     if ($result1 == "Thu") {
                                         $result1 = _JDF_Thu_SHORT;
                                     } else {
                                         if ($result1 == "Fri") {
                                             $result1 = _JDF_Fri_SHORT;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 $result .= $result1;
                 break;
             case "F":
                 list($jyear, $jmonth, $jday) = JalaliCalendar::gregorian_to_jalali($year, $month, $day);
                 $result .= monthname($jmonth);
                 break;
             case "g":
                 $result1 = date("g", $need);
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "G":
                 $result1 = date("G", $need);
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "h":
                 $result1 = date("h", $need);
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "H":
                 $result1 = date("H", $need);
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "i":
                 $result1 = date("i", $need);
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "j":
                 list($jyear, $jmonth, $jday) = JalaliCalendar::gregorian_to_jalali($year, $month, $day);
                 $result1 = $jday;
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "l":
                 $result1 = date("l", $need);
                 if ($result1 == "Saturday") {
                     $result1 = _JDF_Sat_LONG;
                 } else {
                     if ($result1 == "Sunday") {
                         $result1 = _JDF_Sun_LONG;
                     } else {
                         if ($result1 == "Monday") {
                             $result1 = _JDF_Mon_LONG;
                         } else {
                             if ($result1 == "Tuesday") {
                                 $result1 = _JDF_Tue_LONG;
                             } else {
                                 if ($result1 == "Wednesday") {
                                     $result1 = _JDF_Wed_LONG;
                                 } else {
                                     if ($result1 == "Thursday") {
                                         $result1 = _JDF_Thu_LONG;
                                     } else {
                                         if ($result1 == "Friday") {
                                             $result1 = _JDF_Fri_LONG;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 $result .= $result1;
                 break;
             case "m":
                 list($jyear, $jmonth, $jday) = JalaliCalendar::gregorian_to_jalali($year, $month, $day);
                 if ($jmonth < 10) {
                     $result1 = "0" . $jmonth;
                 } else {
                     $result1 = $jmonth;
                 }
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "M":
                 list($jyear, $jmonth, $jday) = JalaliCalendar::gregorian_to_jalali($year, $month, $day);
                 $result .= monthname($jmonth);
                 break;
             case "n":
                 list($jyear, $jmonth, $jday) = JalaliCalendar::gregorian_to_jalali($year, $month, $day);
                 $result1 = $jmonth;
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "s":
                 $result1 = date("s", $need);
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "S":
                 $result .= _JDF_Suffix;
                 break;
             case "t":
                 $result .= JalaliCalendar::lastday($month, $day, $year);
                 break;
             case "w":
                 $result1 = date("w", $need);
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "y":
                 list($jyear, $jmonth, $jday) = JalaliCalendar::gregorian_to_jalali($year, $month, $day);
                 $result1 = substr($jyear, 2, 4);
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             case "Y":
                 list($jyear, $jmonth, $jday) = JalaliCalendar::gregorian_to_jalali($year, $month, $day);
                 $result1 = $jyear;
                 if (_JDF_USE_PERSIANNUM) {
                     $result .= JalaliCalendar::Convertnumber2farsi($result1);
                 } else {
                     $result .= $result1;
                 }
                 break;
             default:
                 $result .= $subtype;
         }
         $i++;
     }
     return $result;
 }
示例#5
0
function mds_date($format, $when = "now", $persianNumber = 0)
{
    ///chosse your timezone
    $TZhours = 0;
    $TZminute = 0;
    $need = "";
    $result1 = "";
    $result = "";
    if ($when == "now") {
        $year = date("Y");
        $month = date("m");
        $day = date("d");
        list($Dyear, $Dmonth, $Dday) = gregorian_to_mds($year, $month, $day);
        $when = mktime(date("H") + $TZhours, date("i") + $TZminute, date("s"), date("m"), date("d"), date("Y"));
    } else {
        //$when=0;
        $when += $TZhours * 3600 + $TZminute * 60;
        $date = date("Y-m-d", $when);
        list($year, $month, $day) = preg_split('/-/', $date);
        list($Dyear, $Dmonth, $Dday) = gregorian_to_mds($year, $month, $day);
    }
    $need = $when;
    $year = date("Y", $need);
    $month = date("m", $need);
    $day = date("d", $need);
    $i = 0;
    $subtype = "";
    $subtypetemp = "";
    list($Dyear, $Dmonth, $Dday) = gregorian_to_mds($year, $month, $day);
    while ($i < strlen($format)) {
        $subtype = substr($format, $i, 1);
        if ($subtypetemp == "\\") {
            $result .= $subtype;
            $i++;
            continue;
        }
        switch ($subtype) {
            case "A":
                $result1 = date("a", $need);
                if ($result1 == "pm") {
                    $result .= "&#1576;&#1593;&#1583;&#1575;&#1586;&#1592;&#1607;&#1585;";
                } else {
                    $result .= "&#1602;&#1576;&#1604;&#8207;&#1575;&#1586;&#1592;&#1607;&#1585;";
                }
                break;
            case "a":
                $result1 = date("a", $need);
                if ($result1 == "pm") {
                    $result .= "&#1576;&#46;&#1592;";
                } else {
                    $result .= "&#1602;&#46;&#1592;";
                }
                break;
            case "d":
                if ($Dday < 10) {
                    $result1 = "0" . $Dday;
                } else {
                    $result1 = $Dday;
                }
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "D":
                $result1 = date("D", $need);
                if ($result1 == "Thu") {
                    $result1 = "&#1662;";
                } else {
                    if ($result1 == "Sat") {
                        $result1 = "&#1588;";
                    } else {
                        if ($result1 == "Sun") {
                            $result1 = "&#1609;";
                        } else {
                            if ($result1 == "Mon") {
                                $result1 = "&#1583;";
                            } else {
                                if ($result1 == "Tue") {
                                    $result1 = "&#1587;";
                                } else {
                                    if ($result1 == "Wed") {
                                        $result1 = "&#1670;";
                                    } else {
                                        if ($result1 == "Thu") {
                                            $result1 = "&#1662;";
                                        } else {
                                            if ($result1 == "Fri") {
                                                $result1 = "&#1580;";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $result .= $result1;
                break;
            case "F":
                $result .= monthname($Dmonth);
                break;
            case "g":
                $result1 = date("g", $need);
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "G":
                $result1 = date("G", $need);
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "h":
                $result1 = date("h", $need);
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "H":
                $result1 = date("H", $need);
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "i":
                $result1 = date("i", $need);
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "j":
                $result1 = $Dday;
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "l":
                $result1 = date("l", $need);
                if ($result1 == "Saturday") {
                    $result1 = "&#1588;&#1606;&#1576;&#1607;";
                } else {
                    if ($result1 == "Sunday") {
                        $result1 = "&#1610;&#1603;&#1588;&#1606;&#1576;&#1607;";
                    } else {
                        if ($result1 == "Monday") {
                            $result1 = "&#1583;&#1608;&#1588;&#1606;&#1576;&#1607;";
                        } else {
                            if ($result1 == "Tuesday") {
                                $result1 = "&#1587;&#1607;&#32;&#1588;&#1606;&#1576;&#1607;";
                            } else {
                                if ($result1 == "Wednesday") {
                                    $result1 = "&#1670;&#1607;&#1575;&#1585;&#1588;&#1606;&#1576;&#1607;";
                                } else {
                                    if ($result1 == "Thursday") {
                                        $result1 = "&#1662;&#1606;&#1580;&#1588;&#1606;&#1576;&#1607;";
                                    } else {
                                        if ($result1 == "Friday") {
                                            $result1 = "&#1580;&#1605;&#1593;&#1607;";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $result .= $result1;
                break;
            case "m":
                if ($Dmonth < 10) {
                    $result1 = "0" . $Dmonth;
                } else {
                    $result1 = $Dmonth;
                }
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "M":
                $result .= short_monthname($Dmonth);
                break;
            case "n":
                $result1 = $Dmonth;
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "s":
                $result1 = date("s", $need);
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "S":
                $result .= "&#1575;&#1605;";
                break;
            case "t":
                $result .= lastday($month, $day, $year);
                break;
            case "w":
                $result1 = date("w", $need);
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "y":
                $result1 = substr($Dyear, 2, 4);
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "Y":
                $result1 = $Dyear;
                if ($persianNumber == 1) {
                    $result .= Convertnumber2farsi($result1);
                } else {
                    $result .= $result1;
                }
                break;
            case "U":
                $result .= mktime();
                break;
            case "Z":
                $result .= days_of_year($Dmonth, $Dday, $Dyear);
                break;
            case "L":
                list($tmp_year, $tmp_month, $tmp_day) = mds_to_gregorian(1384, 12, 1);
                echo $tmp_day;
                /*if(lastday($tmp_month,$tmp_day,$tmp_year)=="31")
                			$result.="1";
                		else
                			$result.="0";
                			*/
                break;
            default:
                $result .= $subtype;
        }
        $subtypetemp = substr($format, $i, 1);
        $i++;
    }
    return $result;
}
示例#6
0
$year = date("Y");
//if we are overriding the current date lets set $day, $month, and $year here.
if (isset($HTTP_GET_VARS['month']) && is_numeric($HTTP_GET_VARS['month'])) {
    $month = $HTTP_GET_VARS['month'];
} else {
    $month = date("m");
}
if (isset($HTTP_GET_VARS['year']) && $HTTP_GET_VARS['year']) {
    $year = $HTTP_GET_VARS['year'];
} else {
    $year = date("Y");
}
//now lets find out what day of the week the first of the month is , and how many days are in the month.
$daysinmonth = daysinmonth($month, $year) . "\r\n";
$firstofmonth = dayofweek($month, "01", $year);
$monthname = monthname($month);
// lets padd the content for the week before the first.
//-----------------------------------------------------------------------------
//---the code below may be converted to a function and placed in calendar.inc.php
//-----------------------------------------------------------------------------
$i = 0;
//lets calculate the month and day for next month
$nextmonth = $month + 1;
$nextyear = $year;
$prevmonth = $month - 1;
$prevyear = $year;
if ($nextmonth > 12) {
    $nextmonth = 1;
    $nextyear += 1;
}
if ($prevmonth < 1) {
示例#7
0
function parse_date($time) {
   $yr = substr($time, 0, 4);
   $mo = substr($time, 5, 2);
   $da = substr($time, 8, 2);
   $month = monthname($mo);

   return "$da $month $yr ";
}
示例#8
0
function listevents()
{
    global $list_prefix;
    $EVENTS = "<select name='deletelist'>\r\n";
    $count = 0;
    //now we will list weekly events
    $sql = "SELECT * FROM " . $list_prefix . "calendar WHERE `weekly` < '7';";
    $result = db_query($sql);
    if ($result) {
        $rows = db_num_rows($result);
    } else {
        $rows = 0;
    }
    if ($rows > 0) {
        $i = 0;
        while ($i < $rows) {
            $row = db_fetch_array($result);
            //calculate the time
            $time = $row['time'];
            $hour = $time[0] . $time[1];
            $min = $time[2] . $time[3];
            if ($hour < 12) {
                //we are in the am.
                if ($hour == 0) {
                    $hour = "12";
                }
                $time = $hour . ":" . $min . "am";
            } else {
                //we are in the pm
                $hour -= 12;
                if ($hour == 0) {
                    $hour = "12";
                }
                $time = $hour . ":" . $min . "pm";
            }
            $EVENTS .= "<option value='" . $row['id'] . "'>" . day_name($row['weekly']) . " at " . $time . "</option>\r\n";
            $count++;
            $i++;
        }
    }
    //we will do the monthly events
    $sql = "SELECT * FROM " . $list_prefix . "calendar WHERE `monthly` NOT LIKE '';";
    $result = db_query($sql);
    if ($result) {
        $rows = db_num_rows($result);
    } else {
        $rows = 0;
    }
    if ($rows > 0) {
        $i = 0;
        while ($i < $rows) {
            $row = db_fetch_array($result);
            //calculate the time
            $time = $row['time'];
            $hour = $time[0] . $time[1];
            $min = $time[2] . $time[3];
            if ($hour < 12) {
                //we are in the am.
                if ($hour == 0) {
                    $hour = "12";
                }
                $time = $hour . ":" . $min . "am";
            } else {
                //we are in the pm
                $hour -= 12;
                if ($hour == 0) {
                    $hour = "12";
                }
                $time = $hour . ":" . $min . "pm";
            }
            $EVENTS .= "<option value='" . $row['id'] . "'>Monthly on the " . $row['monthly'] . " at " . $time . "</option>\r\n";
            $count++;
            $i++;
        }
    }
    //we will do yearly events
    $sql = "SELECT * FROM " . $list_prefix . "calendar WHERE `yearly` NOT LIKE '';";
    $result = db_query($sql);
    if ($result) {
        $rows = db_num_rows($result);
    } else {
        $rows = 0;
    }
    if ($rows > 0) {
        $i = 0;
        while ($i < $rows) {
            $row = db_fetch_array($result);
            //calculate the time
            $time = $row['time'];
            $hour = $time[0] . $time[1];
            $min = $time[2] . $time[3];
            if ($hour < 12) {
                //we are in the am.
                if ($hour == 0) {
                    $hour = "12";
                }
                $time = $hour . ":" . $min . "am";
            } else {
                //we are in the pm
                $hour -= 12;
                if ($hour == 0) {
                    $hour = "12";
                }
                $time = $hour . ":" . $min . "pm";
            }
            $t = $row['yearly'];
            $t = monthname($t[0] . $t[1]) . " " . $t[2] . $t[3];
            $EVENTS .= "<option value='" . $row['id'] . "'>Yearly on " . $t . " at " . $time . "</option>\r\n";
            $count++;
            $i++;
        }
    }
    //now we will work scheduled events
    $sql = "SELECT * FROM " . $list_prefix . "calendar WHERE `date` NOT LIKE '';";
    $result = db_query($sql);
    if ($result) {
        $rows = db_num_rows($result);
    } else {
        $rows = 0;
    }
    if ($rows > 0) {
        $i = 0;
        while ($i < $rows) {
            $row = db_fetch_array($result);
            //calculate the time
            $time = $row['time'];
            $hour = $time[0] . $time[1];
            $min = $time[2] . $time[3];
            if ($hour < 12) {
                //we are in the am.
                if ($hour == 0) {
                    $hour = "12";
                }
                $time = $hour . ":" . $min . "am";
            } else {
                //we are in the pm
                $hour -= 12;
                if ($hour == 0) {
                    $hour = "12";
                }
                $time = $hour . ":" . $min . "pm";
            }
            $t = $row['date'];
            $t = monthname($t[4] . $t[5]) . " " . $t[6] . $t[7] . ", " . $t[0] . $t[1] . $t[2] . $t[3];
            $EVENTS .= "<option value='" . $row['id'] . "'>" . $t . " at " . $time . "</option>\r\n";
            $count++;
            $i++;
        }
    }
    if ($count == 0) {
        $EVENTS .= "<option value='-'>Nothing to delete</option>\r\n";
    }
    $EVENTS .= "</select>";
    return $EVENTS;
}