phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] projects/inc/class.uiprojecthours.inc.php, 1.77


From: nomail
Subject: [Phpgroupware-cvs] projects/inc/class.uiprojecthours.inc.php, 1.77
Date: Mon, 21 Jun 2004 16:35:34 +0200

Update of /projects/inc
Modified Files:
        Branch: 
          class.uiprojecthours.inc.php

date: 2004/06/21 14:35:34;  author: ceb;  state: Exp;  lines: +60 -43

Log Message:
update
=====================================================================
Index: projects/inc/class.uiprojecthours.inc.php
diff -u projects/inc/class.uiprojecthours.inc.php:1.76 
projects/inc/class.uiprojecthours.inc.php:1.77
--- projects/inc/class.uiprojecthours.inc.php:1.76      Sun Jun 20 23:02:38 2004
+++ projects/inc/class.uiprojecthours.inc.php   Mon Jun 21 14:35:34 2004
@@ -7,7 +7,7 @@
        * Project Manager                                                   *
        * Written by Bettina Gille address@hidden                   *
        * -----------------------------------------------                   *
-       * Copyright 2000 - 2004 Free Software Foundation, Inc               *
+       * Copyright 2000 - 2004 Free Software Foundation, Inc.              *
        *                                                                   *
        * This program is free software; you can redistribute it and/or     *
        * modify it under the terms of the GNU General Public License as    *
@@ -529,8 +529,8 @@
                function ttracker()
                {
                        //$project_id   = 
get_var('project_id',array('POST','GET'));
-                       //$pro_main     = 
get_var('pro_main',array('POST','GET'));
-                       $values         = get_var('values',array('POST'));
+                       $sdate  = get_var('sdate',array('POST','GET'));
+                       $values = get_var('values',array('POST'));
 
                        //_debug_array($values);
 
@@ -548,10 +548,18 @@
                                }
                        }
 
