aboutsummaryrefslogtreecommitdiffstats
path: root/include/datetime.php
diff options
context:
space:
mode:
authorTobias Diekershoff <tobias.diekershoff@gmx.net>2011-06-07 20:03:58 +0200
committerTobias Diekershoff <tobias.diekershoff@gmx.net>2011-06-07 20:03:58 +0200
commite036434b8a2dbd8594c0ac5ac7233f4700e4e475 (patch)
tree0d37048ec06d603e45fd9852f208478a89e84476 /include/datetime.php
parent0e8b2092a0c30a8eb898a8f0e7130251300e8d47 (diff)
parentc1b2e90e3720961c280f6378e48fda7bad7c3ad0 (diff)
downloadvolse-hubzilla-e036434b8a2dbd8594c0ac5ac7233f4700e4e475.tar.gz
volse-hubzilla-e036434b8a2dbd8594c0ac5ac7233f4700e4e475.tar.bz2
volse-hubzilla-e036434b8a2dbd8594c0ac5ac7233f4700e4e475.zip
Merge branch 'master' of git://github.com/friendika/friendika
Diffstat (limited to 'include/datetime.php')
-rw-r--r--include/datetime.php48
1 files changed, 41 insertions, 7 deletions
diff --git a/include/datetime.php b/include/datetime.php
index f7be5bdb1..a5b388e76 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -108,20 +108,28 @@ function datesel($pre,$ymin,$ymax,$allow_blank,$y,$m,$d) {
$o .= "<option value=\"0000\" $sel ></option>";
}
- for($x = $ymax; $x >= $ymin; $x --) {
- $sel = (($x == $y) ? " selected=\"selected\" " : "");
- $o .= "<option value=\"$x\" $sel>$x</option>";
+ if($ymax > $ymin) {
+ for($x = $ymax; $x >= $ymin; $x --) {
+ $sel = (($x == $y) ? " selected=\"selected\" " : "");
+ $o .= "<option value=\"$x\" $sel>$x</option>";
+ }
+ }
+ else {
+ for($x = $ymax; $x <= $ymin; $x ++) {
+ $sel = (($x == $y) ? " selected=\"selected\" " : "");
+ $o .= "<option value=\"$x\" $sel>$x</option>";
+ }
}
$o .= "</select> <select name=\"{$pre}month\" class=\"{$pre}month\" size=\"1\">";
- for($x = 0; $x <= 12; $x ++) {
+ for($x = (($allow_blank) ? 0 : 1); $x <= 12; $x ++) {
$sel = (($x == $m) ? " selected=\"selected\" " : "");
$y = (($x) ? $x : '');
$o .= "<option value=\"$x\" $sel>$y</option>";
}
$o .= "</select> <select name=\"{$pre}day\" class=\"{$pre}day\" size=\"1\">";
- for($x = 0; $x <= 31; $x ++) {
+ for($x = (($allow_blank) ? 0 : 1); $x <= 31; $x ++) {
$sel = (($x == $d) ? " selected=\"selected\" " : "");
$y = (($x) ? $x : '');
$o .= "<option value=\"$x\" $sel>$y</option>";
@@ -131,6 +139,32 @@ function datesel($pre,$ymin,$ymax,$allow_blank,$y,$m,$d) {
return $o;
}}
+if(! function_exists('timesel')) {
+function timesel($pre,$h,$m) {
+
+ $o = '';
+ $o .= "<select name=\"{$pre}hour\" class=\"{$pre}hour\" size=\"1\">";
+ for($x = 0; $x < 24; $x ++) {
+ $sel = (($x == $h) ? " selected=\"selected\" " : "");
+ $o .= "<option value=\"$x\" $sel>$x</option>";
+ }
+ $o .= "</select> : <select name=\"{$pre}minute\" class=\"{$pre}minute\" size=\"1\">";
+ for($x = 0; $x < 60; $x ++) {
+ $sel = (($x == $m) ? " selected=\"selected\" " : "");
+ $o .= "<option value=\"$x\" $sel>$x</option>";
+ }
+
+ $o .= "</select>";
+ return $o;
+}}
+
+
+
+
+
+
+
+
// implements "3 seconds ago" etc.
// based on $posted_date, (UTC).
// Results relative to current timezone
@@ -242,7 +276,7 @@ function get_first_dim($y,$m) {
if(! function_exists('cal')) {
-function cal($y = 0,$m = 0, $links = false) {
+function cal($y = 0,$m = 0, $links = false, $class='') {
// month table - start at 1 to match human usage.
@@ -272,7 +306,7 @@ function cal($y = 0,$m = 0, $links = false) {
$tddate = intval(datetime_convert('UTC',date_default_timezone_get(),'now','j'));
$str_month = day_translate($mtab[$m]);
- $o = '<table class="calendar">';
+ $o = '<table class="calendar' . $class . '">';
$o .= "<caption>$str_month $y</caption><tr>";
for($a = 0; $a < 7; $a ++)
$o .= '<th>' . mb_substr(day_translate($dn[$a]),0,3,'UTF-8') . '</th>';