phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: todo/inc class.bo.inc.php,1.2,1.3 class.so.inc.p


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: todo/inc class.bo.inc.php,1.2,1.3 class.so.inc.php,1.2,1.3 class.ui.inc.php,1.3,1.4
Date: Wed, 30 Jan 2002 20:33:05 -0500

Update of /cvsroot/phpgroupware/todo/inc
In directory subversions:/tmp/cvs-serv19991/inc

Modified Files:
        class.bo.inc.php class.so.inc.php class.ui.inc.php 
Log Message:
added the option to assign todos to groups

Index: class.bo.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/todo/inc/class.bo.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.bo.inc.php    27 Jan 2002 22:24:38 -0000      1.2
--- class.bo.inc.php    31 Jan 2002 01:33:02 -0000      1.3
***************
*** 141,154 ****
                        $this->accounts->read_repository();
  
!                       
$cached_data[$this->accounts->data['account_id']]['account_lid'] = 
$this->accounts->data['account_lid'];
!                       
$cached_data[$this->accounts->data['account_id']]['firstname']   = 
$this->accounts->data['firstname'];
!                       
$cached_data[$this->accounts->data['account_id']]['lastname']    = 
$this->accounts->data['lastname'];
  
                        return $cached_data;
                }
  
!               function employee_list()
!               {               
!                       $employees = 
$GLOBALS['phpgw']->accounts->get_list('accounts');
                        return $employees;
                }
--- 141,155 ----
                        $this->accounts->read_repository();
  
!                       
$cached_data[$this->accounts->data['account_id']]['lid']                = 
$this->accounts->data['account_lid'];
!                       
$cached_data[$this->accounts->data['account_id']]['firstname']  = 
$this->accounts->data['firstname'];
!                       
$cached_data[$this->accounts->data['account_id']]['lastname']   = 
$this->accounts->data['lastname'];
!                       
$cached_data[$this->accounts->data['account_id']]['type']               = 
$this->accounts->data['account_type'];
  
                        return $cached_data;
                }
  
!               function employee_list($type)
!               {
!                       $employees = 
$GLOBALS['phpgw']->accounts->get_list($type);
                        return $employees;
                }
***************
*** 171,182 ****
                                {
                                        $cached_data = 
$this->cached_accounts($a);                                              
!                                       $aout  .= 
$GLOBALS['phpgw']->common->display_fullname($cached_data[$a]['account_lid'],
                                                                                
$cached_data[$a]['firstname'],$cached_data[$a]['lastname']) . '<br>';
                                }
                        }
-                       else
-                       {
-                               $aout = '---';
-                       }
                        return $aout;
                }
--- 172,187 ----
                                {
                                        $cached_data = 
$this->cached_accounts($a);                                              
! 
!                                       if ($cached_data[$a]['type'] == 'u')
!                                       {
!                                               $aout  .= 
$GLOBALS['phpgw']->common->display_fullname($cached_data[$a]['lid'],
                                                                                
$cached_data[$a]['firstname'],$cached_data[$a]['lastname']) . '<br>';
+                                       }
+                                       else
+                                       {
+                                               $aout .= 
$cached_data[$a]['firstname'] . ' ' . lang('Group') . '<br>';
+                                       }
                                }
                        }
                        return $aout;
                }
***************
*** 220,247 ****
                                }
  
                                $cached_data = 
$this->cached_accounts($v['owner']);
  
!                               $v['owner']  = 
$GLOBALS['phpgw']->common->display_fullname($cached_data[$v['owner']]['account_lid'],
                                                                                
$cached_data[$v['owner']]['firstname'],$cached_data[$v['owner']]['lastname']);
  
