phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] projects/inc/class.uiprojects.inc.php, 1.148


From: nomail
Subject: [Phpgroupware-cvs] projects/inc/class.uiprojects.inc.php, 1.148
Date: Mon, 21 Jun 2004 01:02:41 +0200

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

date: 2004/06/20 23:02:41;  author: ceb;  state: Exp;  lines: +60 -108

Log Message:
update
=====================================================================
Index: projects/inc/class.uiprojects.inc.php
diff -u projects/inc/class.uiprojects.inc.php:1.147 
projects/inc/class.uiprojects.inc.php:1.148
--- projects/inc/class.uiprojects.inc.php:1.147 Sat Jun 19 22:47:31 2004
+++ projects/inc/class.uiprojects.inc.php       Sun Jun 20 23:02:41 2004
@@ -194,6 +194,8 @@
                        
$GLOBALS['phpgw']->template->set_var('lang_extra_budget',lang('extra budget'));
 
                        
$GLOBALS['phpgw']->template->set_var('lang_billable',lang('billable'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_files',lang('files'));
+                       
$GLOBALS['phpgw']->template->set_var('lang_attach',lang('attach file'));
                }
 
                function display_app_header()
@@ -740,6 +742,11 @@
                        $name                           = 
get_var('name',array('POST'));
                        $values                         = 
get_var('values',array('POST'));
 
+                       $sdate                          = 
get_var('sdate',array('GET','POST'));
+                       $edate                          = 
get_var('edate',array('GET','POST'));
+                       $psdate                         = 
get_var('psdate',array('GET','POST'));
+                       $pedate                         = 
get_var('pedate',array('GET','POST'));
+
                        $link_data = array
                        (
                                'menuaction'    => 
'projects.uiprojects.list_projects',
@@ -749,6 +756,33 @@
                                'pro_parent'    => $pro_parent
                        );
 
+                       //_debug_array($sdate);
+
+                       $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(is_array($psdate))
+                       {
+                               $pstart_array   = 
$jscal->input2date($psdate['str']);
+                               $pstart_val             = $pstart_array['raw'];
+                       }
+
+                       if(is_array($pedate))
+                       {
+                               $pend_array     = 
$jscal->input2date($pedate['str']);
+                               $pend_val       = $pend_array['raw'];
+                       }
+
                        if ($_POST['save'] || $_POST['apply'])
                        {
                                $this->cat_id = 
($values['cat']?$values['cat']:'');
@@ -761,6 +795,11 @@
                                $values['book_activities'] = $book_activities;
                                $values['bill_activities'] = $bill_activities;
 
+                               $values['sdate'] = $start_val;
+                               $values['edate'] = $end_val;
+                               $values['psdate'] = $pstart_val;
+                               $values['pedate'] = $pend_val;
+
                                $error = 
$this->boprojects->check_values($action, $values);
                                if (is_array($error))
                                {
@@ -773,6 +812,7 @@
                                        $link_data['project_id'] = $project_id;
                                        if($_POST['save'])
                                        {
+                                               unset($jscal);
                                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                                        }
                                        else
@@ -812,10 +852,6 @@
                                {
                                        $values = 
$this->boprojects->read_single_project($project_id);
                                }
-                               else
-                               {
-
-                               }
 
                                if(!is_array($values))
                                {
@@ -834,7 +870,6 @@
                                $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . ($project_id?lang('edit job'):lang('add job'))
                                                                                
                                        . $this->admin_header_info();
                        }
-
                        $this->display_app_header();
 
                        $GLOBALS['phpgw']->template->set_file(array('edit_form' 
=> 'form.tpl'));
@@ -846,14 +881,6 @@
                        
$GLOBALS['phpgw']->template->set_block('edit_form','elist','elisthandle');
                        
$GLOBALS['phpgw']->template->set_block('edit_form','efield','efieldhandle');
 
-                       
/*$GLOBALS['phpgw']->template->set_block('edit_form','msfield1','msfield1handle');
-                       
$GLOBALS['phpgw']->template->set_block('edit_form','msfield2','msfield2handle');
-                       
$GLOBALS['phpgw']->template->set_block('edit_form','mslist','mslisthandle');
-
-                       
$GLOBALS['phpgw']->template->set_block('edit_form','rolefield1','rolefield1handle');
-                       
$GLOBALS['phpgw']->template->set_block('edit_form','rolefield2','rolefield2handle');
-                       
$GLOBALS['phpgw']->template->set_block('edit_form','rolelist','rolelisthandle');*/
-
                        
$GLOBALS['phpgw']->template->set_block('edit_form','accounting_act','accounting_acthandle');
                        
$GLOBALS['phpgw']->template->set_block('edit_form','accounting_own','accounting_ownhandle');
 
@@ -897,21 +924,10 @@
                                
$GLOBALS['phpgw']->template->set_var('choose','');
                                $this->cat_id = $values['cat'];
 
-                               $values['sday']         = 
$values['sday']?$values['sday']:($values['sdate']?date('d',$values['sdate']):0);
-                               $values['smonth']       = 
$values['smonth']?$values['smonth']:($values['sdate']?date('m',$values['sdate']):0);
-                               $values['syear']        = 
$values['syear']?$values['syear']:($values['sdate']?date('Y',$values['sdate']):0);
-
-                               $values['eday']         = 
$values['eday']?$values['eday']:($values['edate']?date('d',$values['edate']):0);
-                               $values['emonth']       = 
$values['emonth']?$values['emonth']:($values['edate']?date('m',$values['edate']):0);
-                               $values['eyear']        = 
$values['eyear']?$values['eyear']:($values['edate']?date('Y',$values['edate']):0);
-
-                               $values['psday']        = 
$values['psday']?$values['psday']:($values['psdate']?date('d',$values['psdate']):0);
-                               $values['psmonth']      = 
$values['psmonth']?$values['psmonth']:($values['psdate']?date('m',$values['psdate']):0);
-                               $values['psyear']       = 
$values['psyear']?$values['psyear']:($values['psdate']?date('Y',$values['psdate']):0);
-
-                               $values['peday']        = 
$values['peday']?$values['peday']:($values['pedate']?date('d',$values['pedate']):0);
-                               $values['pemonth']      = 
$values['pemonth']?$values['pemonth']:($values['pedate']?date('m',$values['pedate']):0);
-                               $values['peyear']       = 
$values['peyear']?$values['peyear']:($values['pedate']?date('Y',$values['pedate']):0);
+                               $start  = 
$start_val?$start_val:$values['sdate'];
+                               $end    = $end_val?$end_val:$values['edate'];
+                               $pstart = 
$pstart_val?$pstart_val:$values['psdate'];
+                               $pend   = $pend_val?$pend_val:$values['pedate'];
 
                                
$GLOBALS['phpgw']->template->set_var('edit_mstones_button','<input 
type="submit" name="mstone" value="' . lang('edit milestones') . '">');
                                
$GLOBALS['phpgw']->template->set_var('edit_roles_events_button','<input 
type="submit" name="roles" value="' . lang('edit roles and events') . '">');
@@ -923,89 +939,30 @@
                                switch($action)
                                {
                                        case 'mains':
-                                               $values['smonth']       = 
isset($values['smonth'])?$values['smonth']:date('m',time());
-                                               $values['sday']         = 
isset($values['sday'])?$values['sday']:date('d',time());
-                                               $values['syear']        = 
isset($values['syear'])?$values['syear']:date('Y',time());
-
-                                               $values['emonth']       = 
isset($values['emonth'])?$values['emonth']:0;
-                                               $values['eday']         = 
isset($values['eday'])?$values['eday']:0;
-                                               $values['eyear']        = 
isset($values['eyear'])?$values['eyear']:0;
-
-                                               $values['psmonth']      = 
isset($values['psmonth'])?$values['psmonth']:date('m',time());
-                                               $values['psday']        = 
isset($values['psday'])?$values['psday']:date('d',time());
-                                               $values['psyear']       = 
isset($values['psyear'])?$values['psyear']:date('Y',time());
-
-                                               $values['pemonth']      = 
isset($values['pemonth'])?$values['pemonth']:0;
-                                               $values['peday']        = 
isset($values['peday'])?$values['peday']:0;
-                                               $values['peyear']       = 
isset($values['peyear'])?$values['peyear']:0;
-
+                                               $start  = 
$start_val?$start_val:mktime(12,0,0,date('m'),date('d'),date('Y'));
+                                               $end    = $end_val?$end_val:'';
+                                               $pstart = 
$pstart_val?$pstart_val:'';
+                                               $pend   = 
$pend_val?$pend_val:'';
 
                                                $values['access']       = 
isset($values['access'])?$values['access']:'public';
                                                break;
                                        case 'subs':
                                                if(is_array($parent))
                                                {
-                                                       $values['sdate']        
= $parent['sdate']?$parent['sdate']:time();
-                                                       $values['edate']        
= $parent['edate']?$parent['edate']:0;
-                                                       $values['psdate']       
= $parent['psdate']?$parent['psdate']:0;
-                                                       $values['pedate']       
= $parent['pedate']?$parent['pedate']:0;
-                                               }
-
-                                               $values['smonth']       = 
isset($values['smonth'])?$values['smonth']:date('m',$values['sdate']);
-                                               $values['sday']         = 
isset($values['sday'])?$values['sday']:date('d',$values['sdate']);
-                                               $values['syear']        = 
isset($values['syear'])?$values['syear']:date('Y',$values['sdate']);
-
-                                               if($values['psdate'] > 0)
-                                               {
-                                                       $values['psmonth']      
= isset($values['psmonth'])?$values['psmonth']:date('m',$values['psdate']);
-                                                       $values['psday']        
= isset($values['psday'])?$values['psday']:date('d',$values['psdate']);
-                                                       $values['psyear']       
= isset($values['psyear'])?$values['psyear']:date('Y',$values['psdate']);
-                                               }
-                                               else
-                                               {
-                                                       $values['psmonth'] = 
$values['psday'] = $values['psyear'] = 0;
-                                               }
-
-                                               if($values['edate'] > 0)
-                                               {
-                                                       $values['emonth']       
= isset($values['emonth'])?$values['emonth']:date('m',$values['edate']);
-                                                       $values['eday']         
= isset($values['eday'])?$values['eday']:date('d',$values['edate']);
-                                                       $values['eyear']        
= isset($values['eyear'])?$values['eyear']:date('Y',$values['edate']);
-                                               }
-                                               else
-                                               {
-                                                       $values['emonth'] = 
$values['eday'] = $values['eyear'] = 0;
-                                               }
-
-                                               if($values['pedate'] > 0)
-                                               {
-                                                       $values['pemonth']      
= isset($values['pemonth'])?$values['pemonth']:date('m',$values['pedate']);
-                                                       $values['peday']        
= isset($values['peday'])?$values['peday']:date('d',$values['pedate']);
-                                                       $values['peyear']       
= isset($values['peyear'])?$values['peyear']:date('Y',$values['pedate']);
-                                               }
-                                               else
-                                               {
-                                                       $values['pemonth'] = 
$values['peday'] = $values['peyear'] = 0;
+                                                       $start  = 
$start_val?$start_val:($parent['sdate']?mktime(12,0,0,date('m',$parent['sdate']),date('d',$parent['sdate']),date('Y',$parent['sdate'])):mktime(12,0,0,date('m'),date('d'),date('Y')));
+                                                       $end    = 
$end_val?$end_val:($parent['edate']?mktime(12,0,0,date('m',$parent['edate']),date('d',$parent['edate']),date('Y',$parent['edate'])):'');
+                                                       $pstart = 
$pstart_val?$pstart_val:($parent['psdate']?mktime(12,0,0,date('m',$parent['psdate']),date('d',$parent['psdate']),date('Y',$parent['psdate'])):'');
+                                                       $pend   = 
$pend_val?$pend_val:($parent['pedate']?mktime(12,0,0,date('m',$parent['pedate']),date('d',$parent['pedate']),date('Y',$parent['pedate'])):'');
                                                }
                                                break;
                                }
                        }
 
-                       
$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'])));
-
-                       
$GLOBALS['phpgw']->template->set_var('end_date_select',$GLOBALS['phpgw']->common->dateformatorder($this->sbox->getYears('values[eyear]',$values['eyear']),
-                                                                               
                                                                                
                        
$this->sbox->getMonthText('values[emonth]',$values['emonth']),
-                                                                               
                                                                                
                        $this->sbox->getDays('values[eday]',$values['eday'])));
+                       
$GLOBALS['phpgw']->template->set_var('start_date_select',$jscal->input('sdate[str]',$start));
+                       
$GLOBALS['phpgw']->template->set_var('end_date_select',$jscal->input('edate[str]',$end));
 
-                       
$GLOBALS['phpgw']->template->set_var('pstart_date_select',$GLOBALS['phpgw']->common->dateformatorder($this->sbox->getYears('values[psyear]',$values['psyear']),
-                                                                               
                                                                                
                        
$this->sbox->getMonthText('values[psmonth]',$values['psmonth']),
-                                                                               
                                                                                
                        
$this->sbox->getDays('values[psday]',$values['psday'])));
-
-                       
$GLOBALS['phpgw']->template->set_var('pend_date_select',$GLOBALS['phpgw']->common->dateformatorder($this->sbox->getYears('values[peyear]',$values['peyear']),
-                                                                               
                                                                                
                        
$this->sbox->getMonthText('values[pemonth]',$values['pemonth']),
-                                                                               
                                                                                
                        
$this->sbox->getDays('values[peday]',$values['peday'])));
+                       
$GLOBALS['phpgw']->template->set_var('pstart_date_select',$jscal->input('psdate[str]',$pstart));
+                       
$GLOBALS['phpgw']->template->set_var('pend_date_select',$jscal->input('pedate[str]',$pend));
 
                        if ($action == 'mains')
                        {
@@ -1144,12 +1101,6 @@
                        
$GLOBALS['phpgw']->template->set_var('result',$values['result']);
                        
$GLOBALS['phpgw']->template->set_var('test',$values['test']);
                        
$GLOBALS['phpgw']->template->set_var('quality',$values['quality']);
-                       
-                       
$GLOBALS['phpgw']->template->set_var('attachment',$this->attachedFiles->get_files($project_id,
 true));
-                       
$GLOBALS['phpgw']->template->set_var('lang_files',lang('Files'));
-                       
$GLOBALS['phpgw']->template->set_var('lang_attach',lang('Attach File'));
-                       
-                       
 
 //--------- coordinator -------------
 
@@ -1191,6 +1142,8 @@
                        $GLOBALS['phpgw']->template->set_var('name',$name);
                        $GLOBALS['phpgw']->template->set_var('abid',$abid);
 
+                       
$GLOBALS['phpgw']->template->set_var('attachment',$this->attachedFiles->get_files($project_id,True));
+
                        if ($project_id && 
$this->boprojects->edit_perms(array('action' => $action,'coordinator' => 
$values['coordinator'],'main_co' => $main['coordinator'],
                                                                                
                        'parent_co' => $parent['coordinator'],'type' => 
'delete')))
                        {
@@ -1278,7 +1231,6 @@
                                $this->display_app_header();
                        }
 
-                       
                        $GLOBALS['phpgw']->template->set_file(array('view' => 
'view.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('view','sub','subhandle');
                        
$GLOBALS['phpgw']->template->set_block('view','accounting_act','acthandle');
@@ -1468,7 +1420,7 @@
                        }
                        
                        
$GLOBALS['phpgw']->template->set_var('attachment',$this->attachedFiles->get_files($project_id));
-                       
$GLOBALS['phpgw']->template->set_var('lang_files',lang('Files'));
+
                        $GLOBALS['phpgw']->template->set_var('ownhandle','');
                        $GLOBALS['phpgw']->template->set_var('acthandle','');
                        $GLOBALS['phpgw']->template->set_var('bothhandle','');




reply via email to

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