[2] | 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%"> </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 | |
---|
[855] | 67 | //add_col($tpl,' <td width="2%" align="left">'.add_image_ahref($this->page('matrixselect'),'view',lang('Daily Matrix View')).'</td>'); |
---|
[2] | 68 | |
---|
| 69 | add_col($tpl,' <td width="'.(100 - $col_width).'%" align="left"'.(floor(phpversion()) < 4?' colspan="2"':'').'> </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 = ''; |
---|
[855] | 171 | |
---|
| 172 | $drop_down = $this->bo->list_cals(); //hehe |
---|
| 173 | |
---|
[2] | 174 | foreach($drop_down as $key => $grant) |
---|
[855] | 175 | { |
---|
| 176 | if(!strstr(($grant['value']),'g_')) |
---|
| 177 | $form_options .= ' <option value="'.$grant['value'].'"'.($grant['grantor']==$this->bo->owner?' selected':'').'>'.$grant['name'].'</option>'."\n"; |
---|
[2] | 178 | } |
---|
| 179 | |
---|
| 180 | $var = Array( |
---|
[5165] | 181 | 'form_width' => $remainder, |
---|
| 182 | 'form_link' => $this->page($referrer), |
---|
| 183 | 'id_form_select' => 'id="userExportCalendar"', |
---|
| 184 | 'form_name' => 'owner', |
---|
| 185 | 'title' => lang('User'), |
---|
| 186 | 'hidden_vars' => $base_hidden_vars, |
---|
| 187 | 'form_options' => $form_options, |
---|
| 188 | 'button_value' => lang('Go!') |
---|
[2] | 189 | ); |
---|
| 190 | $tpl->set_var($var); |
---|
| 191 | $tpl->set_var('str',$tpl->fp('out','form_button_dropdown')); |
---|
| 192 | $tpl->parse('header_column','head_col',True); |
---|
| 193 | } |
---|
| 194 | } |
---|
| 195 | |
---|
| 196 | $hidden_vars = ' <input type="hidden" name="from" value="'.$GLOBALS['HTTP_GET_VARS']['menuaction'].'">'."\n"; |
---|
| 197 | if(isset($GLOBALS['HTTP_GET_VARS']['date']) && $GLOBALS['HTTP_GET_VARS']['date']) |
---|
| 198 | { |
---|
| 199 | $hidden_vars .= ' <input type="hidden" name="date" value="'.$GLOBALS['HTTP_GET_VARS']['date'].'">'."\n"; |
---|
| 200 | } |
---|
| 201 | $hidden_vars .= ' <input type="hidden" name="month" value="'.$this->bo->month.'">'."\n"; |
---|
| 202 | $hidden_vars .= ' <input type="hidden" name="day" value="'.$this->bo->day.'">'."\n"; |
---|
| 203 | $hidden_vars .= ' <input type="hidden" name="year" value="'.$this->bo->year.'">'."\n"; |
---|
| 204 | if(isset($this->bo->filter) && $this->bo->filter) |
---|
| 205 | { |
---|
| 206 | $hidden_vars .= ' <input type="hidden" name="filter" value="'.$this->bo->filter.'">'."\n"; |
---|
| 207 | } |
---|
| 208 | if(isset($this->bo->sortby) && $this->bo->sortby) |
---|
| 209 | { |
---|
| 210 | $hidden_vars .= ' <input type="hidden" name="sortby" value="'.$this->bo->sortby.'">'."\n"; |
---|
| 211 | } |
---|
| 212 | if(isset($this->bo->num_months) && $this->bo->num_months) |
---|
| 213 | { |
---|
| 214 | $hidden_vars .= ' <input type="hidden" name="num_months" value="'.$this->bo->num_months.'">'."\n"; |
---|
| 215 | } |
---|
| 216 | $hidden_vars .= ' <input name="keywords"'.($GLOBALS['HTTP_POST_VARS']['keywords']?' value="'.$GLOBALS['HTTP_POST_VARS']['keywords'].'"':'').'>'; |
---|
| 217 | |
---|
| 218 | $var = Array( |
---|
| 219 | 'action_url_button' => $this->page('search'), |
---|
| 220 | 'action_text_button' => lang('Search'), |
---|
| 221 | 'action_confirm_button' => '', |
---|
| 222 | 'action_extra_field' => $hidden_vars |
---|
| 223 | ); |
---|
| 224 | $tpl->set_var($var); |
---|
| 225 | $button = $tpl->fp('out','form_button'); |
---|
| 226 | $tpl->set_var('str','<td align="right" valign="bottom">'.$button.'</td>'); |
---|
| 227 | $tpl->parse('header_column','head_col',True); |
---|
| 228 | $tpl->parse('row','head_table',True); |
---|
| 229 | ?> |
---|