[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] api/class.prefs.php, 1.1.1.1.2.15
From: |
nomail |
Subject: |
[Phpgroupware-cvs] api/class.prefs.php, 1.1.1.1.2.15 |
Date: |
Fri, 14 May 2004 08:01:54 +0200 |
Update of /api
Modified Files:
Branch: proposal-branch
class.prefs.php
date: 2004/05/14 06:01:54; author: jengo; state: Exp; lines: +45 -3
Log Message:
Added a helper function for working with date inputs, javascript and normal
=====================================================================
Index: api/class.prefs.php
diff -u api/class.prefs.php:1.1.1.1.2.14 api/class.prefs.php:1.1.1.1.2.15
--- api/class.prefs.php:1.1.1.1.2.14 Fri Apr 23 07:03:13 2004
+++ api/class.prefs.php Fri May 14 06:01:54 2004
@@ -26,7 +26,7 @@
class api_prefs
{
- var $data = Array();
+ var $data = array();
var $account_id;
var $loaded_api = false;
@@ -37,7 +37,7 @@
$args = $args->get(func_get_args());
$this->account_id = $args['account_id'];
-
+
/* all required defaults can be set here */
$this->data['phpgw_default']['api.skin'] =
'default';
$this->data['phpgw_default']['api.lang'] =
'en';
@@ -53,6 +53,7 @@
function __wakeup()
{
+
}
function set()
@@ -291,4 +292,45 @@
return $name;
}
+ // FIXME: This presently only works with the javascript
calendar *AND*
+ // if the format is "%B %e, %Y"
+ function _read_form_date()
+ {
+ $args = new safe_args();
+ $args->set('date',REQUIRED,'any');
+ $args->set('time',array(),'any');
+ extract($args->get(func_get_args()));
+
+ if (! strlen($time['hour'])
+ || ! strlen($time['minute'])
+ || ! strlen($time['ap'])
+ || ! strlen($date))
+ {
+ return false;
+ }
+
+ if ($time['ap'] == 'pm')
+ {
+ $time['hour'] += 12;
+ }
+
+ // FIXME: The following parsing blows, replace with
something that
+ // makes sense
+ for ($i=1;$i<13;$i++)
+ {
+
$months[strftime('%B',mktime($time['hour'],$time['minute'],0,$i,1,2004))] = $i;
+ }
+
+ $date = ereg_replace(',','',$date);
+ list($month,$day,$year) = explode(" ",$date);
+
+ $timestamp =
mktime($time['hour'],$time['minute'],0,$months[$month],$day,$year);
+ if (! $timestamp)
+ {
+ // Should this be a notice instead ? (jengo)
+ trigger_error(lang('Invalid
date'),E_USER_WARNING);
+ }
+
+ return $timestamp;
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] api/class.prefs.php, 1.1.1.1.2.15,
nomail <=