| @@ -20,9 +20,8 @@ | ||
| 20 | 20 | |
| 21 | 21 | SH4_Shifts_Duration $shiftsDuration, |
| 22 | 22 | SH4_Schedule_Html_View_Week $viewWeek, |
| 23 | 23 | SH4_Shifts_View_Widget $widget, |
| 24 | - SH4_Calendars_Query $calendarsQuery, | |
| 25 | 24 | SH4_Calendars_Presenter $calendarsPresenter, |
| 26 | 25 | SH4_Employees_Presenter $employeesPresenter, |
| 27 | 26 | SH4_Schedule_Html_View_Common $common, |
| 28 | 27 | SH4_Shifts_View_Common $shiftsCommon |
| @@ -40,9 +39,8 @@ | ||
| 40 | 39 | $this->newAcl = $hooks->wrap( $newAcl ); |
| 41 | 40 | |
| 42 | 41 | $this->viewWeek = $hooks->wrap( $viewWeek ); |
| 43 | 42 | $this->shiftsDuration = $hooks->wrap( $shiftsDuration ); |
| 44 | - $this->calendarsQuery = $hooks->wrap( $calendarsQuery ); | |
| 45 | 43 | $this->calendarsPresenter = $hooks->wrap( $calendarsPresenter ); |
| 46 | 44 | $this->employeesPresenter = $hooks->wrap( $employeesPresenter ); |
| 47 | 45 | |
| 48 | 46 | $this->widget = $hooks->wrap( $widget ); |
| @@ -449,22 +447,8 @@ | ||
| 449 | 447 | // $header[] = NULL; |
| 450 | 448 | // } |
| 451 | 449 | |
| 452 | 450 | $rows = array(); |
| 453 | - | |
| 454 | -// link templates to speed things up | |
| 455 | -$toParams = array( | |
| 456 | - 'calendar' => '{CID}', | |
| 457 | - 'date' => '{DATE}' | |
| 458 | -); | |
| 459 | -$thisTo = 'new/calendar'; | |
| 460 | -$thisTo = array( $thisTo, $toParams ); | |
| 461 | -$thisHref = $this->uri->makeUrl( $thisTo ); | |
| 462 | - | |
| 463 | -$linkTemplateShift = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center" href="' . $thisHref . '">+</a>'; | |
| 464 | -$linkTemplateShiftMuted = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center hc-muted3" href="' . $thisHref . '">+</a>'; | |
| 465 | -$isPrintView = $this->request->isPrintView(); | |
| 466 | - | |
| 467 | 451 | foreach( $viewCalendars as $id => $calendarView ){ |
| 468 | 452 | $row = array(); |
| 469 | 453 | |
| 470 | 454 | $this->shiftsDuration->reset(); |
| @@ -535,12 +519,9 @@ | ||
| 535 | 519 | } |
| 536 | 520 | } |
| 537 | 521 | } |
| 538 | 522 | |
| 539 | - if( $isPrintView ) $addOk = false; | |
| 540 | - | |
| 541 | 523 | if( $addOk ){ |
| 542 | -/* | |
| 543 | 524 | $link = $this->ui->makeAhref( $to, $label ) |
| 544 | 525 | ->tag('tab-link') |
| 545 | 526 | ->tag('align', 'center') |
| 546 | 527 | ->addAttr('title', '__Add New__') |
| @@ -548,15 +529,8 @@ | ||
| 548 | 529 | |
| 549 | 530 | if( $today > $date ){ |
| 550 | 531 | $link->tag('muted', 3); |
| 551 | 532 | } |
| 552 | -*/ | |
| 553 | - if( $today > $date ){ | |
| 554 | - $link = str_replace( array('{CID}', '{DATE}'), array($id, $date), $linkTemplateShiftMuted ); | |
| 555 | - } | |
| 556 | - else { | |
| 557 | - $link = str_replace( array('{CID}', '{DATE}'), array($id, $date), $linkTemplateShift ); | |
| 558 | - } | |
| 559 | 533 | |
| 560 | 534 | $cell[] = $link; |
| 561 | 535 | } |
| 562 | 536 | |
| @@ -657,19 +631,14 @@ | ||
| 657 | 631 | |
| 658 | 632 | $viewEmployees = array(); |
| 659 | 633 | foreach( $employees as $employee ){ |
| 660 | 634 | $label = $this->employeesPresenter->presentTitle( $employee ); |
| 635 | + | |
| 661 | 636 | $title = htmlspecialchars( $label ); |
| 662 | - | |
| 663 | 637 | $description = $employee->getDescription(); |
| 664 | 638 | if( strlen($description) ){ |
| 665 | - $imgpos = strpos( $description, '<img' ); | |
| 666 | - if( false !== $imgpos ){ | |
| 667 | - $label = $this->ui->makeList( array($label, $description) ); | |
| 668 | - } | |
| 669 | - else { | |
| 670 | - $title .= "\n" . htmlspecialchars( $description ); | |
| 671 | - } | |
| 639 | + $description = htmlspecialchars( $description ); | |
| 640 | + $title .= "\n" . $description; | |
| 672 | 641 | } |
| 673 | 642 | |
| 674 | 643 | $label = $this->ui->makeSpan( $label ) |
| 675 | 644 | ->tag( 'font-size', 4 ) |
| @@ -791,21 +760,8 @@ | ||
| 791 | 760 | // } |
| 792 | 761 | |
| 793 | 762 | $rows = array(); |
| 794 | 763 | |
| 795 | -// link templates to speed things up | |
| 796 | -$toParams = array( | |
| 797 | - 'employee' => '{EID}', | |
| 798 | - 'date' => '{DATE}' | |
| 799 | -); | |
| 800 | -$thisTo = 'new'; | |
| 801 | -$thisTo = array( $thisTo, $toParams ); | |
| 802 | -$thisHref = $this->uri->makeUrl( $thisTo ); | |
| 803 | - | |
| 804 | -$linkTemplateShift = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center" href="' . $thisHref . '">+</a>'; | |
| 805 | -$linkTemplateShiftMuted = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center hc-muted3" href="' . $thisHref . '">+</a>'; | |
| 806 | -$isPrintView = $this->request->isPrintView(); | |
| 807 | - | |
| 808 | 764 | foreach( $viewEmployees as $id => $employeeView ){ |
| 809 | 765 | $row = array(); |
| 810 | 766 | |
| 811 | 767 | $this->shiftsDuration->reset(); |
| @@ -857,9 +813,8 @@ | ||
| 857 | 813 | } |
| 858 | 814 | |
| 859 | 815 | $comboId = 0 . '-' . $id; |
| 860 | 816 | if( isset($this->allCombos[$comboId]) ){ |
| 861 | -/* | |
| 862 | 817 | $label = '+'; |
| 863 | 818 | |
| 864 | 819 | $to = 'new'; |
| 865 | 820 | $toParams = array( |
| @@ -876,19 +831,10 @@ | ||
| 876 | 831 | |
| 877 | 832 | if( $today > $date ){ |
| 878 | 833 | $link->tag('muted', 3); |
| 879 | 834 | } |
| 880 | -*/ | |
| 881 | - if( $today > $date ){ | |
| 882 | - $link = str_replace( array('{EID}', '{DATE}'), array($id, $date), $linkTemplateShiftMuted ); | |
| 883 | - } | |
| 884 | - else { | |
| 885 | - $link = str_replace( array('{EID}', '{DATE}'), array($id, $date), $linkTemplateShift ); | |
| 886 | - } | |
| 887 | 835 | |
| 888 | - if( ! $isPrintView ){ | |
| 889 | - $cell[] = $link; | |
| 890 | - } | |
| 836 | + $cell[] = $link; | |
| 891 | 837 | } |
| 892 | 838 | |
| 893 | 839 | $cell = $this->ui->makeList( $cell ) |
| 894 | 840 | ->gutter(1) |
| @@ -901,109 +847,8 @@ | ||
| 901 | 847 | // while( count($row) < 32 ){ |
| 902 | 848 | // $row[] = NULL; |
| 903 | 849 | // } |
| 904 | 850 | $rows[] = $row; |
| 905 | - } | |
| 906 | - | |
| 907 | - /* append calendars summary */ | |
| 908 | - $appendCalendars = $this->settings->get('datetime_summary_by_calendar'); | |
| 909 | - if( $appendCalendars && $shifts ){ | |
| 910 | - $calendarIds = array(); | |
| 911 | - foreach( $shifts as $shift ){ | |
| 912 | - $calendar = $shift->getCalendar(); | |
| 913 | - $calendarId = $calendar ? $calendar->getId() : 0; | |
| 914 | - if( ! $calendarId ) continue; | |
| 915 | - $calendarIds[ $calendarId ] = $calendarId; | |
| 916 | - } | |
| 917 | - | |
| 918 | - $calendars = $this->calendarsQuery->findManyById( $calendarIds ); | |
| 919 | - | |
| 920 | - $shiftsByCalendar = $shiftsByDate = array(); | |
| 921 | - foreach( $shifts as $shift ){ | |
| 922 | - $thisCalendar = $shift->getCalendar(); | |
| 923 | - if( ! $thisCalendar ) continue; | |
| 924 | - $shiftId = $shift->getId(); | |
| 925 | - $thisCalendarId = $thisCalendar->getId(); | |
| 926 | - $shiftsByCalendar[ $thisCalendarId ][ $shiftId ] = $shift; | |
| 927 | - | |
| 928 | - $start = $shift->getStart(); | |
| 929 | - $end = $shift->getEnd(); | |
| 930 | - | |
| 931 | - $startDayTime = substr($start, 8, 4); | |
| 932 | - $endDayTime = substr($end, 8, 4); | |
| 933 | - $shiftAllDay = ( (0 == $startDayTime) && (0 == $endDayTime) ) ? TRUE : FALSE; | |
| 934 | - | |
| 935 | - $this->t->setDateTimeDb( $end )->modify('-1 second'); | |
| 936 | - $shiftEndDate = $this->t->formatDateDb(); | |
| 937 | - | |
| 938 | - $this->t->setDateTimeDb( $start ); | |
| 939 | - $shiftStartDate = $this->t->formatDateDb(); | |
| 940 | - | |
| 941 | - $rexDate = $shiftStartDate; | |
| 942 | - while( $rexDate <= $shiftEndDate ){ | |
| 943 | - if( in_array($rexDate, $dates) ){ | |
| 944 | - $shiftsByDate[ $rexDate ][ $shiftId ] = $shift; | |
| 945 | - } | |
| 946 | - | |
| 947 | - if( ! $shiftAllDay ){ | |
| 948 | - break; | |
| 949 | - } | |
| 950 | - $this->t->modify( '+1 day' ); | |
| 951 | - $rexDate = $this->t->formatDateDb(); | |
| 952 | - } | |
| 953 | - } | |
| 954 | - | |
| 955 | - foreach( $calendars as $calendarId => $calendar ){ | |
| 956 | - $row = array(); | |
| 957 | - | |
| 958 | - $calendarView = $this->calendarsPresenter->presentTitle( $calendar ); | |
| 959 | - $title = htmlspecialchars( $calendar->getTitle() ); | |
| 960 | - $calendarView = $this->ui->makeSpan( $calendarView ) | |
| 961 | - ->addAttr( 'title', $title ) | |
| 962 | - ; | |
| 963 | - | |
| 964 | - $this->shiftsDuration->reset(); | |
| 965 | - foreach( $shiftsByCalendar[$calendarId] as $shift ){ | |
| 966 | - $this->shiftsDuration->add( $shift ); | |
| 967 | - } | |
| 968 | - | |
| 969 | - $outReport = $this->common->renderReport( $this->shiftsDuration, FALSE ); | |
| 970 | - $outReport = $this->ui->makeSpan( $outReport ) | |
| 971 | - ->tag('font-size', 2) | |
| 972 | - ; | |
| 973 | - $calendarView = $this->ui->makeList( array($calendarView, $outReport) ) | |
| 974 | - ->gutter(1) | |
| 975 | - ; | |
| 976 | - | |
| 977 | - $calendarView = $this->ui->makeBlock( $calendarView ) | |
| 978 | - ->tag('padding', 2) | |
| 979 | - ->tag('nowrap') | |
| 980 | - ; | |
| 981 | - $row[] = $calendarView; | |
| 982 | - | |
| 983 | - foreach( $dates as $date ){ | |
| 984 | - $cell = ''; | |
| 985 | - if( isset($shiftsByDate[$date]) ){ | |
| 986 | - $thisShifts = array_intersect_key( $shiftsByDate[$date], $shiftsByCalendar[$calendarId] ); | |
| 987 | - if( $thisShifts ){ | |
| 988 | - $this->shiftsDuration->reset(); | |
| 989 | - foreach( $thisShifts as $shift ){ | |
| 990 | - $this->shiftsDuration->add( $shift ); | |
| 991 | - } | |
| 992 | - $outReport = $this->common->renderReport( $this->shiftsDuration, false, true ); | |
| 993 | - $outReport = $this->ui->makeSpan( $outReport ) | |
| 994 | - ->tag('font-size', 2) | |
| 995 | - ; | |
| 996 | - $outReport = $this->ui->makeBlock( $outReport ) | |
| 997 | - ->tag('align', 'center') | |
| 998 | - ; | |
| 999 | - $cell = $outReport; | |
| 1000 | - } | |
| 1001 | - } | |
| 1002 | - $row[] = $cell; | |
| 1003 | - } | |
| 1004 | - $rows[] = $row; | |
| 1005 | - } | |
| 1006 | 851 | } |
| 1007 | 852 | |
| 1008 | 853 | $out = $this->ui->makeTable( $header, $rows, FALSE ) |
| 1009 | 854 | ->gutter(0) |