kihinimi=$nimetus; } public function lisa($arv){ array_push($this->arvud, $arv); $this->salvestaSessiooni(); } public function kogus(){ return count($this->arvud); } public function html(){ $t=""; return $t; } public function vorm(){ $t=$this->kihinimi.": "; foreach($this->arvud as $arv){ $t.=""; } $t.=""; $t.="
"; return $t; } public function loeVormist(){ if(isSet($_REQUEST["{$this->kihinimi}_salvestus"])){ $this->arvud=array(); if(isSet($_REQUEST["{$this->kihinimi}_a"])){ foreach($_REQUEST["{$this->kihinimi}_a"] as $arv){ if($arv){ $this->lisa($arv); } } } } } public function salvestaSessiooni(){ $_SESSION[$this->kihinimi]=json_encode($this->arvud); } public function loeSessioonist(){ if(isSet($_SESSION[$this->kihinimi])){ $this->arvud=json_decode($_SESSION[$this->kihinimi]); } } public function loe(){ $this->loeSessioonist(); $this->loeVormist(); } }