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

Revision 2, 19.8 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • 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                                if ($cats[$i]['owner'] == $this->account && $cats[$i]['app_name'] != 'phpgw')
249                                {
250                                        $link_data['menuaction'] = 'preferences.uicategories.edit';
251                                        $GLOBALS['phpgw']->template->set_var('edit',$GLOBALS['phpgw']->link('/index.php',$link_data));
252                                        $GLOBALS['phpgw']->template->set_var('lang_edit_entry',lang('Edit'));
253
254                                        $link_data['menuaction'] = 'preferences.uicategories.delete';
255                                        $GLOBALS['phpgw']->template->set_var('delete',$GLOBALS['phpgw']->link('/index.php',$link_data));
256                                        $GLOBALS['phpgw']->template->set_var('lang_delete_entry',lang('Delete'));
257                                }
258                                else
259                                {
260                                        $GLOBALS['phpgw']->template->set_var('edit','');
261                                        $GLOBALS['phpgw']->template->set_var('lang_edit_entry','&nbsp;');
262
263                                        $GLOBALS['phpgw']->template->set_var('delete','');
264                                        $GLOBALS['phpgw']->template->set_var('lang_delete_entry','&nbsp;');
265                                }
266                                $GLOBALS['phpgw']->template->fp('list','cat_list',True);
267                        }
268                        $link_data['menuaction'] = 'preferences.uicategories.add';
269                        $GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
270                        $this->save_sessiondata($cats_app);
271
272                        $GLOBALS['phpgw']->template->pfp('out','cat_list_t',True);
273                }
274
275                function add()
276                {
277                        $cats_app    = get_var('cats_app',array('GET','POST'));
278                        $extra       = get_var('extra',array('GET','POST'));
279                        $global_cats = get_var('global_cats',array('GET','POST'));
280                        $cats_level  = get_var('cats_level',array('GET','POST'));
281
282                        $link_data = array
283                        (
284                                'menuaction'  => 'preferences.uicategories.add',
285                                'cats_app'    => $cats_app,
286                                'extra'       => $extra,
287                                'global_cats' => $global_cats,
288                                'cats_level'  => $cats_level
289                        );
290
291                        $new_parent      = $_POST['new_parent'];
292                        $cat_parent      = get_var('cat_parent',array('POST','GET'));
293                        $cat_name        = $_POST['cat_name'];
294                        $cat_description = $_POST['cat_description'];
295                        $cat_data        = $_POST['cat_data'];
296                        $cat_access      = $_POST['cat_access'];
297
298                        $GLOBALS['phpgw']->template->set_file(array('form' => 'category_form.tpl'));
299                        $GLOBALS['phpgw']->template->set_block('form','data_row','row');
300                        $GLOBALS['phpgw']->template->set_block('form','add','addhandle');
301                        $GLOBALS['phpgw']->template->set_block('form','edit','edithandle');
302
303                        $this->set_langs();
304
305                        if ($new_parent)
306                        {
307                                $cat_parent = $new_parent;
308                        }
309
310                        if (!$global_cats)
311                        {
312                                $global_cats = False;
313                        }
314
315                        if ($_POST['save'])
316                        {
317                                $data = serialize($cat_data);
318
319                                $values = array
320                                (
321                                        'parent' => $cat_parent,
322                                        'descr'  => $cat_description,
323                                        'name'   => $cat_name,
324                                        'access' => $cat_access,
325                                        'data'   => $data
326                                );
327
328                                $error = $this->bo->check_values($values);
329                                if (is_array($error))
330                                {
331                                        $GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
332                                }
333                                else
334                                {
335                                        $this->bo->save_cat($values);
336                                        return $this->index();
337                                        //$GLOBALS['phpgw']->template->set_var('message',lang('Category %1 has been added !', $cat_name));
338                                }
339                        }
340                        $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Add %1 category for',
341                                $GLOBALS['phpgw_info']['apps'][$cats_app]['title']).':&nbsp;'.$this->user;
342                        $GLOBALS['phpgw']->common->phpgw_header();
343                        echo parse_navbar();
344
345                        $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
346
347                        if ($cats_level)
348                        {
349                                $type = 'all';
350                        }
351                        else
352                        {
353                                $type = 'mains';
354                        }
355
356                        $GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formated_list('select',$type,$cat_parent,$global_cats));
357                        $GLOBALS['phpgw']->template->set_var('cat_name',$cat_name);
358                        $GLOBALS['phpgw']->template->set_var('cat_description',$cat_description);
359
360                        $GLOBALS['phpgw']->template->set_var('access','<input type="checkbox" name="cat_access" value="True"'
361                                . ($cat_access == True ?' checked':'') . '>');
362
363                        if ($extra)
364                        {
365                                $edata = explode(',',$extra);
366                                for($i=0;$i<count($edata);$i++)
367                                {
368                                        $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color());
369                                        $GLOBALS['phpgw']->template->set_var('td_data','<input name="cat_data[' . $edata[$i] . ']" size="50" value="' . $cat_data[$edata[$i]] . '">');
370                                        $GLOBALS['phpgw']->template->set_var('lang_data',lang($edata[$i]));
371                                        $GLOBALS['phpgw']->template->fp('row','data_row',True);
372                                }
373                        }
374
375                        $link_data['menuaction'] = 'preferences.uicategories.index';
376                        $GLOBALS['phpgw']->template->set_var('cancel_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
377                        $GLOBALS['phpgw']->template->set_var('edithandle','');
378                        $GLOBALS['phpgw']->template->set_var('addhandle','');
379                        $GLOBALS['phpgw']->template->pfp('out','form');
380                        $GLOBALS['phpgw']->template->pfp('addhandle','add');
381                }
382
383                function edit()
384                {
385                        $cats_app    = get_var('cats_app',array('GET','POST'));
386                        $extra       = get_var('extra',array('GET','POST'));
387                        $global_cats = get_var('global_cats',array('GET','POST'));
388                        $cats_level  = get_var('cats_level',array('GET','POST'));
389                        $cat_id      = get_var('cat_id',array('GET','POST'));
390
391                        $link_data = array
392                        (
393                                'menuaction'    => 'preferences.uicategories.index',
394                                'cats_app'              => $cats_app,
395                                'extra'                 => $extra,
396                                'global_cats'   => $global_cats,
397                                'cats_level'    => $cats_level,
398                                'cat_id'                => $cat_id
399                        );
400
401                        if (!$cat_id)
402                        {
403                                $GLOBALS['phpgw']->link_redirect('/index.php',$link_data);
404                        }
405
406                        $new_parent                     = $_POST['new_parent'];
407                        $cat_parent                     = $_POST['cat_parent'];
408                        $cat_name                       = $_POST['cat_name'];
409                        $cat_description        = $_POST['cat_description'];
410                        $cat_data                       = $_POST['cat_data'];
411                        $cat_access                     = $_POST['cat_access'];
412                        $old_parent                     = $_POST['old_parent'];
413
414                        $GLOBALS['phpgw']->template->set_file(array('form' => 'category_form.tpl'));
415                        $GLOBALS['phpgw']->template->set_block('form','data_row','row');
416                        $GLOBALS['phpgw']->template->set_block('form','add','addhandle');
417                        $GLOBALS['phpgw']->template->set_block('form','edit','edithandle');
418
419                        $this->set_langs();
420                        $GLOBALS['phpgw']->template->set_var('cancel_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
421
422                        if ($new_parent)
423                        {
424                                $cat_parent = $new_parent;
425                        }
426
427                        if (!$global_cats)
428                        {
429                                $global_cats = False;
430                        }
431
432                        if ($_POST['save'])
433                        {
434                                $data = serialize($cat_data);
435
436                                $values = array
437                                (
438                                        'id'                    => $cat_id,
439                                        'parent'                => $cat_parent,
440                                        'descr'                 => $cat_description,
441                                        'name'                  => $cat_name,
442                                        'access'                => $cat_access,
443                                        'data'                  => $data,
444                                        'old_parent'    => $old_parent
445                                );
446
447                                $error = $this->bo->check_values($values);
448                                if (is_array($error))
449                                {
450                                        $GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
451                                }
452                                else
453                                {
454                                        $cat_id = $this->bo->save_cat($values);
455                                        return $this->index();
456                                        //$GLOBALS['phpgw']->template->set_var('message',lang('Category %1 has been updated !',$cat_name));
457                                }
458                        }
459
460                        $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Edit %1 category for',
461                                $GLOBALS['phpgw_info']['apps'][$cats_app]['title']).':&nbsp;'.$this->user;
462                        $GLOBALS['phpgw']->common->phpgw_header();
463                        echo parse_navbar();
464
465                        $cats = $this->bo->cats->return_single($cat_id);
466
467                        $link_data['menuaction'] = 'preferences.uicategories.edit';
468                        $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
469
470                        $GLOBALS['phpgw']->template->set_var('cat_name',$GLOBALS['phpgw']->strip_html($cats[0]['name']));
471                        $GLOBALS['phpgw']->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cats[0]['description']));
472
473                        $GLOBALS['phpgw']->template->set_var('hidden_vars','<input type="hidden" name="old_parent" value="' . $cats[0]['parent'] . '">');
474
475                        if ($cats_level)
476                        {
477                                $type = 'all';
478                        }
479                        else
480                        {
481                                $type = 'mains';
482                        }
483
484                        $GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formated_list(array(
485                                'type' => $type,'selected' => $cats[0]['parent'],
486                                'globals' => $global_cats, 'self' => $cat_id
487                        )));
488
489                        $GLOBALS['phpgw']->template->set_var('access','<input type="checkbox" name="cat_access" value="True"'
490                                . ($cats[0]['access'] == 'private' ? ' checked' : '') . '>');
491
492                        if ($extra)
493                        {
494                                $edata = explode(',',$extra);
495
496                                $data = unserialize($cats[0]['data']);
497                                for($i=0;$i<count($edata);$i++)
498                                {
499                                        $GLOBALS['phpgw']->template->set_var('td_data','<input name="cat_data[' . $edata[$i] . ']" size="50" value="' . $data[$edata[$i]] . '">');
500                                        $GLOBALS['phpgw']->template->set_var('lang_data',lang($edata[$i]));
501                                        $GLOBALS['phpgw']->template->fp('row','data_row',True);
502                                }
503                        }
504
505                        if ($cats[0]['owner'] == $this->account)
506                        {
507                                $link_data['menuaction'] = 'preferences.uicategories.delete';
508                                $GLOBALS['phpgw']->template->set_var('delete','<form method="POST" action="' . $GLOBALS['phpgw']->link('/index.php',$link_data)
509                                        . '"><input type="submit" value="' . lang('Delete') .'"></form>');
510                        }
511                        else
512                        {
513                                $GLOBALS['phpgw']->template->set_var('delete','&nbsp;');
514                        }
515
516                        $GLOBALS['phpgw']->template->set_var('edithandle','');
517                        $GLOBALS['phpgw']->template->set_var('addhandle','');
518                        $GLOBALS['phpgw']->template->pfp('out','form');
519                        $GLOBALS['phpgw']->template->pfp('edithandle','edit');
520                }
521
522                function delete()
523                {
524                        $cats_app    = get_var('cats_app',array('GET','POST'));
525                        $extra       = get_var('extra',array('GET','POST'));
526                        $global_cats = get_var('global_cats',array('GET','POST'));
527                        $cats_level  = get_var('cats_level',array('GET','POST'));
528                        $cat_id      = get_var('cat_id',array('GET','POST'));
529
530                        $link_data = array
531                        (
532                                'menuaction'  => 'preferences.uicategories.index',
533                                'cats_app'    => $cats_app,
534                                'extra'       => $extra,
535                                'global_cats' => $global_cats,
536                                'cats_level'  => $cats_level,
537                                'cat_id'      => $cat_id
538                        );
539
540                        if (!$cat_id || $_POST['cancel'])
541                        {
542                                $GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
543                        }
544
545                        if ($_POST['confirm'])
546                        {
547                                if ($_POST['subs'])
548                                {
549                                        $this->bo->delete($cat_id,True);
550                                }
551                                else
552                                {
553                                        $this->bo->delete($cat_id,False);
554                                }
555                                $GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
556                        }
557                        else
558                        {
559                                $GLOBALS['phpgw']->template->set_file(array('category_delete' => 'delete.tpl'));
560
561                                $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Delete Categories');
562                                $GLOBALS['phpgw']->common->phpgw_header();
563                                echo parse_navbar();
564
565                                $GLOBALS['phpgw']->template->set_var('deleteheader',lang('Are you sure you want to delete this category ?'));
566
567                                $exists = $this->bo->exists(array
568                                (
569                                        'type'     => 'subs',
570                                        'cat_name' => '',
571                                        'cat_id'   => $cat_id
572                                ));
573
574                                if ($exists)
575                                {
576                                        $GLOBALS['phpgw']->template->set_var('lang_subs',lang('Do you also want to delete all subcategories ?'));
577                                        $GLOBALS['phpgw']->template->set_var('subs','<input type="checkbox" name="subs" value="True">');
578                                }
579                                else
580                                {
581                                        $GLOBALS['phpgw']->template->set_var('lang_subs','');
582                                        $GLOBALS['phpgw']->template->set_var('subs', '');
583                                }
584
585                                $GLOBALS['phpgw']->template->set_var('lang_no',lang('No'));
586                                $link_data['menuaction'] = 'preferences.uicategories.delete';
587                                $GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
588                                $GLOBALS['phpgw']->template->set_var('lang_yes',lang('Yes'));
589                                $GLOBALS['phpgw']->template->pfp('out','category_delete');
590                        }
591                }
592        }
593?>
Note: See TracBrowser for help on using the repository browser.