Ignore:
Timestamp:
12/14/12 14:30:35 (11 years ago)
Author:
douglasz
Message:

Ticket #3236 - Melhorias de performance no codigo do Expresso.

File:
1 edited

Legend:

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

    r6057 r7655  
    282282                        if(!$mini_cal_tpl->get_var('daynames')) 
    283283                        { 
    284                                 for($i=0;$i<7;$i++) 
     284                                for($i=0;$i<7;++$i) 
    285285                                { 
    286286                                        $var = Array( 
     
    328328                                        ); 
    329329                                } 
    330                                 for($l=0;$l<count($var);$l++) 
     330                                for($l=0;$l<count($var);++$l) 
    331331                                { 
    332332                                        $this->output_template_array($mini_cal_tpl,'monthweek_day','mini_day',$var[$l]); 
     
    742742                        $p->set_var($var); 
    743743 
    744                         for($i=1;$i<=12;$i++) 
     744                        for($i=1;$i<=12;++$i) 
    745745                        { 
    746746                                if(($i % 3) == 1) 
     
    13311331                        $str = ''; 
    13321332 
    1333                         for($i=0;$i<count($event['recur_exception']);$i++) 
     1333                        for($i=0;$i<count($event['recur_exception']);++$i) 
    13341334                        { 
    13351335                                $str .= '    <option value="'.$i.'">'.$GLOBALS['phpgw']->common->show_date($event['recur_exception'][$i]).'</option>'."\n"; 
     
    14571457                                // Add participants 
    14581458                                $participants = explode(";", $GLOBALS['phpgw']->session->appsession("participants") ); 
    1459                                 for($_f_part=0; $_f_part<count($participants); $_f_part++) 
     1459                                for($_f_part=0; $_f_part<count($participants); ++$_f_part) 
    14601460                                { 
    14611461                                        $this->bo->add_attribute('participants','A',$participants[$_f_part]); 
     
    18001800                                . '<tr><td height="1" colspan="'.((11 * $interval) + 1).'" bgcolor="black"><img src="'.$pix.'"></td></tr>' 
    18011801                                . '<tr><td width="15%"><font color="'.$this->theme['bg_text'].'" face="'.$this->theme['font'].'" size="-2">'.lang('Participant').'</font></td>'; 
    1802                         for($i=8;$i<19;$i++) 
    1803                         { 
    1804                                 for($j=0;$j<$interval;$j++) 
     1802                        for($i=8;$i<19;++$i) 
     1803                        { 
     1804                                for($j=0;$j<$interval;++$j) 
    18051805                                { 
    18061806                                        $k = ($j == 0 ? sprintf('%02d',$i).'<br>':'').sprintf('%02d',$j*$increment); 
     
    18541854                                if(!$this->bo->cached_events[$date['full']]) 
    18551855                                { 
    1856                                         for($j=8;$j<19;$j++) 
     1856                                        for($j=8;$j<19;++$j) 
    18571857                                        { 
    1858                                                 for($k=0;$k<$interval;$k++) 
     1858                                                for($k=0;$k<$interval;++$k) 
    18591859                                                { 
    18601860//                                                      $helper_name = $k* 
     
    18671867                                { 
    18681868                                        $time_slice = $this->bo->prepare_matrix($interval,$increment,$part,$date['full']); 
    1869                                         for($h=8;$h<19;$h++) 
     1869                                        for($h=8;$h<19;++$h) 
    18701870                                        { 
    18711871                                                $hour = $h * 10000; 
    1872                                                 for($m=0;$m<$interval;$m++) 
     1872                                                for($m=0;$m<$interval;++$m) 
    18731873                                                { 
    18741874                                                        $index = ($hour + (($m * $increment) * 100)); 
     
    22672267                        $y = $this->bo->year; 
    22682268                        $this->bo->read_holidays($y); 
    2269                         for ($i=1; $i<=$this->bo->num_months; $i++,$m++) 
     2269                        for ($i=1; $i<=$this->bo->num_months; ++$i,++$m) 
    22702270                        { 
    22712271                                if ($m == 13) 
     
    22962296                                        ); 
    22972297                                } 
    2298                                 for ($d=1; $d<=$days; $d++) 
     2298                                for ($d=1; $d<=$days; ++$d) 
    22992299                                { 
    23002300                                        $dayname = substr(lang(date('D',mktime(0,0,0,$m,$d,$y))),0,2); 
     
    26012601                                if ($end_cell == $start_cell && $end_cell < $last_cell) 
    26022602                                { 
    2603                                         $end_cell++;    // min. width 1 interval 
     2603                                        ++$end_cell;    // min. width 1 interval 
    26042604                                } 
    26052605                        } 
     
    27362736                        // process all events within observed interval 
    27372737                        // 
    2738                         for($v=$this->planner_firstday;$v<=$this->planner_lastday;$v++) 
     2738                        for($v=$this->planner_firstday;$v<=$this->planner_lastday;++$v) 
    27392739                        { 
    27402740                                $daily = $this->bo->cached_events[$v]; 
     
    28092809                        $accounts = $GLOBALS['phpgw']->acl->get_ids_for_location('run',1,'calendar'); 
    28102810                        $users = Array(); 
    2811                         for($i=0;$i<count($accounts);$i++) 
     2811                        for($i=0;$i<count($accounts);++$i) 
    28122812                        { 
    28132813                                $user = $accounts[$i]; 
     
    28202820                                                if($group_members != False) 
    28212821                                                { 
    2822                                                         for($j=0;$j<count($group_members);$j++) 
     2822                                                        for($j=0;$j<count($group_members);++$j) 
    28232823                                                        { 
    28242824                                                                if(!isset($users[$group_members[$j]])) 
     
    28612861                        ); 
    28622862 
    2863                         for($i=0;$i<count($var);$i++) 
     2863                        for($i=0;$i<count($var);++$i) 
    28642864                        { 
    28652865                                $this->output_template_array($p,'rows','list',$var[$i]); 
     
    31553155                        if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True) 
    31563156                        { 
    3157                                 $cols++; 
     3157                                ++$cols; 
    31583158                        } 
    31593159 
     
    32293229                        /* Bloco adicionado para receber o dia a partir do qual a versao para impressao sera gerada */ 
    32303230                        $str_ini = ''; 
    3231                         for ($i = 1; $i <= ($GLOBALS['phpgw']->datetime->days_in_month($m, $y)); $i++) 
     3231                        for ($i = 1; $i <= ($GLOBALS['phpgw']->datetime->days_in_month($m, $y)); ++$i) 
    32323232                        { 
    32333233                                $str_ini .= '<option value="'.$i.'"'.($i == $day?' selected':'').'>'.$i.'</option>'."\n"; 
    32343234                        } 
    32353235                        $str_qtd = '<option value="'.''.'"'.($i == $_POST['qtd_dias']?' selected':'').'>'.''.'</option>'."\n"; 
    3236                         for ($i = 1; $i <= 45; $i++) 
     3236                        for ($i = 1; $i <= 45; ++$i) 
    32373237                        { 
    32383238                                $str_qtd .= '<option value="'.$i.'"'.($i == $_POST['qtd_dias']?' selected':'').'>'.$i.'</option>'."\n"; 
     
    32723272 
    32733273                        $str = ''; 
    3274                         for ($i = 0; $i < 20; $i++) 
    3275                         { 
    3276                                 $m++; 
     3274                        for ($i = 0; $i < 20; ++$i) 
     3275                        { 
     3276                                ++$m; 
    32773277                                if ($m > 12) 
    32783278                                { 
    32793279                                        $m = 1; 
    3280                                         $y++; 
     3280                                        ++$y; 
    32813281                                } 
    32823282                                $d = mktime(0,0,0,$m,1,$y); 
     
    33043304 
    33053305                                $str = ''; 
    3306                                 for ($i = -7; $i <= 7; $i++) 
     3306                                for ($i = -7; $i <= 7; ++$i) 
    33073307                                { 
    33083308                                        $begin = $sun + (7*24*60*60 * $i) + 12*60*60;   // we use midday, that changes in daylight-saveing does not effect us 
     
    33293329 
    33303330                        $str = ''; 
    3331                         for ($i = ($this->bo->year - 3); $i < ($this->bo->year + 3); $i++) 
     3331                        for ($i = ($this->bo->year - 3); $i < ($this->bo->year + 3); ++$i) 
    33323332                        { 
    33333333                                $str .= '<option value="'.$i.'"'.($i == $this->bo->year?' selected':'').'>'.$i.'</option>'."\n"; 
     
    33583358                                $date_str .= '    <input type="hidden" name="year" value="'.$this->bo->year.'">'."\n"; 
    33593359 
    3360                                 for($i=1; $i<=6; $i++) 
     3360                                for($i=1; $i<=6; ++$i) 
    33613361                                { 
    33623362                                        $str .= '<option value="'.$i.'"'.($i == $this->bo->num_months?' selected':'').'>'.$i.'</option>'."\n"; 
     
    36073607 
    36083608                        $description = $this->bo->get_short_field($event,$is_private,'description'); 
    3609                         for($i=0;$i<count($picture);$i++) 
     3609                        for($i=0;$i<count($picture);++$i) 
    36103610                        { 
    36113611                                $var = Array( 
     
    37973797 
    37983798                        $description = $this->bo->get_short_field($event,$is_private,'description'); 
    3799                         for($i=0;$i<count($picture);$i++) 
     3799                        for($i=0;$i<count($picture);++$i) 
    38003800                        { 
    38013801                                $var = Array( 
     
    38683868 
    38693869                        $overlap = ''; 
    3870                         for($i=0;$i<count($overlapping_events);$i++) 
     3870                        for($i=0;$i<count($overlapping_events);++$i) 
    38713871                        { 
    38723872                                $overlapped_event = $this->bo->read_entry($overlapping_events[$i],True); 
     
    40564056                        } 
    40574057 
    4058                         for($i=0;$i<7;$i++) 
     4058                        for($i=0;$i<7;++$i) 
    40594059                        { 
    40604060                                $p->set_var('col_title',lang($GLOBALS['phpgw']->datetime->days[$i])); 
     
    45364536                        $tstop = $tstart + 604800; 
    45374537                        $original_owner = $this->bo->so->owner; 
    4538                         for($i=0;$i<$counter;$i++) 
     4538                        for($i=0;$i<$counter;++$i) 
    45394539                        { 
    45404540                                $this->bo->so->owner = $owners_array[$i]; 
     
    48774877                                . '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="black"><img src="'.$pix.'"></td></tr>' 
    48784878                                . '<tr><td width="15%"><font color="'.$this->theme['bg_text'].'" face="'.$this->theme['font'].'" size="-2">'.lang('Participant').'</font></td>'; 
    4879                         for($i=0;$i<24;$i++) 
    4880                         { 
    4881                                 for($j=0;$j<$interval;$j++) 
     4879                        for($i=0;$i<24;++$i) 
     4880                        { 
     4881                                for($j=0;$j<$interval;++$j) 
    48824882                                { 
    48834883                                        $k = ($j == 0 ? sprintf('%02d',$i).'<br>':'').sprintf('%02d',$j*$increment); 
     
    49164916                                if(!$this->bo->cached_events[$date['full']]) 
    49174917                                { 
    4918                                         for($j=0;$j<24;$j++) 
     4918                                        for($j=0;$j<24;++$j) 
    49194919                                        { 
    4920                                                 for($k=0;$k<$interval;$k++) 
     4920                                                for($k=0;$k<$interval;++$k) 
    49214921                                                { 
    49224922                                                        $str .= '<td height="1" align="left" bgcolor="'.$this->theme['bg_color'].'" color="#999999">&nbsp;</td>'; 
     
    49284928                                { 
    49294929                                        $time_slice = $this->bo->prepare_matrix($interval,$increment,$part,$date['full']); 
    4930                                         for($h=0;$h<24;$h++) 
     4930                                        for($h=0;$h<24;++$h) 
    49314931                                        { 
    49324932                                                $hour = $h * 10000; 
     
    54795479                                // days 
    54805480                                $dout = '<select name="cal[alarmdays]">'."\n"; 
    5481                                 for($i=0;$i<32;$i++) 
     5481                                for($i=0;$i<32;++$i) 
    54825482                                { 
    54835483                                        $dout .= '<option value="'.$i.'"'.($i==$days?' selected':'').'>'.$i.'</option>'."\n"; 
     
    54865486                                // hours 
    54875487                                $hout = '<select name="cal[alarmhours]">'."\n"; 
    5488                                 for($i=0;$i<25;$i++) 
     5488                                for($i=0;$i<25;++$i) 
    54895489                                { 
    54905490                                        $hout .= '<option value="'.$i.'"'.($i==$hours?' selected':'').'>'.$i.'</option>'."\n"; 
     
    54935493                                // minutes 
    54945494                                $mout = '<select name="cal[alarmminutes]">'."\n"; 
    5495                                 for($i=0;$i<61;$i++) 
     5495                                for($i=0;$i<61;++$i) 
    54965496                                { 
    54975497                                        $mout .= '<option value="'.$i.'"'.($i==$min?' selected':'').'>'.$i.'</option>'."\n"; 
     
    57345734                        } 
    57355735 
    5736                         for ($i=0; $i<count($control_data['part']); $i++) 
     5736                        for ($i=0; $i<count($control_data['part']); ++$i) 
    57375737                        { 
    57385738                                $id = $control_data['part'][$i]; 
     
    57455745                        if ($control_data['action'] == lang('Delete selected contacts')) 
    57465746                        { 
    5747                                 for ($i=0; $i<count($control_data['delete']); $i++) 
     5747                                for ($i=0; $i<count($control_data['delete']); ++$i) 
    57485748                                { 
    57495749                                        $id = $control_data['delete'][$i]; 
     
    57735773                                $p->set_var('ckbox_delete_participant',$contact['name']); 
    57745774                                $p->parse('V_partlist','B_partlist',True); 
    5775                                 $total_contacts++; 
     5775                                ++$total_contacts; 
    57765776                        } 
    57775777 
     
    58945894                { 
    58955895                        $data = date("m"); 
    5896                         for ($j=0,$datetime=$startdate;$j<7;$j++,$datetime += 86400) 
     5896                        for ($j=0,$datetime=$startdate;$j<7;++$j,$datetime += 86400) 
    58975897                        { 
    58985898                                $date = date('Ymd',$datetime + (60 * 60 * 2)); // +2h to be save when switching to and from dst, $datetime is alreay + TZ-Offset 
     
    59705970                                if($holidays) 
    59715971                                { 
    5972                                         for($k=0;$k<count($holidays);$k++) 
     5972                                        for($k=0;$k<count($holidays);++$k) 
    59735973                                        { 
    59745974                                                $holiday_name[] = $holidays[$k]['name']; 
Note: See TracChangeset for help on using the changeset viewer.