phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] projects/inc class.boprojects.inc.php, 1.59, 1.60 cla


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] projects/inc class.boprojects.inc.php, 1.59, 1.60 class.bostatistics.inc.php, 1.4, 1.5 class.uiprojects.inc.php, 1.72, 1.73 class.uistatistics.inc.php, 1.19, 1.20
Date: Mon, 29 Sep 2003 00:36:38 +0000

Update of /cvsroot/phpgroupware/projects/inc
In directory subversions:/tmp/cvs-serv28884/inc

Modified Files:
        class.boprojects.inc.php class.bostatistics.inc.php 
        class.uiprojects.inc.php class.uistatistics.inc.php 
Log Message:
added gantt chart function

Index: class.uistatistics.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.uistatistics.inc.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** class.uistatistics.inc.php  10 Sep 2003 00:28:57 -0000      1.19
--- class.uistatistics.inc.php  29 Sep 2003 00:36:35 -0000      1.20
***************
*** 42,46 ****
                        'list_users'    => True,
                        'user_stat'             => True,
!                       'project_stat'  => True
                );
  
--- 42,47 ----
                        'list_users'    => True,
                        'user_stat'             => True,
!                       'project_stat'  => True,
!                       'show_stat'             => True
                );
  
***************
*** 163,169 ****
                {
                        $action         = get_var('action',array('POST','GET'));
!                       $pro_parent     = 
get_var('pro_parent',array('POST','GET'));
  
!                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . ($pro_parent?lang('list jobs'):lang('list projects'));
                        $this->display_app_header();
  
--- 164,170 ----
                {
                        $action         = get_var('action',array('POST','GET'));
!                       $pro_main       = 
get_var('pro_main',array('POST','GET'));
  
!                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . ($pro_main?lang('list jobs'):lang('list projects'));
                        $this->display_app_header();
  
***************
*** 179,183 ****
                        (
                                'menuaction'    => 
'projects.uistatistics.list_projects',
!                               'pro_parent'    => $pro_parent,
                                'action'                => $action,
                                'cat_id'                => $this->cat_id
--- 180,184 ----
                        (
                                'menuaction'    => 
'projects.uistatistics.list_projects',
!                               'pro_main'              => $pro_main,
                                'action'                => $action,
                                'cat_id'                => $this->cat_id
***************
*** 189,198 ****
                        }
  
!                       if (!$pro_parent)
!                       {
!                               $pro_parent = 0;
!                       }
! 
!                       $pro = 
$this->boprojects->list_projects($this->start,True,$this->query,$this->filter,$this->sort,$this->order,'active',$this->cat_id,$action,$pro_parent);
  
  // --------------------- nextmatch variable template-declarations 
------------------------
--- 190,194 ----
                        }
  
!                       $pro = $this->boprojects->list_projects(array('type' => 
$action,'parent' => $pro_main));
  
  // --------------------- nextmatch variable template-declarations 
------------------------
***************
*** 210,223 ****
                        {
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . '" name="form">' . "\n"
!                                                       . '<select 
name="cat_id" onChange="this.form.submit();"><option value="">' . lang('Select 
category') . '</option>' . "\n"
!                                                       . 
$this->cats->formatted_list('select','all',$this->cat_id,True) . '</select>';
!                               
$GLOBALS['phpgw']->template->set_var(lang_header,lang('Project list'));
                        }
                        else
                        {
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) .'" name="form">' . "\n"
!                                                       . '<select 
name="pro_parent" onChange="this.form.submit();"><option value="">' . 
lang('Select main project') . '</option>' . "\n"
!                                                       . 
$this->boprojects->select_project_list('mains', $status, $pro_parent) . 
'</select>';
!                               
$GLOBALS['phpgw']->template->set_var('lang_header',lang('Job list'));
                        }
  
--- 206,219 ----
                        {
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . '" name="form">' . "\n"
!                                                       . '<select 
name="cat_id" onChange="this.form.submit();"><option value="none">' . 
lang('Select category') . '</option>' . "\n"
!                                                       . 
$this->boprojects->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
!                               
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Jobs'));
                        }
                        else
                        {
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) .'" name="form">' . "\n"
!                                                       . '<select 
name="pro_main" onChange="this.form.submit();"><option value="">' . 
lang('Select main project') . '</option>' . "\n"
!                                                       . 
$this->boprojects->select_project_list(array('status' => $status, 'selected' => 
$pro_main)) . '</select>';
!                               
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Work hours'));
                        }
  
