1 | <?php |
---|
2 | /**************************************************************************\ |
---|
3 | * eGroupWare - infolog * |
---|
4 | * http://www.eGroupWare.org * |
---|
5 | * Maintained and further developed by RalfBecker@outdoor-training.de * |
---|
6 | * Based on Webinfolog by Craig Knudsen <cknudsen@radix.net> * |
---|
7 | * http://www.radix.net/~cknudsen * |
---|
8 | * Originaly modified by Mark Peters <skeeter@phpgroupware.org> * |
---|
9 | * -------------------------------------------- * |
---|
10 | * This program is free software; you can redistribute it and/or modify it * |
---|
11 | * under the terms of the GNU General Public License as published by the * |
---|
12 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
13 | * option) any later version. * |
---|
14 | \**************************************************************************/ |
---|
15 | |
---|
16 | |
---|
17 | class uiinfolog |
---|
18 | { |
---|
19 | var $dbb; |
---|
20 | var $template; |
---|
21 | var $cat; |
---|
22 | var $debug = False; |
---|
23 | var $cat_id; |
---|
24 | var $theme; |
---|
25 | var $link_tpl; |
---|
26 | var $public_functions = array( |
---|
27 | 'index' => True, |
---|
28 | 'view' => True, |
---|
29 | 'edit' => True, |
---|
30 | 'update'=> True, |
---|
31 | 'delete' => True, |
---|
32 | 'close' => True, |
---|
33 | 'import_mail' => True, |
---|
34 | 'search' => True, |
---|
35 | 'header' => True, |
---|
36 | 'footer' => True |
---|
37 | ); |
---|
38 | |
---|
39 | |
---|
40 | var $prefs; |
---|
41 | /** |
---|
42 | * instance of the bo-class |
---|
43 | * |
---|
44 | * @var boinfolog |
---|
45 | */ |
---|
46 | var $bo; |
---|
47 | /** |
---|
48 | * reference to instance of the link-class of bo |
---|
49 | * |
---|
50 | * @var bolink |
---|
51 | */ |
---|
52 | var $link; |
---|
53 | /** |
---|
54 | * instance of the etemplate class |
---|
55 | * |
---|
56 | * @var etemplate |
---|
57 | */ |
---|
58 | var $tmpl; |
---|
59 | /** |
---|
60 | * reference to the html object of etemplate |
---|
61 | * |
---|
62 | * @var html |
---|
63 | */ |
---|
64 | var $html; |
---|
65 | /** |
---|
66 | * allowed units and hours per day, can be overwritten by the projectmanager configuration, default all units, 8h |
---|
67 | * |
---|
68 | * @var string |
---|
69 | */ |
---|
70 | var $duration_format = ','; // comma is necessary! |
---|
71 | |
---|
72 | var $icons = array( |
---|
73 | 'type' => array( |
---|
74 | 'task' => 'task.png', 'task_alt' => 'Task', |
---|
75 | 'phone' => 'phone.gpng', 'phone_alt' => 'Phonecall', |
---|
76 | 'note' => 'note.png', 'note_alt' => 'Note', |
---|
77 | 'confirm' => 'confirm.png', 'confirm_alt' => 'Confirmation', |
---|
78 | 'reject' => 'reject.png', 'reject_alt' => 'Reject', |
---|
79 | 'email' => 'email.png', 'email_alt' => 'Email' ), |
---|
80 | 'action' => array( |
---|
81 | 'new' => 'new.png', 'new_alt' => 'Add Sub', |
---|
82 | 'view' => 'view.png', 'view_alt' => 'View Subs', |
---|
83 | 'parent' => 'parent.png', 'parent_alt' => 'View other Subs', |
---|
84 | 'edit' => 'edit.png', 'edit_alt' => 'Edit', |
---|
85 | 'addfile' => 'addfile.png', 'addfile_alt' => 'Add a file', |
---|
86 | 'delete' => 'delete.png', 'delete_alt' => 'Delete', |
---|
87 | 'close' => 'done.png', 'close_alt' => 'Close' ), |
---|
88 | 'status' => array( |
---|
89 | 'billed' => 'billed.png', 'billed_alt' => 'billed', |
---|
90 | 'done' => 'done.png', 'done_alt' => 'done', |
---|
91 | 'will-call' => 'will-call.png', 'will-call_alt' => 'will-call', |
---|
92 | 'call' => 'call.png', 'call_alt' => 'call', |
---|
93 | 'ongoing' => 'ongoing.png', 'ongoing_alt' => 'ongoing', |
---|
94 | 'offer' => 'offer.png', 'offer_alt' => 'offer' ) |
---|
95 | ); |
---|
96 | var $filters = array( |
---|
97 | 'none' => 'no Filter', |
---|
98 | 'done' => 'done', |
---|
99 | 'responsible' => 'responsible', |
---|
100 | 'responsible-open-today' => 'responsible open', |
---|
101 | 'responsible-open-overdue' => 'responsible overdue', |
---|
102 | 'responsible-upcoming' => 'responsible upcoming', |
---|
103 | 'delegated' => 'delegated', |
---|
104 | 'delegated-open-today' => 'delegated open', |
---|
105 | 'delegated-open-overdue' => 'delegated overdue', |
---|
106 | 'delegated-upcoming' => 'delegated upcomming', |
---|
107 | 'own' => 'own', |
---|
108 | 'own-open-today' => 'own open', |
---|
109 | 'own-open-overdue' => 'own overdue', |
---|
110 | 'own-upcoming' => 'own upcoming', |
---|
111 | 'open-today' => 'open', |
---|
112 | 'open-overdue' => 'overdue', |
---|
113 | 'upcoming' => 'upcoming', |
---|
114 | ); |
---|
115 | var $messages = array( |
---|
116 | 'edit' => 'InfoLog - Edit', |
---|
117 | 'add' => 'InfoLog - New', |
---|
118 | 'add_sub' => 'InfoLog - New Subproject', |
---|
119 | 'sp' => '- Subprojects from', |
---|
120 | 're' => 'Re:' |
---|
121 | ); |
---|
122 | |
---|
123 | |
---|
124 | var $optionldap; |
---|
125 | |
---|
126 | /** |
---|
127 | * Constructor |
---|
128 | * |
---|
129 | * @return uiinfolog |
---|
130 | */ |
---|
131 | |
---|
132 | |
---|
133 | |
---|
134 | function uiinfolog() |
---|
135 | { |
---|
136 | |
---|
137 | |
---|
138 | |
---|
139 | |
---|
140 | |
---|
141 | |
---|
142 | //print_r($GLOBALS); |
---|
143 | |
---|
144 | $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); |
---|
145 | $this->bo = CreateObject('infolog.boinfolog',1); |
---|
146 | $this->cat = &$this->bo->cat; |
---|
147 | //echo "pwnre".$this->bo->owner." ".$this->bo->today." ".$this->bo->evento; |
---|
148 | $this->dbb = CreateObject('class.DBAccess',1); |
---|
149 | $this->cat = &$this->bo->cat; |
---|
150 | |
---|
151 | |
---|
152 | $this->resources = &$this->bo->resources; |
---|
153 | |
---|
154 | $this->priority = &$this->bo->priority; |
---|
155 | |
---|
156 | print_debug('BO Owner',$this->bo->owner); |
---|
157 | |
---|
158 | $this->template = $GLOBALS['phpgw']->template; |
---|
159 | $this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('infolog'); |
---|
160 | |
---|
161 | $this->cat_id = $this->bo->cat_id; |
---|
162 | |
---|
163 | $this->link_tpl = CreateObject('phpgwapi.Template',$this->template_dir); |
---|
164 | $this->link_tpl->set_unknowns('remove'); |
---|
165 | $this->link_tpl->set_file( |
---|
166 | Array( |
---|
167 | 'link_picture' => 'link_pict.tpl' |
---|
168 | ) |
---|
169 | ); |
---|
170 | $this->link_tpl->set_block('link_picture','link_pict','link_pict'); |
---|
171 | $this->link_tpl->set_block('link_picture','pict','pict'); |
---|
172 | $this->link_tpl->set_block('link_picture','link_open','link_open'); |
---|
173 | $this->link_tpl->set_block('link_picture','link_close','link_close'); |
---|
174 | $this->link_tpl->set_block('link_picture','link_text','link_text'); |
---|
175 | |
---|
176 | |
---|
177 | |
---|
178 | $this->ds = $GLOBALS['phpgw']->common->ldapConnect(); |
---|
179 | if(!$this->ds) |
---|
180 | $this->ds = $GLOBALS['phpgw']->common->ldapConnect(); |
---|
181 | if(!@is_object($GLOBALS['phpgw']->translation)) |
---|
182 | { |
---|
183 | $GLOBALS['phpgw']->translation = CreateObject('phpgwapi.translation'); |
---|
184 | } |
---|
185 | $this->user_context = $GLOBALS['phpgw_info']['server']['ldap_context']; |
---|
186 | $this->group_context = $GLOBALS['phpgw_info']['server']['ldap_group_context']; |
---|
187 | |
---|
188 | /*************************************************/ |
---|
189 | |
---|
190 | $this->always_app_header = $this->bo->prefs['common']['template_set'] == 'idots'; |
---|
191 | |
---|
192 | //print_debug('UI',$this->_debug_sqsof()); |
---|
193 | |
---|
194 | if (!is_object($GLOBALS['phpgw']->html)) |
---|
195 | { |
---|
196 | $GLOBALS['phpgw']->html = CreateObject('phpgwapi.html'); |
---|
197 | } |
---|
198 | $this->html = &$GLOBALS['phpgw']->html; |
---|
199 | } |
---|
200 | |
---|
201 | /* Public functions */ |
---|
202 | |
---|
203 | |
---|
204 | |
---|
205 | function index($params='') |
---|
206 | |
---|
207 | { |
---|
208 | |
---|
209 | if (!$params) |
---|
210 | { |
---|
211 | foreach(array('date','year','month','day') as $field) |
---|
212 | { |
---|
213 | if (isset($_GET[$field])) |
---|
214 | { |
---|
215 | $params[$field] = $_REQUEST[$field]; |
---|
216 | } |
---|
217 | } |
---|
218 | } |
---|
219 | //$todos = $this->get_todos($todo_label); |
---|
220 | |
---|
221 | $GLOBALS['phpgw']->redirect($this->page('search',$params)); |
---|
222 | |
---|
223 | } |
---|
224 | |
---|
225 | |
---|
226 | |
---|
227 | function page($_page='',$params='') |
---|
228 | { |
---|
229 | if($_page == '') |
---|
230 | { |
---|
231 | $page_ = explode('.',$this->bo->prefs['infolog']['defaultinfolog']); |
---|
232 | $_page = $page_[0]; |
---|
233 | |
---|
234 | if ($_page=='planner_cat' || $_page=='planner_user') |
---|
235 | { |
---|
236 | $_page = 'month'; |
---|
237 | } |
---|
238 | elseif ($_page=='index' || ($_page != 'day' && $_page != 'week' && $_page != 'month' && $_page != 'year' && $_page != 'planner')) |
---|
239 | { |
---|
240 | $_page = 'month'; |
---|
241 | $GLOBALS['phpgw']->preferences->add('infolog','defaultinfolog','month'); |
---|
242 | $GLOBALS['phpgw']->preferences->save_repository(); |
---|
243 | } |
---|
244 | } |
---|
245 | if($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home' || |
---|
246 | strstr($GLOBALS['phpgw_info']['flags']['currentapp'],'mail')) // email, felamimail, ... |
---|
247 | { |
---|
248 | $page_app = 'infolog'; |
---|
249 | } |
---|
250 | else |
---|
251 | { |
---|
252 | $page_app = $GLOBALS['phpgw_info']['flags']['currentapp']; |
---|
253 | } |
---|
254 | if (is_array($params)) |
---|
255 | { |
---|
256 | $params['menuaction'] = $page_app.'.ui'.$page_app.'.'.$_page; |
---|
257 | } |
---|
258 | else |
---|
259 | { |
---|
260 | $params = 'menuaction='.$page_app.'.ui'.$page_app.'.'.$_page.$params; |
---|
261 | } |
---|
262 | return $GLOBALS['phpgw']->link('/index.php',$params); |
---|
263 | } |
---|
264 | |
---|
265 | |
---|
266 | |
---|
267 | // NDEE: printer-friendly |
---|
268 | function printer_friendly($body,$app_header='') |
---|
269 | { |
---|
270 | $_SESSION['infolog']['category'] = $this->cat->formated_list('select','all',$this->bo->cat_id,'True'); |
---|
271 | $_SESSION['infolog']['resources'] = $this->resources->formated_list('select','all',$this->bo->resources_id,'True'); |
---|
272 | if((!isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && count($this->bo->grants) > 0) |
---|
273 | $_SESSION['infolog']['cals'] = $this->bo->list_cals(); |
---|
274 | |
---|
275 | |
---|
276 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
277 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
278 | unset($GLOBALS['phpgw_info']['flags']['noappheader']); |
---|
279 | unset($GLOBALS['phpgw_info']['flags']['noappfooter']); |
---|
280 | if ($app_header && $this->always_app_header) |
---|
281 | { |
---|
282 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['infolog']['title'].' - '.$app_header; |
---|
283 | } |
---|
284 | |
---|
285 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
286 | |
---|
287 | return $new_body; |
---|
288 | } |
---|
289 | |
---|
290 | |
---|
291 | |
---|
292 | |
---|
293 | |
---|
294 | |
---|
295 | |
---|
296 | function header() |
---|
297 | { |
---|
298 | $cols = 8; |
---|
299 | if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True) |
---|
300 | { |
---|
301 | $cols++; |
---|
302 | } |
---|
303 | |
---|
304 | $tpl = $GLOBALS['phpgw']->template; |
---|
305 | $tpl->set_unknowns('remove'); |
---|
306 | |
---|
307 | if (!file_exists($file = $this->template_dir.'/header.inc.php')) |
---|
308 | { |
---|
309 | $file = PHPGW_SERVER_ROOT . '/infolog/templates/default/header.inc.php'; |
---|
310 | } |
---|
311 | |
---|
312 | include($file); |
---|
313 | $refer = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']); |
---|
314 | if($refer[2] != 'view') { |
---|
315 | $header = $tpl->fp('out','head'); |
---|
316 | unset($tpl); |
---|
317 | echo $header; |
---|
318 | } |
---|
319 | unset($tpl); |
---|
320 | } |
---|
321 | |
---|
322 | function footer() |
---|
323 | { |
---|
324 | $menuaction = $_GET['menuaction']; |
---|
325 | list(,,$method) = explode('.',$menuaction); |
---|
326 | |
---|
327 | if (@$this->bo->printer_friendly) |
---|
328 | { |
---|
329 | return; |
---|
330 | } |
---|
331 | |
---|
332 | $p = $GLOBALS['phpgw']->template; |
---|
333 | |
---|
334 | $p->set_file( |
---|
335 | Array( |
---|
336 | 'footer' => 'footer.tpl', |
---|
337 | 'form_button' => 'form_button_script.tpl' |
---|
338 | ) |
---|
339 | ); |
---|
340 | $p->set_block('footer','footer_table','footer_table'); |
---|
341 | $p->set_block('footer','footer_row','footer_row'); |
---|
342 | $p->set_block('footer','blank_row','blank_row'); |
---|
343 | $p->set_block('footer','num_dias','num_dias'); |
---|
344 | |
---|
345 | $m = $this->bo->month; |
---|
346 | $y = $this->bo->year; |
---|
347 | |
---|
348 | $hoje = date('Ymd',$GLOBALS['phpgw']->datetime->gmtnow); |
---|
349 | $mes_hoje = (int)substr($hoje,4,2); |
---|
350 | $mes_footer = (int)substr($_POST['date'],4,2); |
---|
351 | if($_GET['sday']) |
---|
352 | { |
---|
353 | if($_GET['month'] == $mes_hoje) |
---|
354 | { |
---|
355 | $day = $this->bo->day; |
---|
356 | } |
---|
357 | else |
---|
358 | { |
---|
359 | $day = $_GET['sday']; |
---|
360 | } |
---|
361 | } |
---|
362 | else |
---|
363 | { |
---|
364 | $day = $this->bo->day; |
---|
365 | $dia_ini = $day; |
---|
366 | } |
---|
367 | if($mes_footer == $mes_hoje) |
---|
368 | { |
---|
369 | $dia_ini = (int)substr($hoje,6,2); |
---|
370 | $day = $dia_ini; |
---|
371 | } |
---|
372 | |
---|
373 | /********************************************************************************************/ |
---|
374 | |
---|
375 | } |
---|
376 | |
---|
377 | |
---|
378 | |
---|
379 | |
---|
380 | |
---|
381 | |
---|
382 | /****************************************************************************************/ |
---|
383 | |
---|
384 | |
---|
385 | function edit($cd=0,$readsess=0) |
---|
386 | { |
---|
387 | |
---|
388 | $this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime); |
---|
389 | |
---|
390 | |
---|
391 | |
---|
392 | |
---|
393 | if(!$this->bo->check_perms(PHPGW_ACL_ADD)) |
---|
394 | { |
---|
395 | $this->index(); |
---|
396 | } |
---|
397 | |
---|
398 | if($readsess) |
---|
399 | { |
---|
400 | |
---|
401 | $event = $this->bo->restore_from_appsession; |
---|
402 | if(!$event['owner']) |
---|
403 | { |
---|
404 | $this->bo->add_attribute('owner',$this->bo->owner); |
---|
405 | } |
---|
406 | $can_edit = True; |
---|
407 | } |
---|
408 | else |
---|
409 | { |
---|
410 | |
---|
411 | |
---|
412 | $this->bo->event_init(); |
---|
413 | $this->bo->add_attribute('id',0); |
---|
414 | |
---|
415 | $can_edit = True; |
---|
416 | $participants = (string)(get_var('participants',array('GET'),FALSE)); |
---|
417 | $starthour = (int)(get_var('hour',array('GET'),$this->bo->prefs['infolog']['workdaystarts'])); |
---|
418 | $startmin = (int)(get_var('minute',array('GET'),0)); |
---|
419 | $endmin = $startmin + (int)$this->bo->prefs['infolog']['defaultlength']; |
---|
420 | $endhour = $starthour + $this->bo->normalizeminutes($endmin); |
---|
421 | |
---|
422 | $subject = (string)(get_var('title',array('GET'),0)); |
---|
423 | if ($subject != '0') |
---|
424 | { |
---|
425 | $description = (string)(get_var('description',array('GET'),0)); |
---|
426 | $description1 = (string)(get_var('description1',array('GET'),0)); |
---|
427 | $location = (string)(get_var('location',array('GET'),0)); |
---|
428 | } |
---|
429 | else |
---|
430 | unset($subject); |
---|
431 | |
---|
432 | $this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$starthour,$startmin,0); |
---|
433 | $this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$endhour,$endmin,0); |
---|
434 | |
---|
435 | //echo "kkkk".$this->bo->year; |
---|
436 | if(@$this->bo->prefs['infolog']['default_private']) |
---|
437 | { |
---|
438 | $this->bo->set_class(False); |
---|
439 | } |
---|
440 | else |
---|
441 | { |
---|
442 | $this->bo->set_class(True); |
---|
443 | } |
---|
444 | |
---|
445 | $event = $this->bo->restore_from_appsession; |
---|
446 | |
---|
447 | } |
---|
448 | $this->edit_form( |
---|
449 | Array( |
---|
450 | 'event' => $event, |
---|
451 | 'cd' => $cd, |
---|
452 | 'plain' => $_GET['plain'] |
---|
453 | ) |
---|
454 | ); |
---|
455 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
456 | } |
---|
457 | |
---|
458 | |
---|
459 | function edit_form($param) |
---|
460 | { |
---|
461 | |
---|
462 | |
---|
463 | if(isset($_REQUEST['id'])){ |
---|
464 | $event=$this->select($_REQUEST['id']); |
---|
465 | }else{ |
---|
466 | $event=$this->select_init(); |
---|
467 | } |
---|
468 | |
---|
469 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
470 | |
---|
471 | |
---|
472 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
473 | |
---|
474 | |
---|
475 | |
---|
476 | $justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail","telephonenumber","gecos","dn"); |
---|
477 | $sri = @ldap_search($this->ds, "ou=usuarios,ou=cnti,dc=gob,dc=ve", ("(&(sn=*)(mail=*@*)(structuralObjectClass=inetOrgPerson)(deliveryMode=virtual))"), $justthese); |
---|
478 | |
---|
479 | |
---|
480 | if(!$sri) |
---|
481 | return null; |
---|
482 | $allValues = ldap_get_entries($this->ds, $sri); |
---|
483 | //echo $event['propietario']." ".(( $event['propietario'] == "1003")?'SELECTED':''); |
---|
484 | |
---|
485 | |
---|
486 | $ttt=count($allValues); |
---|
487 | |
---|
488 | for($i=0;$i<$ttt;$i++){ |
---|
489 | |
---|
490 | if(isset($allValues[$i]['mail'][0])) |
---|
491 | { |
---|
492 | $option = ' <option value="' . $allValues[$i]['uidnumber'][0] . '" '.(( $event['propietario'] == $allValues[$i]['uidnumber'][0] )?'SELECTED':'').'>'.$allValues[$i]['gecos'][0].'</option>'."\n"; |
---|
493 | $optionldap .= $option; |
---|
494 | $option2 = ' <option value="' . $allValues[$i]['uidnumber'][0] . '" '.(( $event['responsable'] == $allValues[$i]['uidnumber'][0] )?'SELECTED':'').'>'.$allValues[$i]['gecos'][0].'</option>'."\n"; |
---|
495 | $optionldap2 .= $option2; |
---|
496 | } |
---|
497 | |
---|
498 | |
---|
499 | |
---|
500 | |
---|
501 | } |
---|
502 | |
---|
503 | |
---|
504 | |
---|
505 | |
---|
506 | |
---|
507 | if(!is_array($param)) |
---|
508 | { |
---|
509 | $this->index(); |
---|
510 | } |
---|
511 | |
---|
512 | if(isset($param['event'])) |
---|
513 | { |
---|
514 | $event = $param['event']; |
---|
515 | } |
---|
516 | |
---|
517 | $hourformat = substr($this->bo->users_timeformat,0,1); |
---|
518 | |
---|
519 | $jscal = CreateObject('phpgwapi.jscalendar'); // before phpgw_header() !!! |
---|
520 | |
---|
521 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
522 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
523 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
524 | $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; |
---|
525 | $GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Editing event') : lang('Adding event'); |
---|
526 | if ($param['plain'] != "True"){ |
---|
527 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
528 | } |
---|
529 | else{ |
---|
530 | $GLOBALS['phpgw_info']['theme']['row_on'] = "F8F8F8"; |
---|
531 | $GLOBALS['phpgw_info']['theme']['row_off'] = "F8F8F8"; |
---|
532 | } |
---|
533 | |
---|
534 | $p = &$GLOBALS['phpgw']->template; |
---|
535 | $p->set_file( |
---|
536 | Array( |
---|
537 | 'edit' => 'edit.tpl', |
---|
538 | 'form_button' => 'form_button_script.tpl' |
---|
539 | ) |
---|
540 | ); |
---|
541 | $p->set_block('edit','edit_entry','edit_entry'); |
---|
542 | $p->set_block('edit','list','list'); |
---|
543 | $p->set_block('edit','hr','hr'); |
---|
544 | |
---|
545 | $vars = Array( |
---|
546 | 'font' => $this->theme['font'], |
---|
547 | 'bg_color' => $this->theme['bg_text'], |
---|
548 | 'action_url' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'infolog.uiinfolog.update')), |
---|
549 | 'accounts_link' => $GLOBALS['phpgw']->link('/index.php','menuaction=infolog.uiinfolog.accounts_popup'), |
---|
550 | 'common_hidden' => '<input type="hidden" name="info[id]" value="'.$event['id'].'">'."\n". |
---|
551 | '<input type="hidden" name="infolog[parent]" value="'.$_POST['parent'].'">'."\n" |
---|
552 | . '<input type="hidden" name="info[owner]" value="'.$event['owner'].'">'."\n" |
---|
553 | . (@isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && $GLOBALS['phpgw_info']['server']['deny_user_grants_access']? |
---|
554 | '<input type="hidden" name="participants[]" value="'.$this->bo->owner.'">'."\n":''), |
---|
555 | 'errormsg' => ($param['cd']?$GLOBALS['phpgw']->common->check_code($param['cd']):'') |
---|
556 | ); |
---|
557 | |
---|
558 | $p->set_var($vars); |
---|
559 | |
---|
560 | // info_type |
---|
561 | //echo $event['type']; |
---|
562 | $var['title'] = Array( |
---|
563 | 'tr_color' => $this->theme['th_bg'], |
---|
564 | 'field' => lang('Type'), |
---|
565 | 'data' => '<select onchange="javascript:changeViewMode(this.value);" id="exec[info_type]" name="exec[info_type]" '.($event['type'] == 'H'?'DISABLED':'').'><option value="email" '.(($event['public'] && $event['type'] == 'email')?'SELECTED':'').' >'.lang('Email').'</option><option value="phone" '.((!$event['public'] && $event['type'] == 'phone')?'SELECTED':'').' >'. lang('Phone').'</option><option value="n" '.($event['type']=='n'?'SELECTED':'').' >'. lang('n').'</option><option value="note" '.($event['type'] == 'note'?'SELECTED':'').' >'.lang('Note').'</option><option value="task" '.($event['type'] == 'task'?'SELECTED':'').' >'.lang('Task').'</option></select>' |
---|
566 | ); //event['public'] |
---|
567 | |
---|
568 | // Display Categories |
---|
569 | if(strpos($event['category'],',')) |
---|
570 | { |
---|
571 | $temp_cats = explode(',',$event['category']); |
---|
572 | @reset($temp_cats); |
---|
573 | while(list($key,$value) = each($temp_cats)) |
---|
574 | { |
---|
575 | $check_cats[] = (int)$value; |
---|
576 | } |
---|
577 | } |
---|
578 | elseif($event['category']) |
---|
579 | { |
---|
580 | $check_cats[] = (int)$event['category']; |
---|
581 | } |
---|
582 | else |
---|
583 | { |
---|
584 | $check_cats[] = 0; |
---|
585 | } |
---|
586 | $var['category'] = Array( |
---|
587 | 'field' => lang('Category'), |
---|
588 | 'data' => '<select name="infolog[category]" onchange="javascript:updateTitleField(this)" >'.$this->cat->formated_list('select','all',$check_cats,True).'</select>' |
---|
589 | ); |
---|
590 | |
---|
591 | |
---|
592 | // Display location |
---|
593 | // Location |
---|
594 | |
---|
595 | |
---|
596 | |
---|
597 | // |
---|
598 | if(strpos($event['location'],',')) |
---|
599 | { |
---|
600 | $temp_cats = explode(',',$event['location']); |
---|
601 | @reset($temp_cats); |
---|
602 | while(list($key,$value) = each($temp_cats)) |
---|
603 | { |
---|
604 | $check_cats[] = (int)$value; |
---|
605 | } |
---|
606 | } |
---|
607 | elseif($event['location']) |
---|
608 | { |
---|
609 | $check_cats[] = (int)$event['location']; |
---|
610 | } |
---|
611 | else |
---|
612 | { |
---|
613 | $check_cats[] = 0; |
---|
614 | } |
---|
615 | $var['location'] = Array( |
---|
616 | 'field' => lang('Location'), |
---|
617 | 'data' => '<select name="infolog[location]" onchange="javascript:updateTitleField(this)" >'.$this->resources->formated_list('select','name,name','',True).'</select>' |
---|
618 | ); |
---|
619 | |
---|
620 | |
---|
621 | |
---|
622 | // Participants |
---|
623 | |
---|
624 | if(!isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_grants_access']) |
---|
625 | { |
---|
626 | |
---|
627 | |
---|
628 | $str = utf8_decode($optionldap); |
---|
629 | |
---|
630 | $var['participants'] = array |
---|
631 | ( |
---|
632 | 'field' => lang('Contacto'), |
---|
633 | 'data' => " |
---|
634 | <select id='user_list' name='participants[]' style='width: 220px' ><option value=0>seleccione</option>".$str."</select> |
---|
635 | |
---|
636 | |
---|
637 | " |
---|
638 | ); |
---|
639 | |
---|
640 | |
---|
641 | |
---|
642 | |
---|
643 | |
---|
644 | } |
---|
645 | |
---|
646 | |
---|
647 | // asunto |
---|
648 | $var['description1'] = Array( |
---|
649 | 'field' => lang('Asunto'), |
---|
650 | 'data' => '<input type="text" name="cal[description1]" maxlength="255" value="'.$event['asunto'].'">' |
---|
651 | ); |
---|
652 | |
---|
653 | |
---|
654 | |
---|
655 | |
---|
656 | // Full Description |
---|
657 | $var['description'] = Array( |
---|
658 | 'field' => lang('Description'), |
---|
659 | 'data' => '<textarea name="cal[description]" rows="5" cols="40" wrap="virtual" maxlength="2048">'.$event['descripcion'].'</textarea>' |
---|
660 | ); |
---|
661 | |
---|
662 | |
---|
663 | |
---|
664 | |
---|
665 | //echo "quuuue".$GLOBALS['phpgw']->datetime->tz_offset." "; |
---|
666 | // Date |
---|
667 | //echo $event['fechainicio']; |
---|
668 | //$start = $this->bo->maketime( $event['fechainicio']) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
669 | //$starttime = $this->bo->maketime2(5,23,0,22,10,2010) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
670 | |
---|
671 | $valorfechainicio=$this->bo->time2array($event['fechainicio'],$alarm = 0); |
---|
672 | $start=$valorfechainicio['mday']."/".$valorfechainicio['month']."/".$valorfechainicio['year']; |
---|
673 | //echo "ddddd".$valorfechainicio['mday']."/".$valorfechainicio['month']."/".$valorfechainicio['year']; |
---|
674 | $var['startdate'] = Array( |
---|
675 | 'field' => lang('Start Date'), |
---|
676 | |
---|
677 | 'data' => $jscal->input('start[str]',$start) |
---|
678 | ); |
---|
679 | |
---|
680 | // Time |
---|
681 | if ($this->bo->prefs['common']['timeformat'] == '12') |
---|
682 | { |
---|
683 | $str .= '<input type="radio" name="start[ampm]" value="am"'.($event['fechainicio']['hour'] >= 12?'':' checked').'>am'."\n" |
---|
684 | . '<input type="radio" name="start[ampm]" value="pm"'.($event['fechainicio']['hour'] >= 12?' checked':'').'>pm'."\n"; |
---|
685 | } |
---|
686 | $var['starttime'] = Array( |
---|
687 | 'field' => lang('Start Time'), |
---|
688 | 'data' => '<input name="start[hour]" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($start,$hourformat).'" maxlength="2">:<input name="start[min]" size="2" value="'.$GLOBALS['phpgw']->common->show_date($start,'i').'" maxlength="2">'."\n" |
---|
689 | ); |
---|
690 | |
---|
691 | // End Date |
---|
692 | //$end = $this->bo->maketime($event['fechafin']) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
693 | |
---|
694 | |
---|
695 | |
---|
696 | $eee=$this->bo->maketime($GLOBALS['phpgw']->datetime->users_localtime); |
---|
697 | $valorfechaend=$this->bo->time2array($eee,$alarm = 0); |
---|
698 | |
---|
699 | //echo $valorfechaend['month']."rrr ".$event['fechafin']." ".$eee; |
---|
700 | $valorfechaend=$this->bo->time2array($event['fechafin'],$alarm = 0); |
---|
701 | $end=$valorfechaend['mday']."/".$valorfechaend['month']."/".$valorfechaend['year']; |
---|
702 | |
---|
703 | |
---|
704 | |
---|
705 | |
---|
706 | |
---|
707 | $var['enddate'] = Array( |
---|
708 | 'field' => lang('End Date'), |
---|
709 | 'data' => $jscal->input('end[str]',$end) |
---|
710 | ); |
---|
711 | |
---|
712 | // End Time |
---|
713 | if ($this->bo->prefs['common']['timeformat'] == '12') |
---|
714 | { |
---|
715 | $str = '<input type="radio" name="end[ampm]" value="am"'.($event['end']['hour'] >= 12?'':' checked').'>am'."\n" |
---|
716 | . '<input type="radio" name="end[ampm]" value="pm"'.($event['end']['hour'] >= 12?' checked':'').'>pm'."\n"; |
---|
717 | } |
---|
718 | $var['endtime'] = Array( |
---|
719 | 'field' => lang('End Time'), |
---|
720 | 'data' => '<input name="end[hour]" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($end,$hourformat).'" maxlength="2">:<input name="end[min]" size="2" value="'.$GLOBALS['phpgw']->common->show_date($end,'i').'" maxlength="2">'."\n".$str |
---|
721 | ); |
---|
722 | |
---|
723 | |
---|
724 | |
---|
725 | |
---|
726 | |
---|
727 | // estado |
---|
728 | |
---|
729 | $var['status'] = Array( |
---|
730 | 'field' => lang('Status'), |
---|
731 | 'data' => '<select name="status"><option value="ongoing" '.(( $event['status'] == 'ongoing' )?'SELECTED':'').'>en curso</option> |
---|
732 | <option value="done" '.(( $event['status'] == 'done' )?'SELECTED':'').'>hecho</option></select>' |
---|
733 | ); |
---|
734 | |
---|
735 | |
---|
736 | // prioridad |
---|
737 | |
---|
738 | |
---|
739 | |
---|
740 | |
---|
741 | |
---|
742 | if(strpos($event['priority'],',')) |
---|
743 | { |
---|
744 | $temp_cats = explode(',',$event['priority']); |
---|
745 | @reset($temp_cats); |
---|
746 | while(list($key,$value) = each($temp_cats)) |
---|
747 | { |
---|
748 | $check_cats[] = (int)$value; |
---|
749 | } |
---|
750 | } |
---|
751 | elseif($event['priority']) |
---|
752 | { |
---|
753 | $check_cats[] = (int)$event['priority']; |
---|
754 | } |
---|
755 | else |
---|
756 | { |
---|
757 | $check_cats[] = 0; |
---|
758 | } |
---|
759 | |
---|
760 | |
---|
761 | |
---|
762 | $var['priority'] = Array( |
---|
763 | 'field' => lang('Priority'), |
---|
764 | 'data' => '<select name="priority" onchange="javascript:updateTitleField(this)" >'.$this->priority->formated_list('select','name,name',$event['priority'],True).'</select>' |
---|
765 | ); |
---|
766 | |
---|
767 | |
---|
768 | |
---|
769 | |
---|
770 | |
---|
771 | // accesso |
---|
772 | |
---|
773 | $var['accesso'] = Array( |
---|
774 | 'field' => lang('access'), |
---|
775 | 'data' => '<select name="exec[accesso]"><option value="public" '.(( $event['access'] == 'public' )?'SELECTED':'').'>Publico</option> |
---|
776 | <option value="private" '.(( $event['access'] == 'private' )?'SELECTED':'').'>Privado</option></select>' |
---|
777 | ); |
---|
778 | |
---|
779 | |
---|
780 | //porcentaje |
---|
781 | |
---|
782 | $var['percent'] = Array( |
---|
783 | 'field' => lang('Completado'), |
---|
784 | 'data' => '<select name="percent"><option value="0" '.(( $event['percent'] == 0 )?'SELECTED':'').'>0%</option> |
---|
785 | <option value="10" '.(( $event['percent'] == 10 )?'SELECTED':'').'>10%</option> |
---|
786 | <option value="20" '.(( $event['percent'] == 20 )?'SELECTED':'').'>20%</option> |
---|
787 | |
---|
788 | <option value="30" '.(( $event['percent'] == 30 )?'SELECTED':'').'>30%</option> |
---|
789 | <option value="40" '.(( $event['percent'] == 40 )?'SELECTED':'').'>40%</option> |
---|
790 | <option value="50" '.(( $event['percent'] == 50 )?'SELECTED':'').'>50%</option> |
---|
791 | <option value="60" '.(( $event['percent'] == 60 )?'SELECTED':'').'>60%</option> |
---|
792 | <option value="70" '.(( $event['percent'] == 70 )?'SELECTED':'').'>70%</option> |
---|
793 | <option value="80" '.(( $event['percent'] == 80 )?'SELECTED':'').'>80%</option> |
---|
794 | <option value="90" '.(( $event['percent'] == 90 )?'SELECTED':'').'>90%</option> |
---|
795 | <option value="100" '.(( $event['percent'] == 100 )?'SELECTED':'').'>100%</option></select>' |
---|
796 | ); |
---|
797 | |
---|
798 | |
---|
799 | /****************************************************/ |
---|
800 | |
---|
801 | |
---|
802 | |
---|
803 | |
---|
804 | |
---|
805 | |
---|
806 | |
---|
807 | |
---|
808 | //responsable |
---|
809 | if(!isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_grants_access']) |
---|
810 | { |
---|
811 | |
---|
812 | |
---|
813 | $str2 = utf8_decode($optionldap2); |
---|
814 | |
---|
815 | $var['participants1'] = array |
---|
816 | ( |
---|
817 | 'field' => lang('Responsable'), |
---|
818 | 'data' => " |
---|
819 | <select id='user_list' name='participants1[]' style='width: 220px' ><option value=0>seleccione</option>".$str2."</select> |
---|
820 | |
---|
821 | |
---|
822 | " |
---|
823 | ); |
---|
824 | |
---|
825 | |
---|
826 | |
---|
827 | |
---|
828 | |
---|
829 | } |
---|
830 | |
---|
831 | |
---|
832 | |
---|
833 | |
---|
834 | |
---|
835 | |
---|
836 | |
---|
837 | |
---|
838 | |
---|
839 | |
---|
840 | |
---|
841 | /*********************************************************************/ |
---|
842 | |
---|
843 | |
---|
844 | |
---|
845 | |
---|
846 | // End Date2 |
---|
847 | //$end2 = $this->bo->maketime($event['fechacompletada']) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
848 | $valorfechaend2=$this->bo->time2array($event['fechacompletada'],$alarm = 0); |
---|
849 | if(isset($event['fechacompletada'])&&$event['fechacompletada']>0){ |
---|
850 | $end2=$valorfechaend2['mday']."/".$valorfechaend2['month']."/".$valorfechaend2['year']; |
---|
851 | }else{ |
---|
852 | $end2=""; |
---|
853 | } |
---|
854 | |
---|
855 | |
---|
856 | $var['enddate2'] = Array( |
---|
857 | 'field' => lang('Fecha completada'), |
---|
858 | |
---|
859 | 'data' => $jscal->input('end2[str]',$end2) |
---|
860 | ); |
---|
861 | |
---|
862 | |
---|
863 | |
---|
864 | |
---|
865 | |
---|
866 | |
---|
867 | |
---|
868 | $i = 0; $boxes = ''; |
---|
869 | foreach ($this->bo->rpt_day as $mask => $name) |
---|
870 | { |
---|
871 | $boxes .= '<input type="checkbox" name="cal[rpt_day][]" value="'.$mask.'"'.($event['recur_data'] & $mask ? ' checked' : '').'> '.lang($name)."\n"; |
---|
872 | if (++$i == 5) $boxes .= '<br>'; |
---|
873 | } |
---|
874 | $var['recure_day'] = Array( |
---|
875 | 'field' => lang('Repeat Day').'<br>'.lang('(required for weekly recursivity)'), |
---|
876 | 'data' => $boxes |
---|
877 | ); |
---|
878 | |
---|
879 | $var['recure_interval'] = Array( |
---|
880 | 'field' => lang('Interval'), |
---|
881 | 'data' => '<input name="cal[recur_interval]" size="4" maxlength="4" value="'.$event['recur_interval'].'">' |
---|
882 | ); |
---|
883 | // $this->output_template_array($p,'row','list',Array('data' => '<script src="simple_show_hide.js" type="text/javascript"></script>')); |
---|
884 | |
---|
885 | if (!isset($this->fields)) |
---|
886 | { |
---|
887 | $this->custom_fields = CreateObject('infolog.bocustom_fields'); |
---|
888 | $this->fields = &$this->custom_fields->fields; |
---|
889 | $this->stock_fields = &$this->custom_fields->stock_fields; |
---|
890 | } |
---|
891 | // $this->output_template_array($p,'row','list',$var['access']); |
---|
892 | unset($var['access']); |
---|
893 | |
---|
894 | $preserved = False; |
---|
895 | foreach($this->fields as $field => $data) |
---|
896 | { |
---|
897 | |
---|
898 | if (!$data['disabled']) |
---|
899 | { |
---|
900 | |
---|
901 | |
---|
902 | if (isset($var[$field])) |
---|
903 | { |
---|
904 | |
---|
905 | |
---|
906 | switch($field) |
---|
907 | { |
---|
908 | case 'startdate': |
---|
909 | $this->output_template_array($p,'row','list',$var['startdate']); |
---|
910 | $this->output_template_array($p,'row','list',$var['starttime']); |
---|
911 | break; |
---|
912 | case 'enddate': |
---|
913 | $this->output_template_array($p,'row','list',$var['enddate']); |
---|
914 | $this->output_template_array($p,'row','list',$var['endtime']); |
---|
915 | break; |
---|
916 | case 'recure_type': |
---|
917 | $p->set_var('tr_color',$this->theme['th_bg']); |
---|
918 | $p->set_var('hr_text','<center id="rpt_label"><b>'.lang('Repeating Event Information').'</b></center>'); |
---|
919 | $p->parse('row','hr',True); |
---|
920 | $this->output_template_array($p,'row','list',$var['recure_type']); |
---|
921 | $this->output_template_array($p,'row','list',$var['recure_enddate']); |
---|
922 | $this->output_template_array($p,'row','list',$var['recure_day']); |
---|
923 | $this->output_template_array($p,'row','list',$var['recure_interval']); |
---|
924 | break; |
---|
925 | default: |
---|
926 | $this->output_template_array($p,'row','list',$var[$field]); |
---|
927 | |
---|
928 | } |
---|
929 | } |
---|
930 | elseif (!isset($this->stock_fields[$field])) // Custom field |
---|
931 | { |
---|
932 | |
---|
933 | |
---|
934 | $lang = lang($name = substr($field,1)); |
---|
935 | $size = 'SIZE='.($data['shown'] ? $data['shown'] : ($data['length'] ? $data['length'] : 30)). |
---|
936 | ' MAXLENGTH='.($data['length'] ? $data['length'] : 255); |
---|
937 | $v = array( |
---|
938 | 'field' => $lang == $name.'*' ? $name : $lang, |
---|
939 | 'data' => '<input name="cal['.htmlspecialchars($field).']" '.$size.' value="'.$event['#'.$name].'">' |
---|
940 | ); |
---|
941 | if ($data['title']) |
---|
942 | { |
---|
943 | $v['tr_color'] = $this->theme['th_bg']; |
---|
944 | } |
---|
945 | if (!$data['length'] && $data['title']) |
---|
946 | { |
---|
947 | $p->set_var('tr_color',$this->theme['th_bg']); |
---|
948 | $p->set_var('hr_text','<center><b>'.$v['field'].'</b></center>'); |
---|
949 | $p->parse('row','hr',True); |
---|
950 | } |
---|
951 | else |
---|
952 | { |
---|
953 | $this->output_template_array($p,'row','list',$v); |
---|
954 | } |
---|
955 | } |
---|
956 | } |
---|
957 | else // preserve disabled fields |
---|
958 | { |
---|
959 | |
---|
960 | |
---|
961 | switch ($field) |
---|
962 | { |
---|
963 | case 'owner': |
---|
964 | $preserved[$field] = $event['id'] ? $event['participants'][$event['owner']] : 'A'; |
---|
965 | break; |
---|
966 | case 'recure_type': |
---|
967 | foreach(array('recur_type','recur_enddate','recur_data','recur_interval') as $field) |
---|
968 | { |
---|
969 | $preserved[$field] = $event[$field]; |
---|
970 | } |
---|
971 | break; |
---|
972 | case 'startdate': |
---|
973 | case 'enddate': |
---|
974 | $field = substr($field,0,-4); |
---|
975 | default: |
---|
976 | $preserved[$field] = $event[$field]; |
---|
977 | } |
---|
978 | } |
---|
979 | } |
---|
980 | unset($var); |
---|
981 | if (is_array($preserved)) |
---|
982 | { |
---|
983 | //echo "preserving<pre>"; print_r($preserved); echo "</pre>\n"; |
---|
984 | $p->set_var('common_hidden',$p->get_var('common_hidden').'<input type="hidden" name="preserved" value="'.htmlspecialchars(serialize($preserved)).'">'."\n"); |
---|
985 | } |
---|
986 | $p->set_var('submit_button',lang('Save')); |
---|
987 | |
---|
988 | $delete_button = $cancel_button = ''; |
---|
989 | if ($event['id'] > 0) |
---|
990 | { |
---|
991 | $var = Array( |
---|
992 | 'action_url_button' => $this->page('delete','&cal_id='.$event['id']), |
---|
993 | 'action_text_button' => lang('Delete'), |
---|
994 | 'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"", |
---|
995 | 'action_extra_field' => '', |
---|
996 | 'button_id' => 'delete_button' |
---|
997 | ); |
---|
998 | $p->set_var($var); |
---|
999 | $delete_button = $p->fp('out','form_button'); |
---|
1000 | } |
---|
1001 | $p->set_var('delete_button',$delete_button); |
---|
1002 | $p->set_var('alert_msg',lang('Required field (category) is empty')); |
---|
1003 | |
---|
1004 | if ($this->bo->return_to) |
---|
1005 | { |
---|
1006 | $var = Array( |
---|
1007 | 'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to), |
---|
1008 | 'action_text_button' => lang('Cancel'), |
---|
1009 | 'action_confirm_button' => '', |
---|
1010 | 'action_extra_field' => '', |
---|
1011 | 'button_id' => 'cancel_button' |
---|
1012 | ); |
---|
1013 | $p->set_var($var); |
---|
1014 | $cancel_button = $p->fp('out','form_button'); |
---|
1015 | } |
---|
1016 | $p->set_var('cancel_button',$cancel_button); |
---|
1017 | $p->pparse('out','edit_entry'); |
---|
1018 | } |
---|
1019 | |
---|
1020 | function output_template_array(&$p,$row,$list,$var) |
---|
1021 | { |
---|
1022 | if (!isset($var['hidden_vars'])) |
---|
1023 | { |
---|
1024 | $var['hidden_vars'] = ''; |
---|
1025 | } |
---|
1026 | if (!isset($var['tr_color'])) |
---|
1027 | { |
---|
1028 | $var['tr_color'] = $GLOBALS['phpgw']->nextmatchs->alternate_row_color(); |
---|
1029 | } |
---|
1030 | $p->set_var($var); |
---|
1031 | $p->parse($row,$list,True); |
---|
1032 | } |
---|
1033 | |
---|
1034 | |
---|
1035 | function get_organizations($context, $selected='', $recursive = false) |
---|
1036 | { |
---|
1037 | $s = CreateObject('phpgwapi.sector_search_ldap'); |
---|
1038 | |
---|
1039 | return ($recursive ? |
---|
1040 | $s->get_organizations($context, $selected, false ,true) : |
---|
1041 | $s->get_sectors($selected, false, false)); |
---|
1042 | } |
---|
1043 | |
---|
1044 | |
---|
1045 | |
---|
1046 | |
---|
1047 | /**********************************************/ |
---|
1048 | |
---|
1049 | |
---|
1050 | function _debug_sqsof() |
---|
1051 | { |
---|
1052 | $data = array( |
---|
1053 | 'filter' => $this->bo->filter, |
---|
1054 | 'cat_id' => $this->bo->cat_id, |
---|
1055 | 'owner' => $this->bo->owner, |
---|
1056 | 'year' => $this->bo->year, |
---|
1057 | 'month' => $this->bo->month, |
---|
1058 | 'day' => $this->bo->day, |
---|
1059 | 'sortby' => $this->bo->sortby, |
---|
1060 | 'num_months' => $this->bo->num_months |
---|
1061 | ); |
---|
1062 | Return _debug_array($data,False); |
---|
1063 | } |
---|
1064 | |
---|
1065 | |
---|
1066 | |
---|
1067 | |
---|
1068 | /***********************************/ |
---|
1069 | |
---|
1070 | |
---|
1071 | |
---|
1072 | |
---|
1073 | function search() |
---|
1074 | { |
---|
1075 | |
---|
1076 | print_r($_REQUEST); |
---|
1077 | |
---|
1078 | $ordenar=$_REQUEST['ordenar']; |
---|
1079 | echo $ordenar."fff"; |
---|
1080 | $adicional=""; |
---|
1081 | switch($ordenar) |
---|
1082 | { |
---|
1083 | case '2':$adicional= " and t1.info_type='".$_REQUEST['valor']."'";break; |
---|
1084 | case '3':$adicional= " and t1.info_from='".$_REQUEST['valor']."'";break; |
---|
1085 | case '4':$adicional= " and t1.info_type='".$_REQUEST['valor']."'";break; |
---|
1086 | case '7':$adicional= " and t1.info_owner='".$_REQUEST['valor']."'";break; |
---|
1087 | case '8':$adicional= " and t1.info_responsible='".$_REQUEST['valor']."'";break; |
---|
1088 | case '9':$adicional= " and t1.info_access='".$_REQUEST['valor']."'";break; |
---|
1089 | default:$adicional= " "; |
---|
1090 | |
---|
1091 | |
---|
1092 | } |
---|
1093 | |
---|
1094 | |
---|
1095 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
1096 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
1097 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['infolog']['title'].' - '.lang('Search Results'); |
---|
1098 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
1099 | |
---|
1100 | $error = ''; |
---|
1101 | |
---|
1102 | $matches = 0; |
---|
1103 | |
---|
1104 | //$event = $this->bo->read_entry($info_id); |
---|
1105 | $event = $this->get_event_ids($adicional); |
---|
1106 | |
---|
1107 | |
---|
1108 | //$event_ids = $this->bo->search_keywords($_POST['keywords']); |
---|
1109 | |
---|
1110 | |
---|
1111 | $matches = count($event); |
---|
1112 | |
---|
1113 | //echo "matches" . $matches; |
---|
1114 | |
---|
1115 | if ($matches == 1) |
---|
1116 | { |
---|
1117 | $quantity = lang('1 match found').'.'; |
---|
1118 | } |
---|
1119 | elseif ($matches > 0) |
---|
1120 | { |
---|
1121 | $quantity = lang('%1 matches found',$matches).'.'; |
---|
1122 | } |
---|
1123 | else |
---|
1124 | { |
---|
1125 | echo '<b>'.lang('Error').':</b>'.lang('no matches found'); |
---|
1126 | return; |
---|
1127 | } |
---|
1128 | |
---|
1129 | $p = $GLOBALS['phpgw']->template; |
---|
1130 | $p->set_file( |
---|
1131 | Array( |
---|
1132 | 'search_form' => 'search.tpl' |
---|
1133 | ) |
---|
1134 | ); |
---|
1135 | $p->set_block('search_form','search','search'); |
---|
1136 | $p->set_block('search_form','search_list_header','search_list_header'); |
---|
1137 | $p->set_block('search_form','search_list','search_list'); |
---|
1138 | $p->set_block('search_form','search_list_footer','search_list_footer'); |
---|
1139 | |
---|
1140 | |
---|
1141 | $script=''; |
---|
1142 | |
---|
1143 | $typo='<select name="search_info_type" onchange="return submitit(this.form,2)" class="noPrint"> |
---|
1144 | <option value="" selected="selected">Tipo</option> |
---|
1145 | <option value="email">'.lang('email').'</option> |
---|
1146 | <option value="phone">'.lang('phone').'</option> |
---|
1147 | <option value="n">n</option> |
---|
1148 | <option value="note">'.lang('note').'</option> |
---|
1149 | <option value="task">'.lang('task').'</option> |
---|
1150 | </select>'; |
---|
1151 | |
---|
1152 | |
---|
1153 | $estatus='<select name="search[info_status]" onchange="return submitit(this.form,3);" class="noPrint"> |
---|
1154 | <option value="" selected="selected">Estado</option> |
---|
1155 | <option value="offer">'.lang('offer').'</option> |
---|
1156 | <option value="not-started">'.lang('not-started').'</option> |
---|
1157 | <option value="ongoing">'.lang('ongoing').'</option> |
---|
1158 | <option value="done">'.lang('done').'</option> |
---|
1159 | <option value="cancelled">'.lang('cancelled').'</option> |
---|
1160 | <option value="billed">'.lang('billed').'</option> |
---|
1161 | </select>'; |
---|
1162 | |
---|
1163 | |
---|
1164 | $var = Array( |
---|
1165 | 'th_bg' => $this->theme['th_bg'], |
---|
1166 | 'search_text' => lang('Search Results'), |
---|
1167 | 'quantity' => $quantity, |
---|
1168 | 'title' => 'Registro de notas y tareas', |
---|
1169 | 'typo' => $typo, |
---|
1170 | 'script'=>$script, |
---|
1171 | 'estatus' => $estatus |
---|
1172 | |
---|
1173 | ); |
---|
1174 | $p->set_var($var); |
---|
1175 | |
---|
1176 | if($matches > 0) |
---|
1177 | { |
---|
1178 | $p->parse('rows','search_list_header',True); |
---|
1179 | } |
---|
1180 | |
---|
1181 | //if($info){ |
---|
1182 | foreach($event as $id => $data) |
---|
1183 | { |
---|
1184 | |
---|
1185 | |
---|
1186 | $datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
1187 | |
---|
1188 | |
---|
1189 | |
---|
1190 | |
---|
1191 | $info = array( |
---|
1192 | 'tr_color' => $GLOBALS['phpgw']->nextmatchs->alternate_row_color(), |
---|
1193 | 'date' => $GLOBALS['phpgw']->common->show_date($datetime), |
---|
1194 | 'tipo' => $data['tipo'], |
---|
1195 | 'id' => $data['id'], |
---|
1196 | 'estado' => $data['estado'], |
---|
1197 | 'asunto' => $data['asunto'], |
---|
1198 | 'descripcion' => $data['descripcion'], |
---|
1199 | 'fechainicio' => $data['fechainicio'], |
---|
1200 | 'fechafin' => $data['fechafin'], |
---|
1201 | 'fechacompletada' => $data['fechacompletada'], |
---|
1202 | 'propietario' => $data['propietario'], |
---|
1203 | 'responsable' => $data['responsable'], |
---|
1204 | 'padre' => $data['padre'], |
---|
1205 | 'priority'=>$data['priority'], |
---|
1206 | 'accionagregar' =>'index.php?menuaction=infolog.uiinfolog.edit&parent='. $data['id'], |
---|
1207 | 'accionmodificar' =>'index.php?menuaction=infolog.uiinfolog.edit&id='. $data['id'], |
---|
1208 | 'accioneditar' =>'', |
---|
1209 | 'accionagregartimet'=>'', |
---|
1210 | 'accionborrar' =>'index.php?menuaction=infolog.uiinfolog.borrar&id='. $data['id'] |
---|
1211 | ); |
---|
1212 | |
---|
1213 | //'accionagregar' =>'index.php?menuaction=infolog.uiinfolog.edit&parent='. $data['id'] |
---|
1214 | $p->set_var($info); |
---|
1215 | $p->set_var($data); |
---|
1216 | $p->parse('rows','search_list',True); |
---|
1217 | } |
---|
1218 | // } |
---|
1219 | if($matches > 0) |
---|
1220 | { |
---|
1221 | $p->parse('rows','search_list_footer',True); |
---|
1222 | } |
---|
1223 | |
---|
1224 | $p->pparse('out','search'); |
---|
1225 | } |
---|
1226 | |
---|
1227 | |
---|
1228 | function get_event_ids($search) |
---|
1229 | { |
---|
1230 | echo "tamannn".count($search)." ".$search[0]; |
---|
1231 | |
---|
1232 | $from =""; |
---|
1233 | if (isset($_REQUEST['id'])){ |
---|
1234 | |
---|
1235 | $from = ' and t1.info_id='.$_REQUEST['id']; |
---|
1236 | } |
---|
1237 | |
---|
1238 | $sql = 'select t1.*,t2.list_descripcion from phpgw_infolog t1, phpgw_listas t2 where t1.info_priority=t2.list_id ' |
---|
1239 | . $from |
---|
1240 | .$search; |
---|
1241 | //. 'WHERE (phpgw_cal_user.info_id = phpgw_cal.info_id) ' |
---|
1242 | //. $where . $extra; |
---|
1243 | |
---|
1244 | |
---|
1245 | echo "FULL SQL : ".$sql."<br>\n"; |
---|
1246 | |
---|
1247 | |
---|
1248 | if($this->debug) |
---|
1249 | { |
---|
1250 | echo "FULL SQL : ".$sql."<br>\n"; |
---|
1251 | } |
---|
1252 | |
---|
1253 | //$resultado=pg_query($this->bo->connect(),$sql) or die("Error al mostrar"); |
---|
1254 | |
---|
1255 | |
---|
1256 | $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__); |
---|
1257 | while( $GLOBALS['phpgw']->db->next_record() ) |
---|
1258 | { |
---|
1259 | // |
---|
1260 | |
---|
1261 | $valorfechaini=$this->bo->time2array($GLOBALS['phpgw']->db->f('info_startdate'),$alarm = 0); |
---|
1262 | $ini=$valorfechaini['mday']."/".$valorfechaini['month']."/".$valorfechaini['year']; |
---|
1263 | |
---|
1264 | $valorfechaend=$this->bo->time2array($GLOBALS['phpgw']->db->f('info_enddate'),$alarm = 0); |
---|
1265 | $end=$valorfechaend['mday']."/".$valorfechaend['month']."/".$valorfechaend['year']; |
---|
1266 | |
---|
1267 | |
---|
1268 | if($GLOBALS['phpgw']->db->f('info_datecompleted')==0){ |
---|
1269 | $comp=""; |
---|
1270 | }else{ |
---|
1271 | $valorfechacom=$this->bo->time2array($GLOBALS['phpgw']->db->f('info_datecompleted'),$alarm = 0); |
---|
1272 | $comp=$valorfechacom['mday']."/".$valorfechacom['month']."/".$valorfechacom['year']; |
---|
1273 | } |
---|
1274 | |
---|
1275 | $retval[] = array( |
---|
1276 | 'id' => $GLOBALS['phpgw']->db->f('info_id'), |
---|
1277 | 'type' => '<img src=/infolog/templates/default/images/'.$GLOBALS['phpgw']->db->f('info_type').'.png>', |
---|
1278 | 'asunto' => $GLOBALS['phpgw']->db->f('info_subject'), |
---|
1279 | 'descripcion' => $GLOBALS['phpgw']->db->f('info_des'), |
---|
1280 | 'fechainicio' => $ini, |
---|
1281 | 'fechafin' => $end, |
---|
1282 | 'status' => lang($GLOBALS['phpgw']->db->f('info_status')), |
---|
1283 | 'fechacompletada' => $comp, |
---|
1284 | 'propietario' => $this->get_account_name($GLOBALS['phpgw']->db->f('info_owner'),'gecos'), |
---|
1285 | 'responsable' => $this->get_account_name($GLOBALS['phpgw']->db->f('info_responsible'),'gecos'), |
---|
1286 | 'owner' => $GLOBALS['phpgw']->db->f('info_uid'), |
---|
1287 | 'percent' => $GLOBALS['phpgw']->db->f('info_percent'), |
---|
1288 | 'access' => $GLOBALS['phpgw']->db->f('info_access'), |
---|
1289 | 'location' =>$GLOBALS['phpgw']->db->f('info_location'), |
---|
1290 | 'category' =>$GLOBALS['phpgw']->db->f('info_cat'), |
---|
1291 | 'priority' => $GLOBALS['phpgw']->db->f('list_descripcion'), |
---|
1292 | 'padre' => $GLOBALS['phpgw']->db->f('info_id_parent') |
---|
1293 | ); |
---|
1294 | |
---|
1295 | |
---|
1296 | } |
---|
1297 | |
---|
1298 | |
---|
1299 | |
---|
1300 | |
---|
1301 | return $retval; |
---|
1302 | } |
---|
1303 | |
---|
1304 | |
---|
1305 | |
---|
1306 | |
---|
1307 | |
---|
1308 | |
---|
1309 | |
---|
1310 | |
---|
1311 | |
---|
1312 | |
---|
1313 | |
---|
1314 | function update() |
---|
1315 | { |
---|
1316 | |
---|
1317 | |
---|
1318 | |
---|
1319 | # $vars = get_defined_vars(); |
---|
1320 | # print_r($vars); |
---|
1321 | /*foreach($_POST as $k=>$v){ |
---|
1322 | $$k=$v; |
---|
1323 | echo $$k."<br>"; |
---|
1324 | } |
---|
1325 | foreach($_POST as $nombre_campo => $valor){ |
---|
1326 | $asignacion = "\$" . $nombre_campo . "='" . $valor . "';"; |
---|
1327 | echo $asignacion."<br>"; |
---|
1328 | } */ |
---|
1329 | |
---|
1330 | |
---|
1331 | |
---|
1332 | |
---|
1333 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
1334 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
1335 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['infolog']['title'].' - '.lang('Search Results'); |
---|
1336 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
1337 | |
---|
1338 | $error = ''; |
---|
1339 | |
---|
1340 | $matches = 0; |
---|
1341 | |
---|
1342 | |
---|
1343 | |
---|
1344 | |
---|
1345 | |
---|
1346 | list($dia,$mes,$ano)=split("/",$_POST['start']['str']); |
---|
1347 | |
---|
1348 | $starttime = $this->bo->maketime2($_POST['start']['hour'],$_POST['start']['min'],0,$dia,$mes,$ano) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
1349 | //echo $starttime; |
---|
1350 | |
---|
1351 | list($dia2,$mes2,$ano2)=split("/",$_POST['end']['str']); |
---|
1352 | |
---|
1353 | $endtime = $this->bo->maketime2($_POST['end']['hour'],$_POST['end']['min'],0,$dia2,$mes2,$ano2) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
1354 | //echo "gggg".$_POST['end2']['month']; |
---|
1355 | if($_POST['end2']['str']['month']>0){ |
---|
1356 | list($dia3,$mes3,$ano3)=split("/",$_POST['end2']['str']); |
---|
1357 | $endtime2 = $this->bo->maketime2($_POST['end2']['hour'],$_POST['end2']['min'],0,$dia3,$mes3,$ano3) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
1358 | }else{ |
---|
1359 | $endtime2=0; |
---|
1360 | } |
---|
1361 | |
---|
1362 | //$starttime = $this->bo->maketime2($starthora,$startmin,0,$startfecha) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
1363 | echo "kkkk3".$_POST['exec']['accesso']; |
---|
1364 | if($_REQUEST['infolog']['parent']==""){ |
---|
1365 | $parent=0; |
---|
1366 | |
---|
1367 | }else{ |
---|
1368 | $parent=$_REQUEST['infolog']['parent']; |
---|
1369 | |
---|
1370 | } |
---|
1371 | // $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
1372 | if(isset($_POST['info']['id'])&&$_POST['info']['id']>0){ |
---|
1373 | $sql = "update phpgw_infolog set info_type='".$_POST['exec']['info_type']."',info_cat='".$_POST['infolog']['category']."',info_from='".$_POST['participants'][0]."',info_subject='".$_POST['cal']['description1']."',info_des='".$_POST['cal']['description']."',info_status='".$_POST['status']."',info_percent=".$_POST['percent'].",info_responsible='".$_POST['participants1'][0]."',info_startdate=".$starttime.",info_enddate=".$endtime.",info_datecompleted=".$endtime2.",info_datemodified=".$GLOBALS['phpgw']->datetime->users_localtime.",info_owner=".$_POST['info']['owner'].",info_priority=".$_POST['priority'].",info_location='".$_POST['infolog']['location']."',info_id_parent=".$parent.",info_access='".$_POST['exec']['accesso']."' where info_id='".$_POST['info']['id']."'"; |
---|
1374 | }else{ |
---|
1375 | $sql = "insert into phpgw_infolog (info_type,info_cat,info_from,info_subject,info_des,info_status,info_percent,info_responsible,info_startdate,info_enddate,info_datecompleted,info_datemodified,info_owner,info_priority,info_location,info_id_parent,info_access) values ('".$_POST['exec']['info_type']."',".$_POST['infolog']['category'].",'".$_POST['participants'][0]."','".$_POST['cal']['description1']."','".$_POST['cal']['description']."','".$_POST['status']."',".$_POST['percent'].",'".$_POST['participants1'][0]."',".$starttime.",".$endtime.",".$endtime2.",".$GLOBALS['phpgw']->datetime->users_localtime.",".$_POST['info']['owner'].",".$_POST['priority'].",'".$_POST['infolog']['location']."',".$parent.",'".$_POST['exec']['accesso']."')"; |
---|
1376 | } |
---|
1377 | |
---|
1378 | $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__); |
---|
1379 | |
---|
1380 | |
---|
1381 | return ""; |
---|
1382 | } |
---|
1383 | |
---|
1384 | |
---|
1385 | |
---|
1386 | |
---|
1387 | function get_account_name($account_id,$valor) |
---|
1388 | { |
---|
1389 | $acct_type = $this->get_type($account_id); |
---|
1390 | |
---|
1391 | /* jakjr: using justthese with ldap_search */ |
---|
1392 | //$justthese = array("cn","uid","givenname","sn","gecos"); |
---|
1393 | |
---|
1394 | /* search the dn for the given uid */ |
---|
1395 | |
---|
1396 | $justthese = array("uidnumber", "cn", "mail","gecos","dn"); |
---|
1397 | // $sri = @ldap_search($this->ds, "ou=usuarios,ou=cnti,dc=gob,dc=ve", ("(&(sn=*)(mail=*@*)(structuralObjectClass=inetOrgPerson)(deliveryMode=virtual))"), $justthese); |
---|
1398 | |
---|
1399 | if(($acct_type == 'g') && $this->group_context) |
---|
1400 | { |
---|
1401 | $sri = @ldap_search($this->ds, $this->group_context, '(gidnumber=' . (int)$account_id . ')', $justthese); |
---|
1402 | } |
---|
1403 | else |
---|
1404 | { |
---|
1405 | $sri = @ldap_search($this->ds, $this->user_context, '(uidnumber=' . (int)$account_id . ')', $justthese); |
---|
1406 | } |
---|
1407 | |
---|
1408 | //echo $this->ds.",". $this->user_context.",". '(uidnumber=' . (int)$account_id . ')'.",". $justthese; |
---|
1409 | if(!$sri) |
---|
1410 | return False; |
---|
1411 | $allValues = ldap_get_entries($this->ds, $sri); |
---|
1412 | $retorna=""; |
---|
1413 | if($acct_type =='g') |
---|
1414 | { |
---|
1415 | if($valor=='gecos') { |
---|
1416 | $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8'); |
---|
1417 | } |
---|
1418 | if($valor=='uidnumber') { |
---|
1419 | $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8'); |
---|
1420 | } |
---|
1421 | if($valor=='cn') { |
---|
1422 | $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8'); |
---|
1423 | } |
---|
1424 | |
---|
1425 | if($valor=='mail') { |
---|
1426 | $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8'); |
---|
1427 | } |
---|
1428 | if($valor=='dn') { |
---|
1429 | $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8'); |
---|
1430 | } |
---|
1431 | |
---|
1432 | } |
---|
1433 | else |
---|
1434 | { |
---|
1435 | if($valor=='gecos') { |
---|
1436 | $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8'); |
---|
1437 | } |
---|
1438 | if($valor=='uidnumber') { |
---|
1439 | $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8'); |
---|
1440 | } |
---|
1441 | if($valor=='cn') { |
---|
1442 | $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8'); |
---|
1443 | } |
---|
1444 | |
---|
1445 | if($valor=='mail') { |
---|
1446 | $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8'); |
---|
1447 | } |
---|
1448 | if($valor=='dn') { |
---|
1449 | $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8'); |
---|
1450 | } |
---|
1451 | |
---|
1452 | |
---|
1453 | |
---|
1454 | |
---|
1455 | } |
---|
1456 | return $retorna; |
---|
1457 | } |
---|
1458 | |
---|
1459 | |
---|
1460 | |
---|
1461 | |
---|
1462 | |
---|
1463 | function get_type($account_id) |
---|
1464 | { |
---|
1465 | $allValues = array(); |
---|
1466 | /* jakjr: using justthese with ldap_search */ |
---|
1467 | $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', array("phpgwaccounttype")); |
---|
1468 | if(!$sri) |
---|
1469 | return False; |
---|
1470 | $allValues = ldap_get_entries($this->ds, $sri); |
---|
1471 | |
---|
1472 | if ($allValues[0]['phpgwaccounttype'][0]) |
---|
1473 | { |
---|
1474 | return $allValues[0]['phpgwaccounttype'][0]; |
---|
1475 | } |
---|
1476 | |
---|
1477 | $allValues = array(); |
---|
1478 | /* jakjr: using justthese with ldap_search */ |
---|
1479 | $sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwaccounttype=g))', array("phpgwaccounttype")); |
---|
1480 | if(!$sri) |
---|
1481 | return False; |
---|
1482 | $allValues = ldap_get_entries($this->ds, $sri); |
---|
1483 | |
---|
1484 | if ($allValues[0]['phpgwaccounttype'][0]) |
---|
1485 | { |
---|
1486 | return $allValues[0]['phpgwaccounttype'][0]; |
---|
1487 | } |
---|
1488 | return False; |
---|
1489 | } |
---|
1490 | |
---|
1491 | |
---|
1492 | |
---|
1493 | |
---|
1494 | |
---|
1495 | |
---|
1496 | |
---|
1497 | function select($id) |
---|
1498 | { |
---|
1499 | |
---|
1500 | |
---|
1501 | $sql = "select * from phpgw_infolog where info_id='".$id."'"; |
---|
1502 | |
---|
1503 | $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__); |
---|
1504 | |
---|
1505 | if( $GLOBALS['phpgw']->db->next_record() ) |
---|
1506 | { |
---|
1507 | |
---|
1508 | |
---|
1509 | |
---|
1510 | $retval = array( |
---|
1511 | 'id' => $GLOBALS['phpgw']->db->f('info_id'), |
---|
1512 | 'type' => $GLOBALS['phpgw']->db->f('info_type'), |
---|
1513 | 'asunto' => $GLOBALS['phpgw']->db->f('info_subject'), |
---|
1514 | 'descripcion' => $GLOBALS['phpgw']->db->f('info_des'), |
---|
1515 | 'fechainicio' => $GLOBALS['phpgw']->db->f('info_startdate'), |
---|
1516 | 'fechafin' => $GLOBALS['phpgw']->db->f('info_enddate'), |
---|
1517 | 'status' => $GLOBALS['phpgw']->db->f('info_status'), |
---|
1518 | 'fechacompletada' => $GLOBALS['phpgw']->db->f('info_datecompleted'), |
---|
1519 | 'propietario' => $GLOBALS['phpgw']->db->f('info_from'), |
---|
1520 | 'responsable' => $GLOBALS['phpgw']->db->f('info_responsible'), |
---|
1521 | 'owner' => $GLOBALS['phpgw']->db->f('info_owner'), |
---|
1522 | 'percent' => $GLOBALS['phpgw']->db->f('info_percent'), |
---|
1523 | 'access' => $GLOBALS['phpgw']->db->f('info_access'), |
---|
1524 | 'location' =>$GLOBALS['phpgw']->db->f('info_location'), |
---|
1525 | 'category' =>$GLOBALS['phpgw']->db->f('info_cat'), |
---|
1526 | 'priority' => $GLOBALS['phpgw']->db->f('info_priority'), |
---|
1527 | 'padre' => $GLOBALS['phpgw']->db->f('info_id_parent') |
---|
1528 | ); |
---|
1529 | |
---|
1530 | } |
---|
1531 | |
---|
1532 | //echo "iddd".$id." 56666 ".$retval['id']; |
---|
1533 | |
---|
1534 | |
---|
1535 | return $retval; |
---|
1536 | |
---|
1537 | } |
---|
1538 | |
---|
1539 | |
---|
1540 | function select_init() |
---|
1541 | { |
---|
1542 | |
---|
1543 | |
---|
1544 | |
---|
1545 | $retval = array( |
---|
1546 | 'id' => 0, |
---|
1547 | 'type' => '', |
---|
1548 | 'asunto' => '', |
---|
1549 | 'descripcion' => '', |
---|
1550 | 'fechainicio' => $GLOBALS['phpgw']->datetime->users_localtime, |
---|
1551 | 'fechafin' =>$GLOBALS['phpgw']->datetime->users_localtime, |
---|
1552 | 'status' => '', |
---|
1553 | 'fechacompletada' => 0, |
---|
1554 | 'propietario' => '', |
---|
1555 | 'responsable' => '', |
---|
1556 | 'owner' => $this->bo->owner, |
---|
1557 | 'percent' => '', |
---|
1558 | 'access' => 'public', |
---|
1559 | 'location' =>'', |
---|
1560 | 'category' =>0, |
---|
1561 | 'priority' => 1, |
---|
1562 | 'padre' => 0 |
---|
1563 | ); |
---|
1564 | |
---|
1565 | |
---|
1566 | |
---|
1567 | |
---|
1568 | return $retval; |
---|
1569 | |
---|
1570 | } |
---|
1571 | |
---|
1572 | |
---|
1573 | |
---|
1574 | |
---|
1575 | |
---|
1576 | } |
---|
1577 | |
---|
1578 | ?> |
---|