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