| @@ -23,9 +23,8 @@ | ||
| 23 | 23 | SH4_Shifts_Duration $shiftsDuration, |
| 24 | 24 | SH4_Schedule_Html_View_Week $viewWeek, |
| 25 | 25 | SH4_Schedule_Html_View_Month $viewMonth, |
| 26 | 26 | SH4_Shifts_View_Widget $widget, |
| 27 | - SH4_Calendars_Query $calendarsQuery, | |
| 28 | 27 | SH4_Calendars_Presenter $calendarsPresenter, |
| 29 | 28 | SH4_Employees_Presenter $employeesPresenter, |
| 30 | 29 | SH4_Schedule_Html_View_Common $common, |
| 31 | 30 | SH4_Shifts_View_Common $shiftsCommon |
| @@ -44,9 +43,8 @@ | ||
| 44 | 43 | |
| 45 | 44 | $this->viewWeek = $hooks->wrap( $viewWeek ); |
| 46 | 45 | $this->viewMonth = $hooks->wrap( $viewMonth ); |
| 47 | 46 | $this->shiftsDuration = $hooks->wrap( $shiftsDuration ); |
| 48 | - $this->calendarsQuery = $hooks->wrap( $calendarsQuery ); | |
| 49 | 47 | $this->calendarsPresenter = $hooks->wrap( $calendarsPresenter ); |
| 50 | 48 | $this->employeesPresenter = $hooks->wrap( $employeesPresenter ); |
| 51 | 49 | |
| 52 | 50 | $this->widget = $hooks->wrap( $widget ); |
| @@ -385,22 +383,8 @@ | ||
| 385 | 383 | // $header[] = NULL; |
| 386 | 384 | // } |
| 387 | 385 | |
| 388 | 386 | $rows = array(); |
| 389 | - | |
| 390 | -// link templates to speed things up | |
| 391 | -$toParams = array( | |
| 392 | - 'calendar' => '{CID}', | |
| 393 | - 'date' => '{DATE}' | |
| 394 | -); | |
| 395 | -$thisTo = 'new'; | |
| 396 | -$thisTo = array( $thisTo, $toParams ); | |
| 397 | -$thisHref = $this->uri->makeUrl( $thisTo ); | |
| 398 | - | |
| 399 | -$linkTemplateShift = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center" href="' . $thisHref . '">+</a>'; | |
| 400 | -$linkTemplateShiftMuted = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center hc-muted3" href="' . $thisHref . '">+</a>'; | |
| 401 | -$isPrintView = $this->request->isPrintView(); | |
| 402 | - | |
| 403 | 387 | foreach( $viewCalendars as $id => $calendarView ){ |
| 404 | 388 | $row = array(); |
| 405 | 389 | |
| 406 | 390 | $this->shiftsDuration->reset(); |
| @@ -471,12 +455,9 @@ | ||
| 471 | 455 | } |
| 472 | 456 | } |
| 473 | 457 | } |
| 474 | 458 | |
| 475 | - if( $isPrintView ) $addOk = false; | |
| 476 | - | |
| 477 | 459 | if( $addOk ){ |
| 478 | -/* | |
| 479 | 460 | $link = $this->ui->makeAhref( $to, $label ) |
| 480 | 461 | ->tag('tab-link') |
| 481 | 462 | ->tag('align', 'center') |
| 482 | 463 | ->addAttr('title', '__Add New__') |
| @@ -484,15 +465,8 @@ | ||
| 484 | 465 | |
| 485 | 466 | if( $today > $date ){ |
| 486 | 467 | $link->tag('muted', 3); |
| 487 | 468 | } |
| 488 | -*/ | |
| 489 | - if( $today > $date ){ | |
| 490 | - $link = str_replace( array('{CID}', '{DATE}'), array($id, $date), $linkTemplateShiftMuted ); | |
| 491 | - } | |
| 492 | - else { | |
| 493 | - $link = str_replace( array('{CID}', '{DATE}'), array($id, $date), $linkTemplateShift ); | |
| 494 | - } | |
| 495 | 469 | |
| 496 | 470 | $cell[] = $link; |
| 497 | 471 | } |
| 498 | 472 | |
| @@ -598,19 +572,14 @@ | ||
| 598 | 572 | |
| 599 | 573 | $viewEmployees = array(); |
| 600 | 574 | foreach( $employees as $employee ){ |
| 601 | 575 | $label = $this->employeesPresenter->presentTitle( $employee ); |
| 576 | + | |
| 602 | 577 | $title = htmlspecialchars( $label ); |
| 603 | - | |
| 604 | 578 | $description = $employee->getDescription(); |
| 605 | 579 | if( strlen($description) ){ |
| 606 | - $imgpos = strpos( $description, '<img' ); | |
| 607 | - if( false !== $imgpos ){ | |
| 608 | - $label = $this->ui->makeList( array($label, $description) ); | |
| 609 | - } | |
| 610 | - else { | |
| 611 | - $title .= "\n" . htmlspecialchars( $description ); | |
| 612 | - } | |
| 580 | + $description = htmlspecialchars( $description ); | |
| 581 | + $title .= "\n" . $description; | |
| 613 | 582 | } |
| 614 | 583 | |
| 615 | 584 | $label = $this->ui->makeSpan( $label ) |
| 616 | 585 | ->tag( 'font-size', 4 ) |
| @@ -698,22 +667,8 @@ | ||
| 698 | 667 | // $header[] = NULL; |
| 699 | 668 | // } |
| 700 | 669 | |
| 701 | 670 | $rows = array(); |
| 702 | - | |
| 703 | -// link templates to speed things up | |
| 704 | -$toParams = array( | |
| 705 | - 'employee' => '{EID}', | |
| 706 | - 'date' => '{DATE}' | |
| 707 | -); | |
| 708 | -$thisTo = 'new'; | |
| 709 | -$thisTo = array( $thisTo, $toParams ); | |
| 710 | -$thisHref = $this->uri->makeUrl( $thisTo ); | |
| 711 | - | |
| 712 | -$linkTemplateShift = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center" href="' . $thisHref . '">+</a>'; | |
| 713 | -$linkTemplateShiftMuted = '<a title="__Add New__" class="hc-block hc-theme-tab-link hc-align-center hc-muted3" href="' . $thisHref . '">+</a>'; | |
| 714 | -$isPrintView = $this->request->isPrintView(); | |
| 715 | - | |
| 716 | 671 | foreach( $viewEmployees as $id => $employeeView ){ |
| 717 | 672 | $row = array(); |
| 718 | 673 | |
| 719 | 674 | $this->shiftsDuration->reset(); |
| @@ -765,9 +720,8 @@ | ||
| 765 | 720 | } |
| 766 | 721 | |
| 767 | 722 | $comboId = 0 . '-' . $id; |
| 768 | 723 | if( isset($this->allCombos[$comboId]) ){ |
| 769 | -/* | |
| 770 | 724 | $label = '+'; |
| 771 | 725 | |
| 772 | 726 | $to = 'new'; |
| 773 | 727 | $toParams = array( |
| @@ -784,19 +738,10 @@ | ||
| 784 | 738 | |
| 785 | 739 | if( $today > $date ){ |
| 786 | 740 | $link->tag('muted', 3); |
| 787 | 741 | } |
| 788 | -*/ | |
| 789 | - if( $today > $date ){ | |
| 790 | - $link = str_replace( array('{EID}', '{DATE}'), array($id, $date), $linkTemplateShiftMuted ); | |
| 791 | - } | |
| 792 | - else { | |
| 793 | - $link = str_replace( array('{EID}', '{DATE}'), array($id, $date), $linkTemplateShift ); | |
| 794 | - } | |
| 795 | 742 | |
| 796 | - if( ! $isPrintView ){ | |
| 797 | - $cell[] = $link; | |
| 798 | - } | |
| 743 | + $cell[] = $link; | |
| 799 | 744 | } |
| 800 | 745 | |
| 801 | 746 | $cell = $this->ui->makeList( $cell ) |
| 802 | 747 | ->gutter(1) |
| @@ -809,109 +754,8 @@ | ||
| 809 | 754 | // while( count($row) < 32 ){ |
| 810 | 755 | // $row[] = NULL; |
| 811 | 756 | // } |
| 812 | 757 | $rows[] = $row; |
| 813 | - } | |
| 814 | - | |
| 815 | - /* append calendars summary */ | |
| 816 | - $appendCalendars = $this->settings->get('datetime_summary_by_calendar'); | |
| 817 | - if( $appendCalendars && $shifts ){ | |
| 818 | - $calendarIds = array(); | |
| 819 | - foreach( $shifts as $shift ){ | |
| 820 | - $calendar = $shift->getCalendar(); | |
| 821 | - $calendarId = $calendar ? $calendar->getId() : 0; | |
| 822 | - if( ! $calendarId ) continue; | |
| 823 | - $calendarIds[ $calendarId ] = $calendarId; | |
| 824 | - } | |
| 825 | - | |
| 826 | - $calendars = $this->calendarsQuery->findManyById( $calendarIds ); | |
| 827 | - | |
| 828 | - $shiftsByCalendar = $shiftsByDate = array(); | |
| 829 | - foreach( $shifts as $shift ){ | |
| 830 | - $thisCalendar = $shift->getCalendar(); | |
| 831 | - if( ! $thisCalendar ) continue; | |
| 832 | - $shiftId = $shift->getId(); | |
| 833 | - $thisCalendarId = $thisCalendar->getId(); | |
| 834 | - $shiftsByCalendar[ $thisCalendarId ][ $shiftId ] = $shift; | |
| 835 | - | |
| 836 | - $start = $shift->getStart(); | |
| 837 | - $end = $shift->getEnd(); | |
| 838 | - | |
| 839 | - $startDayTime = substr($start, 8, 4); | |
| 840 | - $endDayTime = substr($end, 8, 4); | |
| 841 | - $shiftAllDay = ( (0 == $startDayTime) && (0 == $endDayTime) ) ? TRUE : FALSE; | |
| 842 | - | |
| 843 | - $this->t->setDateTimeDb( $end )->modify('-1 second'); | |
| 844 | - $shiftEndDate = $this->t->formatDateDb(); | |
| 845 | - | |
| 846 | - $this->t->setDateTimeDb( $start ); | |
| 847 | - $shiftStartDate = $this->t->formatDateDb(); | |
| 848 | - | |
| 849 | - $rexDate = $shiftStartDate; | |
| 850 | - while( $rexDate <= $shiftEndDate ){ | |
| 851 | - if( in_array($rexDate, $dates) ){ | |
| 852 | - $shiftsByDate[ $rexDate ][ $shiftId ] = $shift; | |
| 853 | - } | |
| 854 | - | |
| 855 | - if( ! $shiftAllDay ){ | |
| 856 | - break; | |
| 857 | - } | |
| 858 | - $this->t->modify( '+1 day' ); | |
| 859 | - $rexDate = $this->t->formatDateDb(); | |
| 860 | - } | |
| 861 | - } | |
| 862 | - | |
| 863 | - foreach( $calendars as $calendarId => $calendar ){ | |
| 864 | - $row = array(); | |
| 865 | - | |
| 866 | - $calendarView = $this->calendarsPresenter->presentTitle( $calendar ); | |
| 867 | - $title = htmlspecialchars( $calendar->getTitle() ); | |
| 868 | - $calendarView = $this->ui->makeSpan( $calendarView ) | |
| 869 | - ->addAttr( 'title', $title ) | |
| 870 | - ; | |
| 871 | - | |
| 872 | - $this->shiftsDuration->reset(); | |
| 873 | - foreach( $shiftsByCalendar[$calendarId] as $shift ){ | |
| 874 | - $this->shiftsDuration->add( $shift ); | |
| 875 | - } | |
| 876 | - | |
| 877 | - $outReport = $this->common->renderReport( $this->shiftsDuration, FALSE ); | |
| 878 | - $outReport = $this->ui->makeSpan( $outReport ) | |
| 879 | - ->tag('font-size', 2) | |
| 880 | - ; | |
| 881 | - $calendarView = $this->ui->makeList( array($calendarView, $outReport) ) | |
| 882 | - ->gutter(1) | |
| 883 | - ; | |
| 884 | - | |
| 885 | - $calendarView = $this->ui->makeBlock( $calendarView ) | |
| 886 | - ->tag('padding', 2) | |
| 887 | - ->tag('nowrap') | |
| 888 | - ; | |
| 889 | - $row[] = $calendarView; | |
| 890 | - | |
| 891 | - foreach( $dates as $date ){ | |
| 892 | - $cell = ''; | |
| 893 | - if( isset($shiftsByDate[$date]) ){ | |
| 894 | - $thisShifts = array_intersect_key( $shiftsByDate[$date], $shiftsByCalendar[$calendarId] ); | |
| 895 | - if( $thisShifts ){ | |
| 896 | - $this->shiftsDuration->reset(); | |
| 897 | - foreach( $thisShifts as $shift ){ | |
| 898 | - $this->shiftsDuration->add( $shift ); | |
| 899 | - } | |
| 900 | - $outReport = $this->common->renderReport( $this->shiftsDuration, false, true ); | |
| 901 | - $outReport = $this->ui->makeSpan( $outReport ) | |
| 902 | - ->tag('font-size', 2) | |
| 903 | - ; | |
| 904 | - $outReport = $this->ui->makeBlock( $outReport ) | |
| 905 | - ->tag('align', 'center') | |
| 906 | - ; | |
| 907 | - $cell = $outReport; | |
| 908 | - } | |
| 909 | - } | |
| 910 | - $row[] = $cell; | |
| 911 | - } | |
| 912 | - $rows[] = $row; | |
| 913 | - } | |
| 914 | 758 | } |
| 915 | 759 | |
| 916 | 760 | $out = $this->ui->makeTable( $header, $rows, FALSE ) |
| 917 | 761 | ->gutter(0) |