Changeset 5132 for trunk/calendar/inc/class.uicalendar.inc.php
- Timestamp:
- 11/03/11 13:21:19 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/calendar/inc/class.uicalendar.inc.php
r4844 r5132 57 57 58 58 var $public_functions = array( 59 'screen_delegate_event' => True,60 'delegate_event' => True,61 59 'mini_calendar' => True, 62 60 'index' => True, … … 67 65 'year' => True, 68 66 'view' => True, 67 //'suggest' => True, 68 'send_suggest_owner' => True, 69 69 'edit' => True, 70 70 'export' => True, … … 92 92 function uicalendar() 93 93 { 94 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 95 $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; 96 $GLOBALS['phpgw_info']['flags']['currentapp'] = 'calendar'; 97 include_once( $_SESSION['rootPath'].'/header.inc.php' ); 98 94 99 $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); 95 100 $GLOBALS['phpgw']->browser = CreateObject('phpgwapi.browser'); … … 163 168 } 164 169 $this->html = &$GLOBALS['phpgw']->html; 165 }166 167 function screen_delegate_event($params=NULL) {168 $module_name = 'expressoMail'.(str_replace("1.","1_",$GLOBALS['phpgw_info']['server']['cal_expressoMail']));169 170 $sb = CreateObject('phpgwapi.sbox2');171 $jscal = CreateObject('phpgwapi.jscalendar'); // before phpgw_header() !!!172 unset($GLOBALS['phpgw_info']['flags']['noheader']);173 unset($GLOBALS['phpgw_info']['flags']['nonavbar']);174 $GLOBALS['phpgw_info']['flags']['noappheader'] = True;175 $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;176 $GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Calendar - Edit') : lang('Calendar - Delegate Event');177 $GLOBALS['phpgw']->common->phpgw_header();178 179 $ldap_manager = CreateObject('contactcenter.bo_ldap_manager');180 $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];181 $_SESSION['phpgw_info']['expressomail']['user']['owner'] = $event['owner'];182 $_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server'];183 $_SESSION['phpgw_info']['expressomail']['ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null;184 $context = $GLOBALS['phpgw_info']['server']['ldap_context'];185 $user_context = array();186 foreach(explode(",",$GLOBALS['phpgw_info']['user']['account_dn']) as $i => $dn_part){187 if($i)188 $user_context[] = $dn_part;189 }190 // Prepara o contexto do usuario com sua OU raiz, pois ele pode pertencer a uma OU de nivel N.191 $user_ou = explode(",",str_replace($context,"",implode(",",$user_context)));192 $user_context = trim(strtolower($user_ou[count($user_ou) - 2].",".$context));193 // Fim194 // Verifica o tipo da visualização da árvore LDAP, configurado no admin da Agenda195 $recursive = $GLOBALS['phpgw_info']['server']['cal_type_tree_participants'] == '1' ? true : false;196 $combo_org = $this->get_organizations(trim(strtolower($context)),$user_context, $recursive);197 198 $var = array(199 "module_name" => $module_name,200 "lang_loading" => lang("Loading"),201 "lang_searching" => lang("Searching"),202 "lang_users" => lang("Users"),203 "lang_groups" => lang("Groups"),204 "recursive" => ($recursive)?"":"search",205 "options" => $combo_org,206 "id_event" => $_REQUEST["id_event"],207 "eventArray" => $_REQUEST["eventArray"],208 "delegator" => $_REQUEST["delegator"],209 "lang_avaliable_users" => lang("Available Users and Groups"),210 "lang_search_for" => lang("Search for"),211 "lang_ou" => lang("Organization"),212 "min_num_characters" => $GLOBALS['phpgw_info']['server']['min_num_characters'],213 "date" => $_REQUEST["date"],214 "eventDelegation" => 1,215 "Delegate" => lang("Delegate"),216 'url_template' => 'calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set']217 );218 219 if(isset($_REQUEST["error"]))220 {221 if($_REQUEST["error"] == 999){222 $var['error_msg'] = lang("Problems delegating. Make sure you have selected a user to delegate the appointment.");223 }else {224 $var['error_msg'] = lang("Problems delegating. Make sure you haven't delegated to a person that was also invited to the meeting");225 }226 }227 228 $template = CreateObject('phpgwapi.Template',$this->template_dir);229 $template->set_file(230 array(231 "screen"=>"delegate.tpl"232 )233 );234 $template->set_var($var);235 print $template->fp('out','screen');236 }237 238 239 function delegate_event($params=NULL) {240 //$ldap = CreateObject('expressoMail1_2.ldap_functions');241 //$delegated = $ldap->uid2uidnumber($_REQUEST['delegated']);242 243 try {244 $this->bo->delegar($_REQUEST['delegator'],$_REQUEST['delegated']/*$delegated*/,$_REQUEST['event']);245 header("Location: index.php?menuaction=calendar.uicalendar.day&date=".$_REQUEST['date']);246 }catch(Exception $e) {247 if($e->getMessage() == '999') {248 header("Location: index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=". $_REQUEST["event"]."&delegator=".$_REQUEST["delegator"]."&date=".$_REQUEST["date"]."&error=999");249 }else {250 header("Location: index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=". $_REQUEST["event"]."&delegator=".$_REQUEST["delegator"]."&date=".$_REQUEST["date"]."&error=1");251 }252 }253 170 } 254 171 … … 392 309 { 393 310 //NDEE: class def what for? 394 $dayToday = (int)(substr($today,6,2)); 395 $seleDay = (int)(substr($_GET['date'],6,2)); 396 if($day == $dayToday) 397 { 398 if($dayToday == $seleDay) 399 { 400 $day_params['class'] = 'minicaltodaysel'; 401 } 402 else 403 { 404 $day_params['class'] = 'minicaltoday'; 405 } 406 } 407 408 if( isset($params['control']) && $params['control'] ) 409 { 410 if($day == $seleDay && $dayToday != $seleDay) 411 { 412 $day_params['class'] = 'minicalnottoday'; 413 } 414 } 415 416 $str = '<a href="'.$this->page($params['link'],'&date='.$date).'" class="'.$day_params['class'].'" ' . ($day_params['class']=='bminicalhol' || $day_params['class']=='minicalhol'?' title="' . $day_params['holidays'][0] . '" ' :'') . ' >'.$day.'</a>'; 311 $str = '<a href="'.$this->page($params['link'],'&date='.$date).'" class="'.$day_params['class'].'">'.$day.'</a>'; 417 312 } 418 313 else … … 473 368 $_SESSION['calendar']['categories'] = $this->cat->formated_list('select','all',$this->bo->cat_id,'True'); 474 369 if((!isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && count($this->bo->grants) > 0) 370 { 475 371 $_SESSION['calendar']['cals'] = $this->bo->list_cals(); 372 } 476 373 477 374 if($this->bo->printer_friendly || $_GET['plain'] == 'True') 478 375 { 479 $app_css_path = $_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'];480 $app_print_css_path = $app_css_path;481 if (!file_exists($GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$app_css_path.'/app.css'))482 $app_css_path = 'default';483 if (!file_exists($GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$app_print_css_path.'/app_print.css'))484 $app_print_css_path = 'default';485 486 376 $new_body = '<html>'."\n" 487 377 .'<head>'."\n" 488 .'<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$app_css_path.'/app.css" type=text/css rel=StyleSheet>'."\n" 489 .'<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$app_print_css_path.'/app_print.css" type=text/css rel=StyleSheet media="print">'."\n" 378 .'<SCRIPT type="text/javascript"> 379 window.onbeforeunload = function() { 380 return \'Gostaria realmente de fechar essa janela ?\'; 381 } 382 </SCRIPT>' 383 .'<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'].'/app.css" type=text/css rel=StyleSheet>'."\n" 384 .'<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'].'/app_print.css" type=text/css rel=StyleSheet media="print">'."\n" 490 385 .'</head> 491 386 <table id="calendar_print_main" class="calendar_print_main"> … … 493 388 <td id="calendar_print_content" class="calendar_print_content">'.$body.'</td> 494 389 </tr> 390 495 391 <tr> 496 392 <td> 393 <br/> 394 <br/> 497 395 <div> 498 396 <input class=button type="button" onClick="javascript:this.style.visibility=\'hidden\';window.print();window.close();" value="Imprimir esta página"> … … 516 414 517 415 $GLOBALS['phpgw']->common->phpgw_header(); 518 $new_body = $this->bo->debug_string.$body;519 416 520 } 417 $new_body = $this->bo->debug_string.$body; 418 } 419 420 421 422 521 423 return $new_body; 522 424 } 523 425 524 426 function month() 525 {526 if($_GET['month']||$_POST['month']){527 $params['month'] = $_GET['month']?(int)$_GET['month']:(int)$_POST['month'];528 $params['year'] = $_GET['year']?(int)$_GET['year']:(int)$_POST['year'];529 $params['day'] = 1;530 531 }else{532 $params['day'] = $_POST['date']?(int)substr($_POST['date'] , 6, 2):(int)substr($_GET['date'] , 6, 2);533 $params['month'] = $_POST['date']?(int)substr($_POST['date'] , 4, 2):(int)substr($_GET['date'] , 4, 2);534 $params['year'] = $_POST['date']?(int)substr($_POST['date'] , 0, 4):(int)substr($_GET['date'] , 0, 4);535 536 }537 538 if($_GET['friendly']==1)539 427 { 540 428 echo $this->printer_friendly($this->get_month(),lang('Monthview')); 541 }542 else543 {544 echo $this->printer_friendly($this->print_month_new($params),lang('Monthview'));545 }546 547 429 $GLOBALS['phpgw']->common->phpgw_footer(); 548 430 } … … 550 432 function get_month() 551 433 { 434 $this->bo->read_holidays(); 435 552 436 $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); 553 437 … … 594 478 $minical_next = ''; 595 479 } 596 $this->bo->read_holidays($params['year']); 480 597 481 if($_POST['year']) { 598 482 599 483 } 600 484 485 $hoje = date('Ymd',$GLOBALS['phpgw']->datetime->gmtnow); 486 $mes_hoje = (int)substr($hoje,4,2); 487 $sday = 1; 488 if($_POST['day']) { 489 $day_ini = (int)$_POST['day']; 490 } 491 elseif($_GET['sday']){ 492 if($_GET['month'] == $mes_hoje) 493 { 494 $day_ini = $this->bo->day; 495 } 496 497 else 498 { 499 $day_ini = (int)$_GET['sday']; 500 } 501 } 502 elseif( ($_POST['dia_ini']) && ($_POST['dia_ini'] == $this->bo->day) ) 503 { 504 $day_ini = (int)substr($hoje,6,2); 505 } 506 else 507 { 508 $day_ini = $this->bo->day; 509 } 510 if($_POST['qtd_dias']) 511 { 512 $num_dias = (int)$_POST['qtd_dias']; 513 } 514 else 515 { 516 $num_dias = 0; 517 } 518 601 519 if (!$this->bo->printer_friendly) 602 520 { 603 $account_name = $_POST['user'] ? $_POST['user'] : ($_GET['account_name'] ? $_GET['account_name'] : '');604 605 $accounts = CreateObject('phpgwapi.accounts');606 $accountId = $accounts->name2id($account_name);607 608 $prefs = CreateObject('phpgwapi.preferences', $accountId);609 $account_prefs = $prefs->read();610 611 521 $printer = ''; 612 522 $prev_month_link = '<a href="'.$this->page('month','&year='.$prevyear.'&month='.$prev.'&sday='.$sday).'"><<</a>'; … … 614 524 $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$day_ini.'&num_dias='.$num_dias; 615 525 //$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'; 616 /*if($account_prefs['calendar']['type_month_print'] == '0')617 {618 526 $print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('month'.$param). 619 527 "','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '". 620 528 lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 621 }622 else623 {624 $print = '<a href="javascript:void(0)" onclick="scheduler.toPDF('."'calendar/js/dhtmlx/server/generate.php'".')">['.lang('Printer Friendly').']</a>';625 }*/626 627 529 //linha abaixo foi adicionada para exibir a pagina do mes em tela 628 //$month,$year,$showyear,$owner=0; 629 $params = Array( 630 'month' => $this->bo->month, 631 'year' => $this->bo->year, 632 'showyear' => True, 633 'owner' => $this->bo->owner 634 ); 635 $large_month = $this->display_month($params); 530 $large_month = $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner); 636 531 } 637 532 else … … 643 538 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 644 539 //linha abaixo foi adicionada para exibir a pagina do mes para impressao 645 646 //if($_GET['classic_print']==1)647 // $large_month = $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner);648 //else649 540 $large_month = $this->display_month_print($this->bo->month,$this->bo->year,True,$this->bo->owner); 650 541 } 651 542 652 543 $this->bo->read_holidays(); 653 654 $aux_month_identifier = lang(strftime("%B",$m)).' '.$this->bo->year;655 if(isset($_GET['friendly']) && $_GET['friendly'] ==1)656 {657 if( isset($_GET['num_dias']) && ($_GET['num_dias'] == 1) )658 {659 $year = $_GET['year'];660 $month = $_GET['month'];661 $day = $_GET['day_ini'];662 $aux_month_identifier = $this->month_day_of_week($year,$month,$day).', '.$day.' de '.lang(strftime("%B",$m)).' de '.$this->bo->year;663 }664 }665 544 666 545 $var = Array( … … 669 548 'small_calendar_prev' => $minical_prev, 670 549 'prev_month_link' => $prev_month_link, 671 'month_identifier' => $aux_month_identifier,550 'month_identifier' => lang(strftime("%B",$m)).' '.$this->bo->year, 672 551 'username' => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner), 673 552 'next_month_link' => $next_month_link, 674 553 'small_calendar_next' => $minical_next, 554 //'large_month' => $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner), 675 555 'large_month' => $large_month, 676 556 'print' => $print … … 700 580 function week() 701 581 { 702 703 if($_GET['month']||$_POST['month']){ 704 $params['month'] = $_GET['month']?(int)$_GET['month']:(int)$_POST['month']; 705 $params['year'] = $_GET['year']?(int)$_GET['year']:(int)$_POST['year']; 706 $params['day'] = $_GET['day']?(int)$_GET['day']:(int)$_POST['day']; 707 708 }else{ 709 $params['day'] = $_POST['date']?(int)substr($_POST['date'] , 6, 2):(int)substr($_GET['date'] , 6, 2); 710 $params['month'] = $_POST['date']?(int)substr($_POST['date'] , 4, 2):(int)substr($_GET['date'] , 4, 2); 711 $params['year'] = $_POST['date']?(int)substr($_POST['date'] , 0, 4):(int)substr($_GET['date'] , 0, 4); 712 713 } 714 715 echo $this->printer_friendly($this->print_week_new($params),lang('Weekview')); 716 582 echo $this->printer_friendly($this->get_week(),lang('Weekview')); 717 583 $GLOBALS['phpgw']->common->phpgw_footer(); 718 584 } … … 727 593 if (isset($this->bo->prefs['calendar']['display_minicals']) && $this->bo->prefs['calendar']['display_minicals'] == "1" && !$this->bo->printer_friendly) 728 594 { 595 $minical_this = $this->mini_calendar( 596 Array( 597 'day' => $this->bo->day, 598 'month' => $this->bo->month, 599 'year' => $this->bo->year, 600 'link' => 'day', 601 'butons' => 'none', 602 'outside_month' => False 603 ) 604 ); 729 605 $minical_prev = $this->mini_calendar( 730 606 Array( … … 747 623 ) 748 624 ); 749 $minical_this = $this->mini_calendar(750 Array(751 'day' => $this->bo->day,752 'month' => $this->bo->month,753 'year' => $this->bo->year,754 'link' => 'day',755 'butons' => 'none',756 'outside_month' => False757 )758 );759 625 } 760 626 else 761 627 { 762 628 763 629 //NDEE: printer-friendly what? 764 630 $minical_this = ''; 765 631 $minical_prev = ''; … … 773 639 $prev_week_link = '<a href="'.$this->page('week','&date='.$prev['full']).'"><<</a>'; 774 640 $next_week_link = '<a href="'.$this->page('week','&date='.$next['full']).'">>></a>'; 775 $print = '<a href="javascript:void(0);" onclick="scheduler.toPDF('."'calendar/js/dhtmlx/server/generate.php'".')">['.lang('Printer Friendly').']</a>'; 776 777 //$print = '<a href="'.$this->page('week','&friendly=1&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day))."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."' \">[".lang('Printer Friendly').']</a>'; 641 $print = '<a href="'.$this->page('week','&friendly=1&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day))."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 778 642 } 779 643 else 780 644 { 781 645 782 646 //NDEE: printer-friendly (weekly-view) 783 647 $printer = '<body bgcolor="'.$this->theme['bg_color'].'">'; 784 648 $prev_week_link = ''; … … 807 671 'print' => $print 808 672 ); 809 673 //todo 810 674 $p = CreateObject('phpgwapi.Template',$this->template_dir); 811 675 $p->set_file( … … 968 832 ); 969 833 970 $button_left = $button_center = $button_right = ''; 834 $p->set_file(Array('form_button' => 'form_button_script.tpl' )); 835 836 $button_left = $button_center = $button_right = $button_right_suggestion = ''; 971 837 972 838 if($this->bo->check_perms(PHPGW_ACL_EDIT,$event)) … … 976 842 $var = Array( 977 843 'action_url_button' => $this->page('edit','&cal_id='.$cal_id), 844 // added date to the action parameteres so we can add an exception to an edited event 845 'action_url_button' => $this->page('edit','&cal_id='.$cal_id.'&date='.$date), 978 846 'action_text_button' => lang('Edit Single'), 979 847 'action_confirm_button' => '', … … 1027 895 'action_url_button' => $this->page('delete','&cal_id='.$cal_id), 1028 896 'action_text_button' => lang('Delete Single'), 1029 'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this single occurence? ').'\\n'.lang('This will delete this entry for all users.')."')\"",897 'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this single occurence?\\nThis will delete this entry for all users.')."')\"", 1030 898 'action_extra_field' => $this->html->input_hidden(array( 1031 899 'delete_type' => 'single', … … 1092 960 } 1093 961 } 962 $uid = $event['uid']; 963 $owner = $event['owner']; 964 $title = $event['title']; 965 $description = rtrim(utf8_encode($event['description'])); 966 $location = $event['location']; 967 $start = $event['start']; 968 $end = $event['end']; 969 970 $p->set_var( 'suggestion', $this->build_suggestion( $event , $GLOBALS['phpgw_info']['user']['account_id']) ); 1094 971 1095 972 $var = Array( … … 1113 990 $button_left .= '<td>'.$p->fp('button','form_button').'</td>'; 1114 991 } 992 993 $label_suggest = lang('Suggest new hour'); 994 $button_right_suggestion = "<td><input type=\"button\" style=\"height: 16px; width: 110px; font-size: 10px;\" value=\"" . $label_suggest . "\"onclick=\"show_suggestion()\";</td>"; 995 1115 996 $p->set_var(array( 1116 997 'button_left' => $button_left, 1117 998 'button_center' => $button_center, 1118 'button_right' => $button_right 999 'button_right' => $button_right, 1000 'button_right_suggestion' => $button_right_suggestion 1119 1001 )); 1120 1002 $p->pfp('phpgw_body','view_event'); … … 1128 1010 } 1129 1011 1012 function build_suggestion( $event , $user = false ) 1013 { 1014 $p = $GLOBALS['phpgw']->template; 1015 1016 $p->set_file( 1017 Array( 1018 'suggestion' => 'suggestion.tpl' 1019 ) 1020 ); 1021 1022 include_once($_SESSION['rootPath'].'/calendar/inc/class.ex_participants.inc.php'); 1023 $exParticipants = new exParticipants(); 1024 $exParticipants->setParticipantsBySerializable($event['ex_participants']); 1025 1026 $cal_id = $event['id']; 1027 $uid = $event['uid']; 1028 $owner = $event['owner']; 1029 $title = $event['title']; 1030 $description = rtrim(utf8_encode($event['description'])); 1031 $location = $event['location']; 1032 $start = $event['start']; 1033 $end = $event['end']; 1034 1035 if( $owner == -2 ) 1036 { 1037 $to = $event['organizer']; 1038 $mail = array(); 1039 1040 if( preg_match ('(<([^>]*@[^>]*)>)', $to, $mail ) ) 1041 $to = $mail[1]; 1042 } 1043 else 1044 { 1045 $preferences = CreateObject('phpgwapi.preferences',$owner); 1046 $to = $preferences->email_address($owner); 1047 } 1048 1049 1050 if(((int)$start['month']) < 10 && strlen($start['month']) == 1) 1051 $mes = "0" . $start['month']; 1052 else 1053 $mes = $start['month']; 1054 1055 if(((int)$start['mday']) < 10 && strlen($start['mday']) == 1) 1056 $dia = "0" . $start['mday']; 1057 else 1058 $dia = $start['mday']; 1059 1060 if(((int)$start['hour']) < 10 && strlen($start['hour']) == 1) 1061 $hor = "0" . $start['hour']; 1062 else 1063 $hor = $start['hour']; 1064 1065 if(((int)$start['min']) < 10 && strlen($start['min']) == 1) 1066 $min = "0" . $start['min']; 1067 else 1068 $min = $start['min']; 1069 1070 if(((int)$end['month']) < 10 && strlen($end['month']) == 1) 1071 $end['month'] = "0" . $end['month']; 1072 1073 if(((int)$end['mday']) < 10 && strlen($end['mday']) == 1) 1074 $end['mday'] = "0" . $end['mday']; 1075 1076 if(((int)$end['hour']) < 10 && strlen($end['hour']) == 1) 1077 $end['hour'] = "0" . $end['hour']; 1078 1079 if(((int)$end['min']) < 10 && strlen($end['min']) == 1) 1080 $end['min'] = "0" . $end['min']; 1081 1082 $start_date = $dia . "/" . $mes . "/" . $start['year']; 1083 $start_hour = $hor . ":" . $min; 1084 $end_date = $end['mday'] . "/" . $mes . "/" . $start['year']; 1085 $end_hour = $end['hour'] . ":" . $end['min']; 1086 1087 $notify_message = lang('suggest new hour'); 1088 $start_h = substr($start_hour, 0, strpos($start_hour, ":")); 1089 $start_m = substr($start_hour, strpos($start_hour, ":")+1); 1090 $end_h = substr($end_hour, 0, strpos($end_hour, ":")); 1091 $end_m = substr($end_hour, strpos($end_hour, ":")+1); 1092 1093 $p->set_var('notify_message', $notify_message); 1094 $p->set_var('action_form', $this->page('send_suggest_owner')); 1095 $p->set_var('lang_start_hour', lang('Start hour')); 1096 $p->set_var('lang_end_hour', lang('End hour')); 1097 $p->set_var('lang_start_date', lang('Start date')); 1098 $p->set_var('lang_end_date', lang('End date')); 1099 $p->set_var('lang_suggest_new_hour', lang('Suggest new hour')); 1100 $p->set_var('cal_id', $cal_id); 1101 $p->set_var('to', $to); 1102 $p->set_var('title', $title); 1103 $p->set_var('description', $description); 1104 $p->set_var('uid', $uid); 1105 $p->set_var('location', $location); 1106 $p->set_var('ex_participants', $exParticipants->getParticipantsMailsString()); 1107 $p->set_var('start_date', $start_date); 1108 $p->set_var('start_hour', $start_h); 1109 $p->set_var('start_minute', $start_m); 1110 $p->set_var('end_date', $end_date); 1111 $p->set_var('end_hour', $end_h); 1112 $p->set_var('end_minute', $end_m); 1113 $p->set_var('url', $GLOBALS['phpgw_info']['server']['webserver_url']); 1114 $p->set_var('user', $user); 1115 1116 return $p->fp( 'suggestion', 'suggestion' ); 1117 } 1118 1119 /** 1120 * @license http://www.gnu.org/copyleft/gpl.html GPL 1121 * @abstract: método que envia a sugestão para o criador do compromisso. 1122 * @author Prognus Software Livre (http://www.prognus.com.br) 1123 */ 1124 function send_suggest_owner() 1125 { 1126 $array_data_inicio = explode('/',$_POST['data_inicio']); 1127 $array_data_final = explode('/',$_POST['data_final']); 1128 $hora_inicio = $_POST['hora_inicio']; 1129 $minuto_inicio = $_POST['minuto_inicio']; 1130 $hora_final = $_POST['hora_final']; 1131 $minuto_final = $_POST['minuto_final']; 1132 1133 $vars = $_GET['cal_id']; 1134 $array_vars = explode(";", $vars); 1135 $cal_id = $array_vars[0]; 1136 $to = $array_vars[1]; 1137 $title_ = $array_vars[2]; 1138 $description_ = $array_vars[3]; 1139 $uid = $array_vars[4]; 1140 $location = $array_vars[5]; 1141 $ex_participants = $array_vars[6]; 1142 $user = $array_vars[7]; 1143 $time_suggest = array('hora_inicio' => $hora_inicio, 'hora_final' => $hora_final, 'minuto_inicio' => $minuto_inicio, 'minuto_final' => $minuto_final); 1144 1145 $cal_id = $this->bo->send_suggestion_external_owner($cal_id, $uid, $to, $time_suggest, $array_data_inicio, $array_data_final, $title_, $description_, $location, $ex_participants,$user); 1146 1147 Header('Location: '.$this->page('view','&cal_id='.$cal_id)); 1148 1149 } 1150 1151 1130 1152 function edit($params='') 1131 1153 { … … 1186 1208 'event' => $event, 1187 1209 'cd' => $cd, 1188 'plain' => $plain 1210 'plain' => $plain, 1211 'date' => $_GET['date'] 1189 1212 ) 1190 1213 ); … … 1219 1242 function export($vcal_id=0) 1220 1243 { 1244 $extern = true; 1245 $method = 'PUBLISH'; 1221 1246 $temp_path = $GLOBALS['phpgw_info']['server']['temp_dir'] . SEP; 1222 1247 srand((double)microtime()*1000000); … … 1227 1252 $cal_id = get_var('cal_id',array('GET','POST'),$vcal_id); 1228 1253 $event[0] = $this->bo->read_entry($cal_id); 1254 1229 1255 include_once('class.bocalendar.inc.php'); 1230 1256 $cal = new bocalendar; 1231 $tmpattach=$cal->create_vcard($event );1257 $tmpattach=$cal->create_vcard($event, $method, $extern); 1232 1258 fwrite($attach_fd,$tmpattach); 1233 1259 header ("Content-Type: text/plain"); … … 1422 1448 } 1423 1449 // Add participants 1424 //$participants = explode(";", $GLOBALS['phpgw']->session->appsession("participants") );1425 //for($_f_part=0; $_f_part<count($participants); $_f_part++)1426 //{1427 //$this->bo->add_attribute('participants','A',$participants[$_f_part]);1428 //}1450 $participants = explode(";", $GLOBALS['phpgw']->session->appsession("participants") ); 1451 for($_f_part=0; $_f_part<count($participants); $_f_part++) 1452 { 1453 $this->bo->add_attribute('participants','A',$participants[$_f_part]); 1454 } 1429 1455 // Add misc 1430 1456 $this->bo->add_attribute('participants','A',$this->bo->owner); … … 1487 1513 } 1488 1514 1515 1516 1517 function getLdap() 1518 { 1519 include_once('../phpgwapi/inc/class.common.inc.php'); 1520 $GLOBALS['phpgw_info']['server'] = $_SESSION['phpgw_info']['expresso']['server']; 1521 $common = new common(); 1522 1523 if ( (!empty($GLOBALS['phpgw_info']['server']['ldap_master_host'])) && 1524 (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_dn'])) && 1525 (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_pw'])) ) 1526 { 1527 $ldap = $common->ldapConnect($GLOBALS['phpgw_info']['server']['ldap_master_host'], 1528 $GLOBALS['phpgw_info']['server']['ldap_master_root_dn'], 1529 $GLOBALS['phpgw_info']['server']['ldap_master_root_pw']); 1530 } 1531 else 1532 { 1533 $ldap = $common->ldapConnect(); 1534 } 1535 1536 return $ldap; 1537 } 1538 1539 1540 1489 1541 function disponibility($params) { 1490 1542 … … 1505 1557 $str_participants = substr($_GET['participants'],0,strlen($_GET['participants'])-1); //remove the last comma 1506 1558 $participants= array(); 1507 1508 1559 $participants_splited = explode(",",$str_participants); 1509 foreach($participants_splited as $participant) { 1560 1561 1562 $ldap = $this->getLdap(); 1563 foreach ($participants_splited as $participant) 1564 { 1510 1565 $participant = substr($participant,0,strlen($participant)-1); 1566 1567 $entry = array(); 1568 $extern_contact = false; 1569 1570 $justthese = array('accountStatus'); 1571 $filter="(&(|(phpgwAccountType=u)(phpgwAccountType=l))(uidNumber=".(int)$participant."))"; 1572 $search = ldap_search($ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 1573 $entry = ldap_get_entries($ldap, $search); 1574 1575 if($entry[0]['accountstatus'][0] == "false") 1576 $extern_contact = true; 1577 1578 1511 1579 $acct_type = $GLOBALS['phpgw']->accounts->get_type((int)$participant); 1580 1512 1581 if($acct_type=='g') { 1513 1582 $bo_groups = CreateObject('expressoAdmin1_2.group'); 1514 $users = $bo_groups->get_info($participant ,true);1583 $users = $bo_groups->get_info($participant); 1515 1584 foreach($users['memberuid_info'] as $user) { 1516 if($user['type']==u) 1585 if($user['type']==u){ 1586 if (!$user['uidnumber']){ 1587 continue; 1588 } 1517 1589 $participants[$user['uidnumber']] = 'U'; 1518 1590 } 1519 1591 } 1520 else { 1592 } 1593 else 1594 { 1595 if($extern_contact) 1596 { 1597 $participants[$participant] = 'I'; 1598 continue; 1599 } 1600 1601 if (!$participant) 1602 continue; 1603 1521 1604 $participants[$participant] = 'U'; 1522 1605 } … … 1665 1748 "; 1666 1749 1750 $extra_ = ""; 1751 1667 1752 $str.= "<table border=\'1\' bgcolor=\"#FFFFFF\" width=\"100%\" height=\"100%\"><tr><td>"; 1668 1753 … … 1679 1764 foreach($participants as $part => $nul) 1680 1765 { 1766 $extra_ = ""; 1767 1768 if($nul == 'I') 1769 $extra_ = "(externalI)"; 1770 1681 1771 $participants[$part] = $GLOBALS['phpgw']->common->grab_owner_name($part); 1772 $participants[$part].= $extra_; 1682 1773 // Much better for processor :) 1683 1774 $participants_id[] .= $part; … … 1691 1782 $GLOBALS['phpgw']->preferences->save_repository(); 1692 1783 } 1693 if($this->bo->prefs['calendar']['interval'] == '42') 1694 { 1695 $increment = 30; 1696 } 1697 elseif($this->bo->prefs['calendar']['interval'] == '84') 1698 { 1699 $increment = 15; 1700 } 1784 $increment = $this->bo->prefs['calendar']['interval']; 1701 1785 $interval = (int)(60 / $increment); 1702 1786 … … 1727 1811 foreach($participants as $part => $fullname) 1728 1812 { 1813 $external = false; 1814 if(strpos($fullname,"(externalI)")) 1815 { 1816 $tmp_name = str_replace("(externalI)","",$fullname); 1817 $fullname = $tmp_name; 1818 $external = true; 1819 } 1820 1729 1821 $str .= '<tr align="center">' 1730 1822 . '<td width="15%" align="left"><font color="'.$this->theme['bg_text'].'" face="'.$this->theme['font'].'" size="-2">'.$fullname.'</font></td>'; … … 1743 1835 ) 1744 1836 ); 1837 1838 if($external) 1839 { 1840 $str .= '<td height="1" align="center" colspan="22" bgcolor="'.$this->theme['bg_color'].'" color="#999999">' .lang('Agenda not available') .'</td>'; 1841 $str .= '</tr>' 1842 . '<tr><td height="1" colspan="'.((11 * $interval) + 1).'" bgcolor="#999999"><img src="'.$pix.'"></td></tr>'; 1843 continue; 1844 } 1745 1845 1746 1846 if(!$this->bo->cached_events[$date['full']]) … … 1772 1872 break; 1773 1873 case '-': 1874 $time_slice[$index]['marker'] = "#"; 1774 1875 $time_slice[$index]['color'] = $this->theme['bg11']; 1775 1876 $link = $this->page('view','&cal_id='.$time_slice[$index]['id'].'&date='.$date['full']); … … 1797 1898 { 1798 1899 1799 $next = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day + 1,$this->bo->year);1800 $prev = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day - 1,$this->bo->year);1801 1802 1900 $this->bo->read_holidays(); 1803 1901 1804 $legend_holiday = $this->bo->cached_holidays[$_GET['date']][0]['name']?'('.$this->bo->cached_holidays[$_GET['date']][0]['name'].')':'';1805 1902 if (!$this->bo->printer_friendly || ($this->bo->printer_friendly && @$this->bo->prefs['calendar']['display_minicals'])) 1806 1903 { 1807 1904 $minical = $this->mini_calendar( 1808 1905 Array( 1809 'day' => 1,1906 'day' => $this->bo->day, 1810 1907 'month' => $this->bo->month, 1811 1908 'year' => $this->bo->year, 1812 'link' => 'day', 1813 'control' => True, 1814 'outside_month' => False 1909 'link' => 'day' 1815 1910 ) 1816 1911 ); 1817 $minical1 = $this->mini_calendar(1818 Array(1819 'day' => 1,1820 'month' => $this->bo->month+1,1821 'year' => $this->bo->year,1822 'link' => 'day',1823 'control' => False,1824 'outside_month' => False1825 )1826 );1827 $minical2 = $this->mini_calendar(1828 Array(1829 'day' => 1,1830 'month' => $this->bo->month+2,1831 'year' => $this->bo->year,1832 'link' => 'day',1833 'control' => False,1834 'outside_month' => False1835 )1836 );1837 1912 } 1838 1913 else 1839 1914 { 1840 1915 1841 1916 //NDEE: printer-friendly (what?) 1842 1917 $minical = ''; 1843 1918 } 1844 1919 1845 if(isset($_GET['date'])) 1846 { 1847 $dia = substr($_GET['date'],-2); 1920 if (!$this->bo->printer_friendly) 1921 { 1922 $printer = ''; 1923 $param = '&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day).'&friendly=1'; 1924 // $print = '<a href="'.$this->page('day'.$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 1925 1926 //Adiciona modo que o mesmo abra uma nova janela nos navegadores IE e FF 1927 $print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('day'.$param). 1928 "','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '". 1929 lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 1930 1848 1931 } 1849 1932 else 1850 1933 { 1851 $dia = $_POST['day']; 1852 } 1853 1854 if (!$this->bo->printer_friendly) 1855 { 1856 $printer = ''; 1857 $prev_day_link = '<a href="'.$this->page('day','&date='.$prev['full']).'"><<</a>'; 1858 $next_day_link = '<a href="'.$this->page('day','&date='.$next['full']).'">>></a>'; 1859 //$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$dia.'&num_dias=1'.'&d=1'; 1860 //$print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('month'.$param). 1861 // "','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '". 1862 // lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 1863 } 1864 else 1865 { 1866 1867 //NDEE: printer-friendly (daily-view) 1934 1935 //NDEE: printer-friendly (daily-view) 1868 1936 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 1869 1937 $printer = '<body bgcolor="'.$this->theme['bg_color'].'">'; 1870 //$print = ''; 1871 } 1872 $print = '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>'; 1873 1874 $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$dia.'&num_dias=1'.'&d=1'; 1938 $print = ''; 1939 } 1875 1940 1876 1941 $now = $GLOBALS['phpgw']->datetime->makegmttime(0, 0, 0, $this->bo->month, $this->bo->day, $this->bo->year); 1877 1942 $now['raw'] += $GLOBALS['phpgw']->datetime->tz_offset; 1878 1879 $week_days = array(lang('Sunday'),1880 lang('Monday'),1881 lang('Tuesday'),1882 lang('Wednesday'),1883 lang('Thursday'),1884 lang('Friday'),1885 lang('Saturday'));1886 1943 1887 1944 $p = $GLOBALS['phpgw']->template; … … 1898 1955 'printer_friendly' => $printer, 1899 1956 'bg_text' => $this->theme['bg_text'], 1900 'daily_events' => $this->print_day_new(1957 'daily_events' => $this->print_day( 1901 1958 Array( 1902 1959 'year' => $this->bo->year, … … 1905 1962 ) 1906 1963 ), 1907 'small_calendar' => $minical.'<br/>'.$minical1.'<br/>'.$minical2, 1908 'date' => $this->bo->long_date($now) . $legend_holiday, 1909 'day_of_week' => $week_days[$now['dow']], 1964 'small_calendar' => $minical, 1965 'date' => $this->bo->long_date($now), 1910 1966 'username' => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner), 1911 'prev_day_link' => $prev_day_link, 1912 'next_day_link' => $next_day_link, 1913 'iprint' => $print, 1914 'param' => $param, 1967 'print' => $print, 1915 1968 'lang_todos' => $todo_label, 1916 1969 'todos' => $this->bo->printer_friendly ? $todos : 1917 1970 1918 1971 //NDEE: todo's layout 1919 1972 "<div style=\"overflow: auto; max-height: 200px\">\n$todos</div>\n" 1920 1973 ); … … 1922 1975 $p->set_var($var); 1923 1976 $p->parse('day_events','day_event'); 1924 echo$this->printer_friendly($p->fp('out','day'),lang('Dayview'));1977 print $this->printer_friendly($p->fp('out','day'),lang('Dayview')); 1925 1978 $GLOBALS['phpgw']->common->phpgw_footer(); 1926 1979 } … … 2042 2095 $notify_message = lang('This commitment has already been accepted!'); 2043 2096 } 2044 else 2097 else if($_GET['response'] == 2) 2045 2098 { 2046 2099 if(!$duplicated_action) … … 2048 2101 else 2049 2102 $notify_message = lang('This commitment has already been rejected!'); 2103 } 2104 else if($_GET['response'] == 3) 2105 { 2106 if(!$duplicated_action) 2107 $notify_message = lang('The commitment was tentatived successfully!'); 2108 else 2109 $notify_message = lang('This commitment has already been tentatived!'); 2050 2110 } 2051 2111 … … 2057 2117 $tmpbody1 = $body1->pfp('out','list'); 2058 2118 } 2059 2060 function confirm_conflict($user_id,$event,$overlapping_events)2061 {2062 if(!$overlapping_events){2063 $notify_message = lang('This event conflicts with your other event.');2064 2065 $action_ignore = $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 3, 'response' => 1,'user_id' => $user_id, 'ignore_conflict' => 1));2066 $action_reject = $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 0, 'response' => 0));2067 2068 $body1 = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);2069 $body1->set_file(Array('calendar' => 'conflict.tpl'));2070 $body1->set_block('calendar','list');2071 $var = Array( 'notify_message' => $notify_message,2072 'action_url' => $action_url,2073 'ignore_conflict' => 'Ignorar Conflito',2074 'reject_event' => 'Rejeitar Evento',2075 'action_reject' => $action_reject,2076 'action_ignore' => $action_ignore);2077 $body1->set_var($var);2078 $tmpbody1 = $body1->pfp('out','list');2079 }2080 else2081 {2082 $month = $event['start']['month'];2083 $mday = $event['start']['mday'];2084 $year = $event['start']['year'];2085 2086 $start = mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$mday,$year) - $GLOBALS['phpgw']->datetime->tz_offset;2087 $end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;2088 2089 $overlap = '';2090 for($i=0;$i<count($overlapping_events);$i++)2091 {2092 $overlapped_event = $this->bo->read_entry($overlapping_events[$i],True);2093 foreach($overlapped_event['participants'] as $id => $status)2094 {2095 $conflict = isset($event['participants'][$user_id]);2096 $overlap .= '<li>'.($conflict?'<b>':'').2097 $GLOBALS['phpgw']->common->grab_owner_name($id).2098 ($conflict?'</b> - '.lang('Scheduling conflict'):'')."</li>";2099 }2100 if ($this->bo->prefs['calendar']['hide_event_conflict'])2101 $overlap .= '<ul><font size="1"><span>'.2102 $this->normDec($overlapped_event['start']['hour']).":".2103 $this->normDec($overlapped_event['start']['min'])."-".2104 $this->normDec($overlapped_event['end']['hour']).":".2105 $this->normDec($overlapped_event['end']['min']).2106 '<br><b>'.lang('title').": ".lang("Hidden").2107 '</b><br>'.lang('description').": ".lang("Hidden").'<br></span></ul><br>';2108 else2109 $overlap .= '<ul>'.$this->link_to_entry($overlapped_event,$month,$mday,$year)."</ul><br>";2110 }2111 2112 unset($GLOBALS['phpgw_info']['flags']['noheader']);2113 unset($GLOBALS['phpgw_info']['flags']['nonavbar']);2114 $GLOBALS['phpgw_info']['flags']['noappheader'] = True;2115 $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;2116 $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Scheduling Conflict');2117 $GLOBALS['phpgw']->common->phpgw_header();2118 2119 $p = $GLOBALS['phpgw']->template;2120 $p->set_file(2121 Array(2122 'overlap' => 'overlap.tpl',2123 'form_button' => 'form_button_script.tpl'2124 )2125 );2126 2127 $var = Array(2128 'color' => $this->theme['bg_text'],2129 'overlap_title' => lang('Scheduling Conflict'),2130 'overlap_text' => lang('Your suggested time of <B> %1 - %2 </B> conflicts with the following existing calendar entries:',$GLOBALS['phpgw']->common->show_date($start),$GLOBALS['phpgw']->common->show_date($end)),2131 'overlap_list' => $overlap2132 );2133 $p->set_var($var);2134 2135 $date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->mday);2136 $var = Array(2137 'action_url_button' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 3, 'user_id' => $user_id, 'ignore_conflict' => 1)),2138 'action_text_button' => lang('Ignore Conflict'),2139 'action_confirm_button' => '',2140 'action_extra_field' => '',2141 'button_id' => 'ignore_button'2142 );2143 $action_reject = $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 0, 'response' => 0));2144 2145 $this->output_template_array($p,'resubmit_button','form_button',$var);2146 2147 $var = Array(2148 'action_url_button' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 0)),2149 'action_text_button' => lang('Reject'),2150 'action_confirm_button' => '',2151 'action_extra_field' => '',2152 'button_id' => 'redit_button'2153 );2154 $this->output_template_array($p,'reedit_button','form_button',$var);2155 $p->pparse('out','overlap');2156 }2157 }2158 2159 2119 function set_action() 2160 2120 { … … 2165 2125 } 2166 2126 2167 $overlapping_events = false; 2168 $event = $this->bo->read_entry((int)$_GET['cal_id']); 2169 if((!$_GET['response'] == 0 && !$_GET['ignore_conflict'] == 1) || 2170 (!isset($_GET['response']) && $_GET['action'] == 3 && !$_GET['ignore_conflict'] == 1)) 2171 { 2172 if($event['id']) 2173 { 2174 $event_ids[] = $event['id']; 2175 } 2176 if($event['reference']) 2177 { 2178 $event_ids[] = $event['reference']; 2179 } 2180 2181 $event['participants'] = Array($_SESSION['phpgw_info']['expressomail']['user']['account_id'] => $event['participants'][$_SESSION['phpgw_info']['expressomail']['user']['account_id']]); 2182 2183 $overlapping_events = $this->bo->overlap( 2184 $this->bo->maketime($event['start']), 2185 $this->bo->maketime($event['end']), 2186 $event['participants'], 2187 $event['owner'], 2188 $event_ids 2189 ); 2190 } 2127 $confirm_status = $this->bo->set_status((int)$_GET['cal_id'],(int)$_GET['action'],(int)$_GET['user']); 2191 2128 2192 2129 if(isset($_GET['response'])) 2193 2130 { 2194 if($overlapping_events)2195 {2196 $this->confirm_conflict($_GET['user_id'],$event);2197 }else2198 {2199 $confirm_status = $this->bo->set_status((int)$_GET['cal_id'],(int)$_GET['action']);2200 2131 $this->confirm_action($confirm_status); 2201 2132 $GLOBALS['phpgw']->common->phpgw_exit(False); 2202 2133 } 2203 }else 2204 { 2205 if($overlapping_events) 2206 { 2207 $this->confirm_conflict($_GET['user_id'],$event,$overlapping_events); 2208 }else 2209 { 2210 $confirm_status = $this->bo->set_status((int)$_GET['cal_id'],(int)$_GET['action']); 2134 else 2135 { 2211 2136 if ($this->bo->return_to) 2212 2137 { … … 2219 2144 $GLOBALS['phpgw']->common->phpgw_exit(); 2220 2145 } 2221 }2222 2223 2146 2224 2147 } … … 2293 2216 if ($this->always_app_header) $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Group Planner'); 2294 2217 $GLOBALS['phpgw']->common->phpgw_header(); 2218 $this->header(); 2295 2219 } 2296 2220 … … 2564 2488 if (!$is_private) 2565 2489 { 2566 $opt .= ' title="'.lang('Title').": ".$event['title'] ;2490 $opt .= ' title="'.lang('Title').": ".$event['title']." | "; 2567 2491 if ($event['description']) 2568 2492 { 2569 $opt .= "\n".lang('Description').": ".$event['description'] ;2493 $opt .= "\n".lang('Description').": ".$event['description']." | "; 2570 2494 } 2571 2495 } … … 2577 2501 $start = $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset); 2578 2502 $end = $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset); 2579 $opt .= "\n".lang('Start Date/Time').": ".$start." \n".lang('End Date/Time').": ".$end;2503 $opt .= "\n".lang('Start Date/Time').": ".$start." | ".lang('End Date/Time').": ".$end." | "; 2580 2504 2581 2505 if ($event['location'] && !$is_private) … … 3053 2977 } 3054 2978 } 3055 $GLOBALS['phpgw']->redirect_link('/index.php',$vars); 2979 2980 unset($GLOBALS['phpgw_info']['flags']['noheader']); 2981 unset($GLOBALS['phpgw_info']['flags']['nonavbar']); 2982 $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Search Results'); 2983 $GLOBALS['phpgw']->common->phpgw_header(); 2984 2985 echo '<b>'.lang('Error').':</b>'.lang('no matches found'); 2986 return; 2987 //$GLOBALS['phpgw']->redirect_link('/index.php',$vars); 3056 2988 } 3057 2989 … … 3252 3184 'footer' => 'footer.tpl', 3253 3185 'form_button' => 'form_button_script.tpl' 3254 //'new_component' => 'new_component.tpl'3255 3186 ) 3256 3187 ); … … 3294 3225 $str_ini .= '<option value="'.$i.'"'.($i == $day?' selected':'').'>'.$i.'</option>'."\n"; 3295 3226 } 3296 $str_qtd = '<option value="'.''.'"'.( !$_POST['qtd_dias']?' selected':'').'>'.''.'</option>'."\n";3227 $str_qtd = '<option value="'.''.'"'.($i == $_POST['qtd_dias']?' selected':'').'>'.''.'</option>'."\n"; 3297 3228 for ($i = 1; $i <= 45; $i++) 3298 3229 { … … 3301 3232 $display = ''; 3302 3233 $display_view = ''; 3303 // if ($menuaction == 'calendar.uicalendar.month') 3304 // { 3305 // $accounts = CreateObject('phpgwapi.accounts'); 3306 // $accountId = $accounts->name2id($account_name); 3307 // $prefs = CreateObject('phpgwapi.preferences', $accountId); 3308 // $account_prefs = $prefs->read(); 3309 // } 3310 if ( ($menuaction == 'calendar.uicalendar.week') || ($menuaction == 'calendar.uicalendar.day') || ($menuaction == 'calendar.uicalendar.year') || ($menuaction == 'calendar.uicalendar.planner')) 3234 if ( ($menuaction == 'calendar.uicalendar.week') || ($menuaction == 'calendar.uicalendar.day') ) 3311 3235 { 3312 3236 $display = 'none'; … … 3321 3245 'formname' => 'SelectDay', 3322 3246 'formonchange' => 'document.SelectDay.submit()', 3323 'day_ini_label' => lang('print start day'),3247 'day_ini_label' => lang('print starting in'), 3324 3248 'num_dias_label' => lang('quantity of days'), 3325 'tip' => lang('empty prints from the start day chosento the end of the current month'),3326 //'day_ini_name' => 'day',3327 //'num_dias_name' => 'qtd_dias',3249 'tip' => lang('empty prints from the day chosen below to the end of the current month'), 3250 'day_ini_name' => 'day', 3251 'num_dias_name' => 'qtd_dias', 3328 3252 'row_ini' => $str_ini, 3329 3253 'row_qtd' => $str_qtd, … … 3360 3284 'form_onchange' => 'document.SelectMonth.submit()', 3361 3285 'row' => $str, 3362 //'dia_ini' => $dia_ini,3286 'dia_ini' => $dia_ini, 3363 3287 'go' => lang('Go!') 3364 3288 ); … … 3464 3388 $this->output_template_array($p,'b_row2','form_button',$var); 3465 3389 3466 //$p->set_var('place_component','');3467 3390 $p->parse('table_row','blank_row',True); 3391 3468 3392 $p->pparse('out','footer_table'); 3469 3393 unset($p); … … 3522 3446 $viewable = !$this->bo->printer_friendly && $this->bo->check_perms(PHPGW_ACL_READ,$event); 3523 3447 3448 if(!$viewable && $event['type'] == 'E' && !$event['public']){ 3449 return ""; 3450 } 3451 3524 3452 $starttime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; 3525 3453 $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; … … 3546 3474 } 3547 3475 3548 if($endtime >= ($rawdate_offset + 86400)) 3549 { 3550 $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat); 3551 } 3552 else 3553 { 3476 3477 // if($endtime >= ($rawdate_offset + 86400 )) 3478 // { 3479 // $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat); 3480 // } 3481 // else 3482 // { 3554 3483 $end_time = $GLOBALS['phpgw']->common->show_date($endtime,$this->bo->users_timeformat); 3555 }3484 // } 3556 3485 $time = $start_time.'-'.$end_time; 3557 3486 } … … 3582 3511 $texttime=$time; 3583 3512 $texttitle=$this->bo->get_short_field($event,$is_private,'title'); 3584 3585 $account_name = $_POST['user'] ? 3586 $_POST['user'] : 3587 ($_GET['account_name'] ? 3588 $_GET['account_name'] : ''); 3589 3590 $accounts = CreateObject('phpgwapi.accounts'); 3591 $accountId = $accounts->name2id($account_name); 3592 3593 $prefs = CreateObject('phpgwapi.preferences', $accountId); 3594 $account_prefs = $prefs->read(); 3595 3596 $titleView = $account_prefs['calendar']['title_view']; 3597 if($titleView == "1") 3598 { 3599 $textdesc = ''; 3600 } 3601 else 3602 { 3603 $textdesc = (!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 3604 $textdesc=nl2br($textdesc); 3605 } 3606 3513 $textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 3607 3514 // added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set 3608 $textlocation= $event['location']?"<br/><b>Local:</b> ".$this->bo->get_short_field($event,$is_private,'location'):'';3515 $textlocation=$this->bo->get_short_field($event,$is_private,'location'); 3609 3516 3610 3517 if ($viewable) … … 3658 3565 } 3659 3566 else 3660 { if ($texttitle)3567 { 3661 3568 $picture[] = Array( 3662 3569 'pict' => $GLOBALS['phpgw']->common->image('calendar','single'), … … 3690 3597 } 3691 3598 } 3692 3693 if($event['attachment'] != '')3694 {3695 $picture[] = Array(3696 'pict' => $GLOBALS['phpgw']->common->image('calendar','clip'),3697 'width' => 9,3698 'height'=> 9,3699 'title' => lang('Notification with attachments sent.')3700 );3701 }3702 3599 3703 3600 $description = $this->bo->get_short_field($event,$is_private,'description'); … … 3712 3609 $this->output_template_array($this->link_tpl,'picture','pict',$var); 3713 3610 } 3714 if ($ event['type'] == 'H' || $texttitle)3611 if ($texttitle) 3715 3612 { 3716 3613 $var = Array( … … 3720 3617 'users_status'=>$textstatus, 3721 3618 'desc'=> $textdesc, 3722 'location'=> $textlocation3619 'location'=> "<br><b>Local:</b> ".$textlocation 3723 3620 ); 3724 3621 $this->output_template_array($this->link_tpl,'picture','link_text',$var); … … 3785 3682 } 3786 3683 3787 $textTitlePrint = $textTimePrint = $textDescPrint = $textLocationPrint = $textObservationsPrint = $textstatus = ''; 3684 $texttitle = $texttime = $textdesc = $textlocation = $textstatus = ''; 3685 3686 3788 3687 3789 3688 if(!$is_private) 3790 3689 { 3690 //$text .= $this->bo->display_status($event['users_status']); 3691 3791 3692 // split text for better display by templates, also see $texttime $texttitle $textdesc $textlocation 3792 3693 $textstatus=$this->bo->display_status($event['users_status']); … … 3794 3695 } 3795 3696 3796 $account_name = $_POST['user'] ? 3797 $_POST['user'] : 3798 ($_GET['account_name'] ? 3799 $_GET['account_name'] : ''); 3800 3801 $accounts = CreateObject('phpgwapi.accounts'); 3802 $accountId = $accounts->name2id($account_name); 3803 3804 $prefs = CreateObject('phpgwapi.preferences', $accountId); 3805 $account_prefs = $prefs->read(); 3806 3807 3808 $textTimePrint = $time; 3809 $textTitlePrint = $is_private ? lang('Private event. You are not allowed to print it.') : ( $event['type'] == 'H' ? 'Apontamento de horas' : $this->bo->get_short_field($event,$is_private,'title' ) ); 3810 3811 $fieldsToPrint = $account_prefs['calendar']['fields_to_print']; 3812 if($fieldsToPrint == "0") 3813 { 3814 $textDescPrint = ''; 3815 } 3816 elseif($fieldsToPrint == "1") 3817 { 3818 $textDescPrint = (!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 3819 } 3820 else 3821 { 3822 $textDescPrint = (!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 3823 $textObservationsPrint = $event['observations']?"<br /><b>Observações:</b> ".$this->bo->get_short_field($event,$is_private,'observations'):''; 3824 } 3825 3697 $text = '<nobr> '.$time.' </nobr> '.$this->bo->get_short_field($event,$is_private,'title').$text. 3698 3699 $texttime=$time; 3700 $texttitle=$this->bo->get_short_field($event,$is_private,'title'); 3701 $textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 3826 3702 // added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set 3827 $text LocationPrint = $event['location']?"<br /><b>Local:</b> ".$this->bo->get_short_field($event,$is_private,'location'):'';3703 $textlocation=$this->bo->get_short_field($event,$is_private,'location'); 3828 3704 3829 3705 if ($viewable) … … 3832 3708 $this->event_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date)); 3833 3709 $this->event_tpl->set_var('lang_view',lang('View this entry')); 3834 $this->event_tpl->set_var('desc', $textDescPrint); 3835 $this->event_tpl->set_var('location', $textLocationPrint); 3836 $this->event_tpl->set_var('observations', $textObservationsPrint); 3710 $this->event_tpl->set_var('desc', $textdesc); 3711 $this->event_tpl->set_var('location', $textlocation); 3837 3712 $this->event_tpl->parse('picture','link_event_open',True); 3838 3713 } 3839 3840 3714 if (!$is_private) 3841 3715 { … … 3925 3799 $this->output_template_array($this->event_tpl,'picture','event_pict',$var); 3926 3800 } 3927 3928 if ($textTitlePrint) 3801 if ($texttitle) 3929 3802 { 3930 3803 $var = Array( 3931 3804 // 'text' => $text, 3932 'time'=> $text TimePrint,3933 'title'=> $text TitlePrint,3805 'time'=> $texttime, 3806 'title'=> $texttitle, 3934 3807 'users_status'=>$textstatus, 3935 'desc'=> $textDescPrint, 3936 'location'=> $textLocationPrint, 3937 'observations'=> $textObservationsPrint 3808 'desc'=> $textdesc, 3809 'location'=> "<br><b>Local:</b> ".$textlocation 3938 3810 ); 3939 3811 $this->output_template_array($this->event_tpl,'picture','link_event_text',$var); … … 3967 3839 { 3968 3840 $overlapping_events = $params['o_events']; 3841 3842 if( is_string( $overlapping_events )) 3843 $overlapping_events = explode( ';', $overlapping_events ); 3844 3969 3845 $event = $params['this_event']; 3846 3847 if( is_string( $event ) ) 3848 $event = $this->bo->read_entry( $event ); 3849 3850 if( !$event ) 3851 $event = $this->bo->restore_from_appsession(); 3970 3852 } 3971 3853 … … 3986 3868 $overlap .= '<li>'.($conflict?'<b>':''). 3987 3869 $GLOBALS['phpgw']->common->grab_owner_name($id). 3988 ($conflict?'</b> - '.lang('Scheduling conflict'):''). "</li>";3870 ($conflict?'</b> - '.lang('Scheduling conflict'):'').'</li>'; 3989 3871 } 3990 3872 if ($this->bo->prefs['calendar']['hide_event_conflict']) … … 3997 3879 '</b><br>'.lang('description').": ".lang("Hidden").'<br></span></ul><br>'; 3998 3880 else 3999 $overlap .= '<ul>'.$this->link_to_entry($overlapped_event,$month,$mday,$year). "</ul><br>";3881 $overlap .= '<ul>'.$this->link_to_entry($overlapped_event,$month,$mday,$year).'"</ul><br>'; 4000 3882 } 4001 3883 … … 4007 3889 $GLOBALS['phpgw']->common->phpgw_header(); 4008 3890 3891 $porig = $GLOBALS['phpgw']->template; 3892 3893 $GLOBALS['phpgw']->template->root = $_SESSION['rootPath'].'/calendar/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/'; 3894 4009 3895 $p = $GLOBALS['phpgw']->template; 4010 3896 $p->set_file( … … 4024 3910 4025 3911 $date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->mday); 3912 3913 $var = Array( 3914 'action_url_button' => $GLOBALS['phpgw']->link('/index.php',array('menuaction' => 'calendar.uicalendar.index')), 3915 'action_text_button' => lang('Cancel'), 3916 'action_confirm_button' => '', 3917 'action_extra_field' => '', 3918 'button_id' => 'cancel_button' 3919 ); 3920 $this->output_template_array($p,'cancel_button','form_button',$var); 3921 4026 3922 $var = Array( 4027 3923 'action_url_button' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update','readsess'=>1)), … … 4033 3929 $this->output_template_array($p,'resubmit_button','form_button',$var); 4034 3930 3931 if( $event['owner'] == -2 || $event['id'] != 0 ) 3932 { 3933 $p->set_var( 'suggestion', $this->build_suggestion( $event , $params['this_account']) ); 3934 3935 $var = Array( 3936 'action_url_button' => '', 3937 'action_text_button' => lang('Suggest new hour'), 3938 'action_confirm_button' => 'onsubmit="javascript: return false;" onclick="javascript: return show_suggestion();"', 3939 'action_extra_field' => '', 3940 'button_id' => 'redit_button' 3941 ); 3942 } 3943 else 3944 { 3945 $p->set_var( 'suggestion', '' ); 3946 4035 3947 $var = Array( 4036 3948 'action_url_button' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.edit','readsess'=>1,'date'=>$date)), … … 4040 3952 'button_id' => 'redit_button' 4041 3953 ); 3954 } 4042 3955 $this->output_template_array($p,'reedit_button','form_button',$var); 4043 3956 $p->pparse('out','overlap'); 3957 //return 'OLA'; 4044 3958 } 4045 3959 … … 4357 4271 $month = (int)substr($date,4,2); 4358 4272 $day = (int)substr($date,6,2); 4359 4273 $var = Array( 4274 'column_data' => '', 4275 'extra' => '' 4276 ); 4360 4277 $p->set_var($var); 4361 4278 if ($weekly || ($date >= $monthstart && $date <= $monthend)) … … 4366 4283 $id_aux = mktime(0,0,0,$month,$day,$year); 4367 4284 $month_identifier = substr(lang(strftime("%B",$id_aux)),0,3); 4368 $day_number = $ dia_semana . ", " . $day_num;4285 $day_number = $month_identifier . " - " . $dia_semana . ", " . $day_num; 4369 4286 4370 4287 $var = Array( 4371 4288 'extra' => $day_params['extra'], 4372 4289 'new_event_link'=> $new_event_link, 4373 'day_number' => (isset($_GET['num_dias']) && ($_GET['num_dias'] > 1 || $_GET['num_dias'] == "")?$day_number:'')4290 'day_number' => $day_number 4374 4291 ); 4375 4292 … … 4383 4300 ); 4384 4301 $p->set_var($var); 4385 $eventsCached = $this->bo->cached_events[$date]; 4386 4387 if($_GET['d'] == '1') 4388 { 4389 4390 for($i_events = 0; $i_events < count($eventsCached) ; $i_events++) 4302 $events = $this->bo->cached_events[$date]; 4303 foreach($events as $event) 4391 4304 { 4392 if ($eventsCached[$i_events]['users_status'] == 'R') 4393 { 4394 continue; // user does not want to see rejected events 4395 } 4396 $events[] = $eventsCached[$i_events]; 4397 } 4398 /*echo "<pre>"; 4399 print_r($events1); 4400 4401 echo "</pre>"; 4402 exit();*/ 4403 4404 $newEvents = Array(); 4405 $eventAux = Array 4406 ( 4407 'owner' => '', 4408 'id' => '', 4409 'type' => '', 4410 'public' => '', 4411 'category' => '', 4412 'title' => '', 4413 'description' => '', 4414 'alter_by' => '', 4415 'observations' => '', 4416 'attachment' => '', 4417 'ex_participants' => '', 4418 'uid' => '', 4419 'location' => '', 4420 'reference' => '', 4421 'start' => Array 4422 ( 4423 'year' => '', 4424 'month' => '', 4425 'mday' => '', 4426 'hour' => '', 4427 'min' => '', 4428 'sec' => '', 4429 'alarm' => '', 4430 ), 4431 4432 'modtime' => Array 4433 ( 4434 ), 4435 4436 'end' => Array 4437 ( 4438 'year' => '', 4439 'month' => '', 4440 'mday' => '', 4441 'hour' => '', 4442 'min' => '', 4443 'sec' => '', 4444 'alarm' => '', 4445 ), 4446 4447 'priority' => '', 4448 'users_status' => '', 4449 'participants' => Array 4450 ( 4451 ), 4452 4453 'alarm' => Array 4454 ( 4455 ), 4456 4457 ); 4458 4459 $delta = 60; //em segundos 4460 for($i_events = 0; $i_events < count($events) ; $i_events++) 4461 { 4462 4463 $newEvents[] = $events[$i_events]; 4464 4465 $hf_current = mktime($events[$i_events]['end']['hour'], 0, 0, $month, $day, $year); 4466 $hi_prox = mktime($events[$i_events+1]['start']['hour'], 0, 0, $month, $day, $year); 4467 4468 if($events[$i_events]['end']['min'] > 0) 4469 { 4470 $hf_current += 60*$delta; 4471 } 4472 4473 while($hi_prox > $hf_current) 4474 { 4475 4476 $aux1 = date('Y:m:d:H:i:s',$hf_current); 4477 $aux2 = explode(':',$aux1); 4478 $eventAux['start']['year'] = $aux2[0]; 4479 $eventAux['start']['month'] = $aux2[1]; 4480 $eventAux['start']['mday'] = $aux2[2]; 4481 $eventAux['start']['hour'] = $aux2[3]; 4482 $eventAux['start']['min'] = $aux2[4]; 4483 $eventAux['start']['sec'] = $aux2[5]; 4484 4485 //$aux3 = date('Y:m:d:H:i:s',$hf_current); 4486 //$aux4 = explode(':',$aux3); 4487 $eventAux['end']['year'] = $aux2[0]; 4488 $eventAux['end']['month'] = $aux2[1]; 4489 $eventAux['end']['mday'] = $aux2[2]; 4490 $eventAux['end']['hour'] = $aux2[3]; 4491 $eventAux['end']['min'] = $aux2[4]; 4492 $eventAux['end']['sec'] = $aux2[5]; 4493 4494 $eventAux['owner'] = $GLOBALS['phpgw_info']['user']['account_id']; 4495 $eventAux['title'] = "\n\n\n"; 4496 $eventAux['description'] = ''; 4497 $eventAux['observations'] = ''; 4498 $eventAux['location'] = ''; 4499 4500 $newEvents[] = $eventAux; 4501 $hf_current += 60*$delta; 4502 4503 } 4504 } 4505 4506 foreach($newEvents as $event) 4507 { 4508 $p->set_var('day_events',$this->link_to_month_entry($event,$month,$day,$year)); 4509 $p->parse('events','event',True); 4510 $p->set_var('day_events',''); 4511 } 4512 } 4513 else 4514 { 4515 foreach($eventsCached as $event) 4516 { 4517 if ($this->bo->rejected_no_show($event) || $event['users_status'] == 'R') 4305 if ($this->bo->rejected_no_show($event)) 4518 4306 { 4519 4307 continue; // user does not want to see rejected events … … 4522 4310 $p->parse('events','event',True); 4523 4311 $p->set_var('day_events',''); 4524 }4525 4312 } 4526 4527 /*echo "<pre>";4528 print_r($newEvents);4529 4530 echo "</pre>";4531 exit();*/4532 4313 } 4533 4314 $p->parse('daily_events','day_event',True); … … 4552 4333 } 4553 4334 4335 /* $this->bo->store_to_cache( 4336 Array( 4337 'syear' => $year, 4338 'smonth'=> $month, 4339 'sday' => 1 4340 ) 4341 ); 4342 */ 4554 4343 $day_ini = $_GET['day_ini'];// dia do inicio da impressao; o padrao e o dia atual; 4555 4344 $num_dias = $_GET['num_dias'];// quantidade de dias a partir do dia inicial; … … 4558 4347 // $monthend = (int)(date('Ymd',mktime(0,0,0,$month + 1,0,$year))); 4559 4348 4560 if($num_dias != '')4349 if($num_dias != 0) 4561 4350 { 4562 4351 //se a qtde de dias for informada, a data final para impressao considera a soma $day_ini+$num_dias; … … 4609 4398 4610 4399 $var = Array( 4611 'cols' => 1 4612 //'day_events'=> '' 4613 ); 4400 'cols' => 1, 4401 'day_events'=> '' //$this->month_week_header($month,$year,False) 4402 ); 4403 // $this->output_template_array($p,'row','event',$var); 4614 4404 4615 4405 $cellcolor = $this->theme['row_on']; … … 4629 4419 /***************************************************************************************/ 4630 4420 4631 function display_month($params) //($month,$year,$showyear,$owner=0) 4632 { 4633 $month = $params['month']; 4634 $year = $params['year']; 4635 $showyear = $params['showyear']; 4636 $owner = $params['owner']; 4637 4421 function display_month($month,$year,$showyear,$owner=0) 4422 { 4638 4423 if($this->debug) 4639 4424 { … … 4678 4463 4679 4464 $cellcolor = $this->theme['row_on']; 4680 4681 $result_events_json = $this->print_events_to_show_json($params);4682 $p->set_var('date','Date(2011,1,1)');4683 $p->set_var('hora_final',$result_events_json['hora_final']);4684 $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null');4685 4686 4465 4687 4466 for($i = (int)($start + $GLOBALS['phpgw']->datetime->tz_offset);(int)(date('Ymd',$i)) <= $monthend;$i += 604800) … … 4789 4568 $p->set_block('view','hr','hr'); 4790 4569 4570 include_once($_SESSION['rootPath'].'/calendar/inc/class.ex_participants.inc.php'); 4571 $langp = array(); 4572 $langp['ACCEPTED'] = lang('Accepted'); 4573 $langp['DECLINED'] = lang('Declined'); 4574 $langp['TENTATIVE'] = lang('Tentative'); 4575 $langp['DELEGATED'] = lang('Delegated'); 4576 $langp['NO ANSWER'] = lang('No answer'); 4577 $exParticipants = new exParticipants($langp); 4578 $exParticipants->setParticipantsBySerializable($event['ex_participants']); 4579 $event['ex_participants'] = $exParticipants->getParticipantsView(); 4580 4791 4581 $vars = $this->bo->event2array($event); 4792 4793 if($vars['attachment']['data'] == "")4794 $vars['attachment']['data'] = lang('No Attachment');4795 else{4796 $vars['attachment']['data'] = lang('Has attachment(s)');4797 }4798 4582 4799 4583 $vars['title']['tr_color'] = $this->theme['th_bg']; … … 4804 4588 { 4805 4589 $vars['participants']['data'][$user] = $parts[1].' (<a href="'.$this->page('edit_status','&cal_id='.$event['id'].'&owner='.$user).'">'.$parts[2].'</a>)'; 4806 $vars['participants']['data'][$user].=' (<a href=\'index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event='.$event['id'].'&delegator='.$user.'&date='.$_REQUEST["date"].'&eventArray='.$event.'\'>'.lang("Delegate event").'</a>)';4807 //system('echo "event: '.$event['start'].'" >>/tmp/controle');4808 4590 } 4809 4591 } … … 5051 4833 return $p->fp('out','day'); 5052 4834 } // end function 5053 5054 //função para exibição do calendário novo.5055 5056 function print_day_new($params){5057 $this->bo->store_to_cache(5058 Array(5059 'syear' => $params['year'],5060 'smonth' => $params['month'],5061 'sday' => $params['day'],5062 'eyear' => $params['year'],5063 'emonth' => $params['month'],5064 'eday' => $params['day']5065 )5066 );5067 5068 $p = CreateObject('phpgwapi.Template',$this->template_dir);5069 $p->set_unknowns('keep');5070 5071 $tpl = 'day_cal.tpl';5072 //$new_component_tpl = 'new_component.tpl';5073 5074 if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 &&5075 $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home')5076 {5077 $tpl = 'day_list.tpl';5078 }5079 5080 $templates = Array(5081 'day_cal' => $tpl5082 //'new_component_tpl' => $new_component_tpl5083 );5084 5085 $templateSet = $GLOBALS['phpgw_info']['server']['template_set'];5086 5087 if(isset($_GET['date']))5088 {5089 $dia = substr($_GET['date'],-2);5090 }5091 elseif(isset($_POST['day']))5092 {5093 $dia = $_POST['day'];5094 }5095 else5096 {5097 $dia = $params['day'];5098 }5099 5100 $print = '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>';5101 $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$dia.'&num_dias=1'.'&d=1';5102 5103 $p->set_file($templates);5104 $p->set_block('day_cal','day','day');5105 //$p->set_block('new_component_tpl','new_component','new_component');5106 $params['period'] = 1;5107 $result_events_json = $this->print_events_to_show_json($params);5108 $p->set_var('date',$result_events_json['date_events_json']);5109 $p->set_var('templateSet',$templateSet);5110 $p->set_var('iprint',$print);5111 $p->set_var('param',$param);5112 $p->set_var('hora_final',$result_events_json['hora_final']);5113 $p->set_var('hora_inicial',$result_events_json['hora_inicial']);5114 $p->set_var('hour_size_px',$result_events_json['hour_size_px']);5115 5116 $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null');5117 return $p->fp('out','day');5118 }5119 5120 function print_week_new($params){5121 5122 $p = CreateObject('phpgwapi.Template',$this->template_dir);5123 $p->set_unknowns('keep');5124 5125 $tpl = 'new_week.tpl';5126 5127 if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 &&5128 $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home')5129 {5130 $tpl = 'day_list.tpl';5131 }5132 5133 $minical_prev = $this->mini_calendar(5134 Array(5135 'day' => 1,5136 'month' => $this->bo->month,5137 'year' => $this->bo->year,5138 'link' => 'week',5139 'control' => False,5140 'outside_month' => False5141 )5142 );5143 5144 $minical_next1 = $this->mini_calendar(5145 Array(5146 'day' => 1,5147 'month' => $this->bo->month+2,5148 'year' => $this->bo->year,5149 'link' => 'week',5150 'control' => False,5151 'outside_month' => False5152 )5153 );5154 5155 $minical_next = $this->mini_calendar(5156 Array(5157 'day' => 1,5158 'month' => $this->bo->month+1,5159 'year' => $this->bo->year,5160 'link' => 'week',5161 'control' => False,5162 'outside_month' => False5163 )5164 );5165 $this->bo->read_holidays($params['year']);5166 $next = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day + 7,$this->bo->year);5167 $prev = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day - 7,$this->bo->year);5168 $prev_week_link = '<a href="'.$this->page('week','&date='.$prev['full']).'"><<</a>';5169 $next_week_link = '<a href="'.$this->page('week','&date='.$next['full']).'">>></a>';5170 5171 $daily = $this->set_week_array($GLOBALS['phpgw']->datetime->get_weekday_start($params['year'],$params['month'],$params['day']),$this->theme['row_on'],True);5172 foreach($daily as $key => $value)5173 {5174 $dates[] = $key;5175 }5176 5177 $day_ini = (int)substr($dates[0],6,2);5178 5179 $print = '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>';5180 5181 $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$day_ini.'&num_dias=7';5182 5183 $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year);5184 5185 $templates = Array(5186 'new_week' => $tpl,5187 );5188 $feriados_do_ano = Array();5189 foreach ($this->bo->cached_holidays as $key => $value)5190 {5191 $feriados_do_ano[$key] = utf8_encode($this->bo->cached_holidays[$key][0]['name']);5192 }5193 $p->set_file($templates);5194 $p->set_block('new_week','day','day');5195 $params['period'] = 2;5196 $result_events_json = $this->print_events_to_show_json($params);5197 $p->set_var('date',$result_events_json['date_events_json']);5198 $p->set_var('hora_final',$result_events_json['hora_final']);5199 $p->set_var('hora_inicial',$result_events_json['hora_inicial']);5200 $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1);5201 $p->set_var('iprint',$print);5202 $p->set_var('param',$param);5203 $p->set_var('title',$prev_week_link.' ::'.$this->bo->get_week_label().':: '.$next_week_link);5204 $p->set_var('user',$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner));5205 $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null');5206 $p->set_var('holidays_json',json_encode($feriados_do_ano)?json_encode($feriados_do_ano):null);5207 return $p->fp('out','day');5208 5209 }5210 5211 function print_month_new($params){5212 5213 $p = CreateObject('phpgwapi.Template',$this->template_dir);5214 $p->set_unknowns('keep');5215 $tpl = 'new_month.tpl';5216 5217 if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 &&5218 $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home')5219 {5220 $tpl = 'day_list.tpl';5221 }5222 5223 5224 5225 $templates = Array(5226 'new_month' => $tpl,5227 );5228 5229 $minical_prev = $this->mini_calendar(5230 Array(5231 'day' => 1,5232 'month' => $this->bo->month -1,5233 'year' => $this->bo->year,5234 'link' => 'day',5235 'control' => False,5236 'outside_month' => False5237 )5238 );5239 5240 $minical_next1 = $this->mini_calendar(5241 Array(5242 'day' => 1,5243 'month' => $this->bo->month + 2,5244 'year' => $this->bo->year,5245 'link' => 'day',5246 'control' => False,5247 'outside_month' => False5248 )5249 );5250 5251 $minical_next = $this->mini_calendar(5252 Array(5253 'day' => 1,5254 'month' => $this->bo->month + 1,5255 'year' => $this->bo->year,5256 'link' => 'day',5257 'control' => False,5258 'outside_month' => False5259 )5260 );5261 $this->bo->read_holidays($params['year']);5262 $print = '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>';5263 5264 $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1';5265 5266 $next = $this->bo->month + 1;5267 $prev = $this->bo->month - 1;5268 $nextyear = $this->bo->year;5269 $prevyear = $this->bo->year;5270 if ($this->bo->month == 12)5271 {5272 $next = 1;5273 $nextyear = $nextyear + 1;5274 }5275 elseif ($this->bo->month == 1)5276 {5277 $prev = 12;5278 $prevyear = $prevyear - 1;5279 }5280 5281 $feriados_do_ano = Array();5282 foreach ($this->bo->cached_holidays as $key => $value)5283 {5284 $feriados_do_ano[$key] = utf8_encode($this->bo->cached_holidays[$key][0]['name']);5285 }5286 $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year);5287 $p->set_file($templates);5288 $p->set_block('new_month','day','day');5289 $params['period'] = 3;5290 $result_events_json = $this->print_events_to_show_json($params);5291 $prev_month_link = '<a href="'.$this->page('month','&year='.$prevyear.'&month='.$prev.'&sday='.$sday).'"><<</a>';5292 $next_month_link = '<a href="'.$this->page('month','&year='.$nextyear.'&month='.$next.'&sday='.$sday).'">>></a>';5293 $p->set_var('date',$result_events_json['date_events_json']);5294 $p->set_var('hora_final',$result_events_json['hora_final']);5295 $p->set_var('hora_inicial',$result_events_json['hora_inicial']);5296 $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1);5297 $p->set_var('iprint',$print);5298 $p->set_var('param',$param);5299 $p->set_var('title',$prev_month_link." ::".lang(strftime("%B",$m)).' '.$this->bo->year.':: '.$next_month_link);5300 $p->set_var('user',$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner));5301 $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null');5302 $p->set_var('holidays_json',json_encode($feriados_do_ano)?json_encode($feriados_do_ano):null);5303 return $p->fp('out','day');5304 }5305 5306 //função vai devolver os eventos do mês atual para exibição no novo componente da Agenda5307 function print_events_to_show_json($params)5308 {5309 5310 if( (!isset($this->bo->prefs['calendar']['interval'])) || ( (isset($this->bo->prefs['calendar']['interval'])) && ( ($this->bo->prefs['calendar']['interval'] != 42) && ($this->bo->prefs['calendar']['interval'] != 84) ) ) )5311 {5312 $this->bo->prefs['calendar']['interval'] = 42;5313 $GLOBALS['phpgw']->preferences->add('calendar','interval',42);5314 $GLOBALS['phpgw']->preferences->save_repository();5315 }5316 5317 if(!is_array($params))5318 {5319 $this->index();5320 }5321 5322 // $params['period'] pode ser 1 pra dia, 2 pra semana e 3 pra mes5323 5324 if(!$params['period'] || $params['period'] == '')5325 $period = 3;5326 else5327 $period = $params['period'];5328 $accounts = CreateObject('phpgwapi.accounts');5329 $accountId = $accounts->name2id($account_name);5330 $date_to_eval = sprintf("%04d%02d%02d",$params['year'],$params['month'],$params['day']);5331 $dates = array();5332 if($period == 1){5333 $dates[] = $date_to_eval;5334 $this->bo->store_to_cache(5335 Array(5336 'smonth'=> $params['month'],5337 'sday' => $params['day'],5338 'syear' => $params['year']5339 )5340 );5341 }else if($period == 2){5342 $daily = $this->set_week_array($GLOBALS['phpgw']->datetime->get_weekday_start($params['year'],$params['month'],$params['day']),$this->theme['row_on'],True);5343 5344 foreach($daily as $key => $value)5345 $dates[] = $key;5346 5347 $this->bo->store_to_cache(5348 Array(5349 'smonth'=> (int)substr($dates[0],4,2),5350 'sday' => (int)substr($dates[0],6),5351 'syear' => (int)substr($dates[0],0,4),5352 'eyear' => 0,5353 'emonth'=> 0,5354 'eday' => ((int)substr($dates[0],6))+6,5355 )5356 );5357 }else{5358 $month_tmp = substr($date_to_eval, 0, 6);5359 5360 $this->bo->store_to_cache(5361 Array(5362 'smonth'=> (int)substr($date_to_eval,4,2),5363 'sday' => 1,5364 'syear' => (int)substr($date_to_eval,0,4),5365 'eyear' => 0,5366 'emonth'=> 0,5367 'eday' => ((int)substr($date_to_eval,6))+30,5368 )5369 );5370 for( $i=1 ; $i<=31; $i++){5371 if($i<10)5372 $day= $month_tmp."0".(string)$i;5373 else5374 $day=$month_tmp.(string)$i;5375 $dates[] = $day;5376 5377 }5378 5379 }5380 5381 $prefs = CreateObject('phpgwapi.preferences', $accountId);5382 $account_prefs = $prefs->read();5383 //print_debug('in print_day()');5384 5385 $month = (string)((Int)$params['month']-1);5386 $date_events_json = 'Date('.$params['year'].','.$month.','.$params['day'].')';5387 5388 print_debug('Date to Eval',$date_to_eval);5389 5390 $hora_inicial = $account_prefs['calendar']['workdaystarts'];5391 $hora_final = $account_prefs['calendar']['workdayends']; //18;5392 5393 $hour_size_px = $account_prefs['calendar']['interval'] ? $account_prefs['calendar']['interval'] : 42;5394 5395 $title_view = $account_prefs['calendar']['title_view'];5396 5397 $events_to_show_json = array();5398 $templateSet = $GLOBALS['phpgw_info']['server']['template_set'];5399 foreach($dates as $day)5400 {5401 5402 $events = $this->bo->cached_events[$day];5403 5404 foreach($events as $event)5405 {5406 //$is_private = !$event['public'] && !$this->bo->check_perms(PHPGW_ACL_READ,$event);5407 if($event['users_status'] == 'R' && $this->bo->prefs['calendar']['show_rejected'] == 0 && $event['owner'] != $GLOBALS['phpgw_info']['user']['account_id'])5408 continue;5409 5410 if($event['recur_type']){5411 $recur = $day;5412 $event['start']['year'] = (int)substr($day,0,4);5413 $event['start']['month'] = (int)substr($day,4,2);5414 $event['start']['mday'] = (int)substr($day,6,2);5415 $event['end']['year'] = (int)substr($day,0,4);5416 $event['end']['month'] = (int)substr($day,4,2);5417 $event['end']['mday'] = (int)substr($day,6,2);5418 $event['id'] = $event['id'].'rc'.$day;5419 }else{5420 $recur = false;5421 }5422 5423 $isPublic = 1;5424 if(($event['type'] == E && $event['public'] == 0))5425 {5426 $isPublic = 0;5427 $isPublicTitle = lang('restrict');5428 }5429 5430 if(($event['type'] == P && $event['public'] == 0))5431 {5432 $isPublic = 0;5433 $isPublicTitle = lang('private');5434 }5435 5436 $eventTime = ( (mktime($event['end']['hour'], $event['end']['min'], 0, $event['end']['month'], $event['end']['mday'], $event['end']['year'])-mktime($event['start']['hour'], $event['start']['min'], 0, $event['start']['month'], $event['start']['mday'], $event['start']['year']) )/60 );5437 5438 $participants = $this->planner_participants($event['participants']);5439 $intersection = FALSE;5440 5441 foreach($events as $ev)5442 {5443 if($ev['id'] == $event['id']) continue;5444 if($ev['users_status'] == 'R') continue;5445 $event_start = 60*$event['start']['hour']+$event['start']['min'];5446 $event_end = 60*$event['end']['hour']+$event['end']['min'];5447 $event_i_start = 60*$ev['start']['hour']+$ev['start']['min'];5448 $event_i_end = 60*$ev['end']['hour']+$ev['end']['min'];5449 if((($event_start >= $event_i_start) && ($event_start < $event_i_end))||(($event_start < $event_i_start) && ($event_i_start < $event_end)))5450 {5451 $intersection = TRUE;5452 break;5453 }5454 }5455 if($event['users_status'] == 'R')5456 {5457 $rejected = TRUE;5458 }5459 else5460 {5461 $rejected = FALSE;5462 }5463 5464 $evDescription = '';5465 if($title_view == 0)5466 {5467 $evDescription = " - ".$event['description'];5468 }5469 5470 if($_GET['menuaction'] == 'calendar.uicalendar.day')5471 {5472 $text = $event['description'];5473 }5474 elseif($_GET['menuaction'] == 'calendar.uicalendar.week')5475 {5476 5477 $text = ' - '.$event['end']['hour'].':'.$event['end']['min'];5478 5479 //is recurrent?5480 $text .= (isset($recur) && $recur != false) ? ' ' . '<img width="10px" height="10px" border="0" title="'.lang('recurring event').'" src="calendar/templates/'.$templateSet.'/images/recur.png"/>' : '' ;5481 5482 //participants?5483 if(count($event['participants']) > 1)5484 {5485 $text .= " " . '<img width="11px" height="10px" border="0" title="'.$participants.'" src="calendar/templates/'.$templateSet.'/images/multi_3.png"/>';5486 }5487 else5488 {5489 $text .= " " . '<img width="11px" height="10px" border="0" title="'.$participants.'" src="calendar/templates/'.$templateSet.'/images/single.png"/>';5490 }5491 5492 //has attachments?5493 $text .= (isset($event['attachment']) && $event['attachment'] != '') ? ' ' . '<img width="10px" height="10px" border="0" title="'.lang('email notifications with attachments has been sent').'" src="calendar/templates/'.$templateSet.'/images/clip.png"/>' : '' ;5494 5495 //is public?5496 $text .= $isPublic == 0 ? ' ' . '<img width="11px" height="10px" border="0" title="'.$isPublicTitle.'" src="calendar/templates/'.$templateSet.'/images/private.png"/>' : '' ;5497 5498 //has alarm?5499 $text .= (isset($event['alarm']) && count($event['alarm']) >= 1) ? ' ' . '<img width="11px" height="10px" border="0" title="'.lang('alarm').'" src="calendar/templates/'.$templateSet.'/images/alarm.png"/>' : '' ;5500 5501 $text .= ' - ' . $event['title'].$evDescription;5502 }5503 else5504 {5505 $text = ' - '.$event['end']['hour'].':'.$event['end']['min'] . ' - '. $event['title'].$evDescription;5506 }5507 5508 $events_to_show_json[] = array(5509 start_date => $event['start']['year'].'-'.$event['start']['month'].'-'.$event['start']['mday'].' '.$event['start']['hour'].':'.$event['start']['min'],5510 end_date => $event['end']['year'].'-'.$event['end']['month'].'-'.$event['end']['mday'].' '.$event['end']['hour'].':'.$event['end']['min'] . ' - ' . utf8_encode($event['title']),5511 text => utf8_encode($text),5512 textTitle => utf8_encode($event['description']), //week and month tooltip5513 descOnTitle => ($eventTime <= 57) ? 1 : 0,5514 title => utf8_encode($event['title']),5515 observation => utf8_encode($event['observations']),5516 location => utf8_encode($event['location']),5517 id => $event['id'],5518 participants => (count($event['participants']) > 1) ? 1 : 0,5519 participants_title => $participants,5520 attachments => $event['attachment'] ? 1 : 0 ,5521 attachmentsTitle => utf8_encode(lang('email notifications with attachments has been sent')),5522 isPublic => $isPublic,5523 isPublicTitle => utf8_encode($isPublicTitle),5524 alarm => (isset($event['alarm']) && count($event['alarm']) >= 1) ? 1 : 0,5525 alarmTitle => utf8_encode(lang('alarm')),5526 recur => $recur,5527 recurTitle => utf8_encode(lang('recurring event')),5528 intersection => $intersection,5529 rejected => $rejected,5530 title_view => $title_view5531 );5532 5533 if($event['start']['hour'] < $hora_inicial)5534 {5535 $hora_inicial = $event['start']['hour'];5536 }5537 5538 if($event['end']['hour'] >= $hora_final)5539 {5540 $hora_final = $event['end']['hour'] + 1;5541 }5542 }5543 }5544 5545 $result = Array(5546 'hora_inicial' => $hora_inicial,5547 'hora_final' => $hora_final,5548 'hour_size_px' => $hour_size_px,5549 'date_events_json' => $date_events_json,5550 'events_to_show_json' => $events_to_show_json5551 );5552 5553 return $result;5554 } // end function5555 5556 5557 4835 5558 4836 function timematrix($param) … … 5693 4971 { 5694 4972 $var = Array( 5695 'action_url_button' => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param.'&user _id='.$this->bo->owner),4973 'action_url_button' => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param.'&user='.$this->bo->owner), 5696 4974 'action_text_button' => ' '.$text.' ', 5697 4975 'action_confirm_button' => '', … … 5725 5003 function edit_form($param) 5726 5004 { 5005 $sHValue = '<option></option> 5006 <option value="07:00">07:00</option> 5007 <option value="07:30">07:30</option> 5008 <option value="08:00">08:00</option> 5009 <option value="08:30">08:30</option> 5010 <option value="09:00">09:00</option> 5011 <option value="09:30">09:30</option> 5012 <option value="10:00">10:00</option> 5013 <option value="10:30">10:30</option> 5014 <option value="11:00">11:00</option> 5015 <option value="11:30">11:30</option> 5016 <option value="12:00">12:00</option> 5017 <option value="12:30">12:30</option> 5018 <option value="13:00">13:00</option> 5019 <option value="13:30">13:30</option> 5020 <option value="14:00">14:00</option> 5021 <option value="14:30">14:30</option> 5022 <option value="15:00">15:00</option> 5023 <option value="15:30">15:30</option> 5024 <option value="16:00">16:00</option> 5025 <option value="16:30">16:30</option> 5026 <option value="17:00">17:00</option> 5027 <option value="17:30">17:30</option> 5028 <option value="18:00">18:00</option> 5029 <option value="18:30">18:30</option> 5030 <option value="19:00">19:00</option> 5031 <option value="19:30">19:30</option> 5032 <option value="20:00">20:00</option> 5033 <option value="20:30">20:30</option> 5034 <option value="21:00">21:00</option> 5035 <option value="21:30">21:30</option> 5036 <option value="22:00">22:00</option>'; 5037 5727 5038 if(!is_array($param)) 5728 5039 { … … 5735 5046 } 5736 5047 5048 include_once($_SESSION['rootPath'].'/calendar/inc/class.ex_participants.inc.php'); 5049 $langp = array(); 5050 $langp['ACCEPTED'] = lang('Accepted'); 5051 $langp['DECLINED'] = lang('Declined'); 5052 $langp['TENTATIVE'] = lang('Tentative'); 5053 $langp['DELEGATED'] = lang('Delegated'); 5054 $langp['NO ANSWER'] = lang('No answer'); 5055 $exParticipants = new exParticipants($langp); 5056 $exParticipants->setParticipantsBySerializable($event['ex_participants']); 5057 $event['ex_participants'] = $exParticipants->getParticipantsMailsString(); 5737 5058 $hourformat = substr($this->bo->users_timeformat,0,1); 5738 5739 5059 // $sb = CreateObject('phpgwapi.sbox'); 5740 5060 $sb = CreateObject('phpgwapi.sbox2'); … … 5764 5084 $p->set_block('edit','list','list'); 5765 5085 $p->set_block('edit','hr','hr'); 5766 5086 $p->set_var('lang_set_participants', lang('set the participants')); 5767 5087 $vars = Array( 5768 5088 'font' => $this->theme['font'], … … 5771 5091 'accounts_link' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.accounts_popup'), 5772 5092 'common_hidden' => '<input type="hidden" name="cal[id]" value="'.$event['id'].'">'."\n" 5093 . '<input type="hidden" name="cal[date]" value="'.$param['date'].'">'."\n" 5773 5094 . '<input type="hidden" name="cal[owner]" value="'.$event['owner'].'">'."\n" 5774 5095 . '<input type="hidden" name="cal[uid]" value="'.$event['uid'].'">'."\n" … … 5786 5107 'tr_color' => $this->theme['th_bg'], 5787 5108 'field' => lang('Title'), 5788 'data' => '<input name="cal[title]" size=" 103" maxlength="300" value="'.$event['title'].'">'5109 'data' => '<input name="cal[title]" size="45" maxlength="80" value="'.$event['title'].'">' 5789 5110 ); 5790 5111 … … 5792 5113 $var['description'] = Array( 5793 5114 'field' => lang('Full Description'), 5794 'data' => '<textarea name="cal[description]" rows="5" cols=" 88" wrap="virtual" maxlength="2048">'.$event['description'].'</textarea>'5115 'data' => '<textarea name="cal[description]" rows="5" cols="40" wrap="virtual" maxlength="2048">'.$event['description'].'</textarea>' 5795 5116 ); 5796 5117 … … 5847 5168 $var['starttime'] = Array( 5848 5169 'field' => lang('Start Time'), 5849 'data' => '<input name="start[hour]" id="start_hour" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($start,$hourformat).'" maxlength="2">:<input name="start[min]" id="start_minute" size="2" value="'.$GLOBALS['phpgw']->common->show_date($start,'i').'" maxlength="2"> '."\n".$str5170 'data' => '<input name="start[hour]" id="start_hour" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($start,$hourformat).'" maxlength="2">:<input name="start[min]" id="start_minute" size="2" value="'.$GLOBALS['phpgw']->common->show_date($start,'i').'" maxlength="2"> <select name="sStartHour" onchange="javascript:sChangeHour(this);">'.$sHValue.'</select>'."\n".$str 5850 5171 ); 5851 5172 … … 5872 5193 $var['endtime'] = Array( 5873 5194 'field' => lang('End Time'), 5874 'data' => '<input name="end[hour]" id="end_hour" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($end,$hourformat).'" maxlength="2">:<input name="end[min]" id="end_minute" size="2" value="'.$GLOBALS['phpgw']->common->show_date($end,'i').'" maxlength="2"> '."\n".$str5195 'data' => '<input name="end[hour]" id="end_hour" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($end,$hourformat).'" maxlength="2">:<input name="end[min]" id="end_minute" size="2" value="'.$GLOBALS['phpgw']->common->show_date($end,'i').'" maxlength="2"> <select name="sEndHour" onchange="javascript:sChangeHour(this);">'.$sHValue.'</select>'."\n".$str 5875 5196 ); 5876 5197 … … 5884 5205 $var['access'] = Array( 5885 5206 'field' => lang('Type'), 5886 'data' => '<select onchange="javascript:changeViewMode(this.value);" id="cal[type]" name="cal[type]" '. '><option value="normal" '.(($event['public'] && $event['type'] == 'E')?'SELECTED':'').' >'.lang('Normal').'</option><option value="private" '.((!$event['public'] && $event['type'] == 'E')?'SELECTED':'').' >'. lang('Restrict').'</option><option value="privateHiddenFields" '.($event['type']=='P'?'SELECTED':'').' >'. lang('Private').'</option><option value="hourAppointment" '.($event['type'] == 'H'?'SELECTED':'').' >'.lang('Hours Appointment').'</option></select>'5207 'data' => '<select onchange="javascript:changeViewMode(this.value);" id="cal[type]" name="cal[type]" '.($event['type'] == 'H'?'DISABLED':'').'><option value="normal" '.(($event['public'] && $event['type'] == 'E')?'SELECTED':'').' >'.lang('Normal').'</option><option value="private" '.((!$event['public'] && $event['type'] == 'E')?'SELECTED':'').' >'. lang('Restrict').'</option><option value="privateHiddenFields" '.($event['type']=='P'?'SELECTED':'').' >'. lang('Private').'</option><option value="hourAppointment" '.($event['type'] == 'H'?'SELECTED':'').' >'.lang('Hours Appointment').'</option></select>' 5887 5208 ); //event['public'] 5888 5209 … … 5898 5219 { 5899 5220 $str .= '<option value="' . $id.$event['participants'][$id] . '"'.($event['participants'][$id]?' selected':'').'>('.$GLOBALS['phpgw']->accounts->get_type($id) 5900 .') ' . $GLOBALS['phpgw']->common->grab_owner_name($id) . ' </option>' . "\n";5221 .') ' . $GLOBALS['phpgw']->common->grab_owner_name($id) . ' ('. $id.')</option>' . "\n"; 5901 5222 } 5902 5223 } … … 5959 5280 </tr> 5960 5281 </table> 5961 <script src='calendar/js/edit.js' type='text/javascript'></script>5962 5282 " 5963 5283 ); … … 5992 5312 5993 5313 if ($GLOBALS['phpgw_info']['server']['cal_type_tree_participants'] == '3'){ 5314 $context = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$context); 5315 $context = utf8_decode($context); 5994 5316 $combo_org = '<option value='.$context.'>'.strtoupper($context).'</option>'; 5995 5317 }else{ 5996 5318 $combo_org = $this->get_organizations(trim(strtolower($context)),$user_context, $recursive); 5319 $combo_org = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$combo_org); 5320 $combo_org = utf8_decode($combo_org); 5997 5321 } 5998 5322 … … 6007 5331 } 6008 5332 6009 $edit_js_path = 'calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'];6010 if (!file_exists($GLOBALS['phpgw_info']['server']['webserver_url'].$edit_js_path.'/js/edit.js'))6011 $edit_js_path = 'calendar';6012 6013 5333 $var['participants'] = array 6014 5334 ( 6015 5335 'field' => ' 6016 <script src=" '.$edit_js_path.'/js/edit.js" type="text/javascript"></script><div id=\'disponibility\' style=\'display:none;position:absolute\' bgcolor=\'#FFFFFF\'>5336 <script src="calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'].'/js/edit.js" type="text/javascript"></script><div id=\'disponibility\' style=\'display:none;position:absolute\' bgcolor=\'#FFFFFF\'> 6017 5337 <iframe src=\'#\' id=\'frame_disponibility\' width=\'500\' marginHeight=\'0\' marginWidth=\'0\' height=\'200px\'></iframe> 6018 </div>5338 </div> 6019 5339 '.lang('Participants'), 6020 'data' => '6021 <input type="hidden" id="txt_loading" value="'.lang("Loading").'">' .5340 'data' => 5341 '<input type="hidden" id="txt_loading" value="'.lang("Loading").'">' . 6022 5342 '<input type="hidden" id="txt_searching" value="'.lang("Searching").'">' . 6023 5343 '<input type="hidden" id="txt_users" value="'.lang("Users").'">' . 6024 5344 '<input type="hidden" id="txt_groups" value="'.lang("Groups").'">' . 5345 '<input type="hidden" id="txt_shared_accounts" value="'.lang("shared accounts").'">' . 5346 '<input type="hidden" id="txt_min_search" value="'.lang("Your search argument must be longer than 4 characters.").'">' . 5347 '<input type="hidden" id="txt_none_result" value="'.lang("None result was found.").'">' . 5348 '<input type="hidden" id="txt_Select_a_name" value="'.lang("Select a name").'">' . 5349 '<input type="hidden" id="txt_Close" value="'.lang("Close").'">' . 5350 '<input type="hidden" id="txt_More_than_%1_results._Please,_try_to_refine_your_search" value="'.lang("More than %1 results. Please, try to refine your search",'%1').'">' . 5351 '<input type="hidden" id="txt_The_results_were_found_in_the_Global_Catalog" value="'.lang("The results were found in the Global Catalog").'">' . 6025 5352 '<table width="100%" border="0">'. 6026 5353 '<tr>'. 6027 '<td width="25%"><br><br>'. 5354 '<td width="25%"><br>'. 5355 '<button type="button" onClick="javascript:add_user();"><img src="calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/images/add.png" style="vertical-align: middle;" > '.lang("Add").'</button>'. 5356 ' <button type="button" onClick="javascript:remove_user();"><img src="calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/images/rem.png" style="vertical-align: middle;" > '.lang("Remove").'</button>'. 6028 5357 '<br><br> <b>'.lang("Event's participants").'</b><br>'. 6029 5358 ' <select id="user_list" name="participants[]" style="width: 300px" multiple size="13">'.$str.'</select>'. … … 6033 5362 '<td valign="bottom">'. 6034 5363 ' '.lang("Organization").': '. 6035 ' <select name="org_context" id="combo_org" onchange="javascript:get_available_users(\''.$module_name.'\',this.value,\''.($recursive ? "" : "search").'\',\''.$GLOBALS['phpgw_info']['server']['auto_search'].'\');">'.$combo_org.'</select>'.5364 ' <select name="org_context" id="combo_org">'.$combo_org.'</select>'. 6036 5365 ' <br>'. 6037 5366 ' <font color="red"><span id="cal_span_searching"> </span></font>'. 6038 5367 ' <br>'.lang("Search for").':'. 6039 ' <input value="" id="cal_input_searchUser" size="35" autocomplete="off" onkey up="javascript:optionFinderTimeout(this,'.$GLOBALS['phpgw_info']['server']['min_num_characters'].',\''.($recursive ? "" : "search").'\',\''.$GLOBALS['phpgw_info']['server']['auto_search'].'\')"><br>'.5368 ' <input value="" id="cal_input_searchUser" size="35" autocomplete="off" onkeypress="return optionFinderTimeout(this,'.$GLOBALS['phpgw_info']['server']['min_num_characters'].',\''.($recursive ? "" : "search").'\',\''.$GLOBALS['phpgw_info']['server']['auto_search'].'\', event);"><br>'. 6040 5369 ' <b>'.lang("Available users and groups").'</b><br>'. 6041 5370 ' <select id="user_list_in" style="width: 300px" multiple size="13"></select>'. 6042 5371 '</td>'. 6043 5372 '</tr>'. 6044 '<tr>'. 6045 '<td width="25%">'. 6046 '<button type="button" id="time_map" onClick="javascript:show_disponibility();">'.lang("Disponibility map").'</button>'. 6047 '</td>'. 6048 '<td width="30px" valign="middle" align="center"> '. 6049 '</td>'. 6050 '<td valign="bottom">'. 6051 '<button type="button" onClick="javascript:add_user();"><img src="calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/images/add.png" style="vertical-align: middle;" > '.lang("Add").'</button>'. 6052 ' <button type="button" onClick="javascript:remove_user();"><img src="calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/images/rem.png" style="vertical-align: middle;" > '.lang("Remove").'</button>'. 6053 '</td>'. 6054 '</tr>'. 5373 '<tr>' . 5374 '<td>' . 5375 '<button onclick="javascript:show_disponibility();" id="time_map" type="button">Mapa de disponibilidade</button><br>' . 5376 '<b>'.lang("Can have users and groups that doesn't appears on the map").'</b><br>' . 5377 '<td>' . 5378 '</tr>' . 6055 5379 '</table>'. 6056 5380 '<script type="text/javascript" src="phpgwapi/js/wz_dragdrop/wz_dragdrop.js"></script>'. 6057 5381 '<script type="text/javascript" src="phpgwapi/js/dJSWin/dJSWin.js"></script>'. 6058 "<script src='calendar/js/edit_exmail.js' type='text/javascript'></script>" . 5382 "<script src='calendar/templates/".$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']."/js/finder.js' type='text/javascript'></script>" . 5383 "<script src='calendar/templates/".$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']."/js/edit_exmail.js' type='text/javascript'></script>" . 6059 5384 $load_lang_vars. 6060 5385 "<script src='".$module_name."/js/connector.js' type='text/javascript'></script>". … … 6067 5392 } 6068 5393 6069 $var['participants']['data'] .= '< br /><a id="a_ext_participants" title="'.lang("It types below the email addresses, if you want to invite other people out" .5394 $var['participants']['data'] .= '<a id="a_ext_participants" title="'.lang("It types below the email addresses, if you want to invite other people out" . 6070 5395 " of this system").'" name="a_ext_participants" onClick="javascript:showExParticipants(this,\''.$module_name.'\')" href="#a_ext_participants"><b>'.lang("Inform").' '.lang("external participants").'</b> <img align="top" ' . 6071 5396 'src="calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/images/sent.gif"></a><table id="tbl_ext_participants" width="100%" border="0" style="display:none">'. … … 6079 5404 '<td>'. 6080 5405 ' >> '.lang("It types below the email addresses, if you want to invite other people out of this system").':'. 6081 ' <br><textarea name="ex_participants" id="ex_participants" cols="70" rows="2">'.$event['ex_participants'].'</textarea><br> '. 6082 //$footer_ext_participantes. 5406 ' <br> <input type="hidden" name="h_exParticipants" id="h_exParticipants" value="'.$exParticipants->getParticipantsSerializable().'" /> 5407 <textarea name="ex_participants" id="ex_participants" cols="70" rows="2">'.$event['ex_participants'].'</textarea><br> '. 5408 $footer_ext_participantes. 6083 5409 '</tr>'. 6084 5410 '</table>'; … … 6100 5426 } 6101 5427 6102 5428 // Reminder 6103 5429 // The user must use "Alarm Management" to change/modify an alarm 6104 5430 // so only display the email reminder fields if this is a new event … … 6182 5508 'data' => '<select name="cal[recur_type]">'."\n".$str.'</select>'."\n" 6183 5509 ); 6184 6185 6186 $preferences = CreateObject('phpgwapi.preferences',(int)$this->owner);6187 $selected_creator = $selected_owner = '';6188 if($event['notifications_owner'] == 1)6189 $selected_owner = ' selected';6190 else6191 $selected_creator = ' selected';6192 6193 $option = '<option value="0" '.$selected_creator.' >'.$GLOBALS['phpgw']->common->grab_owner_name((int)$_SESSION['phpgw_session']['account_id']).'</option>';6194 if($_SESSION['phpgw_session']['account_id'] != $event['owner']){6195 $option .= '<option value="1" '.$selected_owner.' >'.$GLOBALS['phpgw']->common->grab_owner_name((int)$event['owner']).'</option>';6196 }6197 6198 6199 $var['notifications_owner'] = Array(6200 'field' => lang('Send notificatios as'),6201 'data' => '<select name="cal[notifications_owner]" >'.$option.'</select>'6202 );6203 6204 5510 6205 5511 if($event['recur_enddate']['year'] != 0 && $event['recur_enddate']['month'] != 0 && $event['recur_enddate']['mday'] != 0) … … 6243 5549 ); 6244 5550 // $this->output_template_array($p,'row','list',Array('data' => '<script src="simple_show_hide.js" type="text/javascript"></script>')); 6245 6246 // Observations6247 $var['observations'] = Array(6248 'field' => lang('Observations'),6249 'data' => '<textarea name="cal[observations]" rows="5" cols="88" wrap="virtual" maxlength="2048">'.$event['observations'].'</textarea>'6250 );6251 6252 if ($event['attachment'] == '' || $event['attachment'] == 'ERROR' || is_array($event['attachment']))6253 $data = '<a onClick="javascript:addAttach()" href="#divFiles" >Anexos: adicionar+</a><div id="divFiles"></div>';6254 else6255 $data = '<input type="hidden" name="cal[attachment]" value='.$event["attachment"].'>'.lang('Notification with attachments sent.').'<br><a onClick="javascript:addAttach()" href="#divFiles" >Anexos: adicionar+</a><div id="divFiles"</div>';6256 6257 $var['attachment'] = Array(6258 'field' => lang('Attachment'),6259 //'data' => '<input type="file" name="cal[attachment]" />'6260 'data' => $data6261 );6262 5551 6263 5552 if (!isset($this->fields))
Note: See TracChangeset
for help on using the changeset viewer.