!                               $r[] = array(
!                                       'id'                    => 
(int)$v['id'],
!                                       'main'                  => 
(int)$v['main'],
!                                       'parent'                => 
(int)$v['parent'],
!                                       'level'                 => 
(int)$v['level'],
!                                       'owner'                 => $v['owner'],
!                                       'owner_id'              => 
(int)$v['owner_id'],
!                                       'access'                => $v['access'],
!                                       'cat'                   => 
(int)$v['cat'],
!                                       'title'                 => $v['title'],
!                                       'descr'                 => $v['descr'],
!                                       'pri'                   => 
(int)$v['pri'],
!                                       'status'                => 
(int)$v['status'],
!                                       'sdate'                 => $v['sdate'],
!                                       'edate'                 => $v['edate'],
!                                       'grants'                => 
(int)$v['grants'],
!                                       'sdate_epoch'   => 
(int)$v['sdate_epoch'],
!                                       'edate_epoch'   => 
(int)$v['edate_epoch'],
!                                       'assigned'              => 
$v['assigned']
                                );
                        }
--- 225,259 ----
                                }
  
+                               if ($v['assigned_group'])
+                               {
+                                       $v['assigned_group'] = 
$this->format_assigned($v['assigned_group']);
+                               }
+ 
                                $cached_data = 
$this->cached_accounts($v['owner']);
  
!                               $v['owner']  = 
$GLOBALS['phpgw']->common->display_fullname($cached_data[$v['owner']]['lid'],
                                                                                
$cached_data[$v['owner']]['firstname'],$cached_data[$v['owner']]['lastname']);
  
!                               $r[] = array
!                               (
!                                       'id'                            => 
(int)$v['id'],
!                                       'main'                          => 
(int)$v['main'],
!                                       'parent'                        => 
(int)$v['parent'],
!                                       'level'                         => 
(int)$v['level'],
!                                       'owner'                         => 
$v['owner'],
!                                       'owner_id'                      => 
(int)$v['owner_id'],
!                                       'access'                        => 
$v['access'],
!                                       'cat'                           => 
(int)$v['cat'],
!                                       'title'                         => 
$v['title'],
!                                       'descr'                         => 
$v['descr'],
!                                       'pri'                           => 
(int)$v['pri'],
!                                       'status'                        => 
(int)$v['status'],
!                                       'sdate'                         => 
$v['sdate'],
!                                       'edate'                         => 
$v['edate'],
!                                       'grants'                        => 
(int)$v['grants'],
!                                       'sdate_epoch'           => 
(int)$v['sdate_epoch'],
!                                       'edate_epoch'           => 
(int)$v['edate_epoch'],
!                                       'assigned'                      => 
$v['assigned'],
!                                       'assigned_group'        => 
$v['assigned_group']
                                );
                        }

Index: class.so.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/todo/inc/class.so.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.so.inc.php    27 Jan 2002 22:24:38 -0000      1.2
--- class.so.inc.php    31 Jan 2002 01:33:02 -0000      1.3
***************
*** 24,27 ****
--- 24,28 ----
                        $this->db2                      = $this->db;
                        $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants('todo');
