Changeset 17982

Show
Ignore:
Timestamp:
10/07/08 08:47:48 (2 months ago)
Author:
adrenalin
Message:

Added locales and breadcrumbs and bulletproofed event fetching.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/org.openpsa.calendar/handler/view.php

    r17966 r17982  
    331331        $subscribed_contacts = $user->list_parameters('org_openpsa_calendar_show'); 
    332332         
    333         // Backwards compatibilti
     333        // Backwards compatibilit
    334334        foreach ($subscribed_contacts as $guid => $subscribed) 
    335335        { 
     
    337337            $this->_request_data['calendar']->_resources[$person->guid] = $this->_populate_calendar_resource($person, $from, $to); 
    338338            $shown_persons[$person->id] = true; 
     339        } 
     340         
     341        // Backwards compatibility 
     342        if ($this->_config->get('always_show_group')) 
     343        { 
     344            // Add this group to display as well 
     345            $additional_group = & $_MIDCOM->auth->get_group($this->_config->get('always_show_group')); 
     346            if ($additional_group) 
     347            { 
     348                $members = $additional_group->list_members(); 
     349                foreach ($members as $person) 
     350                { 
     351                    if (array_key_exists($person->id, $shown_persons)) 
     352                    { 
     353                        continue; 
     354                    } 
     355                    $person_object = $person->get_storage(); 
     356                    $this->_request_data['calendar']->_resources[$person_object->guid] = $this->_populate_calendar_resource($person_object, $from, $to); 
     357                    $shown_persons[$person->id] = true; 
     358                } 
     359            } 
    339360        } 
    340361         
     
    358379                    { 
    359380                        $person = new midcom_db_person($guid); 
     381                         
     382                        if (   isset($shown_persons[$person->id]) 
     383                            && $shown_persons[$person->id] === true) 
     384                        { 
     385                            continue; 
     386                        } 
     387                         
    360388                        $this->_request_data['calendar']->_resources[$person->guid] = $this->_populate_calendar_resource($person, $from, $to); 
    361389                        $shown_persons[$person->id] = true; 
     
    385413                        foreach ($keys as $membership_guid => $array) 
    386414                        { 
    387                             $person = new midcom_db_person($mc->get_subkey($membership_guid, 'uid')); 
     415                            $user_id = $mc->get_subkey($membership_guid, 'uid'); 
     416                             
     417                            if (   isset($shown_persons[$user_id]) 
     418                                && $shown_persons[$user_id] === true) 
     419                            { 
     420                                continue; 
     421                            } 
     422                             
     423                            $person = new midcom_db_person($user_id); 
    388424                            $this->_request_data['calendar']->_resources[$person->guid] = $this->_populate_calendar_resource($person, $from, $to); 
    389425                            $shown_persons[$person->id] = true; 
     
    391427                    } 
    392428                    break; 
    393             } 
    394         } 
    395  
    396         if ($this->_config->get('always_show_group')) 
    397         { 
    398             // Add this group to display as well 
    399             $additional_group = & $_MIDCOM->auth->get_group($this->_config->get('always_show_group')); 
    400             if ($additional_group) 
    401             { 
    402                 $members = $additional_group->list_members(); 
    403                 foreach ($members as $person) 
    404                 { 
    405                     if (array_key_exists($person->id, $shown_persons)) 
    406                     { 
    407                         continue; 
    408                     } 
    409                     $person_object = $person->get_storage(); 
    410                     $this->_request_data['calendar']->_resources[$person_object->guid] = $this->_populate_calendar_resource($person_object, $from, $to); 
    411                     $shown_persons[$person->id] = true; 
    412                 } 
    413429            } 
    414430        } 
     
    527543        $this->_populate_calendar_contacts($this->_request_data['calendar']->get_month_start(), $this->_request_data['calendar']->get_month_end()); 
    528544 
     545        // Set the breadcrumb 
     546        $tmp = array(); 
     547         
     548        $tmp[] = array 
     549        ( 
     550            MIDCOM_NAV_URL => 'year/' . date('Y-01-01', $this->_request_data['calendar']->get_week_start()) . '/', 
     551            MIDCOM_NAV_NAME => strftime('%Y'), 
     552        ); 
     553        $tmp[] = array 
     554        ( 
     555            MIDCOM_NAV_URL => 'month/' . date('Y-m-01', $this->_request_data['calendar']->get_week_start()) . '/', 
     556            MIDCOM_NAV_NAME => strftime('%B'), 
     557        ); 
     558         
     559        $_MIDCOM->set_custom_context_data('midcom.helper.nav.breadcrumb', $tmp); 
     560         
    529561        return true; 
    530562    } 
     
    645677            ) 
    646678        ); 
    647  
     679         
     680        // Set the breadcrumb 
     681        $tmp = array(); 
     682         
     683        $tmp[] = array 
     684        ( 
     685            MIDCOM_NAV_URL => 'year/' . date('Y-01-01', $this->_request_data['calendar']->get_week_start()) . '/', 
     686            MIDCOM_NAV_NAME => strftime('%Y'), 
     687        ); 
     688        $tmp[] = array 
     689        ( 
     690            MIDCOM_NAV_URL => 'month/' . date('Y-m-01', $this->_request_data['calendar']->get_week_start()) . '/', 
     691            MIDCOM_NAV_NAME => strftime('%B'), 
     692        ); 
     693        $tmp[] = array 
     694        ( 
     695            MIDCOM_NAV_URL => "week/{$args[0]}/", 
     696            MIDCOM_NAV_NAME => sprintf($this->_l10n->get('week %s'), strftime('%V', $this->_request_data['calendar']->get_week_start())), 
     697        ); 
     698         
     699        $_MIDCOM->set_custom_context_data('midcom.helper.nav.breadcrumb', $tmp); 
     700         
    648701        return true; 
    649702    } 
     
    770823        $this->_populate_calendar_contacts($this->_request_data['calendar']->get_day_start(), $this->_request_data['calendar']->get_day_end()); 
    771824 
     825        // Set the breadcrumb 
     826        $tmp = array(); 
     827         
     828        $tmp[] = array 
     829        ( 
     830            MIDCOM_NAV_URL => 'year/' . date('Y-01-01', $this->_request_data['calendar']->get_week_start()) . '/', 
     831            MIDCOM_NAV_NAME => strftime('%Y'), 
     832        ); 
     833        $tmp[] = array 
     834        ( 
     835            MIDCOM_NAV_URL => 'month/' . date('Y-m-01', $this->_request_data['calendar']->get_week_start()) . '/', 
     836            MIDCOM_NAV_NAME => strftime('%B'), 
     837        ); 
     838        $tmp[] = array 
     839        ( 
     840            MIDCOM_NAV_URL => "day/{$args[0]}/", 
     841            MIDCOM_NAV_NAME => strftime('%d'), 
     842        ); 
     843        $_MIDCOM->set_custom_context_data('midcom.helper.nav.breadcrumb', $tmp); 
     844         
    772845        return true; 
    773846    } 
  • branches/MidCOM_2_8/org.openpsa.calendar/locale/default.en.txt

    r17966 r17982  
    148148---STRINGEND 
    149149 
     150---STRING resources 
     151Resources 
     152---STRINGEND 
     153 
    150154---STRING start time 
    151155Start time 
     
    168172---STRINGEND 
    169173 
    170 ---STRING resource
    171 Resource
     174---STRING week %
     175Week %
    172176---STRINGEND 
    173177 
  • branches/MidCOM_2_8/org.openpsa.calendar/locale/default.fi.txt

    r17966 r17982  
    148148---STRINGEND 
    149149 
     150---STRING resources 
     151Resurssit 
     152---STRINGEND 
     153 
    150154---STRING start time 
    151155Alkaa 
     
    168172---STRINGEND 
    169173 
    170 ---STRING resource
    171 Resurssit 
     174---STRING week %
     175Viikko %s 
    172176---STRINGEND 
    173177