// Klassendefinition class CounterTable extends IPSModule { // Überschreibt die interne IPS_Create($id) Funktion public function Create() { // Diese Zeile nicht löschen. parent::Create(); $this->RegisterPropertyFloat("Price",0.23); $this->RegisterPropertyString("Counters",""); $this->RegisterVariableString("htmlOutput", "Zählerübersicht",["PRESENTATION"=> VARIABLE_PRESENTATION_LEGACY, "PROFILE" => "~HTMLBox"],0); } // Überschreibt die intere IPS_ApplyChanges($id) Funktion public function ApplyChanges() { // Diese Zeile nicht löschen parent::ApplyChanges(); $this->checkTable(); } public function RequestAction($Ident, $Value) { $varid = $this->GetIDForIdent($Ident); SetValue($varid, $Value); } public function checkTable(){ $price = $this->ReadPropertyFloat("Price"); $arrString = $this->ReadPropertyString("Counters"); $arr = json_decode($arrString); $dataoutput = ""; /// print_r($arr); if($arr != NULL){ foreach($arr as $cnt){ $cost = 0.0; $cost = $cnt->Monthly * $price; $style =''; if ($cnt->Monthly > $cnt->Limit){ $style = 'style="background-color:yellow;"'; } $dataoutput .= '
| Name: | Gesamt: | Monat: | Woche: | Tag: | Kosten: |
|---|---|---|---|---|---|