PluginProbe
ShiftController Employee Shift Scheduling / 4.9.66
ShiftController Employee Shift Scheduling v4.9.66
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
← All changes | sh4/schedule/html/view/day.php +5 -118 4.9.954.9.66 View file →
@@ -23,9 +23,8 @@
23 23 SH4_Schedule_Html_Widget_DayGrid $widgetDayGrid,
24 24
25 25 SH4_Shifts_Duration $shiftsDuration,
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
@@ -43,9 +42,8 @@
43 42 $this->newAcl = $hooks->wrap( $newAcl );
44 43
45 44 $this->widgetDayGrid = $hooks->wrap( $widgetDayGrid );
46 45 $this->shiftsDuration = $hooks->wrap( $shiftsDuration );
47 - $this->calendarsQuery = $hooks->wrap( $calendarsQuery );
48 46 $this->calendarsPresenter = $hooks->wrap( $calendarsPresenter );
49 47 $this->employeesPresenter = $hooks->wrap( $employeesPresenter );
50 48
51 49 $this->widget = $hooks->wrap( $widget );
@@ -411,12 +409,11 @@
411 409 else {
412 410 $label = '+ ' . '__Shift__';
413 411 }
414 412
415 - $to = 'new/calendar';
413 + $to = 'new';
416 414 $toParams = array(
417 - 'calendar' => $id,
418 - 'date' => $date,
415 + 'date' => $date
419 416 );
420 417 if( array_key_exists('employee', $params) && (count($params['employee']) == 1) ){
421 418 if( ! in_array(-1, $params['employee']) ){
422 419 $toParams['employee'] = $params['employee'][0];
@@ -558,19 +555,14 @@
558 555
559 556 $viewEmployees = array();
560 557 foreach( $employees as $employee ){
561 558 $label = $this->employeesPresenter->presentTitle( $employee );
559 +
562 560 $title = htmlspecialchars( $label );
563 -
564 561 $description = $employee->getDescription();
565 562 if( strlen($description) ){
566 - $imgpos = strpos( $description, '<img' );
567 - if( false !== $imgpos ){
568 - $label = $this->ui->makeList( array($label, $description) );
569 - }
570 - else {
571 - $title .= "\n" . htmlspecialchars( $description );
572 - }
563 + $description = htmlspecialchars( $description );
564 + $title .= "\n" . $description;
573 565 }
574 566
575 567 $label = $this->ui->makeSpan( $label )
576 568 ->tag( 'font-size', 4 )
@@ -712,109 +704,8 @@
712 704 $rows[] = $row;
713 705 }
714 706
715 707
716 - /* append calendars summary */
717 - $appendCalendars = $this->settings->get('datetime_summary_by_calendar');
718 - if( $appendCalendars && $shifts ){
719 - $calendarIds = array();
720 - foreach( $shifts as $shift ){
721 - $calendar = $shift->getCalendar();
722 - $calendarId = $calendar ? $calendar->getId() : 0;
723 - if( ! $calendarId ) continue;
724 - $calendarIds[ $calendarId ] = $calendarId;
725 - }
726 -
727 - $calendars = $this->calendarsQuery->findManyById( $calendarIds );
728 -
729 - $shiftsByCalendar = $shiftsByDate = array();
730 - foreach( $shifts as $shift ){
731 - $thisCalendar = $shift->getCalendar();
732 - if( ! $thisCalendar ) continue;
733 - $shiftId = $shift->getId();
734 - $thisCalendarId = $thisCalendar->getId();
735 - $shiftsByCalendar[ $thisCalendarId ][ $shiftId ] = $shift;
736 -
737 - $start = $shift->getStart();
738 - $end = $shift->getEnd();
739 -
740 - $startDayTime = substr($start, 8, 4);
741 - $endDayTime = substr($end, 8, 4);
742 - $shiftAllDay = ( (0 == $startDayTime) && (0 == $endDayTime) ) ? TRUE : FALSE;
743 -
744 - $this->t->setDateTimeDb( $end )->modify('-1 second');
745 - $shiftEndDate = $this->t->formatDateDb();
746 -
747 - $this->t->setDateTimeDb( $start );
748 - $shiftStartDate = $this->t->formatDateDb();
749 -
750 - $rexDate = $shiftStartDate;
751 - while( $rexDate <= $shiftEndDate ){
752 - if( in_array($rexDate, $dates) ){
753 - $shiftsByDate[ $rexDate ][ $shiftId ] = $shift;
754 - }
755 -
756 - if( ! $shiftAllDay ){
757 - break;
758 - }
759 - $this->t->modify( '+1 day' );
760 - $rexDate = $this->t->formatDateDb();
761 - }
762 - }
763 -
764 - foreach( $calendars as $calendarId => $calendar ){
765 - $row = array();
766 -
767 - $calendarView = $this->calendarsPresenter->presentTitle( $calendar );
768 - $title = htmlspecialchars( $calendar->getTitle() );
769 - $calendarView = $this->ui->makeSpan( $calendarView )
770 - ->addAttr( 'title', $title )
771 - ;
772 -
773 - $this->shiftsDuration->reset();
774 - foreach( $shiftsByCalendar[$calendarId] as $shift ){
775 - $this->shiftsDuration->add( $shift );
776 - }
777 -
778 - $outReport = $this->common->renderReport( $this->shiftsDuration, FALSE );
779 - $outReport = $this->ui->makeSpan( $outReport )
780 - ->tag('font-size', 2)
781 - ;
782 - $calendarView = $this->ui->makeList( array($calendarView, $outReport) )
783 - ->gutter(1)
784 - ;
785 -
786 - $calendarView = $this->ui->makeBlock( $calendarView )
787 - ->tag('padding', 2)
788 - ->tag('nowrap')
789 - ;
790 - $row[] = $calendarView;
791 -
792 - foreach( $dates as $date ){
793 - $cell = '';
794 - if( isset($shiftsByDate[$date]) ){
795 - $thisShifts = array_intersect_key( $shiftsByDate[$date], $shiftsByCalendar[$calendarId] );
796 - if( $thisShifts ){
797 - $this->shiftsDuration->reset();
798 - foreach( $thisShifts as $shift ){
799 - $this->shiftsDuration->add( $shift );
800 - }
801 - $outReport = $this->common->renderReport( $this->shiftsDuration, FALSE );
802 - $outReport = $this->ui->makeSpan( $outReport )
803 - ->tag('font-size', 2)
804 - ;
805 - $outReport = $this->ui->makeBlock( $outReport )
806 - ->tag('align', 'center')
807 - ;
808 - $cell = $outReport;
809 - }
810 - }
811 - $row[] = $cell;
812 - }
813 - $rows[] = $row;
814 - }
815 - }
816 -
817 708 $thisOut[] = $this->ui->makeTable( $header, $rows, FALSE )
818 709 ->gutter(0)
819 710 ->setBordered( $this->borderColor )
820 711 // ->setSegments( $weekSegments )
@@ -867,10 +758,8 @@
867 758 else {
868 759 $this->t->modify('+1 day');
869 760 }
870 761 $dayEnd = $this->t->formatDateTimeDb();
871 -// echo "DAY END $dayEnd<br>";
872 -// exit;
873 762
874 763 // check if we need to extend ranges to show overtime shifts
875 764 if( $shifts ){
876 765 $this->t->setDateDb( $startDate )->modify('+1 day');
@@ -879,11 +768,9 @@
879 768 $this->t->modify('+1 day');
880 769 $maxCheckEnd = $this->t->formatDateTimeDb();
881 770
882 771 foreach( $shifts as $shift ){
883 - $thisStart = $shift->getStart();
884 772 $thisEnd = $shift->getEnd();
885 - // if( ($thisStart < $dayEnd) && ($thisEnd > $minCheckEnd) && ($thisEnd < $maxCheckEnd) ){
886 773 if( ($thisEnd > $minCheckEnd) && ($thisEnd < $maxCheckEnd) ){
887 774 if( $thisEnd > $dayEnd ){
888 775 $dayEnd = $thisEnd;
889 776 }