***************
*** 299,303 ****
                                if ($action == 'mains')
                                {
!                                       $action_entry = '<td align="center"><a 
href="' . 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uistatistics.list_projects&pro_parent='
                                                                                
                                                . $pro[$i]['project_id'] . 
'&action=subs') . '">' . lang('Jobs')
                                                                                
                                                . '</a></td>' . "\n";
--- 295,299 ----
                                if ($action == 'mains')
                                {
!                                       $action_entry = '<td align="center"><a 
href="' . 
$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uistatistics.list_projects&pro_main='
                                                                                
                                                . $pro[$i]['project_id'] . 
'&action=subs') . '">' . lang('Jobs')
                                                                                
                                                . '</a></td>' . "\n";
***************
*** 571,576 ****
--- 567,605 ----
                }
  
+               function show_stat($project_id)
+               {
+                       $this->bostatistics->show_graph($project_id);
+               }
+ 
                function project_stat()
                {
+                       $project_id     = 
get_var('project_id',array('GET','POST'));
+ 
+                       if (! $project_id)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=projects.uistatistics.list_projects&action=mains');
+                       }
+ 
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'projects.uistatistics.project_stat',
+                               'action'                => $action,
+                               'project_id'    => $project_id
+                       );
+ 
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . lang('gantt chart for project %1', 
$this->boprojects->return_value('pro',$project_id));
+                       $this->display_app_header();
+ 
+                       
$GLOBALS['phpgw']->template->set_file(array('project_stat' => 
'stats_gant.tpl'));
+ 
+                       $this->bostatistics->show_graph($project_id);
+ 
+                       
$GLOBALS['phpgw']->template->set_var('pix_src',$GLOBALS['phpgw_info']['server']['webserver_url']
 . SEP . 'phpgwapi' . SEP . 'images' . SEP . 'draw_tmp.png');
+ 
+                       $GLOBALS['phpgw']->template->pfp('out','project_stat');
+               }
+ 
+               /*function project_stat()
+               {
                        $submit         = get_var('submit',array('POST'));
                        $values         = get_var('values',array('POST','GET'));
***************
*** 776,780 ****
                        
$GLOBALS['phpgw']->template->fp('list','stat_list',True);
                        $GLOBALS['phpgw']->template->pfp('out','project_stat');
!               }
        }
  ?>
--- 805,809 ----
                        
$GLOBALS['phpgw']->template->fp('list','stat_list',True);
                        $GLOBALS['phpgw']->template->pfp('out','project_stat');
!               }*/
        }
  ?>

Index: class.uiprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.uiprojects.inc.php,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -d -r1.72 -r1.73
*** class.uiprojects.inc.php    23 Sep 2003 23:43:44 -0000      1.72
--- class.uiprojects.inc.php    29 Sep 2003 00:36:35 -0000      1.73
***************
*** 260,264 ****
                        }
  
!                       $pro = $this->bo->list_projects($action,$pro_main);
  
  // --------------------- nextmatch variable template-declarations 
------------------------
--- 260,264 ----
                        }
  
!                       $pro = $this->bo->list_projects(array('type' => 
$action,'parent' => $pro_main));
  
  // --------------------- nextmatch variable template-declarations 
------------------------

Index: class.boprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.boprojects.inc.php,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** class.boprojects.inc.php    23 Sep 2003 23:43:44 -0000      1.59
--- class.boprojects.inc.php    29 Sep 2003 00:36:35 -0000      1.60
***************
*** 110,113 ****
--- 110,114 ----
                                unset($this->cat_id);
                        }
+                       $this->limit = True;
                }
  
