public function ScheduleData::makeSchedule in Loft Data Grids 7.2
Split the current page up into a number of pages based on workload.
Return value
$this
File
- vendor/
aklump/ loft_data_grids/ src/ AKlump/ LoftDataGrids/ ScheduleData.php, line 70
Class
- ScheduleData
- Class ScheduleData
Namespace
AKlump\LoftDataGridsCode
public function makeSchedule() {
// Pull out the first page to distribute it; then delete.
$items = $this
->getRows();
$id = $this
->getCurrentPageId();
$this
->deletePage($id);
$this->date = clone $this
->getStartDate();
$this
->avoidHolidaysAndWeekdaysOff();
$this->stats['start date'] = $this->date
->format($this
->getPageIdFormat());
$this->stats['hours per day'] = $this
->getHoursPerDay();
$this->stats['total items'] = count($items);
$this->stats['dates off'] = array();
$this
->setDatePage($this->date);
$dayTotal = 0;
$this->stats['total hours'] = 0;
while ($item = array_shift($items)) {
$this->stats['total hours'] += $item[$this
->getHoursKey()];
$this
->processItem($item, $item[$this
->getHoursKey()], $dayTotal);
}
$this->stats['end date'] = $this->date
->format($this
->getPageIdFormat());
if ($this->todoStatsPage) {
$this
->addStatsPage($this->todoStatsPage);
}
return $this;
}