source: trunk/preferences/inc/class.uicategories.inc.php @ 1623

Revision 1623, 19.8 KB checked in by eduardoalex, 14 years ago (diff)

Ticket #743 - Resolve problema reportado no ticket em questao

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * phpGroupWare - Preferences - categories                                  *
4        * http://www.phpgroupware.org                                              *
5        * Written by Bettina Gille [ceb@phpgroupware.org]                          *
6        * -----------------------------------------------                          *
7        * Copyright 2000 - 2003 Free Software Foundation, Inc                      *
8        *                                                                          *
9        * This program is free software; you can redistribute it and/or modify it  *
10        * under the terms of the GNU General Public License as published by the    *
11        * Free Software Foundation; either version 2 of the License, or (at your   *
12        * option) any later version.                                               *
13        \**************************************************************************/
14
15        class uicategories
16        {
17                var $bo;
18
19                var $start;
20                var $query;
21                var $sort;
22                var $order;
23                var $cat_id;
24
25                var $cats_app;
26
27                var $public_functions = array
28                (
29                        'index'  => True,
30                        'add'    => True,
31                        'edit'   => True,
32                        'delete' => True
33                );
34
35                function uicategories()
36                {
37                        $cats_app                       = get_var('cats_app',array('GET','POST'));
38
39                        $this->bo                       = CreateObject('preferences.bocategories',$cats_app);
40                        $this->nextmatchs       = CreateObject('phpgwapi.nextmatchs');
41                        $this->account          = $GLOBALS['phpgw_info']['user']['account_id'];
42                        $this->user                     = $GLOBALS['phpgw_info']['user']['fullname'];
43
44                        $this->start = $this->bo->start;
45                        $this->query = $this->bo->query;
46                        $this->sort  = $this->bo->sort;
47                        $this->order = $this->bo->order;
48                }
49
50                function save_sessiondata($cats_app)
51                {
52                        $data = array
53                        (
54                                'start' => $this->start,
55                                'query' => $this->query,
56                                'sort'  => $this->sort,
57                                'order' => $this->order
58                        );
59                        $this->bo->save_sessiondata($data,$cats_app);
60                }
61
62                function set_langs()
63                {
64                        $GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
65                        $GLOBALS['phpgw']->template->set_var('row_on',$GLOBALS['phpgw_info']['theme']['row_on']);
66                        $GLOBALS['phpgw']->template->set_var('row_off',$GLOBALS['phpgw_info']['theme']['row_off']);
67                        $GLOBALS['phpgw']->template->set_var('lang_access',lang('Private'));
68                        $GLOBALS['phpgw']->template->set_var('lang_save',lang('Save'));
69                        $GLOBALS['phpgw']->template->set_var('user_name',$this->user);
70                        $GLOBALS['phpgw']->template->set_var('lang_search',lang('Search'));
71                        $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel'));
72                        $GLOBALS['phpgw']->template->set_var('lang_sub',lang('Add sub'));
73                        $GLOBALS['phpgw']->template->set_var('lang_edit',lang('Edit'));
74                        $GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete'));
75                        $GLOBALS['phpgw']->template->set_var('lang_parent',lang('Parent category'));
76                        $GLOBALS['phpgw']->template->set_var('lang_none',lang('None'));
77                        $GLOBALS['phpgw']->template->set_var('lang_name',lang('Name'));
78                        $GLOBALS['phpgw']->template->set_var('lang_descr',lang('Description'));
79                        $GLOBALS['phpgw']->template->set_var('lang_add',lang('Add'));
80                        $GLOBALS['phpgw']->template->set_var('lang_reset',lang('Clear Form'));
81                }
82
83                function cat_data($edata,$data)
84                {
85                        for ($j=0;$j<count($edata);$j++)
86                        {
87                                $td_data .= '<td>' . $data[$edata[$j]] . '</td>' . "\n";
88                        }
89                        return $td_data;
90                }
91
92                function index()
93                {
94                        $cats_app    = get_var('cats_app',array('GET','POST'));
95                        $extra       = get_var('extra',array('GET','POST'));
96                        $global_cats = get_var('global_cats',array('GET','POST'));
97                        $cats_level  = get_var('cats_level',array('GET','POST'));
98
99                        $link_data = array
100                        (
101                                'menuaction'  => 'preferences.uicategories.index',
102                                'cats_app'    => $cats_app,
103                                'extra'       => $extra,
104                                'global_cats' => $global_cats,
105                                'cats_level'  => $cats_level
106                        );
107
108                        if($extra)
109                        {
110                                $edata = explode(',',$extra);
111                        }
112                        $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps'][$cats_app]['title'].
113                                '&nbsp;'.lang('categories for').':&nbsp;'.$this->user;
114                        $GLOBALS['phpgw']->common->phpgw_header();
115                        echo parse_navbar();
116
117                        $GLOBALS['phpgw']->template->set_file(array(
118                                'cat_list_t'  => 'listcats.tpl',
119                                'data_column' => 'listcats.tpl'
120                        ));
121                        $GLOBALS['phpgw']->template->set_block('cat_list_t','data_column','column');
122                        $GLOBALS['phpgw']->template->set_block('cat_list_t','cat_list','list');
123
124                        $this->set_langs();
125
126                        $GLOBALS['phpgw']->template->set_var('title_categories',lang('categories for'));
127                        $GLOBALS['phpgw']->template->set_var('lang_app',lang($cats_app));
128                        $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
129                        $GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/preferences/index.php'));
130
131                        if(!$this->start)
132                        {
133                                $this->start = 0;
134                        }
135
136                        if(!$global_cats)
137                        {
138                                $global_cats = False;
139                        }
140
141                        $cats = $this->bo->get_list($global_cats);
142
143//--------------------------------- nextmatch --------------------------------------------
144
145                        $left  = $this->nextmatchs->left('/index.php',$this->start,$this->bo->cats->total_records,$link_data);
146                        $right = $this->nextmatchs->right('/index.php',$this->start,$this->bo->cats->total_records,$link_data);
147                        $GLOBALS['phpgw']->template->set_var('left',$left);
148                        $GLOBALS['phpgw']->template->set_var('right',$right);
149
150                        $GLOBALS['phpgw']->template->set_var('lang_showing',$this->nextmatchs->show_hits($this->bo->cats->total_records,$this->start));
151
152// ------------------------------ end nextmatch ------------------------------------------
153
154//------------------- list header variable template-declarations -------------------------
155
156                        $GLOBALS['phpgw']->template->set_var('sort_name',$this->nextmatchs->show_sort_order($this->sort,'cat_name',$this->order,'/index.php',lang('Name'),$link_data));
157                        $GLOBALS['phpgw']->template->set_var('sort_description',$this->nextmatchs->show_sort_order($this->sort,'cat_description',$this->order,'/index.php',lang('Description'),$link_data));
158
159                        if (is_array($edata))
160                        {
161                                for($i=0;$i<count($edata);$i++)
162                                {
163                                        $GLOBALS['phpgw']->template->set_var('th_data','<td bgcolor="' . $GLOBALS['phpgw_info']['theme']['th_bg'] . '">' . lang($edata[$i]) . '</td>');
164                                        $GLOBALS['phpgw']->template->fp('column','data_column',True);
165                                }
166                        }
167                        else
168                        {
169                                $GLOBALS['phpgw']->template->set_var('th_data','');
170                        }
171
172// -------------------------- end header declaration --------------------------------------
173
174                        for ($i=0;$i<count($cats);$i++)
175                        {
176                                $this->nextmatchs->template_alternate_row_color($GLOBALS['phpgw']->template);
177
178                                if ($cats[$i]['app_name'] == 'phpgw')
179                                {
180                                        $appendix = '&lt;' . lang('Global') . '&gt;';
181                                }
182                                elseif ($cats[$i]['owner'] == '-1')
183                                {
184                                        $appendix = '&lt;' . lang('Global') . '&nbsp;' . $GLOBALS['phpgw_info']['apps'][$cats_app]['title'] . '&gt;';
185                                }
186                                else
187                                {
188                                        $appendix = '';
189                                }
190
191                                $level = $cats[$i]['level'];
192
193                                if ($level > 0)
194                                {
195                                        $space = '&nbsp;&nbsp;';
196                                        $spaceset = str_repeat($space,$level);
197                                        $name = $spaceset . $GLOBALS['phpgw']->strip_html($cats[$i]['name']) . $appendix;
198                                }
199
200                                $descr = $GLOBALS['phpgw']->strip_html($cats[$i]['description']);
201                                if (!$descr) { $descr = '&nbsp;'; }
202
203                                if (is_array($edata))
204                                {
205                                        $data = unserialize($cats[$i]['data']);
206                                        if (! is_array($data))
207                                        {
208                                                $holder = '<td>&nbsp;</td>' . "\n";
209                                                $placeholder = str_repeat($holder,count($edata));
210                                                $GLOBALS['phpgw']->template->set_var('td_data',$placeholder);
211                                        }
212                                        else
213                                        {
214                                                $GLOBALS['phpgw']->template->set_var('td_data',$this->cat_data($edata,$data));
215                                        }
216                                }
217
218                                if ($level == 0)
219                                {
220                                        $name = '<font color="FF0000"><b>' . $GLOBALS['phpgw']->strip_html($cats[$i]['name']) . '</b></font>' . $appendix;
221                                        $descr = '<font color="FF0000"><b>' . $descr . '</b></font>';
222                                }
223
224                                $GLOBALS['phpgw']->template->set_var(array(
225                                        'name'  => $name,
226                                        'descr' => $descr
227                                ));
228
229                                $GLOBALS['phpgw']->template->set_var('app_url',$GLOBALS['phpgw']->link('/' . $cats_app . '/index.php','cat_id=' . $cats[$i]['id']));
230
231                                if ($cats_level || ($level == 0))
232                                {
233                                        if ($cats[$i]['owner'] == $this->account || $cats[$i]['app_name'] == 'phpgw')
234                                        {
235                                                $link_data['menuaction'] = 'preferences.uicategories.add';
236                                                $link_data['cat_parent'] = $cats[$i]['id'];
237                                                $GLOBALS['phpgw']->template->set_var('add_sub',$GLOBALS['phpgw']->link('/index.php',$link_data));
238                                                $GLOBALS['phpgw']->template->set_var('lang_sub_entry',lang('Add sub'));
239                                        }
240                                }
241                                else
242                                {
243                                        $GLOBALS['phpgw']->template->set_var('add_sub','');
244                                        $GLOBALS['phpgw']->template->set_var('lang_sub_entry','&nbsp;');
245                                }
246
247                                $link_data['cat_id'] = $cats[$i]['id'];
248
249                                if ($cats[$i]['owner'] == $GLOBALS['phpgw']->accounts->id2name($this->account) && $cats[$i]['app_name'] != 'phpgw')
250                                {
251                                        $link_data['menuaction'] = 'preferences.uicategories.edit';
252                                        $GLOBALS['phpgw']->template->set_var('edit',$GLOBALS['phpgw']->link('/index.php',$link_data));
253                                        $GLOBALS['phpgw']->template->set_var('lang_edit_entry',lang('Edit'));
254
255                                        $link_data['menuaction'] = 'preferences.uicategories.delete';
256                                        $GLOBALS['phpgw']->template->set_var('delete',$GLOBALS['phpgw']->link('/index.php',$link_data));
257                                        $GLOBALS['phpgw']->template->set_var('lang_delete_entry',lang('Delete'));
258                                }
259                                else
260                                {
261                                        $GLOBALS['phpgw']->template->set_var('edit','');
262                                        $GLOBALS['phpgw']->template->set_var('lang_edit_entry','&nbsp;');
263
264                                        $GLOBALS['phpgw']->template->set_var('delete','');
265                                        $GLOBALS['phpgw']->template->set_var('lang_delete_entry','&nbsp;');
266                                }
267                                $GLOBALS['phpgw']->template->fp('list','cat_list',True);
268                        }
269                        $link_data['menuaction'] = 'preferences.uicategories.add';
270                        $GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
271                        $this->save_sessiondata($cats_app);
272
273                        $GLOBALS['phpgw']->template->pfp('out','cat_list_t',True);
274                }
275
276                function add()
277                {
278                        $cats_app    = get_var('cats_app',array('GET','POST'));
279                        $extra       = get_var('extra',array('GET','POST'));
280                        $global_cats = get_var('global_cats',array('GET','POST'));
281                        $cats_level  = get_var('cats_level',array('GET','POST'));
282
283                        $link_data = array
284                        (
285                                'menuaction'  => 'preferences.uicategories.add',
286                                'cats_app'    => $cats_app,
287                                'extra'       => $extra,
288                                'global_cats' => $global_cats,
289                                'cats_level'  => $cats_level
290                        );
291
292                        $new_parent      = $_POST['new_parent'];
293                        $cat_parent      = get_var('cat_parent',array('POST','GET'));
294                        $cat_name        = $_POST['cat_name'];
295                        $cat_description = $_POST['cat_description'];
296                        $cat_data        = $_POST['cat_data'];
297                        $cat_access      = $_POST['cat_access'];
298
299                        $GLOBALS['phpgw']->template->set_file(array('form' => 'category_form.tpl'));
300                        $GLOBALS['phpgw']->template->set_block('form','data_row','row');
301                        $GLOBALS['phpgw']->template->set_block('form','add','addhandle');
302                        $GLOBALS['phpgw']->template->set_block('form','edit','edithandle');
303
304                        $this->set_langs();
305
306                        if ($new_parent)
307                        {
308                                $cat_parent = $new_parent;
309                        }
310
311                        if (!$global_cats)
312                        {
313                                $global_cats = False;
314                        }
315
316                        if ($_POST['save'])
317                        {
318                                $data = serialize($cat_data);
319
320                                $values = array
321                                (
322                                        'parent' => $cat_parent,
323                                        'descr'  => $cat_description,
324                                        'name'   => $cat_name,
325                                        'access' => $cat_access,
326                                        'data'   => $data
327                                );
328
329                                $error = $this->bo->check_values($values);
330                                if (is_array($error))
331                                {
332                                        $GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
333                                }
334                                else
335                                {
336                                        $this->bo->save_cat($values);
337                                        return $this->index();
338                                        //$GLOBALS['phpgw']->template->set_var('message',lang('Category %1 has been added !', $cat_name));
339                                }
340                        }
341                        $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Add %1 category for',
342                                $GLOBALS['phpgw_info']['apps'][$cats_app]['title']).':&nbsp;'.$this->user;
343                        $GLOBALS['phpgw']->common->phpgw_header();
344                        echo parse_navbar();
345
346                        $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
347
348                        if ($cats_level)
349                        {
350                                $type = 'all';
351                        }
352                        else
353                        {
354                                $type = 'mains';
355                        }
356
357                        $GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formated_list('select',$type,$cat_parent,$global_cats));
358                        $GLOBALS['phpgw']->template->set_var('cat_name',$cat_name);
359                        $GLOBALS['phpgw']->template->set_var('cat_description',$cat_description);
360
361                        $GLOBALS['phpgw']->template->set_var('access','<input type="checkbox" name="cat_access" value="True"'
362                                . ($cat_access == True ?' checked':'') . '>');
363
364                        if ($extra)
365                        {
366                                $edata = explode(',',$extra);
367                                for($i=0;$i<count($edata);$i++)
368                                {
369                                        $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color());
370                                        $GLOBALS['phpgw']->template->set_var('td_data','<input name="cat_data[' . $edata[$i] . ']" size="50" value="' . $cat_data[$edata[$i]] . '">');
371                                        $GLOBALS['phpgw']->template->set_var('lang_data',lang($edata[$i]));
372                                        $GLOBALS['phpgw']->template->fp('row','data_row',True);
373                                }
374                        }
375
376                        $link_data['menuaction'] = 'preferences.uicategories.index';
377                        $GLOBALS['phpgw']->template->set_var('cancel_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
378                        $GLOBALS['phpgw']->template->set_var('edithandle','');
379                        $GLOBALS['phpgw']->template->set_var('addhandle','');
380                        $GLOBALS['phpgw']->template->pfp('out','form');
381                        $GLOBALS['phpgw']->template->pfp('addhandle','add');
382                }
383
384                function edit()
385                {
386                        $cats_app    = get_var('cats_app',array('GET','POST'));
387                        $extra       = get_var('extra',array('GET','POST'));
388                        $global_cats = get_var('global_cats',array('GET','POST'));
389                        $cats_level  = get_var('cats_level',array('GET','POST'));
390                        $cat_id      = get_var('cat_id',array('GET','POST'));
391
392                        $link_data = array
393                        (
394                                'menuaction'    => 'preferences.uicategories.index',
395                                'cats_app'              => $cats_app,
396                                'extra'                 => $extra,
397                                'global_cats'   => $global_cats,
398                                'cats_level'    => $cats_level,
399                                'cat_id'                => $cat_id
400                        );
401
402                        if (!$cat_id)
403                        {
404                                $GLOBALS['phpgw']->link_redirect('/index.php',$link_data);
405                        }
406
407                        $new_parent                     = $_POST['new_parent'];
408                        $cat_parent                     = $_POST['cat_parent'];
409                        $cat_name                       = $_POST['cat_name'];
410                        $cat_description        = $_POST['cat_description'];
411                        $cat_data                       = $_POST['cat_data'];
412                        $cat_access                     = $_POST['cat_access'];
413                        $old_parent                     = $_POST['old_parent'];
414
415                        $GLOBALS['phpgw']->template->set_file(array('form' => 'category_form.tpl'));
416                        $GLOBALS['phpgw']->template->set_block('form','data_row','row');
417                        $GLOBALS['phpgw']->template->set_block('form','add','addhandle');
418                        $GLOBALS['phpgw']->template->set_block('form','edit','edithandle');
419
420                        $this->set_langs();
421                        $GLOBALS['phpgw']->template->set_var('cancel_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
422
423                        if ($new_parent)
424                        {
425                                $cat_parent = $new_parent;
426                        }
427
428                        if (!$global_cats)
429                        {
430                                $global_cats = False;
431                        }
432
433                        if ($_POST['save'])
434                        {
435                                $data = serialize($cat_data);
436
437                                $values = array
438                                (
439                                        'id'                    => $cat_id,
440                                        'parent'                => $cat_parent,
441                                        'descr'                 => $cat_description,
442                                        'name'                  => $cat_name,
443                                        'access'                => $cat_access,
444                                        'data'                  => $data,
445                                        'old_parent'    => $old_parent
446                                );
447
448                                $error = $this->bo->check_values($values);
449                                if (is_array($error))
450                                {
451                                        $GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
452                                }
453                                else
454                                {
455                                        $cat_id = $this->bo->save_cat($values);
456                                        return $this->index();
457                                        //$GLOBALS['phpgw']->template->set_var('message',lang('Category %1 has been updated !',$cat_name));
458                                }
459                        }
460
461                        $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Edit %1 category for',
462                                $GLOBALS['phpgw_info']['apps'][$cats_app]['title']).':&nbsp;'.$this->user;
463                        $GLOBALS['phpgw']->common->phpgw_header();
464                        echo parse_navbar();
465
466                        $cats = $this->bo->cats->return_single($cat_id);
467
468                        $link_data['menuaction'] = 'preferences.uicategories.edit';
469                        $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
470
471                        $GLOBALS['phpgw']->template->set_var('cat_name',$GLOBALS['phpgw']->strip_html($cats[0]['name']));
472                        $GLOBALS['phpgw']->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cats[0]['description']));
473
474                        $GLOBALS['phpgw']->template->set_var('hidden_vars','<input type="hidden" name="old_parent" value="' . $cats[0]['parent'] . '">');
475
476                        if ($cats_level)
477                        {
478                                $type = 'all';
479                        }
480                        else
481                        {
482                                $type = 'mains';
483                        }
484
485                        $GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formated_list(array(
486                                'type' => $type,'selected' => $cats[0]['parent'],
487                                'globals' => $global_cats, 'self' => $cat_id
488                        )));
489
490                        $GLOBALS['phpgw']->template->set_var('access','<input type="checkbox" name="cat_access" value="True"'
491                                . ($cats[0]['access'] == 'private' ? ' checked' : '') . '>');
492
493                        if ($extra)
494                        {
495                                $edata = explode(',',$extra);
496
497                                $data = unserialize($cats[0]['data']);
498                                for($i=0;$i<count($edata);$i++)
499                                {
500                                        $GLOBALS['phpgw']->template->set_var('td_data','<input name="cat_data[' . $edata[$i] . ']" size="50" value="' . $data[$edata[$i]] . '">');
501                                        $GLOBALS['phpgw']->template->set_var('lang_data',lang($edata[$i]));
502                                        $GLOBALS['phpgw']->template->fp('row','data_row',True);
503                                }
504                        }
505
506                        if ($cats[0]['owner'] == $this->account)
507                        {
508                                $link_data['menuaction'] = 'preferences.uicategories.delete';
509                                $GLOBALS['phpgw']->template->set_var('delete','<form method="POST" action="' . $GLOBALS['phpgw']->link('/index.php',$link_data)
510                                        . '"><input type="submit" value="' . lang('Delete') .'"></form>');
511                        }
512                        else
513                        {
514                                $GLOBALS['phpgw']->template->set_var('delete','&nbsp;');
515                        }
516
517                        $GLOBALS['phpgw']->template->set_var('edithandle','');
518                        $GLOBALS['phpgw']->template->set_var('addhandle','');
519                        $GLOBALS['phpgw']->template->pfp('out','form');
520                        $GLOBALS['phpgw']->template->pfp('edithandle','edit');
521                }
522
523                function delete()
524                {
525                        $cats_app    = get_var('cats_app',array('GET','POST'));
526                        $extra       = get_var('extra',array('GET','POST'));
527                        $global_cats = get_var('global_cats',array('GET','POST'));
528                        $cats_level  = get_var('cats_level',array('GET','POST'));
529                        $cat_id      = get_var('cat_id',array('GET','POST'));
530
531                        $link_data = array
532                        (
533                                'menuaction'  => 'preferences.uicategories.index',
534                                'cats_app'    => $cats_app,
535                                'extra'       => $extra,
536                                'global_cats' => $global_cats,
537                                'cats_level'  => $cats_level,
538                                'cat_id'      => $cat_id
539                        );
540
541                        if (!$cat_id || $_POST['cancel'])
542                        {
543                                $GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
544                        }
545
546                        if ($_POST['confirm'])
547                        {
548                                if ($_POST['subs'])
549                                {
550                                        $this->bo->delete($cat_id,True);
551                                }
552                                else
553                                {
554                                        $this->bo->delete($cat_id,False);
555                                }
556                                $GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
557                        }
558                        else
559                        {
560                                $GLOBALS['phpgw']->template->set_file(array('category_delete' => 'delete.tpl'));
561
562                                $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Delete Categories');
563                                $GLOBALS['phpgw']->common->phpgw_header();
564                                echo parse_navbar();
565
566                                $GLOBALS['phpgw']->template->set_var('deleteheader',lang('Are you sure you want to delete this category ?'));
567
568                                $exists = $this->bo->exists(array
569                                (
570                                        'type'     => 'subs',
571                                        'cat_name' => '',
572                                        'cat_id'   => $cat_id
573                                ));
574
575                                if ($exists)
576                                {
577                                        $GLOBALS['phpgw']->template->set_var('lang_subs',lang('Do you also want to delete all subcategories ?'));
578                                        $GLOBALS['phpgw']->template->set_var('subs','<input type="checkbox" name="subs" value="True">');
579                                }
580                                else
581                                {
582                                        $GLOBALS['phpgw']->template->set_var('lang_subs','');
583                                        $GLOBALS['phpgw']->template->set_var('subs', '');
584                                }
585
586                                $GLOBALS['phpgw']->template->set_var('lang_no',lang('No'));
587                                $link_data['menuaction'] = 'preferences.uicategories.delete';
588                                $GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
589                                $GLOBALS['phpgw']->template->set_var('lang_yes',lang('Yes'));
590                                $GLOBALS['phpgw']->template->pfp('out','category_delete');
591                        }
592                }
593        }
594?>
Note: See TracBrowser for help on using the repository browser.