Changeset 4049
- Timestamp:
- 04/15/11 16:53:03 (13 years ago)
- Location:
- branches/2.2.0.1/calendar
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.0.1/calendar/inc/class.uicalendar.inc.php
r4030 r4049 495 495 function month() 496 496 { 497 echo $this->printer_friendly($this->get_month(),lang('Monthview')); 497 if($_GET['month']||$_POST['month']){ 498 $params['month'] = $_GET['month']?(int)$_GET['month']:(int)$_POST['month']; 499 $params['year'] = $_GET['year']?(int)$_GET['year']:(int)$_POST['year']; 500 $params['day'] = 1; 501 502 }else{ 503 $params['day'] = $_post['date']?(int)substr($_POST['date'] , 6, 2):(int)substr($_GET['date'] , 6, 2); 504 $params['month'] = $_post['date']?(int)substr($_POST['date'] , 4, 2):(int)substr($_GET['date'] , 4, 2); 505 $params['year'] = $_post['date']?(int)substr($_POST['date'] , 0, 4):(int)substr($_GET['date'] , 0, 4); 506 507 } 508 509 echo $this->printer_friendly($this->print_month_new($params),lang('Weekview')); 498 510 $GLOBALS['phpgw']->common->phpgw_footer(); 499 511 } … … 689 701 function week() 690 702 { 691 echo $this->printer_friendly($this->get_week(),lang('Weekview')); 703 704 if($_GET['month']||$_POST['month']){ 705 $params['month'] = $_GET['month']?(int)$_GET['month']:(int)$_POST['month']; 706 $params['year'] = $_GET['year']?(int)$_GET['year']:(int)$_POST['year']; 707 $params['day'] = 1; 708 709 }else{ 710 $params['day'] = $_post['date']?(int)substr($_POST['date'] , 6, 2):(int)substr($_GET['date'] , 6, 2); 711 $params['month'] = $_post['date']?(int)substr($_POST['date'] , 4, 2):(int)substr($_GET['date'] , 4, 2); 712 $params['year'] = $_post['date']?(int)substr($_POST['date'] , 0, 4):(int)substr($_GET['date'] , 0, 4); 713 714 } 715 716 echo $this->printer_friendly($this->print_week_new($params),lang('Weekview')); 692 717 $GLOBALS['phpgw']->common->phpgw_footer(); 693 718 } … … 3395 3420 ); 3396 3421 $this->output_template_array($p,'b_row2','form_button',$var); 3397 if ( $menuaction == 'calendar.uicalendar.week' || ($menuaction == 'calendar.uicalendar.month' && $account_prefs['calendar']['type_month_print'] == '1'))3398 {3399 $aux = explode('.',$menuaction);3400 $typeview = $aux[2];3401 if($typeview == 'week')3402 $params['period'] = 2;3403 else3404 $params['period'] = 3;3405 3406 if(isset($_GET['date']))3407 $date = $_GET['date'];3408 else3409 $date = $_POST['date'];3410 if($date)3411 {3412 $params['year'] = substr($date, 0,4);3413 $params['month'] = substr($date, 4,2);3414 $params['day'] = substr($date, 6,2);3415 }3416 else3417 {3418 $params['year'] = $_GET['year']?$_GET['year']:$_POST['year'];3419 $params['month'] = $_GET['month']?$_GET['month']:$_POST['month'];3420 if(!$params['month'])3421 {3422 $params['month'] = $this->bo->month;3423 }3424 $params['day'] = $this->bo->day;3425 }3426 3427 $result_events_json = $this->print_events_to_show_json($params);3428 $var = Array(3429 'typeview' => $typeview,3430 'typeview_aux' => $typeview,3431 'date' => $result_events_json['date_events_json'],3432 'hora_final' => $result_events_json['hora_final'],3433 'hora_inicial' => $result_events_json['hora_inicial'],3434 'events_json' => json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null'3435 );3436 $this->output_template_array($p,'place_component','new_component',$var);3437 }3438 else3439 {3422 // if ( $menuaction == 'calendar.uicalendar.week' || ($menuaction == 'calendar.uicalendar.month' && $account_prefs['calendar']['type_month_print'] == '1')) 3423 // { 3424 // $aux = explode('.',$menuaction); 3425 // $typeview = $aux[2]; 3426 // if($typeview == 'week') 3427 // $params['period'] = 2; 3428 // else 3429 // $params['period'] = 3; 3430 // 3431 // if(isset($_GET['date'])) 3432 // $date = $_GET['date']; 3433 // else 3434 // $date = $_POST['date']; 3435 // if($date) 3436 // { 3437 // $params['year'] = substr($date, 0,4); 3438 // $params['month'] = substr($date, 4,2); 3439 // $params['day'] = substr($date, 6,2); 3440 // } 3441 // else 3442 // { 3443 // $params['year'] = $_GET['year']?$_GET['year']:$_POST['year']; 3444 // $params['month'] = $_GET['month']?$_GET['month']:$_POST['month']; 3445 // if(!$params['month']) 3446 // { 3447 // $params['month'] = $this->bo->month; 3448 // } 3449 // $params['day'] = $this->bo->day; 3450 // } 3451 // 3452 // $result_events_json = $this->print_events_to_show_json($params); 3453 // $var = Array( 3454 // 'typeview' => $typeview, 3455 // 'typeview_aux' => $typeview, 3456 // 'date' => $result_events_json['date_events_json'], 3457 // 'hora_final' => $result_events_json['hora_final'], 3458 // 'hora_inicial' => $result_events_json['hora_inicial'], 3459 // 'events_json' => json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null' 3460 // ); 3461 // $this->output_template_array($p,'place_component','new_component',$var); 3462 // } 3463 // else 3464 // { 3440 3465 $p->set_var('place_component',''); 3441 }3466 // } 3442 3467 $p->parse('table_row','blank_row',True); 3443 3468 $p->pparse('out','footer_table'); … … 5074 5099 } 5075 5100 5101 function print_week_new($params){ 5102 5103 $p = CreateObject('phpgwapi.Template',$this->template_dir); 5104 $p->set_unknowns('keep'); 5105 5106 $tpl = 'new_week.tpl'; 5107 5108 if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 && 5109 $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home') 5110 { 5111 $tpl = 'day_list.tpl'; 5112 } 5113 5114 $minical_prev = $this->mini_calendar( 5115 Array( 5116 'day' => 1, 5117 'month' => $this->bo->month -1, 5118 'year' => $this->bo->year, 5119 'link' => 'week', 5120 'outside_month' => False 5121 ) 5122 ); 5123 5124 $minical_next1 = $this->mini_calendar( 5125 Array( 5126 'day' => 1, 5127 'month' => $this->bo->month + 1, 5128 'year' => $this->bo->year, 5129 'link' => 'week', 5130 'outside_month' => False 5131 ) 5132 ); 5133 5134 $minical_next = $this->mini_calendar( 5135 Array( 5136 'day' => 1, 5137 'month' => $this->bo->month, 5138 'year' => $this->bo->year, 5139 'link' => 'week', 5140 'outside_month' => False 5141 ) 5142 ); 5143 $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); 5144 5145 $templates = Array( 5146 'new_week' => $tpl, 5147 ); 5148 5149 $p->set_file($templates); 5150 $p->set_block('new_week','day','day'); 5151 $params['period'] = 2; 5152 $result_events_json = $this->print_events_to_show_json($params); 5153 $p->set_var('date',$result_events_json['date_events_json']); 5154 $p->set_var('hora_final',$result_events_json['hora_final']); 5155 $p->set_var('hora_inicial',$result_events_json['hora_inicial']); 5156 $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1); 5157 $p->set_var('title',lang(strftime("%B",$m)).' '.$this->bo->year); 5158 $p->set_var('user',$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner)); 5159 $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null'); 5160 return $p->fp('out','day'); 5161 } 5162 5163 function print_month_new($params){ 5164 5165 $p = CreateObject('phpgwapi.Template',$this->template_dir); 5166 $p->set_unknowns('keep'); 5167 5168 $tpl = 'new_month.tpl'; 5169 5170 if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 && 5171 $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home') 5172 { 5173 $tpl = 'day_list.tpl'; 5174 } 5175 5176 5177 5178 $templates = Array( 5179 'new_month' => $tpl, 5180 ); 5181 5182 $minical_prev = $this->mini_calendar( 5183 Array( 5184 'day' => 1, 5185 'month' => $this->bo->month -1, 5186 'year' => $this->bo->year, 5187 'link' => 'week', 5188 'outside_month' => False 5189 ) 5190 ); 5191 5192 $minical_next1 = $this->mini_calendar( 5193 Array( 5194 'day' => 1, 5195 'month' => $this->bo->month + 2, 5196 'year' => $this->bo->year, 5197 'link' => 'week', 5198 'outside_month' => False 5199 ) 5200 ); 5201 5202 $minical_next = $this->mini_calendar( 5203 Array( 5204 'day' => 1, 5205 'month' => $this->bo->month + 1, 5206 'year' => $this->bo->year, 5207 'link' => 'week', 5208 'outside_month' => False 5209 ) 5210 ); 5211 $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); 5212 $p->set_file($templates); 5213 $p->set_block('new_month','day','day'); 5214 $params['period'] = 3; 5215 $result_events_json = $this->print_events_to_show_json($params); 5216 $p->set_var('date',$result_events_json['date_events_json']); 5217 $p->set_var('hora_final',$result_events_json['hora_final']); 5218 $p->set_var('hora_inicial',$result_events_json['hora_inicial']); 5219 $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1); 5220 $p->set_var('title',lang(strftime("%B",$m)).' '.$this->bo->year); 5221 $p->set_var('user',$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner)); 5222 $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null'); 5223 return $p->fp('out','day'); 5224 } 5076 5225 5077 5226 //função vai devolver os eventos do mês atual para exibição no novo componente da Agenda … … 5188 5337 else 5189 5338 { 5190 $text = $event['title'] ;5339 $text = $event['title']." - ".$event['description']; 5191 5340 } 5192 5341 … … 5410 5559 { 5411 5560 $var = Array( 5412 'action_url_button' => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param ),5561 'action_url_button' => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param.'&user_id='.$this->bo->owner), 5413 5562 'action_text_button' => ' '.$text.' ', 5414 5563 'action_confirm_button' => '', -
branches/2.2.0.1/calendar/js/dhtmlx/server/pdfGenerator.php
r4001 r4049 10 10 public $offsetLeft = 10; 11 11 public $offsetRight = 10; 12 12 13 13 // header height of day container in month mode 14 14 public $monthDayHeaderHeight = 6; … … 23 23 // width of left scale in day and week mode 24 24 public $dayLeftWidth = 16; 25 25 26 26 // font size settings 27 27 public $monthHeaderFontSize = 9; … … 79 79 case 'week': 80 80 $date = date("Ymd") . "_" . date("H:i"); 81 $this->orientation = ' L';81 $this->orientation = 'P'; 82 82 $this->wrapper = new pdfWrapper($this->offsetTop, $this->offsetRight, $this->offsetBottom, $this->offsetLeft, $this->orientation); 83 $this->print DayWeek();83 $this->printWeek(); 84 84 break; 85 85 case 'year': … … 102 102 // print_r($this); 103 103 // echo "</pre>"; 104 104 105 105 $this->wrapper->pdfOut($date); 106 106 } 107 107 108 // parses options profile, orientation, header and footer from xml 108 // parses options profile, orientation, header and footer from xml 109 109 private function renderData($data) { 110 110 if (isset($data->attributes()->profile)) { … … 177 177 $this->todayTextColor = '000000'; 178 178 $this->scaleColorOne = 'FFFFFF'; 179 $this->scaleColorTwo = 'FFFFFF'; 179 $this->scaleColorTwo = 'FFFFFF'; 180 180 $this->yearDayColor = 'FFFFFF'; 181 181 $this->yearDayColorInactive = 'FFFFFF'; … … 192 192 193 193 switch ($this->mode) { 194 case 'week': 195 foreach ($scales->x->column as $text) { 196 $this->topScales[] = (string) $text; 197 } 198 foreach ($scales->row as $text) { 199 $week = explode("|", $text); 200 $this->dayHeader[] = $week; 201 } 202 break; 194 203 case 'month': 195 204 foreach ($scales->x->column as $text) { … … 201 210 } 202 211 break; 203 212 204 213 case 'year': 205 214 foreach ($scales->month as $month) { … … 209 218 $monthArr['columns'][] = (string) $col; 210 219 } 211 220 212 221 foreach ($month->row as $row) { 213 222 $row = explode("|", $row); … … 217 226 } 218 227 break; 219 228 220 229 case 'agenda': 221 230 $this->agendaHeader[0] = (string) $scales->column[0]; … … 224 233 225 234 case 'day': 226 case 'week':227 235 foreach ($scales->x->column as $col) { 228 236 $this->columnHeader[] = (string) $col; … … 255 263 } 256 264 break; 265 case 'week': 266 foreach ($xml->event as $ev) { 267 $event['week'] = (int) $ev->attributes()->week; 268 $event['day'] = (int) $ev->attributes()->day; 269 $event['x'] = (int) $ev->attributes()->x; 270 $event['y'] = (int) $ev->attributes()->y; 271 $event['width'] = (int) $ev->attributes()->width; 272 $event['height'] = (int) $ev->attributes()->height; 273 $event['type'] = (string) $ev->attributes()->type; 274 $event['text'] = (string) $ev->body; 275 $event['color'] = (string) $ev->body->attributes()->color; 276 $this->events[] = $event; 277 } 278 break; 257 279 case 'year': 258 280 foreach ($xml->event as $ev) { … … 271 293 break; 272 294 case 'day': 273 case 'week':274 295 foreach ($xml->event as $ev) { 275 296 $event['head'] = (string) $ev->header; … … 311 332 } 312 333 334 private function printWeek() { 335 $this->wrapper->drawWeekHeader($this->orientation, $this->topScales, $this->monthHeaderHeight, $this->bgColor, $this->lineColor, $this->monthHeaderFontSize); 336 $this->wrapper->drawToday($this->today, $this->todayFontSize); 337 $this->wrapper->drawWeekGrid($this->dayHeader, $this->monthDayHeaderHeight, $this->dayHeaderColor, $this->dayBodyColor, $this->dayHeaderColorInactive, $this->dayBodyColorInactive, $this->monthDayHeaderFontSize); 338 $this->wrapper->drawWeekEvents($this->events, $this->eventColor, $this->eventBorderColor, $this->monthEventFontSize, $this->profile); 339 } 340 313 341 } 314 342 -
branches/2.2.0.1/calendar/js/dhtmlx/server/pdfWrapper.php
r4001 r4049 86 86 // circle for drawing day containers 87 87 for ($i = 0; $i < count($dayHeader); $i++) { 88 89 90 91 92 93 94 95 96 97 98 99 100 101 $this->cb->Cell($this->dayWidth, $this->dayBodyHeight, '', 1, $ln, 'R', 1);102 88 // draws day headers for every cell of row 89 for ($j = 0; $j < count($dayHeader[$i]); $j++) { 90 $ln = ($j == 6) ? 1 : 0; 91 $color = ($activeDays[$i][$j] == true) ? $this->dayHeaderColor : $this->dayHeaderColorInactive; 92 $this->cb->SetFillColor($color['R'], $color['G'], $color['B']); 93 $this->cb->Cell($this->dayWidth, $this->dayHeaderHeight, $dayHeader[$i][$j], 1, $ln, 'R', 1); 94 $this->dayEventsHeight[$i][$j] = 0; 95 } 96 // draws day body for every cell of row 97 for ($j = 0; $j < 7; $j++) { 98 $ln = ($j == 6) ? 1 : 0; 99 $color = ($activeDays[$i][$j] == true) ? $this->dayBodyColor : $this->dayBodyColorInactive; 100 $this->cb->SetFillColor($color['R'], $color['G'], $color['B']); 101 $this->cb->Cell($this->dayWidth, $this->dayBodyHeight, '', 1, $ln, 'R', 0); 102 } 103 103 } 104 104 } … … 113 113 $this->cb->setFontSize($monthEventFontSize); 114 114 115 $this->cb->SetFillColor($this->eventColor['R'], $this->eventColor['G'], $this->eventColor['B']); 115 $this->cb->SetFillColor($this->eventColor['R'], $this->eventColor['G'], $this->eventColor['B']); 116 116 // initial value for footnote number 117 117 $footNum = 0; … … 204 204 $x = $this->offsetLeft; 205 205 $y = $this->offsetTop; 206 206 207 207 // variables for checking if events have the same date 208 208 $week = -1; … … 233 233 } 234 234 } 235 235 236 236 $this->cb->MultiCell($this->colWidth, 5, $textTop, 0, 'C', 0, 0, $x, $y); 237 237 $y += $this->cb->getLastH(); … … 276 276 $activeDays = Array(); 277 277 $prevDay = (int) $dayHeader[0][0]; 278 278 279 279 for ($i = 0; $i < count($dayHeader); $i++) { 280 280 for ($j = 0; $j < count($dayHeader[$i]); $j++) { … … 290 290 return $activeDays; 291 291 } 292 293 292 293 294 294 // 295 295 public function drawYear($orientation, $yearValues, $events, $headerHeight, $bgColor, $lineColor, $dayColor, $dayColorInactive, $eventColor, $yearHeaderFontSize, $yearFontSize) { … … 387 387 $this->cb->setFontSize($fontSize); 388 388 389 // sets column 389 // sets column 390 390 $timeColWidth = 50; 391 391 $dscColWidth = $this->cb->getPageWidth() - $this->offsetLeft - $this->offsetRight - $timeColWidth; … … 450 450 $this->cb->setX($this->offsetLeft + $leftWidth); 451 451 $this->cb->setY($this->offsetTop, false); 452 452 453 453 // draws scales on top 454 454 $this->cb->setFontSize($dayHeaderFontSize); … … 496 496 $this->eventColor = $this->convertColor($eventColor); 497 497 $this->eventBorderColor = $this->convertColor($eventBorderColor); 498 498 499 499 $eventHeaderHeight = 4; 500 500 501 501 $this->lineStyle = Array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '0', 'color' => $this->eventBorderColor); 502 502 $this->cb->setLineStyle($this->lineStyle); 503 503 504 504 505 505 // circle for every event … … 520 520 $width = $event['width']*$this->colWidth/100 - $this->colWidth/60; 521 521 $height = $event['height']*$this->colHeight/100; 522 522 523 523 // draws event container 524 524 $this->cb->RoundedRect($x, $y, $width, $height, 1, '1111', 'DF', array(), $this->eventColor); … … 540 540 541 541 542 543 544 /*************************************************************************/ 545 // draws scheduler header in month mode 546 public function drawWeekHeader($orientation, $topScale, $topScaleHeight, $bgColor, $lineColor, $monthHeaderFontSize) { 547 $this->cb->AddPage($orientation); 548 $this->bgColor = $this->convertColor($bgColor); 549 $this->lineColor = $this->convertColor($lineColor); 550 $this->topScaleHeight = $topScaleHeight; 551 $this->topScale = $topScale; 552 553 $this->lineStyle = Array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2', 'color' => $this->lineColor); 554 $this->cb->SetLineStyle($this->lineStyle); 555 $this->cb->SetFillColor($this->bgColor['R'], $this->bgColor['G'], $this->bgColor['B']); 556 $this->cb->SetFontSize($monthHeaderFontSize); 557 558 // calculates day width 559 $this->dayWidth = ($this->cb->getPageWidth() - $this->offsetLeft - $this->offsetRight)/2; 560 // circle: for every column of header draw cell 561 // for ($i = 0; $i < count($topScale); $i++) { 562 // $this->cb->Cell($this->dayWidth, $topScaleHeight, $topScale[$i], 1, 0, 'C', 1); 563 // } 564 } 565 566 567 // draws scheduler grid on month mode 568 public function drawWeekGrid($dayHeader, $dayHeaderHeight, $dayHeaderColor, $dayBodyColor, $dayHeaderColorInactive, $dayBodyColorInactive, $monthDayHeaderFontSize) { 569 570 // sets starting coordinates 571 $this->cb->setX($this->offsetLeft); 572 $this->cb->setY($this->offsetTop + $this->topScaleHeight, false); 573 574 $this->dayHeaderColor = $this->convertColor($dayHeaderColor); 575 $this->dayBodyColor = $this->convertColor($dayBodyColor); 576 $this->dayHeaderColorInactive = $this->convertColor($dayHeaderColorInactive); 577 $this->dayBodyColorInactive = $this->convertColor($dayBodyColorInactive); 578 579 // calculates height of day container header, body and whole height of day container 580 $this->dayHeaderHeight = $dayHeaderHeight; 581 $this->dayHeader = $dayHeader; 582 $this->dayBodyHeight = ($this->cb->getPageHeight() - $this->offsetTop - $this->offsetBottom - $this->topScaleHeight - $this->dayHeaderHeight*count($dayHeader))/count($dayHeader); 583 $this->dayHeight = $this->dayHeaderHeight + $this->dayBodyHeight; 584 585 // sets font size 586 $this->cb->SetFontSize($monthDayHeaderFontSize); 587 // creates array of values where result['week']['day'] is true if day container in current month and false otherwise 588 //$activeDays = $this->setActiveDays($dayHeader); 589 590 // circle for drawing day containers 591 for ($i = 0; $i < count($dayHeader); $i++) { 592 // draws day headers for every cell of row 593 for ($j = 0; $j < 2; $j++) { 594 if($i == 3 && $j == 1){ 595 $ln = ($j == 1) ? 1 : 0; 596 $color = $this->dayHeaderColor ; 597 $this->cb->SetFillColor($color['R'], $color['G'], $color['B']); 598 $this->cb->Cell($this->dayWidth, $this->dayHeaderHeight, '', 1, $ln, 'R', 1); 599 $this->dayEventsHeight[$i][$j] = 0; 600 }else{ 601 $ln = ($j == 1) ? 1 : 0; 602 $color = $this->dayHeaderColor ; 603 $this->cb->SetFillColor($color['R'], $color['G'], $color['B']); 604 $this->cb->Cell($this->dayWidth, $this->dayHeaderHeight, $dayHeader[$i][$j], 1, $ln, 'R', 1); 605 $this->dayEventsHeight[$i][$j] = 0; 606 607 } 608 609 610 } 611 // draws day body for every cell of row 612 for ($j = 0; $j < 2; $j++) { 613 $ln = ($j == 1) ? 1 : 0; 614 $color = $this->dayBodyColor ; 615 $this->cb->SetFillColor($color['R'], $color['G'], $color['B']); 616 $this->cb->Cell($this->dayWidth, $this->dayBodyHeight, '', 1, $ln, 'R', 0); 617 618 } 619 620 } 621 } 622 623 624 625 // draws events in month mode 626 public function drawWeekEvents($events, $eventColor, $eventBorderColor, $monthEventFontSize, $mode, $offset = 1, $offsetLine = 6) { 627 $this->eventColor = $this->convertColor($eventColor); 628 $this->eventBorderColor = $this->convertColor($eventBorderColor); 629 $this->events = $events; 630 631 $this->cb->setFontSize($monthEventFontSize); 632 633 $this->cb->SetFillColor($this->eventColor['R'], $this->eventColor['G'], $this->eventColor['B']); 634 // initial value for footnote number 635 $footNum = 0; 636 // initial values for checking if in some day footenote has already drawed 637 $day = -1; 638 $week = -1; 639 640 // circle for drawing every event 641 foreach ($this->events as $i => $event) { 642 //$event = $this->events[$i]; 643 644 if($event['week'] == 3 && $event['day'] > 0) 645 continue; 646 // $event['week'] = $event['week'] -1; 647 // calculation x-, y- positions, width and height of event 648 $x = $this->offsetLeft + $event['day']*$this->dayWidth; 649 $y = $this->offsetTop + $this->topScaleHeight + $event['week']*$this->dayHeight + $this->dayHeaderHeight + $this->dayEventsHeight[$event['week']][$event['day']]; 650 if ($event['type'] == 'event_line') { 651 $width = $event['width']*$this->dayWidth/100; 652 $x += 1.5; 653 } else { 654 $width = $this->dayWidth - 1; 655 } 656 $height = 4; 657 658 $this->cb->setX($x); 659 $this->cb->setY($y, false); 660 661 // checks if event can be drawed in day container 662 // if ($y + $height > ($this->offsetTop + $this->topScaleHeight + ($event['week'] + 1)*$this->dayHeight)) { 663 // // checks if footenote hasn't already drawed for current day and week values 664 // if (!(($week == $event['week'])&&($day == $event['day']))) { 665 // $footNum++; 666 // $x1Line = $this->offsetLeft + $this->dayWidth*($event['day'] + 1); 667 // $x2Line = $x1Line - $offsetLine; 668 // $y1Line = $this->offsetTop + $this->topScaleHeight + $this->dayHeight*($event['week'] + 1) - $offsetLine; 669 // $y2Line = $this->offsetTop + $this->topScaleHeight + $this->dayHeight*($event['week'] + 1); 670 // $this->lineStyle = Array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2', 'color' => $this->lineColor); 671 // $this->cb->SetLineStyle($this->lineStyle); 672 // $this->cb->Line($x1Line, $y1Line, $x2Line, $y2Line); 673 // $textWidth = $this->cb->getStringWidth($footNum); 674 // $xText = $x1Line - $textWidth - 0.5; 675 // $yText = $y2Line - 0.6; 676 // 677 // $day = $event['day']; 678 // $week = $event['week']; 679 // $this->cb->Text($xText, $yText, $footNum); 680 // } 681 // // sets variable which means that this event will print in footenotes 682 // $this->events[$i]['foot'] = true; 683 // } else { 684 // draws event in current day 685 $this->lineStyle = Array('width' => 0.3, 'cap' => 'round', 'join' => 'round', 'dash' => '0', 'color' => $this->eventBorderColor); 686 $this->cb->SetLineStyle($this->lineStyle); 687 $text = $this->textWrap($event['text'], $width, $monthEventFontSize); 688 689 // sets event color 690 $color = $this->processEventColor($event['color']); 691 if (($color == 'transparent')||($mode !== 'color')) { 692 $this->cb->SetFillColor($this->eventColor['R'], $this->eventColor['G'], $this->eventColor['B']); 693 } else { 694 $color = $this->convertColor($color); 695 $this->cb->SetFillColor($color['R'], $color['G'], $color['B']); 696 } 697 698 if ($event['type'] == 'event_clear') { 699 $this->cb->Cell($width, $height, $text, 0, 0, 'L', 0); 700 } else { 701 $this->cb->Cell($width, $height, $text, 1, 0, 'L', 1); 702 } 703 for ($j = $event['day']; ($j < $event['day'] + ceil($width/$this->dayWidth))&&($j < 7); $j++) { 704 if ($event['week'] < count($this->dayHeader)) { 705 $this->dayEventsHeight[$event['week']][$j] += $height + $offset; 706 } 707 } 708 $this->events[$i]['foot'] = false; 709 // } 710 //} 711 // draws footenotes 712 // if ($footNum > 0) { 713 // $this->drawMonthFootenotes(); 714 } 715 } 716 717 /*********************************************/ 718 719 720 721 722 542 723 // draws today value 543 724 public function drawToday($today, $todayFontSize) { … … 584 765 return $final; 585 766 } 586 587 767 768 588 769 // convert event color ot RGB-format 589 770 private function processEventColor($color) { … … 596 777 } 597 778 $result = preg_match_all("/rgb\s?\((\d{1,3})\s?,\s?(\d{1,3})\s?,\s?(\d{1,3})\)/", $color, $rgb); 598 779 599 780 if ($result) { 600 781 $color = ''; … … 612 793 } 613 794 795 796 797 798 799 800 801 614 802 } 615 803 -
branches/2.2.0.1/calendar/js/dhtmlx/sources/ext/ext_pdf.js
r4001 r4049 1 scheduler.toPDF=function(url,mode,header,footer){ 1 scheduler.toPDF=function(url,mode,header,footer){ 2 2 var dx = 0; 3 3 var dy = 0; … … 7 7 mode = "color"; 8 8 } 9 9 10 10 mode = mode||"color"; 11 11 12 12 function x_norm(x) { 13 13 x = parseFloat(x); … … 27 27 return xml; 28 28 } 29 function de_day(node,n){ 29 function de_day(node,n){ 30 30 var x = parseInt(node.style.left); 31 31 32 32 for (var dx=0; dx < scheduler._cols.length; dx++){ 33 33 x-=scheduler._cols[dx]; … … 36 36 return n; 37 37 } 38 function de_week(node,n){ 38 function de_week(node,n){ 39 39 var y = parseInt(node.style.top); 40 40 for (var dy=0; dy < scheduler._colsS.heights.length; dy++) … … 50 50 /* var dd = r[i].cells[j]; 51 51 var css = dd.className; 52 52 53 53 if (css!=" " && css!="dhx_now ") 54 54 days.push(""); … … 70 70 xml+=">"; 71 71 xml += "<scale mode='" + scheduler._mode + "' today='" + scheduler._els.dhx_cal_date[0].innerHTML + "'>"; 72 72 73 73 if (scheduler._mode == "agenda"){ 74 74 var xh = scheduler._els.dhx_cal_header[0].childNodes[0].childNodes; 75 75 76 76 xml+="<column>"+xh[0].innerHTML+"</column><column>"+xh[1].innerHTML+"</column>" 77 77 } else if (scheduler._mode == "year"){ … … 88 88 xml+=xml_month_scale(xh); 89 89 xml += "</x>"; 90 90 91 91 var yh = scheduler._els.dhx_cal_data[0]; 92 92 if (yh.firstChild.tagName == "TABLE") { … … 97 97 yh = yh.previousSibling; 98 98 yh = yh.childNodes; 99 99 100 100 xml += "<y>"; 101 101 for (var i = 0; i < yh.length; i++) … … 105 105 } 106 106 } 107 107 108 108 xml += "</scale>"; 109 109 return xml; … … 112 112 return (window.getComputedStyle?(window.getComputedStyle(node, null)[style]):(node.currentStyle?node.currentStyle[style]:null))||""; 113 113 } 114 function xml_body() { 114 function xml_body() { 115 115 var xml = ""; 116 116 var evs = scheduler._rendered; 117 117 118 118 if (scheduler._mode == "agenda"){ 119 119 for (var i=0; i < evs.length; i++) … … 123 123 for (var i=0; i < evs.length; i++) { 124 124 var d = evs[i].start_date; 125 if (d.valueOf()<scheduler._min_date.valueOf()) 125 if (d.valueOf()<scheduler._min_date.valueOf()) 126 126 d = scheduler._min_date; 127 127 while (d<evs[i].end_date){ 128 var m = d.getMonth()+12*(d.getFullYear()-scheduler._min_date.getFullYear())-scheduler.week_starts._month; 128 var m = d.getMonth()+12*(d.getFullYear()-scheduler._min_date.getFullYear())-scheduler.week_starts._month; 129 129 var day = scheduler.week_starts[m]+d.getDate()-1; 130 130 … … 132 132 scheduler._mark_year_date(d); 133 133 d = scheduler.date.add(d,1,"day"); 134 if (d.valueOf()>=scheduler._max_date.valueOf()) 134 if (d.valueOf()>=scheduler._max_date.valueOf()) 135 135 break; 136 136 } 137 } 137 } 138 138 } else { 139 139 for (var i = 0; i < evs.length; i++) { … … 146 146 var day = dets._sday; 147 147 var week = dets._sweek; 148 if (scheduler._mode != "month" ) {148 if (scheduler._mode != "month" && scheduler._mode != "week") { 149 149 if (parseInt(evs[i].style.left) <= 26) { 150 150 zx = 2; 151 151 zdx += x_norm(evs[i].style.left)-1; 152 } 152 } 153 153 if (evs[i].parentNode == scheduler._els.dhx_cal_data[0]) continue; 154 154 zx += x_norm(evs[i].parentNode.style.left); … … 157 157 zdy = parseInt(evs[i].offsetHeight); 158 158 zy = parseInt(evs[i].style.top) - 22; 159 160 day = de_day(evs[i],day); 161 week = de_week(evs[i],week); 159 if(scheduler._mode == "month" ){ 160 day = de_day(evs[i],day); 161 week = de_week(evs[i],week); 162 } 162 163 } 163 164 164 165 xml += "\n<event week='"+week+"' day='"+day+"' type='" + e_type + "' x='" + zx + "' y='" + zy + "' width='" + zdx + "' height='" + zdy + "'>"; 165 166 166 167 167 168 if (e_type == "event") { 168 169 xml += "<header><![CDATA[" + evs[i].childNodes[1].innerHTML + "]]></header>"; … … 184 185 return xml; 185 186 } 186 187 187 188 var uid = (new Date()).valueOf(); 188 189 var d=document.createElement("div"); … … 193 194 document.getElementById(uid).firstChild.value = xml_top(mode).replace("\u2013", "-") + xml_body() + xml_end(); 194 195 document.getElementById(uid).submit(); 195 d.parentNode.removeChild(d);grid = null; 196 } 196 d.parentNode.removeChild(d);grid = null; 197 }
Note: See TracChangeset
for help on using the changeset viewer.