You are here

public function ScheduleData::addStatsPage in Loft Data Grids 7.2

1 call to ScheduleData::addStatsPage()
ScheduleData::makeSchedule in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/ScheduleData.php
Split the current page up into a number of pages based on workload.

File

vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/ScheduleData.php, line 230

Class

ScheduleData
Class ScheduleData

Namespace

AKlump\LoftDataGrids

Code

public function addStatsPage($title = 'Schedule Statistics') {
  if (empty($this->stats)) {
    $id = $this
      ->getCurrentPageId();
    $this
      ->setPage($title);

    // Add this to ensure placement in the page orders FIFO
    $this
      ->add('start date', null);
    $this->todoStatsPage = $title;
    $this
      ->setPage($id);
  }
  else {
    $this
      ->setPage($title);
    $this
      ->add('days off', count($this->stats['dates off']));
    $this
      ->add('weekdays off', implode(', ', $this->weekdaysOff));
    $this->stats['dates off'] = implode(', ', $this->stats['dates off']);
    foreach ($this->stats as $key => $value) {
      $this
        ->add($key, $value);
    }
    $this
      ->next();
    $this
      ->setKeys('start date', 'end date', 'total hours', 'total items', 'hours per day', 'days off', 'weekdays off', 'dates off');
  }
  return $this;
}