| @@ -21,9 +21,8 @@ | ||
| 21 | 21 | |
| 22 | 22 | SH4_Shifts_Duration $shiftsDuration, |
| 23 | 23 | SH4_Schedule_Html_View_Week $viewWeek, |
| 24 | 24 | SH4_Shifts_View_Widget $widget, |
| 25 | - SH4_Calendars_Query $calendarsQuery, | |
| 26 | 25 | SH4_Calendars_Presenter $calendarsPresenter, |
| 27 | 26 | SH4_Employees_Presenter $employeesPresenter, |
| 28 | 27 | SH4_Schedule_Html_View_Common $common, |
| 29 | 28 | SH4_Shifts_View_Common $shiftsCommon |
| @@ -41,9 +40,8 @@ | ||
| 41 | 40 | $this->newAcl = $hooks->wrap( $newAcl ); |
| 42 | 41 | |
| 43 | 42 | $this->viewWeek = $hooks->wrap( $viewWeek ); |
| 44 | 43 | $this->shiftsDuration = $hooks->wrap( $shiftsDuration ); |
| 45 | - $this->calendarsQuery = $hooks->wrap( $calendarsQuery ); | |
| 46 | 44 | $this->calendarsPresenter = $hooks->wrap( $calendarsPresenter ); |
| 47 | 45 | $this->employeesPresenter = $hooks->wrap( $employeesPresenter ); |
| 48 | 46 | |
| 49 | 47 | $this->widget = $hooks->wrap( $widget ); |
| @@ -126,12 +124,10 @@ | ||
| 126 | 124 | $rexDate = $this->t->formatDateDb(); |
| 127 | 125 | } |
| 128 | 126 | } |
| 129 | 127 | |
| 130 | - $daysInWeek = $this->settings->get('datetime_days_in_week'); | |
| 131 | - if (!$daysInWeek) $daysInWeek = 7; | |
| 132 | - $this->t->setDateDb( $startDate ); | |
| 133 | - $monthMatrix = $this->t->getMonthMatrix($disabledWeekdays, $daysInWeek); | |
| 128 | + $this->t->setDateDb( $startDate ); | |
| 129 | + $monthMatrix = $this->t->getMonthMatrix( $disabledWeekdays ); | |
| 134 | 130 | |
| 135 | 131 | $rows = array(); |
| 136 | 132 | foreach( $monthMatrix as $week => $days ){ |
| 137 | 133 | $row = array(); |
| @@ -378,22 +374,8 @@ | ||
| 378 | 374 | // $header[] = NULL; |
| 379 | 375 | // } |
| 380 | 376 | |
| 381 | 377 | $rows = array(); |
| 382 | - | |
| 383 | -// link templates to speed things up | |
| 384 | -$toParams = array( | |
| 385 | - 'calendar' => '{CID}', | |
| 386 | - 'date' => '{DATE}' | |
| 387 | -); | |
| 388 | -$thisTo = 'new/calendar'; | |
| 389 | -$thisTo = array( $thisTo, $toParams ); | |
| 390 | -$thisHref = $this->uri->makeUrl( $thisTo ); | |
| 391 | - | |
| 392 | -$linkTemplateShift = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center" href="' . $thisHref . '">+</a>'; | |
| 393 | -$linkTemplateShiftMuted = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center hc-muted3" href="' . $thisHref . '">+</a>'; | |
| 394 | -$isPrintView = $this->request->isPrintView(); | |
| 395 | - | |
| 396 | 378 | foreach( $viewCalendars as $id => $calendarView ){ |
| 397 | 379 | $row = array(); |
| 398 | 380 | |
| 399 | 381 | $this->shiftsDuration->reset(); |
| @@ -464,12 +446,9 @@ | ||
| 464 | 446 | } |
| 465 | 447 | } |
| 466 | 448 | } |
| 467 | 449 | |
| 468 | - if( $isPrintView ) $addOk = false; | |
| 469 | - | |
| 470 | 450 | if( $addOk ){ |
| 471 | -/* | |
| 472 | 451 | $link = $this->ui->makeAhref( $to, $label ) |
| 473 | 452 | ->tag('tab-link') |
| 474 | 453 | ->tag('align', 'center') |
| 475 | 454 | ->addAttr('title', '__Add New__') |
| @@ -477,17 +456,9 @@ | ||
| 477 | 456 | |
| 478 | 457 | if( $today > $date ){ |
| 479 | 458 | $link->tag('muted', 3); |
| 480 | 459 | } |
| 481 | -*/ | |
| 482 | 460 | |
| 483 | - if( $today > $date ){ | |
| 484 | - $link = str_replace( array('{CID}', '{DATE}'), array($id, $date), $linkTemplateShiftMuted ); | |
| 485 | - } | |
| 486 | - else { | |
| 487 | - $link = str_replace( array('{CID}', '{DATE}'), array($id, $date), $linkTemplateShift ); | |
| 488 | - } | |
| 489 | - | |
| 490 | 461 | $cell[] = $link; |
| 491 | 462 | } |
| 492 | 463 | |
| 493 | 464 | $cell = $this->ui->makeList( $cell ) |
| @@ -594,19 +565,14 @@ | ||
| 594 | 565 | |
| 595 | 566 | $viewEmployees = array(); |
| 596 | 567 | foreach( $employees as $employee ){ |
| 597 | 568 | $label = $this->employeesPresenter->presentTitle( $employee ); |
| 569 | + | |
| 598 | 570 | $title = htmlspecialchars( $label ); |
| 599 | - | |
| 600 | 571 | $description = $employee->getDescription(); |
| 601 | 572 | if( strlen($description) ){ |
| 602 | - $imgpos = strpos( $description, '<img' ); | |
| 603 | - if( false !== $imgpos ){ | |
| 604 | - $label = $this->ui->makeList( array($label, $description) ); | |
| 605 | - } | |
| 606 | - else { | |
| 607 | - $title .= "\n" . htmlspecialchars( $description ); | |
| 608 | - } | |
| 573 | + $description = htmlspecialchars( $description ); | |
| 574 | + $title .= "\n" . $description; | |
| 609 | 575 | } |
| 610 | 576 | |
| 611 | 577 | $label = $this->ui->makeSpan( $label ) |
| 612 | 578 | ->tag( 'font-size', 4 ) |
| @@ -692,22 +658,8 @@ | ||
| 692 | 658 | // $header[] = NULL; |
| 693 | 659 | // } |
| 694 | 660 | |
| 695 | 661 | $rows = array(); |
| 696 | - | |
| 697 | -// link templates to speed things up | |
| 698 | -$toParams = array( | |
| 699 | - 'employee' => '{EID}', | |
| 700 | - 'date' => '{DATE}' | |
| 701 | -); | |
| 702 | -$thisTo = 'new'; | |
| 703 | -$thisTo = array( $thisTo, $toParams ); | |
| 704 | -$thisHref = $this->uri->makeUrl( $thisTo ); | |
| 705 | - | |
| 706 | -$linkTemplateShift = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center" href="' . $thisHref . '">+</a>'; | |
| 707 | -$linkTemplateShiftMuted = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center hc-muted3" href="' . $thisHref . '">+</a>'; | |
| 708 | -$isPrintView = $this->request->isPrintView(); | |
| 709 | - | |
| 710 | 662 | foreach( $viewEmployees as $id => $employeeView ){ |
| 711 | 663 | $row = array(); |
| 712 | 664 | |
| 713 | 665 | $this->shiftsDuration->reset(); |
| @@ -758,9 +710,8 @@ | ||
| 758 | 710 | } |
| 759 | 711 | |
| 760 | 712 | $comboId = 0 . '-' . $id; |
| 761 | 713 | if( isset($this->allCombos[$comboId]) ){ |
| 762 | -/* | |
| 763 | 714 | $label = '+'; |
| 764 | 715 | |
| 765 | 716 | $to = 'new'; |
| 766 | 717 | $toParams = array( |
| @@ -777,19 +728,10 @@ | ||
| 777 | 728 | |
| 778 | 729 | if( $today > $date ){ |
| 779 | 730 | $link->tag('muted', 3); |
| 780 | 731 | } |
| 781 | -*/ | |
| 782 | - if( $today > $date ){ | |
| 783 | - $link = str_replace( array('{EID}', '{DATE}'), array($id, $date), $linkTemplateShiftMuted ); | |
| 784 | - } | |
| 785 | - else { | |
| 786 | - $link = str_replace( array('{EID}', '{DATE}'), array($id, $date), $linkTemplateShift ); | |
| 787 | - } | |
| 788 | 732 | |
| 789 | - if( ! $isPrintView ){ | |
| 790 | - $cell[] = $link; | |
| 791 | - } | |
| 733 | + $cell[] = $link; | |
| 792 | 734 | } |
| 793 | 735 | |
| 794 | 736 | $cell = $this->ui->makeList( $cell ) |
| 795 | 737 | ->gutter(1) |
| @@ -802,109 +744,8 @@ | ||
| 802 | 744 | // while( count($row) < 32 ){ |
| 803 | 745 | // $row[] = NULL; |
| 804 | 746 | // } |
| 805 | 747 | $rows[] = $row; |
| 806 | - } | |
| 807 | - | |
| 808 | - /* append calendars summary */ | |
| 809 | - $appendCalendars = $this->settings->get('datetime_summary_by_calendar'); | |
| 810 | - if( $appendCalendars && $shifts ){ | |
| 811 | - $calendarIds = array(); | |
| 812 | - foreach( $shifts as $shift ){ | |
| 813 | - $calendar = $shift->getCalendar(); | |
| 814 | - $calendarId = $calendar ? $calendar->getId() : 0; | |
| 815 | - if( ! $calendarId ) continue; | |
| 816 | - $calendarIds[ $calendarId ] = $calendarId; | |
| 817 | - } | |
| 818 | - | |
| 819 | - $calendars = $this->calendarsQuery->findManyById( $calendarIds ); | |
| 820 | - | |
| 821 | - $shiftsByCalendar = $shiftsByDate = array(); | |
| 822 | - foreach( $shifts as $shift ){ | |
| 823 | - $thisCalendar = $shift->getCalendar(); | |
| 824 | - if( ! $thisCalendar ) continue; | |
| 825 | - $shiftId = $shift->getId(); | |
| 826 | - $thisCalendarId = $thisCalendar->getId(); | |
| 827 | - $shiftsByCalendar[ $thisCalendarId ][ $shiftId ] = $shift; | |
| 828 | - | |
| 829 | - $start = $shift->getStart(); | |
| 830 | - $end = $shift->getEnd(); | |
| 831 | - | |
| 832 | - $startDayTime = substr($start, 8, 4); | |
| 833 | - $endDayTime = substr($end, 8, 4); | |
| 834 | - $shiftAllDay = ( (0 == $startDayTime) && (0 == $endDayTime) ) ? TRUE : FALSE; | |
| 835 | - | |
| 836 | - $this->t->setDateTimeDb( $end )->modify('-1 second'); | |
| 837 | - $shiftEndDate = $this->t->formatDateDb(); | |
| 838 | - | |
| 839 | - $this->t->setDateTimeDb( $start ); | |
| 840 | - $shiftStartDate = $this->t->formatDateDb(); | |
| 841 | - | |
| 842 | - $rexDate = $shiftStartDate; | |
| 843 | - while( $rexDate <= $shiftEndDate ){ | |
| 844 | - if( in_array($rexDate, $dates) ){ | |
| 845 | - $shiftsByDate[ $rexDate ][ $shiftId ] = $shift; | |
| 846 | - } | |
| 847 | - | |
| 848 | - if( ! $shiftAllDay ){ | |
| 849 | - break; | |
| 850 | - } | |
| 851 | - $this->t->modify( '+1 day' ); | |
| 852 | - $rexDate = $this->t->formatDateDb(); | |
| 853 | - } | |
| 854 | - } | |
| 855 | - | |
| 856 | - foreach( $calendars as $calendarId => $calendar ){ | |
| 857 | - $row = array(); | |
| 858 | - | |
| 859 | - $calendarView = $this->calendarsPresenter->presentTitle( $calendar ); | |
| 860 | - $title = htmlspecialchars( $calendar->getTitle() ); | |
| 861 | - $calendarView = $this->ui->makeSpan( $calendarView ) | |
| 862 | - ->addAttr( 'title', $title ) | |
| 863 | - ; | |
| 864 | - | |
| 865 | - $this->shiftsDuration->reset(); | |
| 866 | - foreach( $shiftsByCalendar[$calendarId] as $shift ){ | |
| 867 | - $this->shiftsDuration->add( $shift ); | |
| 868 | - } | |
| 869 | - | |
| 870 | - $outReport = $this->common->renderReport( $this->shiftsDuration, false, true ); | |
| 871 | - $outReport = $this->ui->makeSpan( $outReport ) | |
| 872 | - ->tag('font-size', 2) | |
| 873 | - ; | |
| 874 | - $calendarView = $this->ui->makeList( array($calendarView, $outReport) ) | |
| 875 | - ->gutter(1) | |
| 876 | - ; | |
| 877 | - | |
| 878 | - $calendarView = $this->ui->makeBlock( $calendarView ) | |
| 879 | - ->tag('padding', 2) | |
| 880 | - ->tag('nowrap') | |
| 881 | - ; | |
| 882 | - $row[] = $calendarView; | |
| 883 | - | |
| 884 | - foreach( $dates as $date ){ | |
| 885 | - $cell = ''; | |
| 886 | - if( isset($shiftsByDate[$date]) ){ | |
| 887 | - $thisShifts = array_intersect_key( $shiftsByDate[$date], $shiftsByCalendar[$calendarId] ); | |
| 888 | - if( $thisShifts ){ | |
| 889 | - $this->shiftsDuration->reset(); | |
| 890 | - foreach( $thisShifts as $shift ){ | |
| 891 | - $this->shiftsDuration->add( $shift ); | |
| 892 | - } | |
| 893 | - $outReport = $this->common->renderReport( $this->shiftsDuration, FALSE ); | |
| 894 | - $outReport = $this->ui->makeSpan( $outReport ) | |
| 895 | - ->tag('font-size', 2) | |
| 896 | - ; | |
| 897 | - $outReport = $this->ui->makeBlock( $outReport ) | |
| 898 | - ->tag('align', 'center') | |
| 899 | - ; | |
| 900 | - $cell = $outReport; | |
| 901 | - } | |
| 902 | - } | |
| 903 | - $row[] = $cell; | |
| 904 | - } | |
| 905 | - $rows[] = $row; | |
| 906 | - } | |
| 907 | 748 | } |
| 908 | 749 | |
| 909 | 750 | $out = $this->ui->makeTable( $header, $rows, false ) |
| 910 | 751 | ->gutter(0) |