*/
class day_exporter extends exporter {
+ /**
+ * @var \calendar_information $calendar The calendar being displayed.
+ */
+ protected $calendar;
+
+ /**
+ * Constructor.
+ *
+ * @param \calendar_information $calendar The calendar information for the period being displayed
+ * @param mixed $data Either an stdClass or an array of values.
+ * @param array $related Related objects.
+ */
+ public function __construct(\calendar_information $calendar, $data, $related) {
+ $this->calendar = $calendar;
+
+ parent::__construct($data, $related);
+ }
+
/**
* Return the list of properties.
*
$prepadding = ($firstdayno + $daysinweek - 1) % $daysinweek;
$daysinfirstweek = $daysinweek - $prepadding;
$days = array_slice($alldays, 0, $daysinfirstweek);
- $week = new week_exporter($days, $prepadding, ($daysinweek - count($days) - $prepadding), $this->related);
+ $week = new week_exporter($this->calendar, $days, $prepadding, ($daysinweek - count($days) - $prepadding), $this->related);
$weeks[] = $week->export($output);
// Now chunk up the remaining day. and turn them into weeks.
$daychunks = array_chunk(array_slice($alldays, $daysinfirstweek), $daysinweek);
foreach ($daychunks as $days) {
- $week = new week_exporter($days, 0, ($daysinweek - count($days)), $this->related);
+ $week = new week_exporter($this->calendar, $days, 0, ($daysinweek - count($days)), $this->related);
$weeks[] = $week->export($output);
}
*/
protected $postpadding = 0;
+
+ /**
+ * @var \calendar_information $calendar The calendar being displayed.
+ */
+ protected $calendar;
+
/**
* Constructor.
*
+ * @param \calendar_information $calendar The calendar information for the period being displayed
* @param mixed $days An array of day_exporter objects.
* @param int $prepadding The number of pre-padding days at the start of the week.
* @param int $postpadding The number of post-padding days at the start of the week.
* @param array $related Related objects.
*/
- public function __construct($days, $prepadding, $postpadding, $related) {
+ public function __construct(\calendar_information $calendar, $days, $prepadding, $postpadding, $related) {
$this->days = $days;
$this->prepadding = $prepadding;
$this->postpadding = $postpadding;
+ $this->calendar = $calendar;
parent::__construct([], $related);
}