+                       $this->user_groups      = 
$GLOBALS['phpgw']->accounts->membership($this->account);
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->historylog       = 
CreateObject('phpgwapi.historylog','todo');
***************
*** 65,69 ****
                        {
                                $filtermethod = "(( todo_owner='" . 
$this->account . "' OR todo_assigned like '%," . $this->account . ",%' OR 
todo_assigned='"
!                                                               . 
$this->account . "')";
                                if (is_array($this->grants))
                                {
--- 66,82 ----
                        {
                                $filtermethod = "(( todo_owner='" . 
$this->account . "' OR todo_assigned like '%," . $this->account . ",%' OR 
todo_assigned='"
!                                                               . 
$this->account . "'";
! 
!                               if (is_array($this->user_groups))
!                               {
!                                       $groups = $this->user_groups;
!                                       while (list($null,$group) = 
each($groups))
!                                       {
!                                               $filtermethod .= " OR 
assigned_group like '%," . $group['account_id'] . ",%' OR assigned_group='" . 
$group['account_id'] . "'";
!                                       }
!                               }
! 
!                               $filtermethod .= ')';
! 
                                if (is_array($this->grants))
                                {
***************
*** 109,115 ****
                        $sql = "SELECT * FROM phpgw_todo WHERE $filtermethod 
$querymethod $type $parentmethod";
  
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
- 
                        if ($limit)
                        {
--- 122,125 ----
***************
*** 121,146 ****
                        }
  
                        while ($this->db->next_record())
                        {
                                $todos[] = array
                                (
!                                       'id'                    => 
(int)$this->db->f('todo_id'),
!                                       'main'                  => 
(int)$this->db->f('todo_id_main'),
!                                       'parent'                => 
(int)$this->db->f('todo_id_parent'),
!                                       'level'                 => 
(int)$this->db->f('todo_level'),
!                                       'owner'                 => 
$this->db->f('todo_owner'),
!                                       'owner_id'              => 
$this->db->f('todo_owner'),
!                                       'access'                => 
$this->db->f('todo_access'),
!                                       'cat'                   => 
(int)$this->db->f('todo_cat'),
!                                       'title'                 => 
$this->db->f('todo_title'),
!                                       'descr'                 => 
$this->db->f('todo_des'),
!                                       'pri'                   => 
(int)$this->db->f('todo_pri'),
!                                       'status'                => 
(int)$this->db->f('todo_status'),
!                                       'sdate'                 => 
$this->db->f('todo_startdate'),
!                                       'edate'                 => 
$this->db->f('todo_enddate'),
!                                       'grants'                => 
(int)$this->grants[$this->db->f('todo_owner')],
!                                       'sdate_epoch'   => 
(int)$this->db->f('todo_startdate'),
!                                       'edate_epoch'   => 
(int)$this->db->f('todo_enddate'),
!                                       'assigned'              => 
$this->db->f('todo_assigned')
                                );
                        }
--- 131,159 ----
                        }
  
+                       $this->total_records = $this->db->num_rows();
+ 
                        while ($this->db->next_record())
                        {
                                $todos[] = array
                                (
!                                       'id'                            => 
(int)$this->db->f('todo_id'),
!                                       'main'                          => 
(int)$this->db->f('todo_id_main'),
!                                       'parent'                        => 
(int)$this->db->f('todo_id_parent'),
!                                       'level'                         => 
(int)$this->db->f('todo_level'),
!                                       'owner'                         => 
$this->db->f('todo_owner'),
!                                       'owner_id'                      => 
$this->db->f('todo_owner'),
!                                       'access'                        => 
$this->db->f('todo_access'),
!                                       'cat'                           => 
(int)$this->db->f('todo_cat'),
!                                       'title'                         => 
$this->db->f('todo_title'),
!                                       'descr'                         => 
$this->db->f('todo_des'),
!                                       'pri'                           => 
(int)$this->db->f('todo_pri'),
!                                       'status'                        => 
(int)$this->db->f('todo_status'),
!                                       'sdate'                         => 
$this->db->f('todo_startdate'),
!                                       'edate'                         => 
$this->db->f('todo_enddate'),
!                                       'grants'                        => 
(int)$this->grants[$this->db->f('todo_owner')],
!                                       'sdate_epoch'           => 
(int)$this->db->f('todo_startdate'),
!                                       'edate_epoch'           => 
(int)$this->db->f('todo_enddate'),
!                                       'assigned'                      => 
$this->db->f('todo_assigned'),
!                                       'assigned_group'        => 
$this->db->f('assigned_group')
                                );
                        }
***************
*** 154,171 ****
                        if ($this->db->next_record())
                        {
!                               $todo['id']                     = 
$this->db->f('todo_id');
!                               $todo['main']           = 
$this->db->f('todo_id_main');
!                               $todo['parent']         = 
$this->db->f('todo_id_parent');
!                               $todo['level']          = 
$this->db->f('todo_level');
!                               $todo['owner']          = 
$this->db->f('todo_owner');
!                               $todo['access']         = 
$this->db->f('todo_access');
!                               $todo['cat']            = 
$this->db->f('todo_cat');
!                               $todo['title']          = 
$this->db->f('todo_title');
!                               $todo['descr']          = 
$this->db->f('todo_des');
!                               $todo['pri']            = 
$this->db->f('todo_pri');
!                               $todo['status']         = 
$this->db->f('todo_status');
!                               $todo['sdate']          = 
$this->db->f('todo_startdate');
!                               $todo['edate']          = 
$this->db->f('todo_enddate');
!                               $todo['assigned']       = 
$this->db->f('todo_assigned');
                        }
                        return $todo;
--- 167,185 ----
                        if ($this->db->next_record())
                        {
!                               $todo['id']                             = 
$this->db->f('todo_id');
!                               $todo['main']                   = 
$this->db->f('todo_id_main');
!                               $todo['parent']                 = 
$this->db->f('todo_id_parent');
!                               $todo['level']                  = 
$this->db->f('todo_level');
!                               $todo['owner']                  = 
$this->db->f('todo_owner');
!                               $todo['access']                 = 
$this->db->f('todo_access');
!                               $todo['cat']                    = 
$this->db->f('todo_cat');
!                               $todo['title']                  = 
$this->db->f('todo_title');
!                               $todo['descr']                  = 
$this->db->f('todo_des');
!                               $todo['pri']                    = 
$this->db->f('todo_pri');
!                               $todo['status']                 = 
$this->db->f('todo_status');
!                               $todo['sdate']                  = 
$this->db->f('todo_startdate');
!                               $todo['edate']                  = 
$this->db->f('todo_enddate');
!                               $todo['assigned']               = 
$this->db->f('todo_assigned');
!                               $todo['assigned_group'] = 
$this->db->f('assigned_group');
                        }
                        return $todo;
***************
*** 198,206 ****
                        $this->db->transaction_begin();
                        $this->db->query("insert into phpgw_todo 
(todo_id_main,todo_id_parent,todo_level,todo_owner,todo_access,todo_cat,"
!                               . 
"todo_des,todo_title,todo_pri,todo_status,todo_datecreated,todo_startdate,todo_enddate,todo_assigned)
 values ('"
                                . $values['main'] . "','" . $values['parent'] . 
"','" . $values['level'] . "','" . $this->owner . "','" . $values['access']
                                . "','" . $values['cat'] . "','" . 
$values['descr'] . "','" . $values['title'] . "','" . $values['pri'] . "','"
                                . $values['status'] . "','" . time() . "','" . 
$values['sdate'] . "','" . $values['edate'] . "','" . $values['assigned']
!                               . "')",__LINE__,__FILE__);
                        $this->db->get_last_insert_id('phpgw_todo','todo_id');
  
--- 212,220 ----
                        $this->db->transaction_begin();
                        $this->db->query("insert into phpgw_todo 
(todo_id_main,todo_id_parent,todo_level,todo_owner,todo_access,todo_cat,"
!                               . 
"todo_des,todo_title,todo_pri,todo_status,todo_datecreated,todo_startdate,todo_enddate,todo_assigned,assigned_group)
 values ('"
                                . $values['main'] . "','" . $values['parent'] . 
"','" . $values['level'] . "','" . $this->owner . "','" . $values['access']
                                . "','" . $values['cat'] . "','" . 
$values['descr'] . "','" . $values['title'] . "','" . $values['pri'] . "','"
                                . $values['status'] . "','" . time() . "','" . 
$values['sdate'] . "','" . $values['edate'] . "','" . $values['assigned']
!                               . "','" . $values['assigned_group'] . 
"')",__LINE__,__FILE__);
                        $this->db->get_last_insert_id('phpgw_todo','todo_id');
  
***************
*** 300,305 ****
                                . "', todo_access='" . $values['access'] . "', 
todo_level='" . $values['level']
                                . "', todo_startdate='" . $values['sdate'] . 
"', todo_enddate='" . $values['edate'] . "', todo_title='" . $values['title']
!                               . "', todo_cat='" . $values['cat'] . "' 
todo_assigned='" . $values['assigned'] . "'where todo_id='" . $values['id']
!                               . "'",__LINE__,__FILE__);
                        $this->db->transaction_commit();
                }
--- 314,319 ----
                                . "', todo_access='" . $values['access'] . "', 
todo_level='" . $values['level']
                                . "', todo_startdate='" . $values['sdate'] . 
"', todo_enddate='" . $values['edate'] . "', todo_title='" . $values['title']
!                               . "', todo_cat='" . $values['cat'] . "', 
todo_assigned='" . $values['assigned'] . "', assigned_group='" . 
$values['assigned_group']
!                               . "' where todo_id='" . $values['id'] . 
"'",__LINE__,__FILE__);
                        $this->db->transaction_commit();
                }

Index: class.ui.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/todo/inc/class.ui.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.ui.inc.php    27 Jan 2002 22:24:38 -0000      1.3
--- class.ui.inc.php    31 Jan 2002 01:33:02 -0000      1.4
***************
*** 221,224 ****
--- 221,227 ----
                                }
  
+                               $assigned = 
$this->bo->list_assigned($todo_list[$i]['assigned']);
+                               $assigned .= 
$this->bo->list_assigned($todo_list[$i]['assigned_group']);
+ 
  // --------------- template declaration for list records 
-------------------------------------
  
***************
*** 231,235 ****
                                        'datedue'               => $datedueout,
                                        'owner'                 => 
$todo_list[$i]['owner'],
!                                       'assigned'              => 
$this->bo->list_assigned($todo_list[$i]['assigned'])
                                ));
  
