From 61214059675b4f458a86935da03a1cfc5fad7a92 Mon Sep 17 00:00:00 2001 From: bettina Date: Thu, 7 Jun 2001 07:44:26 +0000 Subject: [PATCH] update formated_list to prevent error msg if array empty --- phpgwapi/inc/class.categories.inc.php | 42 +++++++++++++++------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/phpgwapi/inc/class.categories.inc.php b/phpgwapi/inc/class.categories.inc.php index e2301425d5..9c9c330663 100644 --- a/phpgwapi/inc/class.categories.inc.php +++ b/phpgwapi/inc/class.categories.inc.php @@ -219,7 +219,7 @@ $this->app_name = $app_name; $this->db = $phpgw->db; $this->db2 = $this->db; - $this->total_records = $this->db->num_rows(); + $this->total_records = $this->db2->num_rows(); $this->grants = $phpgw->acl->get_grants($app_name); $this->cats = $this->return_array($type,$start,$limit,$query,$sort,$order,$public); } @@ -286,28 +286,34 @@ $cats = $this->return_array($type,$start,False,$query,$sort,$order,$public); + $this->total_records = $this->db2->num_rows(); + $s = '' . "\n"; - for ($i=0;$itotal_records > 0) { - $image_set = ' '; - - if ($this->in_array($cats[$i]['id'],$selected)) + for ($i=0;$i'; + $image_set = ' '; + + if ($this->in_array($cats[$i]['id'],$selected)) + { + $image_set = ''; + } + + if (($cats[$i]['level'] == 0) && !$this->in_array($cats[$i]['id'],$selected)) + { + $image_set = ''; + } + + $space_set = str_repeat($space,$cats[$i]['level']); + + $s .= '' . "\n"; + $s .= '' . "\n"; + $s .= '' . "\n"; + $s .= '' . "\n"; } - - if (($cats[$i]['level'] == 0) && !$this->in_array($cats[$i]['id'],$selected)) - { - $image_set = ''; - } - - $space_set = str_repeat($space,$cats[$i]['level']); - - $s .= '' . "\n"; - $s .= '' . "\n"; - $s .= '' . "\n"; - $s .= '' . "\n"; } $s .= '
' . $image_set . '' . $space_set . '' . $phpgw->strip_html($cats[$i]['name']) + . '
' . $image_set . '' . $space_set . '' . $phpgw->strip_html($cats[$i]['name']) . '
' . "\n"; return $s;