+                       $jscal = CreateObject('phpgwapi.jscalendar');
+                       if(is_array($sdate))
+                       {
+                               $start_array    = 
$jscal->input2date($sdate['str']);
+                               $start_val              = $start_array['raw'];
+                       }
+
                        if($values['apply'])
                        {
-                               $values['action'] = 'apply';
+                               $values['action']       = 'apply';
                                $values['ttracker'] = True;
+                               $values['sdate']        = $start_val;
                                $error = $this->bohours->check_values($values);
                                if (is_array($error))
                                {
@@ -614,9 +622,8 @@
                        
$GLOBALS['phpgw']->template->set_var('t_journey',$values['t_journey']);
                        
$GLOBALS['phpgw']->template->set_var('surcharge_list',$this->boprojects->action_format($values['surcharge'],'charge'));
 
-                       
$GLOBALS['phpgw']->template->set_var('start_date_select',$GLOBALS['phpgw']->common->dateformatorder($this->sbox->getYears('values[syear]',$values['syear']),
-                                                                               
                                                                        
$this->sbox->getMonthText('values[smonth]',$values['smonth']),
-                                                                               
                                                                        
$this->sbox->getDays('values[sday]',$values['sday'])));
+                       $start = 
$start_val?$start_val:mktime(12,0,0,date('m'),date('d'),date('Y'));
+                       
$GLOBALS['phpgw']->template->set_var('start_date_select',$jscal->input('sdate[str]',$start));
 
                        if($this->siteconfig['accounting'] == 'activity')
                        {
@@ -881,6 +888,9 @@
                        $delivery_id    = 
get_var('delivery_id',array('POST','GET'));
                        $invoice_id             = 
get_var('invoice_id',array('POST','GET'));
 
+                       $sdate                  = 
get_var('sdate',array('POST','GET'));
+                       $edate                  = 
get_var('edate',array('POST','GET'));
+
                        if(!$referer)  //$_POST['back'] && !$_POST['done'] && 
!$_POST['edit'])
                        {
                                $referer = $_SERVER['HTTP_REFERER'];
@@ -902,10 +912,25 @@
                                'referer'               => $referer
                        );
 
+                       $jscal = CreateObject('phpgwapi.jscalendar');
+                       if(is_array($sdate))
+                       {
+                               $start_array    = 
$jscal->input2date($sdate['str']);
+                               $start_val              = $start_array['raw'];
+                       }
+
+                       if(is_array($edate))
+                       {
+                               $end_array      = 
$jscal->input2date($edate['str']);
+                               $end_val        = $end_array['raw'];
+                       }
+
                        if ($_POST['save'])
                        {
-                               $values['pro_main']             = $pro_main;
-                               $values['hours_id']             = $hours_id;
+                               $values['sdate']        = $start_val;
+                               $values['edate']        = $end_val;
+                               $values['pro_main']     = $pro_main;
+                               $values['hours_id']     = $hours_id;
                                $error = $this->bohours->check_values($values);
                                if (is_array($error))
                                {
@@ -960,44 +985,34 @@
                        if ($hours_id)
                        {
                                $values = 
$this->bohours->read_single_hours($hours_id);
-
-
-
                                $activity_id    = $values['activity_id'];
                                $pro_parent             = $values['pro_parent'];
                        }
-                       else
-                       {
-                               if(!is_array($values))
-                               {
-                                       $values['sdate_formatted'] = 
$this->bohours->hdate_format();
-                                       $values['edate_formatted'] = 
$this->bohours->hdate_format();
-                               }
-                       }
-                       
$GLOBALS['phpgw']->template->set_var('status_list',$this->status_format($values['status']));
 
-                       
$GLOBALS['phpgw']->template->set_var('start_date_select',$GLOBALS['phpgw']->common->dateformatorder($this->sbox->getYears('values[syear]',$values['sdate_formatted']['year']),
-                                                                               
                                                                        
$this->sbox->getMonthText('values[smonth]',$values['sdate_formatted']['month']),
-                                                                               
                                                                        
$this->sbox->getDays('values[sday]',$values['sdate_formatted']['day'])));
+                       $start = 
$start_val?$start_val:($values['sdate']?mktime(12,0,0,date('m',$values['sdate']),date('d',$values['sdate']),date('Y',$values['sdate'])):mktime(12,0,0,date('m'),date('d'),date('Y')));
+                       $shour  = 
$values['sdate']?date('H',$values['sdate']):date('H',time());
+                       $smin   = 
$values['sdate']?date('i',$values['sdate']):date('i',time());
+
+                       
$GLOBALS['phpgw']->template->set_var('start_date_select',$jscal->input('sdate[str]',$start));
 
                        $amsel = ' checked';
                        $pmsel = '';
 
                        if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12')
                        {
-                               if ($values['sdate_formatted']['hour'] >= 12)
+                               if ($shour >= 12)
                                {
                                        $amsel = '';
                                        $pmsel = ' checked'; 
-                                       if ($values['sdate_formatted']['hour'] 
> 12)
+                                       if ($shour > 12)
                                        {
-                                               
$values['sdate_formatted']['hour'] = $values['sdate_formatted']['hour'] - 12;
+                                               $shour = $shour - 12;
                                        }
                                }
 
-                               if ($values['sdate_formatted']['hour'] == 0)
+                               if ($shour == 0)
                                {
-                                       $values['sdate_formatted']['hour'] = 12;
+                                       $shour = 12;
                                }
 
                                $sradio = '<input type="radio" 
name="values[sampm]" value="am"' . $amsel . '>am';
@@ -1009,28 +1024,30 @@
                                
$GLOBALS['phpgw']->template->set_var('sradio','');
                        }
 
-                       
$GLOBALS['phpgw']->template->set_var('shour',$values['sdate_formatted']['hour']);
-                       
$GLOBALS['phpgw']->template->set_var('smin',$values['sdate_formatted']['min']);
+                       $GLOBALS['phpgw']->template->set_var('shour',$shour);
+                       $GLOBALS['phpgw']->template->set_var('smin',$smin);
 
-                       
$GLOBALS['phpgw']->template->set_var('end_date_select',$GLOBALS['phpgw']->common->dateformatorder($this->sbox->getYears('values[eyear]',$values['edate_formatted']['year']),
-                                                                               
                                                                
$this->sbox->getMonthText('values[emonth]',$values['edate_formatted']['month']),
-                                                                               
                                                                
$this->sbox->getDays('values[eday]',$values['edate_formatted']['day'])));
+                       $end = 
$end_val?$end_val:($values['edate']?mktime(12,0,0,date('m',$values['edate']),date('d',$values['edate']),date('Y',$values['edate'])):mktime(12,0,0,date('m'),date('d'),date('Y')));
+                       $ehour  = 
$values['edate']?date('H',$values['edate']):date('H',time());
+                       $emin   = 
$values['edate']?date('i',$values['edate']):date('i',time());
+
+                       
$GLOBALS['phpgw']->template->set_var('end_date_select',$jscal->input('edate[str]',$end));
 
                        if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12')
                        {
-                               if ($values['edate_formatted']['hour'] >= 12)
+                               if ($ehour >= 12)
                                {
                                        $amsel = '';
                                        $pmsel = ' checked';
 
-                                       if ($values['edate_formatted']['hour'] 
> 12)
+                                       if ($ehour > 12)
                                        {
-                                               
$values['edate_formatted']['hour'] = $values['edate_formatted']['hour'] - 12;
+                                               $ehour = $ehour - 12;
                                        }
                                }
-                               if ($values['edate_formatted']['hour'] == 0)
+                               if ($ehour == 0)
                                {
-                                       $values['edate_formatted']['hour'] = 12;
+                                       $ehour = 12;
                                }
 
                                $eradio = '<input type="radio" 
name="values[eampm]" value="am"' . $amsel . '>am';
@@ -1042,10 +1059,10 @@
                                
$GLOBALS['phpgw']->template->set_var('eradio','');
                        }
 
-                       
$GLOBALS['phpgw']->template->set_var('ehour',$values['edate_formatted']['hour']);
-                       
$GLOBALS['phpgw']->template->set_var('emin',$values['edate_formatted']['min']);
-
+                       $GLOBALS['phpgw']->template->set_var('ehour',$ehour);
+                       $GLOBALS['phpgw']->template->set_var('emin',$emin);
 
+                       
$GLOBALS['phpgw']->template->set_var('status_list',$this->status_format($values['status']));
                        
$GLOBALS['phpgw']->template->set_var('remark',$values['remark']);
                        
$GLOBALS['phpgw']->template->set_var('hours_descr',$values['hours_descr']);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]