--- 234,238 ----
                                        'datedue'               => $datedueout,
                                        'owner'                 => 
$todo_list[$i]['owner'],
!                                       'assigned'              => $assigned
                                ));
  
***************
*** 311,315 ****
                }
  
!               function formatted_user($selected = '')
                {
                        if (!$selected)
--- 314,318 ----
                }
  
!               function formatted_user($selected = '',$type)
                {
                        if (!$selected)
***************
*** 323,327 ****
                        }
  
!                       $employees = $this->bo->employee_list();
  
                        while (list($null,$account) = each($employees))
--- 326,330 ----
                        }
  
!                       $employees = $this->bo->employee_list($type);
  
                        while (list($null,$account) = each($employees))
***************
*** 329,335 ****
                                $user_list .= '<option value="' . 
$account['account_id'] . '"';
                                if (in_array($account['account_id'],$selected))
!                               $user_list .= ' selected';
!                               $user_list .= '>' . 
$account['account_firstname'] . ' ' . $account['account_lastname']
!                                                                               
. ' [ ' . $account['account_lid'] . ' ]' . '</option>' . "\n";
                        }
                        return $user_list;
--- 332,348 ----
                                $user_list .= '<option value="' . 
$account['account_id'] . '"';
                                if (in_array($account['account_id'],$selected))
