Ignore:
Timestamp:
10/07/09 16:34:46 (15 years ago)
Author:
eduardoalex
Message:

Ticket #681 - Criada a função para delegar evento

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/calendar/inc/class.uicalendar.inc.php

    r1447 r1500  
    5757 
    5858                var $public_functions = array( 
     59                        'screen_delegate_event' => True, 
     60                        'delegate_event' => True, 
    5961                        'mini_calendar' => True, 
    6062                        'index' => True, 
     
    163165                } 
    164166 
     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 - Add'); 
     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                        // Fim           
     194                        // Verifica o tipo da visualização da árvore LDAP, configurado no admin da Agenda 
     195                        $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                                "delegator" => $_REQUEST["delegator"], 
     208                                "lang_avaliable_users" => lang("Available Users and Groups"), 
     209                                "lang_search_for" => lang("Search for"), 
     210                                "lang_ou" => lang("Organization"), 
     211                                "date" => $_REQUEST["date"], 
     212                                "Delegate" => lang("Delegate"), 
     213                                'url_template' => 'calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'] 
     214                        );       
     215                         
     216                        if(isset($_REQUEST["error"])) 
     217                                $var['error_msg'] = lang("Problems delegating. Make sure you haven't delegated to a person that was also invited to the meeting"); 
     218                                 
     219                        $template = CreateObject('phpgwapi.Template',$this->template_dir); 
     220                        $template->set_file( 
     221                                                                array( 
     222                                                                        "screen"=>"delegate.tpl" 
     223                                                                        ) 
     224                                                           ); 
     225                        $template->set_var($var); 
     226                        print $template->fp('out','screen'); 
     227                } 
     228 
     229 
     230                function delegate_event($params=NULL) { 
     231                        $ldap = CreateObject('expressoMail1_2.ldap_functions'); 
     232                        $delegated = $ldap->uid2uidnumber($_REQUEST['delegated']); 
     233                        try { 
     234                                $this->bo->delegar($_REQUEST['delegator'], 
     235                                                $delegated,$_REQUEST['event']); 
     236                                header("Location: index.php?menuaction=calendar.uicalendar.day&date=".$_REQUEST['date']);                                                                
     237                        }catch(Exception $e) { 
     238                                header("Location: index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=". $_REQUEST["event"]."&delegator=".$_REQUEST["delegator"]."&date=".$_REQUEST["date"]."&error=1"); 
     239                        } 
     240 
     241                         
     242                } 
     243 
    165244                /* Public functions */ 
    166245 
     
    42364315                                { 
    42374316                                        $vars['participants']['data'][$user] = $parts[1].' (<a href="'.$this->page('edit_status','&cal_id='.$event['id'].'&owner='.$user).'">'.$parts[2].'</a>)'; 
     4317                                        $vars['participants']['data'][$user].='&nbsp;(<a href=\'index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event='.$event['id'].'&delegator='.$user.'&date='.$_REQUEST["date"].'\'>'.lang("Delegate event").'</a>)'; 
    42384318                                } 
    42394319                        } 
Note: See TracChangeset for help on using the changeset viewer.