source: companies/celepar/calendar/templates/edge-it/header.inc.php @ 763

Revision 763, 9.1 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1<?php
2  /**************************************************************************\
3  * eGroupWare                                                               *
4  * http://www.egroupware.org                                                *
5  * --------------------------------------------                             *
6  *  This program is free software; you can redistribute it and/or modify it *
7  *  under the terms of the GNU General Public License as published by the   *
8  *  Free Software Foundation; either version 2 of the License, or (at your  *
9  *  option) any later version.                                              *
10  \**************************************************************************/
11
12
13        function add_col(&$tpl,$str)
14        {
15                $tpl->set_var('str',$str);
16                $tpl->parse('header_column','head_col',True);
17        }
18
19        function add_image_ahref($link,$image,$alt)
20        {
21                return '<a href="'.$link.'"><img src="'.$GLOBALS['phpgw']->common->image('calendar',$image).'" alt="'.$alt.'" title="'.$alt.'" border="0"></a>';
22        }
23
24        $refer = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
25        $referrer = $refer[2];
26
27        $templates = Array(
28                'head_tpl'      => 'head.tpl',
29                'form_button_dropdown'  => 'form_button_dropdown.tpl',
30                'form_button_script'    => 'form_button_script.tpl'
31        );
32        $tpl->set_file($templates);
33        $tpl->set_block('head_tpl','head','head');
34        $tpl->set_block('head_tpl','head_table','head_table');
35        $tpl->set_block('head_tpl','head_col','head_col');
36        $tpl->set_block('form_button_script','form_button');
37
38        if(floor(phpversion()) >= 4)
39        {
40                $tpl->set_var('cols',8);
41        }
42        else
43        {
44                $tpl->set_var('cols',7);
45        }
46
47        $today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
48
49        $col_width = 12;
50
51        add_col($tpl,'  <td width="2%">&nbsp;</td>');
52
53        add_col($tpl,'  <td width="2%">'.add_image_ahref($this->page('day','&date='.$today),'today',lang('Today')).'</td>');
54
55        add_col($tpl,'  <td width="2%" align="left">'.add_image_ahref($this->page('week','&date='.$today),'week',lang('This week')).'</td>');
56
57        add_col($tpl,'  <td width="2%" align="left">'.add_image_ahref($this->page('month','&date='.$today),'month',lang('This month')).'</td>');
58
59        add_col($tpl,'  <td width="2%" align="left">'.add_image_ahref($this->page('year','&date='.$today),'year',lang('This Year')).'</td>');
60
61        if(floor(phpversion()) >= 4)
62        {
63                add_col($tpl,'  <td width="2%" align="left">'.add_image_ahref($this->page('planner','&date='.$today),'planner',lang('Planner')).'</td>');
64                $col_width += 2;
65        }
66
67        add_col($tpl,'  <td width="2%" align="left">'.add_image_ahref($this->page('matrixselect'),'view',lang('Daily Matrix View')).'</td>');
68
69        add_col($tpl,'  <td width="'.(100 - $col_width).'%" align="left"'.(floor(phpversion()) < 4?' colspan="2"':'').'>&nbsp;</td>');
70
71        $tpl->parse('row','head_table',True);
72
73        $tpl->set_var('header_column','');
74        $tpl->set_var('cols',$cols);
75
76        if($referrer!='view')
77        {
78                $remainder = 72;
79               
80                $date = (isset($GLOBALS['date'])?$GLOBALS['date']:'');
81                $date = (isset($GLOBALS['HTTP_GET_VARS']['date'])?$GLOBALS['HTTP_GET_VARS']['date']:$date);
82                $date = ($date=='' && isset($GLOBALS['HTTP_POST_VARS']['date'])?$GLOBALS['HTTP_POST_VARS']['date']:$date);
83
84                $base_hidden_vars = '<input type="hidden" name="from" value="'.$GLOBALS['HTTP_GET_VARS']['menuaction'].'">'."\n";
85                if(isset($GLOBALS['HTTP_GET_VARS']['cal_id']) && $GLOBALS['HTTP_GET_VARS']['cal_id'] != 0)
86                {
87                        $base_hidden_vars .= '    <input type="hidden" name="cal_id" value="'.$GLOBALS['HTTP_GET_VARS']['cal_id'].'">'."\n";
88                }
89                if(isset($GLOBALS['HTTP_POST_VARS']['keywords']) && $GLOBALS['HTTP_POST_VARS']['keywords'])
90                {
91                        $base_hidden_vars .= '    <input type="hidden" name="keywords" value="'.$GLOBALS['HTTP_POST_VARS']['keywords'].'">'."\n";
92                }
93                if(isset($GLOBALS['HTTP_POST_VARS']['matrixtype']) && $GLOBALS['HTTP_POST_VARS']['matrixtype'])
94                {
95                        $base_hidden_vars .= '    <input type="hidden" name="matrixtype" value="'.$GLOBALS['HTTP_POST_VARS']['matrixtype'].'">'."\n";
96                }
97                if($date)
98                {
99                        $base_hidden_vars .= '    <input type="hidden" name="date" value="'.$date.'">'."\n";
100                }
101                $base_hidden_vars .= '    <input type="hidden" name="month" value="'.$this->bo->month.'">'."\n";
102                $base_hidden_vars .= '    <input type="hidden" name="day" value="'.$this->bo->day.'">'."\n";
103                $base_hidden_vars .= '    <input type="hidden" name="year" value="'.$this->bo->year.'">'."\n";
104               
105                if(isset($GLOBALS['HTTP_POST_VARS']['participants']) && $GLOBALS['HTTP_POST_VARS']['participants'])
106                {
107                        for ($i=0;$i<count($GLOBALS['HTTP_POST_VARS']['participants']);$i++)
108                        {
109                                $base_hidden_vars .= '    <input type="hidden" name="participants[]" value="'.$GLOBALS['HTTP_POST_VARS']['participants'][$i].'">'."\n";
110                        }
111                }
112
113                $var = Array(
114                        'form_width' => '28',
115                        'form_link'     => $this->page($referrer),
116                        'form_name'     => 'cat_id',
117                        'title' => lang('Category'),
118                        'hidden_vars'   => $base_hidden_vars,
119                        'form_options'  => '<option value="0">'.lang('All').'</option>'.$this->cat->formated_list('select','all',$this->bo->cat_id,'True'),
120                        'button_value'  => lang('Go!')
121                );
122                $tpl->set_var($var);
123                $tpl->set_var('str',$tpl->fp('out','form_button_dropdown'));
124                $tpl->parse('header_column','head_col',True);
125
126                if($GLOBALS['HTTP_GET_VARS']['menuaction'] == 'calendar.uicalendar.planner')
127                {
128                        $remainder -= 28;
129                        print_debug('Sort By',$this->bo->sortby);
130
131                        $form_options = '<option value="user"'.($this->bo->sortby=='user'?' selected':'').'>'.lang('User').'</option>'."\n";
132                        $form_options .= '     <option value="category"'.((!isset($this->bo->sortby) || !$this->bo->sortby) || $this->bo->sortby=='category'?' selected':'').'>'.lang('Category').'</option>'."\n";
133               
134                        $var = Array(
135                                'form_width' => '28',
136                                'form_link'     => $this->page($referrer),
137                                'form_name'     => 'sortby',
138                                'title' => lang('Sort By'),
139                                'hidden_vars'   => $base_hidden_vars,
140                                'form_options'  => $form_options,
141                                'button_value'  => lang('Go!')
142                        );
143                        $tpl->set_var($var);
144                        $tpl->set_var('str',$tpl->fp('out','form_button_dropdown'));
145                        $tpl->parse('header_column','head_col',True);
146                }
147
148                if($this->bo->check_perms(PHPGW_ACL_PRIVATE))
149                {
150                        $remainder -= 28;
151                        $form_options = '<option value=" all "'.($this->bo->filter==' all '?' selected':'').'>'.lang('All').'</option>'."\n";
152                        $form_options .= '     <option value=" private "'.((!isset($this->bo->filter) || !$this->bo->filter) || $this->bo->filter==' private '?' selected':'').'>'.lang('Private Only').'</option>'."\n";
153               
154                        $var = Array(
155                                'form_width' => '28',
156                                'form_link'     => $this->page($referrer),
157                                'form_name'     => 'filter',
158                                'title' => lang('Filter'),
159                                'hidden_vars'   => $base_hidden_vars,
160                                'form_options'  => $form_options,
161                                'button_value'  => lang('Go!')
162                        );
163                        $tpl->set_var($var);
164                        $tpl->set_var('str',$tpl->fp('out','form_button_dropdown'));
165                        $tpl->parse('header_column','head_col',True);
166                }
167
168                if((!isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && count($this->bo->grants) > 0)
169                {
170                        $form_options = '';
171                        $drop_down = $this->bo->list_cals();
172                        foreach($drop_down as $key => $grant)
173                        {
174                                $form_options .= '    <option value="'.$grant['value'].'"'.($grant['grantor']==$this->bo->owner?' selected':'').'>'.$grant['name'].'</option>'."\n";
175                        }
176               
177                        $var = Array(
178                                'form_width' => $remainder,
179                                'form_link'     => $this->page($referrer),
180                                'form_name'     => 'owner',
181                                'title' => lang('User'),
182                                'hidden_vars'   => $base_hidden_vars,
183                                'form_options'  => $form_options,
184                                'button_value'  => lang('Go!')
185                        );
186                        $tpl->set_var($var);
187                        $tpl->set_var('str',$tpl->fp('out','form_button_dropdown'));
188                        $tpl->parse('header_column','head_col',True);
189                }
190        }
191
192        $hidden_vars = '    <input type="hidden" name="from" value="'.$GLOBALS['HTTP_GET_VARS']['menuaction'].'">'."\n";
193        if(isset($GLOBALS['HTTP_GET_VARS']['date']) && $GLOBALS['HTTP_GET_VARS']['date'])
194        {
195                $hidden_vars .= '    <input type="hidden" name="date" value="'.$GLOBALS['HTTP_GET_VARS']['date'].'">'."\n";
196        }
197        $hidden_vars .= '    <input type="hidden" name="month" value="'.$this->bo->month.'">'."\n";
198        $hidden_vars .= '    <input type="hidden" name="day" value="'.$this->bo->day.'">'."\n";
199        $hidden_vars .= '    <input type="hidden" name="year" value="'.$this->bo->year.'">'."\n";
200        if(isset($this->bo->filter) && $this->bo->filter)
201        {
202                $hidden_vars .= '    <input type="hidden" name="filter" value="'.$this->bo->filter.'">'."\n";
203        }
204        if(isset($this->bo->sortby) && $this->bo->sortby)
205        {
206                $hidden_vars .= '    <input type="hidden" name="sortby" value="'.$this->bo->sortby.'">'."\n";
207        }
208        if(isset($this->bo->num_months) && $this->bo->num_months)
209        {
210                $hidden_vars .= '    <input type="hidden" name="num_months" value="'.$this->bo->num_months.'">'."\n";
211        }
212        $hidden_vars .= '    <input name="keywords"'.($GLOBALS['HTTP_POST_VARS']['keywords']?' value="'.$GLOBALS['HTTP_POST_VARS']['keywords'].'"':'').'>';
213
214        $var = Array(
215                'action_url_button'     => $this->page('search'),
216                'action_text_button'    => lang('Search'),
217                'action_confirm_button' => '',
218                'action_extra_field'    => $hidden_vars
219        );
220        $tpl->set_var($var);
221        $button = $tpl->fp('out','form_button');
222        $tpl->set_var('str','<td align="right" valign="bottom">'.$button.'</td>');
223        $tpl->parse('header_column','head_col',True);
224        $tpl->parse('row','head_table',True);
225?>
Note: See TracBrowser for help on using the repository browser.