***************
*** 430,439 ****
                }
  
!               function list_projects($type, $parent)
                {
                        $pro_list = $this->so->read_projects(array
                                                                        (
                                                                                
'start'         => $this->start,
!                                                                               
'limit'         => True,
                                                                                
'query'         => $this->query,
                                                                                
'filter'        => $this->filter,
--- 431,440 ----
                }
  
!               function list_projects($params)
                {
                        $pro_list = $this->so->read_projects(array
                                                                        (
                                                                                
'start'         => $this->start,
!                                                                               
'limit'         => $this->limit,
                                                                                
'query'         => $this->query,
                                                                                
'filter'        => $this->filter,
***************
*** 442,447 ****
                                                                                
'status'        => $this->status,
                                                                                
'cat_id'        => $this->cat_id,
!                                                                               
'type'          => $type,
!                                                                               
'parent'        => $parent
                                                                        ));
  
--- 443,449 ----
                                                                                
'status'        => $this->status,
                                                                                
'cat_id'        => $this->cat_id,
!                                                                               
'type'          => $params['type'],
!                                                                               
'parent'        => $params['parent'],
!                                                                               
'main'          => $params['main']
                                                                        ));
  
***************
*** 462,475 ****
                                $sdateout = 
$GLOBALS['phpgw']->common->show_date($pro['sdate'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);*/
  
-                               $mlist = '';
                                $mstones = 
$this->get_mstones($pro['project_id']);
!                               if (is_array($mstones))
                                {
!                                       $mlist = '<table width="100%" 
border="0" cellpadding="0" cellspacing="0">' . "\n";
!                                       for ($i=0;$i<count($mstones);$i++)
                                        {
!                                               $mlist .= '<tr><td 
width="50%">' . $mstones[$i]['title'] . '</td><td width="50%" align="right">' . 
$this->formatted_edate($mstones[$i]['edate']) . '</td></tr>' . "\n";
                                        }
-                                       $mlist .= '</table>';
                                }
  
--- 464,481 ----
                                $sdateout = 
$GLOBALS['phpgw']->common->show_date($pro['sdate'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);*/
  
                                $mstones = 
$this->get_mstones($pro['project_id']);
! 
!                               if (!isset($params['mstones_stat']))
                                {
!                                       $mlist = '';
!                                       if (is_array($mstones))
                                        {
!                                               $mlist = '<table width="100%" 
border="0" cellpadding="0" cellspacing="0">' . "\n";
!                                               for 
($i=0;$i<count($mstones);$i++)
!                                               {
!                                                       $mlist .= '<tr><td 
width="50%">' . $mstones[$i]['title'] . '</td><td width="50%" align="right">' . 
$this->formatted_edate($mstones[$i]['edate']) . '</td></tr>' . "\n";
!                                               }
!                                               $mlist .= '</table>';
                                        }
                                }
  
***************
*** 485,489 ****
                                        'investment_nr'         => 
$GLOBALS['phpgw']->strip_html($pro['investment_nr']),
                                        'descr'                         => 
$GLOBALS['phpgw']->strip_html($pro['descr']),
!                                       'sdateout'                      => 
$sdateout,
                                        'budget'                        => 
$pro['budget'],
                                        'pcosts'                        => 
$pro['pcosts'],
--- 491,495 ----
                                        'investment_nr'         => 
$GLOBALS['phpgw']->strip_html($pro['investment_nr']),
                                        'descr'                         => 
$GLOBALS['phpgw']->strip_html($pro['descr']),
!                                       'sdate'                         => 
$pro['sdate'],
                                        'budget'                        => 
$pro['budget'],
                                        'pcosts'                        => 
$pro['pcosts'],
***************
*** 491,495 ****
                                        'status'                        => 
$pro['status'],
                                        'level'                         => 
$pro['level'],
!                                       'mstones'                       => 
$mlist
                                );
                        }
--- 497,501 ----
                                        'status'                        => 
$pro['status'],
                                        'level'                         => 
$pro['level'],
!                                       'mstones'                       => 
(isset($mlist)?$mlist:$mstones)
                                );
                        }

