Taka oto zagwozdka:
- przypisuje wlasciwosci wartosc w funkcji. Jest ona widoczna w innej klasie nastomiast w drugiej ma on wartosc null. Why?! Chodzi o -> protected $temp;
..... protected $temp; public function tableTh() { for ($i = 0; $i <= 7; $i++) { if ($i == 0) { $this->tableTh.='<td width="25px" style="background: #c0c0c0;">X</td>'; } else if ($i == 1) { // -7 because it has to get the day commencing the week - monday $this->tableTh .= '<td style="background: #c0c0c0;">' . $this->giveCalendarName() . "</br>" . $this->giveCalendarNumber('null',7) . '</td>'; $this->temp= $this->giveCalendarNumber(7,$i-7); } else if ($i > 1) { // -7 because it has to get the day commencing the week - monday $this->tableTh .= '<td style="background: #c0c0c0;">' . $this->giveCalendarName($i - 1) . "</br>" . $this->giveCalendarNumber(7,$i-1) . '</td>'; $this->temp= $this->giveCalendarNumber(7,$i-7); } } return $this->tableTh; }
Tutaj (ponizej) ma rece i nogi i po wywolaniu dostaje wartosc taka jaka chce czyli - (w tym konkretnym przypadku) string 07.03.2016.
public function tableRow() { for ($i = 1; $i <= 8; $i++) { for ($j = 0; $j <= 7; $j++) { if ($j == 0) { } else { echo '<td><input type="checkbox" name="Reservation[' . $j . ']['.$this->temp.'][' . $i . ']" value="1"></br></td>'; } } } }
Natomiast gdy chce uzyc tej samej wlasciwosci ($this->temp) w innej funkcji ma ona wartosc NULL. Jakies pomysly?