!                               {
!                                       $user_list .= ' selected';
!                               }
!                               if ($account['account_type'] == 'u')
!                               {
!                                       $user_list .= '>' . 
$account['account_firstname'] . ' ' . $account['account_lastname']
!                                                                               
. ' [' . $account['account_lid'] . ']'; 
!                               }
!                               else
!                               {
!                                       $user_list .= '>' . 
$account['account_firstname'] . '&nbsp;' . lang('Group');
!                               }
!                               $user_list .= '</option>' . "\n";
                        }
                        return $user_list;
***************
*** 364,368 ****
                function add()
                {
!                       global $cat_id, $new_cat, $values, $submit, 
$new_parent, $parent, $assigned;
  
                        if ($new_parent)
--- 377,381 ----
                function add()
                {
!                       global $cat_id, $new_cat, $values, $submit, 
$new_parent, $parent, $assigned, $assigned_group;
  
                        if ($new_parent)
***************
*** 390,393 ****
--- 403,415 ----
                                }
  
+                               if (is_array($assigned_group))
+                               {
+                                       $values['assigned_group'] = 
implode(',',$assigned_group);
+                                       if (count($assigned_group) > 1)
+                                       {
+                                               $values['assigned_group'] = ',' 
. $values['assigned_group'] . ',';
+                                       }
+                               }
+ 
                                $error = $this->bo->check_values($values);
                                if (is_array($error))
***************
*** 429,433 ****
                        
$this->t->set_var('stat_list',$this->sbox->getPercentage('values[status]',0));
  
!                       
$this->t->set_var('user_list',$this->formatted_user($assigned));
  
                        if (!$values['smonth'])
--- 451,457 ----
                        
$this->t->set_var('stat_list',$this->sbox->getPercentage('values[status]',0));
  
!                       
$this->t->set_var('user_list',$this->formatted_user($assigned,'accounts'));
! 
!                       
$this->t->set_var('group_list',$this->formatted_user($assigned_group,'groups'));
  
                        if (!$values['smonth'])
***************
*** 492,496 ****
  
                        $cached_data = 
$this->bo->cached_accounts($values['owner']);
!                       
$this->t->set_var('owner',$GLOBALS['phpgw']->common->display_fullname($cached_data[$values['owner']]['account_lid'],
                                                                        
$cached_data[$values['owner']]['firstname'],$cached_data[$values['owner']]['lastname']));
  
--- 516,520 ----
  
                        $cached_data = 
$this->bo->cached_accounts($values['owner']);
!                       
$this->t->set_var('owner',$GLOBALS['phpgw']->common->display_fullname($cached_data[$values['owner']]['lid'],
                                                                        
$cached_data[$values['owner']]['firstname'],$cached_data[$values['owner']]['lastname']));
  
***************
*** 513,517 ****
                function edit()
                {
!                       global $cat_id, $new_cat, $values, $submit, 
$new_parent, $parent, $todo_id, $assigned;
  
                        if ($new_parent)
--- 537,541 ----
                function edit()
                {
!                       global $cat_id, $new_cat, $values, $submit, 
$new_parent, $parent, $todo_id, $assigned, $assigned_group;
  
                        if ($new_parent)
***************
*** 540,543 ****
--- 564,576 ----
                                }
  
+                               if (is_array($assigned_group))
+                               {
+                                       $values['assigned_group'] = 
implode(',',$assigned_group);
+                                       if (count($assigned_group) > 1)
+                                       {
+                                               $values['assigned_group'] = ',' 
. $values['assigned_group'] . ',';
+                                       }
+                               }
+ 
                                $error = $this->bo->check_values($values);
                                if (is_array($error))
***************
*** 581,585 ****
                        
$this->t->set_var('pri_list',$this->sbox->getPriority('values[pri]',$values['pri']));
                        
$this->t->set_var('stat_list',$this->sbox->getPercentage('values[status]',$values['status']));
!                       
$this->t->set_var('user_list',$this->formatted_user($this->bo->format_assigned($values['assigned'])));
  
                        if ($values['sdate'] == 0)
--- 614,619 ----
                        
$this->t->set_var('pri_list',$this->sbox->getPriority('values[pri]',$values['pri']));
                        
$this->t->set_var('stat_list',$this->sbox->getPercentage('values[status]',$values['status']));
!                       
$this->t->set_var('user_list',$this->formatted_user($this->bo->format_assigned($values['assigned']),'accounts'));
!                       
$this->t->set_var('group_list',$this->formatted_user($this->bo->format_assigned($values['assigned_group']),'groups'));
  
                        if ($values['sdate'] == 0)




reply via email to

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