Index: class.bostatistics.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.bostatistics.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** class.bostatistics.inc.php  10 Sep 2003 00:28:57 -0000      1.4
--- class.bostatistics.inc.php  29 Sep 2003 00:36:35 -0000      1.5
***************
*** 47,50 ****
--- 47,53 ----
                {
                        $this->sostatistics     = 
CreateObject('projects.sostatistics');
+                       $this->boprojects       = 
CreateObject('projects.boprojects');
+ 
+                       $this->date_diff        = 0;
                }
  
***************
*** 69,72 ****
--- 72,143 ----
                {
                        return 
$this->sostatistics->pro_stat_employees($project_id, $values);
+               }
+ 
+               function set_x_text()
+               {
+                       $weekday = 
strftime('%w',mktime(0,0,0,date('m'),date('d'),date('Y')));
+                       $weekend = date('d') + (7-$weekday);
+ 
+                       $graph_edate = 
mktime(0,0,0,date('m'),$weekend,date('Y'));
+                       $graph_sdate = 
mktime(0,0,0,date('m')-1,date('d'),date('Y'));
+ 
+                       $graph_sdateout = 
$GLOBALS['phpgw']->common->show_date($graph_sdate,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       $graph_edateout = 
$GLOBALS['phpgw']->common->show_date($graph_edate,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       $sdiff  = $graph_edate - $graph_sdate;
+                       $mdiff  = $sdiff/60;
+                       $sdiff  = $mdiff/60;
+ 
+                       $diff   = $sdiff/24;
+                       $this->date_diff        = $diff;
+ 
+                       //echo 'DIFF: ' . $tdiff;
+                       //exit;
+                       $this->graph->line_captions_x[0]['date_formatted']      
= $GLOBALS['phpgw']->common->show_date($graph_sdate,'d/m');
+                       $this->graph->line_captions_x[0]['date']                
        = $graph_sdate;
+                       $this->graph->line_captions_x[0]['x']                   
        = 0;
+ 
+                       for ($i=1;$i<$diff;$i++)
+                       {
+                               $temp_date = '';
+                               $temp_date = 
mktime(0,0,0,date('m',$graph_sdate),date('d',$graph_sdate)+$i,date('Y',$graph_sdate));
+ 
+                               
$this->graph->line_captions_x[$i]['date_formatted']     = 
$GLOBALS['phpgw']->common->show_date($temp_date,'d');
+                               $this->graph->line_captions_x[$i]['date']       
                = $temp_date;
+                               $this->graph->line_captions_x[$i]['x']          
                = $i*20;
+                       }
+ 
+                       $this->graph->line_captions_x[$diff]['date_formatted']  
= $GLOBALS['phpgw']->common->show_date($graph_edate,'d/m');
+                       $this->graph->line_captions_x[$diff]['date']            
        = $graph_edate;
+                       $this->graph->line_captions_x[$diff]['x']               
                = $diff*20;
+ 
+                       $this->graph->title = lang('Gantt chart from %1 to %2', 
$graph_sdateout,$graph_edateout);
+               }
+ 
+               function set_y_text($pro = 0)
+               {
+                       for($i=0;$i<count($pro);$i++)
+                       {
+                               $this->graph->line_captions_y[$i] = 
$pro[$i]['title'];
+                       }
+               }
+ 
+               function show_graph($project_id)
+               {
+                       $this->graph = CreateObject('phpgwapi.gdgraph');
+                       $pro = $this->boprojects->list_projects(array('type' => 
'mainandsubs','main' => $project_id,'mstones_stat' => True));
+ 
+                       //_debug_array($pro);
+ 
+                       $this->graph->data = $pro;
+ 
+                       $this->set_x_text();
+ 
+                       $this->set_y_text($pro);
+ 
+                       $this->graph->num_lines_y = count($pro)+2;
+                       $this->graph->num_lines_x = $this->date_diff + 1;
+                       $this->graph->colors = array('red','blue');
+ 
+                       $this->graph->render();
                }
        }





reply via email to

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