Stundenpläne der Kinder visualisieren

Guten Abend,

noch schnell vor den Ferien :wink: ein Script zum visualisieren der Stundenpläne der Kinder. Kann man bestimmt auch für andere Sachen missbraucen :eek:

WICHTIG: Folgende Schritte unbedingt vor dem ersten Start des Scriptes ausführen:

[ul]
[li]Script igendwo anlegen
[/li][li]Script öffnen und Arrays an eigene Situation anpassen
[/li][li]Im Array childs die Kinder fortlaufend hinterlegen
[/li][li]Die Schulfächer im Array subjects anpassen/erweitern
[/li][li]Das Array persons entsprechend dem Array childs anpassen und die richtigen Zeiten hinterlegen
[/li][li]Einmal das Script in der Konsole starten
[/li][li]Dannach die Variablen im Webfront verlinken (siehe Bilder)
[/li][li]Button Speichern schreibt das gewählte Fach in die gewählte Zelle
[/li][li]Button Update erzeugt nach getaner Arbeit den „schönen“ Stundenplan
[/li][/ul]

VORSICHT: ein wiederholtes Ausführen des Scripts auf der Konsole löscht alle bisher konfigurierten Daten!!!

Und hier das Script:


<?php
################################################################################
# Script: Other.Timetable.ips.php
# Version:	1.0.20180402
# Author:	Heiko Wilknitz (@pitti)
#
# Anlegen und Verwalten von Stundenplänen
#
# ------------------------------ Profile ---------------------------------------
#
# Kinder, muss in Reihenfolge und Anzahl mit dem "persons"-Array übereinstimmen
#
$childs =array(
  array(0, 'Kind1', '', 0x800080),
  array(1, 'Kind2', '', 0x00FFFF)
);
#
# Tage, die der Stundenplan abbilden soll (5 ist Standard)
#
$cols = array(
  array(5, 'Mo - Fr', '', 0x80FF80),
  array(6, 'Mo - Fr, Sa', '', 0xFFFF80),
  array(7, 'Mo - Fr, Sa, So', '', 0xFF8080)
);
#
# Schultag 
#
$days = array(
  array(0, 'Montag', '', 0x80FF80),
  array(1, 'Dienstag', '', 0x80FF80),
  array(2, 'Mittwoch', '', 0x80FF80),
  array(3, 'Donnerstag', '', 0x80FF80),
  array(4, 'Freitag', '', 0x80FF80),
  array(5, 'Samstag', '', 0xFFFF80),
  array(6, 'Sonntag', '', 0xFF8080)
);
#
# Fächer
#
$subjects = array(
  array(0, 'Chemie', '', -1),
  array(1, 'Deutsch', '', -1),
  array(2, 'Engl.-Conv.', '', -1),
  array(3, 'Englisch', '', -1),
  array(4, 'Ethik', '', -1),
  array(5, 'Geschichte', '', -1),
  array(6, 'Informatik', '', -1),
  array(7, 'Kunst', '', -1),
  array(8, 'Mathematik', '', -1),
  array(9, 'Physik', '', -1),
  array(10,'P-Seminar', '', -1),
  array(11, 'Sozialkunde', '', -1),
  array(12, 'Sport', '', -1),
  array(13, 'Technologie', '', -1),
  array(14, 'Wirt.-Englisch', '', -1),
  array(15, 'Wirtschaft', '', -1),
  array(16, 'W-Seminar', '', -1)
);
#
# Speichern 
#
$save = array(
  array(0, '>', '', -1),
  array(1, 'Speichern', '', 0xFF8000)
);
#
# Generieren 
#
$write = array(
  array(0, '>', '', -1),
  array(1, 'Update', '', 0x008000)
);
#
# ----------------------------- Konfiguration ----------------------------------
#
# Namen der Kinder und Schulzeiten, kann pro Kind unterschiedlich sein
#
$persons = array (
	"Kind1" => array (
	  	1  => "08:00 - 08:45",
	  	2  => "08:45 - 09:30",
	  	3  => "09:45 - 10:30",
	  	4  => "10:30 - 11:15",
	  	5  => "11:30 - 12:15",
	  	6  => "12:15 - 13:00",
	  	7  => "13:00 - 13:45",
	  	8  => "13:45 - 14:30",
	  	9  => "14:30 - 15:15",
	  	10 => "15:15 - 16:00"),
	"Kind2" => array (
	  	1  => "08:15 - 09:00",
	  	2  => "08:00 - 09:45",
	  	3  => "10:00 - 10:45",
	  	4  => "10:45 - 11:30",
	  	5  => "11:45 - 12:25",
	  	6  => "12:25 - 13:10",
	  	7  => "13:10 - 13:55",
	  	8  => "13:55 - 14:40",
	  	9  => "14:40 - 15:25",
	  	10 => "15:30 - 16:15"),
);
#
# Benennung der Spalten
#
$header = array (
	"Zeit",
	"Montag",
	"Dienstag",
	"Mittwoch",
	"Donnerstag",
	"Freitag",
	"Samstag",
	"Sonntag"
);
#
################################################################################

// INSTALLATION
if ($_IPS['SENDER']=='Execute') {
	$pos = -1;
	// Daten
	$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
	SetValue($did, InitData($persons, $header));
	IPS_SetPosition($did, $pos++);
	// Kinder
	$vid = CreateVariableByName($_IPS['SELF'], "Kinder", 1);
	CreateProfileInteger('Timetable.Childs', 'Robot', '', '', 0, 0, 0, 0, $childs);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Childs');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 0);	
	// Spalten
	$vid = CreateVariableByName($_IPS['SELF'], "Spalten", 1);
	CreateProfileInteger('Timetable.Cols', 'Distance', '', '', 0, 0, 0, 0, $cols);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Cols');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 5);
	// Zeilen
	$vid = CreateVariableByName($_IPS['SELF'], "Stunden", 1);
	CreateProfileInteger('Timetable.Rows', 'Database', '', '', 1, 10, 1, 0);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Rows');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 10);
	// Tag
	$vid = CreateVariableByName($_IPS['SELF'], "Tag", 1);
	CreateProfileInteger('Timetable.Days', 'Calendar', '', '', 0, 0, 0, 0, $days);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Days');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 0);
	// Stunde
	$vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1);
	CreateProfileInteger('Timetable.Lesson', 'Clock', '', '. Stunde', 1, 10, 1, 0);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Lesson');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 1);
	// Fach
	$vid = CreateVariableByName($_IPS['SELF'], "Fach", 1);
	CreateProfileInteger('Timetable.Subjects', 'ErlenmeyerFlask', '', '', 0, 0, 0, 0, $subjects);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Subjects');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 0);	
	// Speichern
	$vid = CreateVariableByName($_IPS['SELF'], "Speichern", 1);
	CreateProfileInteger('Timetable.Save', 'Repeat', '', '', 0, 0, 0, 0, $save);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Save');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 0);	
	// Vorschau
	$vid = CreateVariableByName($_IPS['SELF'], "Vorschau", 3);
	IPS_SetVariableCustomProfile($vid, '~HTMLBox');
	IPS_SetIcon($vid, "Edit");
	IPS_SetPosition($vid, $pos++);
	$json = json_decode(GetValue($did), true);
	SetValue($vid, GeneratePreview(key($persons), $json));
	// Update Table
	$vid = CreateVariableByName($_IPS['SELF'], "Update", 1);
	CreateProfileInteger('Timetable.Update', 'Script', '', '', 0, 0, 0, 0, $write);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Update');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 0);	
	// HTML Stundenpläne für Kinder
	foreach($persons as $key => $value) {
		$vid = CreateVariableByName($_IPS['SELF'], "Stundenplan ".$key, 3);
		IPS_SetVariableCustomProfile($vid, '~HTMLBox');
		IPS_SetIcon($vid, "Robot");
		IPS_SetPosition($vid, $pos++);
	}
}

// AKTION VIA WEBFRONT
else if($_IPS['SENDER'] == "WebFront") {
	// Speichern
  	SetValue($_IPS['VARIABLE'], $_IPS['VALUE']);
	
	$name = IPS_GetName($_IPS['VARIABLE']);
	// viel zu tun
	switch ($name) {
    case 'Kinder':
		// Kind
		$cid = GetValueFormatted($_IPS['VARIABLE']);
		// Daten 
		$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
		$dat = GetValue($did);
		$json = json_decode($dat, true);
		$col = $json[$cid]['days'];
		$row = $json[$cid]['lessons'];
		// Spalten korrekt setzen
		$vid = CreateVariableByName($_IPS['SELF'], "Spalten", 1);
		SetValue($vid, $col);
		// Stunden korrekt setzen
		$vid = CreateVariableByName($_IPS['SELF'], "Stunden", 1);
		SetValue($vid, $row);
		// Tag zurücksetzen	
		$vid = CreateVariableByName($_IPS['SELF'], "Tag", 1);
		SetValue($vid, 0);
		// Stunde zurücksetzen		
		$vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1);
		SetValue($vid, 1);
		// Preview neu rendern
		$vid = CreateVariableByName($_IPS['SELF'], "Vorschau", 3);
		SetValue($vid, GeneratePreview($cid, $json));	
		break;	
    case 'Spalten':
		// Kind
		$vid = CreateVariableByName($_IPS['SELF'], "Kinder", 1);
		$cid = GetValueFormatted($vid);	
		// Daten 
		$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
		$dat = GetValue($did);
		$json = json_decode($dat, true);
		$json[$cid]['days'] = $_IPS['VALUE'];
		SetValue($did, json_encode($json));	
		// Tag zurücksetzen
		$vid = CreateVariableByName($_IPS['SELF'], "Tag", 1);
	  	SetValue($vid, 0);
		// Stunde zurücksetzen
		$vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1);
	  	SetValue($vid, 1);
		// Preview neu rendern
		$vid = CreateVariableByName($_IPS['SELF'], "Vorschau", 3);
		SetValue($vid, GeneratePreview($cid, $json));				        
		break;
    case 'Stunden':
		// Kind
		$vid = CreateVariableByName($_IPS['SELF'], "Kinder", 1);
		$cid = GetValueFormatted($vid);	
		// Daten 
		$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
		$dat = GetValue($did);
		$json = json_decode($dat, true);
		$json[$cid]['lessons'] = $_IPS['VALUE'];
		SetValue($did, json_encode($json));	
		// Tag zurücksetzen
		$vid = CreateVariableByName($_IPS['SELF'], "Tag", 1);
	  	SetValue($vid, 0);
		// Stunde zurücksetzen
		$vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1);
	  	SetValue($vid, 1);
		// Preview neu rendern
		$vid = CreateVariableByName($_IPS['SELF'], "Vorschau", 3);
		SetValue($vid, GeneratePreview($cid, $json));				        
		break;
    case 'Tag':
		// Check ob Tag erlaubt
		$vid = CreateVariableByName($_IPS['SELF'], "Spalten", 1);
		$col = GetValue($vid);
		if($_IPS['VALUE'] >= $col) {
		  	SetValue($_IPS['VARIABLE'],$col-1);
		}
        break;
    case 'Stunde':
		// Check ob Stunde erlaubt
		$vid = CreateVariableByName($_IPS['SELF'], "Stunden", 1);
		$hours = GetValue($vid);
		if($_IPS['VALUE'] > $hours) {
		  	SetValue($_IPS['VARIABLE'],$hours);
		}
        break;
    case 'Fach':
        // nix zu tun
        break;
    case 'Speichern':
		// Kind,Spalte, Zeile, Fach & Daten 
		$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
		$dat = GetValue($did);
		$vid = CreateVariableByName($_IPS['SELF'], "Kinder", 1);
		$cid = GetValueFormatted($vid);
		$vid = CreateVariableByName($_IPS['SELF'], "Tag", 1);
		$col = GetValue($vid);
		$vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1);
		$row = GetValue($vid);
		$vid = CreateVariableByName($_IPS['SELF'], "Fach", 1);
		$sub = GetValueFormatted($vid);
		// Fach Speichern
		$json = json_decode($dat, true);
		$lesson = sprintf('%02d.', $row);
		$json[$cid][$lesson][$col+1] = $sub;
		SetValue($did, json_encode($json));	
		// Preview neu rendern
		$vid = CreateVariableByName($_IPS['SELF'], "Vorschau", 3);
		SetValue($vid, GeneratePreview($cid, $json));		
		// Speichern Button zurückstellen
	  	SetValue($_IPS['VARIABLE'], 0);
        break;
    case 'Update':
		// Kind & Daten 
		$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
		$dat = GetValue($did);
		$vid = CreateVariableByName($_IPS['SELF'], "Kinder", 1);
		$cid = GetValueFormatted($vid);
		// Json 
		$json = json_decode($dat, true);
		// HTML neu rendern
		$vid = CreateVariableByName($_IPS['SELF'], "Stundenplan ".$cid, 3);
		SetValue($vid, GenerateTimetable($cid, $json));		
		// Update Button zurückstellen
	  	SetValue($_IPS['VARIABLE'], 0);
        break;
	}
}

# ------------------------------ Funktionen ------------------------------------

// Erzeugt initial die Json Struktur
function InitData($persons, $header)
{
	$json = array();
	foreach ($persons as $key => $value) {
		$json[$key]['days'] = 5;
		$json[$key]['lessons'] = 10;
		$json[$key]['header'] = $header;
		for($l = 1; $l <= count($value); $l++) {
			$lesson = sprintf('%02d.', $l);
			$json[$key][$lesson] = array($value[$l], '', '', '', '', '', '', '');
		}
	}
//	var_dump($json);
	return json_encode($json);
}

// Erzeugt aus den JSON Daten eine "unformatierte " HTML Tabelle
function GeneratePreview($person, $json)
{
	$arr = $json[$person];
	$html = '<style>table{width:100%;border: 1px solid rgba(255, 255, 255, 0.2);border-collapse:collapse;} th,td{border:1px solid rgba(255, 255, 255, 0.2); text-align:center;}</style>';
	$html = $html.'<table>';
	$html = $html.'<tr>';
    for ($h = 0; $h <= $arr['days']; $h++) {
		$html = $html.'<th>'.$arr['header'][$h].'</th>';
	}		
    $html = $html.'</tr>';
    for ($z = 1; $z <= $arr['lessons']; $z++) {
		$lesson = sprintf('%02d.', $z);
        $html = $html.'<tr>';
		for ($s = 0; $s <= $arr['days']; $s++) {
			if($s == 0) {
			
	            $html = $html.'<td>'.$lesson.' Stunde ('.$arr[$lesson][$s].')</td>';
			}
			else {
	            $html = $html.'<td>'.$arr[$lesson][$s].'</td>';
			}
        }
        $html = $html.'</tr>';
    }
    $html = $html.'</table>';
	return $html;
}

// Erzeugt aus den JSON Daten eine HTML Tabelle
function GenerateTimetable($person, $json)
{
	// Kind wählen
	$arr = $json[$person];
	// styles definieren
	$style = "";
	$style = $style.'<style type="text/css">';
	$style = $style.'table  {border-collapse: collapse; font-size: 14px; width: 100%; }';
	$style = $style.'td.fst {vertical-align: middle; text-align: center; width: 120px; padding: 5px; border-left: 1px solid rgba(255, 255, 255, 0.2); border-right: 1px solid rgba(255, 255, 255, 0.2); border-top: 1px solid rgba(255, 255, 255, 0.1); }';
	$style = $style.'td.mid {vertical-align: middle; text-align: center; line-height: 20px; padding: 5px; border-right: 1px solid rgba(255, 255, 255, 0.2); border-top: 1px solid rgba(255, 255, 255, 0.1); }';
	$style = $style.'td.lst {vertical-align: middle; text-align: center; line-height: 20px; padding: 5px; border-right: 1px solid rgba(255, 255, 255, 0.2); border-top: 1px solid rgba(255, 255, 255, 0.1); }';
	$style = $style.'tr:last-child {border-bottom: 1px solid rgba(255, 255, 255, 0.2); }';
	$style = $style.'tr:nth-child(even) {  background-color: rgba(0, 0, 0, 0.2); }';	  
	$style = $style.'.th { color: rgb(255, 255, 255); background-color: rgb(0, 160, 255); font-weight:bold; background-image: linear-gradient(top,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0.3) 100%); background-image: -o-linear-gradient(top,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0.3) 100%); background-image: -moz-linear-gradient(top,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0.3) 100%); background-image: -webkit-linear-gradient(top,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0.3) 100%); background-image: -ms-linear-gradient(top,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0.3) 100%); }';
	$style = $style.'.num { font-size: 32px; font-weight:bold; color: rgb(0,160,255); float:left; }';
	$style = $style.'.ttt { font-size: 11px; width:30px; float:right;}';
	$style = $style.'.les { font-size: 1.5em; }';
	$style = $style.'</style>';
	// html table erzeugen
	$html = $style;	
	$html = $html.'<table>';
	$html = $html.'<tr>';
	// table head	
    for ($h = 0; $h <= $arr['days']; $h++) {
		// first
		if ($h == 0) {
			$html = $html.'<td class="fst th">'.$arr['header'][$h].'</td>';
		}
		// middle
		else if ($h < $arr['days']) {
			$html = $html.'<td class="mid th">'.$arr['header'][$h].'</td>';
		}
		// last
		else {
			$html = $html.'<td class="lst th">'.$arr['header'][$h].'</td>';
		}	
	}		
    $html = $html.'</tr>';
	// table rows
    for ($z = 1; $z <= $arr['lessons']; $z++) {
		$lesson = sprintf('%02d.', $z);
        $html = $html.'<tr>';
		for ($s = 0; $s <= $arr['days']; $s++) {
			// first
			if($s == 0) {
				$col ='<div class="num">'.$lesson.'</div><div class="ttt">'.$arr[$lesson][$s].'</div>';
	            $html = $html.'<td class="fst">'.$col.'</td>';
			}
			// middle
			else if ($s < $arr['days']) {
	            $html = $html.'<td class="mid les">'.$arr[$lesson][$s].'</td>';
			}
			// last
			else {
	            $html = $html.'<td class="lst les">'.$arr[$lesson][$s].'</td>';
			}
        }
        $html = $html.'</tr>';
    }
    $html = $html.'</table>';
	return $html;
}

// Erzeugt eine Variable unterhalb {id} mit dem Namen {name} vom Typ [type}
// Existiert die Variable schon wird diese zurückgeliefert.
// Types: 0 = Boolean, 1 = Integer, 2 = Float, 3 = String
function CreateVariableByName($id, $name, $type) 
{ 
   $vid = @IPS_GetVariableIDByName($name, $id); 
   if($vid===false) { 
      $vid = IPS_CreateVariable($type); 
      IPS_SetParent($vid, $id); 
      IPS_SetName($vid, $name); 
   } 
   return $vid; 
} 

// Erzeugt ein Variablenprofil vom Typ {type} mit Name n{name} 
function CreateProfile($name, $type)
{
	if(!IPS_VariableProfileExists($name)) {
	  IPS_CreateVariableProfile($name, $type);
	} 
	else {
	  $profile = IPS_GetVariableProfile($name);
	  if($profile['ProfileType'] != $type)
	    throw new Exception("Variable profile type does not match for profile ".$name);
	}
}

// Erzeugt ein Integer-Variablenprofil
function CreateProfileInteger($name, $icon, $prefix, $suffix, $minvalue, $maxvalue, $step, $digits, $asso = NULL)
{
	CreateProfile($name, 1);

	IPS_SetVariableProfileIcon($name, $icon);
	IPS_SetVariableProfileText($name, $prefix, $suffix);
	IPS_SetVariableProfileDigits($name, $digits);
	
	if(sizeof($asso) !== 0){
	  $minvalue = 0;
	  $maxvalue = 0;
	} 
	IPS_SetVariableProfileValues($name, $minvalue, $maxvalue, $step);
	
	if(sizeof($asso) !== 0){
	  foreach($asso as $ass) {
	    IPS_SetVariableProfileAssociation($name, $ass[0], $ass[1], $ass[2], $ass[3]);
	  }
	}         
}
 
?>

Viel Spaß beim Klicken :slight_smile:

Ciao Pitti

Hi,

super … sieht toll aus danke … hab ich auch umgesetzt …

Eine Frage, ich benötige mehr Stunden für den Tag, das Array für die Stunden habe ich angepasst. Muss ich denn im HTML auch noch was machen.

Kannst du mir sagen wo?

Gruß

Hallo mactoolz,

vorab ein herzliches Dankeschön an pitti, für das super Script, läßt sich perfekt handeln und ich hab endlich die Stundenpläne meiner Töchter griffbereit. :smiley:
ich mußte es ebenfalls um zwei Einträge erhöhen. Dazu mußt Du im folgenden Part:

// Zeilen 
    $vid = CreateVariableByName($_IPS['SELF'], "Stunden", 1); 
    CreateProfileInteger('Timetable.Rows', 'Database', '', '', 1, 10, 1, 0); 
    IPS_SetVariableCustomProfile($vid, 'Timetable.Rows'); 
    IPS_SetVariableCustomAction($vid, $_IPS['SELF']); 
    IPS_SetPosition($vid, $pos++); 
    SetValue($vid, 10); 

Die Zeilen:

CreateProfileInteger(‚Timetable.Rows‘, ‚Database‘,’’.’’, 1, 10, 1, 0);
SetValue($vid, 10);

Wie folgt ändern:

CreateProfileInteger(‚Timetable.Rows‘, ‚Database‘, ‚‘, ‚‘, 1, 10 (benötigte Zahl der Stunden), 1, 0);
SetValue($vid, 10 (benötigte Zahl passend zur oberen Zeile);

Also z.B. für 12 anstatt 10 Stunden:

CreateProfileInteger(‚Timetable.Rows‘, ‚Database‘, ‚‘, ‚‘, 1, 12, 1, 0);
SetValue($vid,12);

Viele Grüße,

Burkhard

P.S.: Bitte bedenke, nach Änderung muß das Script nochmal ausgeführt werden. Solltest Du schon Stundenpläne hinterlegt haben, werden sie gelöscht.

@ pitti: sehe ich das richtig, dass die Stundenanzahl bei jedem Kind im Script immer gleich sein muß, auch wenn ich bei Kind1 nur 8 und bei Kind2 12 Stunden benötige?

Hi,

besten dank … hab es nicht gefunden.
Hab dafür direkt mal eine Variabel angelegt die ich dann initialisiere zum Anfang des Scripts.

Gruß
MacToolz

Hi zusammen,

bin leider gerade unterwegs, schaue ich mir heute Abend an und melde mich. Glaube in der InitData() muss auch noch was angepasst werden.

Ciao Pitti

Hallo pitti,

hast recht, wenn ich Dein Script richtig gedeutet habe, dann muss auch noch etwas unter dem Punkt „// Stunde“ angepaßt werden:

// Stunde 
    $vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1); 
    CreateProfileInteger('Timetable.Lesson', 'Clock', '', '. Stunde', 1, 10, 1, 0); // Die '10' an die benötigte Stundenzahl anpassen
    IPS_SetVariableCustomProfile($vid, 'Timetable.Lesson'); 
    IPS_SetVariableCustomAction($vid, $_IPS['SELF']); 
    IPS_SetPosition($vid, $pos++); 
    SetValue($vid, 1); 

@ MacToolz: Findet sich Alles im Script unter dem Punkt:"// Installation" etwa ab Zeile 120.

Viele Grüße,

Burkhard

Hi Jungs,

habe das Script nochmal an den entscheidenden Stellen angepasst und komplett dynamisiert, bin gespannt ob es bei Euch funzt.


<?php
################################################################################
# Script: Other.Timetable.ips.php
# Version:	1.1.20180502
# Author:	Heiko Wilknitz (@pitti)
#
# Anlegen und Verwalten von Stundenplänen
#
# ------------------------------ Profile ---------------------------------------
#
# Kinder, muss in Reihenfolge und Anzahl mit dem "persons"-Array übereinstimmen
#
$childs =array(
  array(0, 'Kind1', '', 0x800080),
  array(1, 'Kind2', '', 0x00FFFF)
);
#
# Tage, die der Stundenplan abbilden soll (5 ist Standard)
#
$cols = array(
  array(5, 'Mo - Fr', '', 0x80FF80),
  array(6, 'Mo - Fr, Sa', '', 0xFFFF80),
  array(7, 'Mo - Fr, Sa, So', '', 0xFF8080)
);
#
# Schultag 
#
$days = array(
  array(0, 'Montag', '', 0x80FF80),
  array(1, 'Dienstag', '', 0x80FF80),
  array(2, 'Mittwoch', '', 0x80FF80),
  array(3, 'Donnerstag', '', 0x80FF80),
  array(4, 'Freitag', '', 0x80FF80),
  array(5, 'Samstag', '', 0xFFFF80),
  array(6, 'Sonntag', '', 0xFF8080)
);
#
# Fächer
#
$subjects = array(
  array(0, 'Chemie', '', -1),
  array(1, 'Deutsch', '', -1),
  array(2, 'Engl.-Conv.', '', -1),
  array(3, 'Englisch', '', -1),
  array(4, 'Ethik', '', -1),
  array(5, 'Geschichte', '', -1),
  array(6, 'Informatik', '', -1),
  array(7, 'Kunst', '', -1),
  array(8, 'Mathematik', '', -1),
  array(9, 'Physik', '', -1),
  array(10,'P-Seminar', '', -1),
  array(11, 'Sozialkunde', '', -1),
  array(12, 'Sport', '', -1),
  array(13, 'Technologie', '', -1),
  array(14, 'Wirt.-Englisch', '', -1),
  array(15, 'Wirtschaft', '', -1),
  array(16, 'W-Seminar', '', -1)
);
#
# Speichern 
#
$save = array(
  array(0, '>', '', -1),
  array(1, 'Speichern', '', 0xFF8000)
);
#
# Generieren 
#
$write = array(
  array(0, '>', '', -1),
  array(1, 'Update', '', 0x008000)
);
#
# ----------------------------- Konfiguration ----------------------------------
#
# Namen der Kinder und Schulzeiten, kann pro Kind unterschiedlich sein
#
$persons = array (
	"Kind1" => array (
	  	1  => "08:00 - 08:45",
	  	2  => "08:45 - 09:30",
	  	3  => "09:45 - 10:30",
	  	4  => "10:30 - 11:15",
	  	5  => "11:30 - 12:15",
	  	6  => "12:15 - 13:00",
	  	7  => "13:00 - 13:45",
	  	8  => "13:45 - 14:30",
	  	9  => "14:30 - 15:15",
	  	10 => "15:15 - 16:00",
	  	11 => "16:00 - 16:45",
	  	12 => "16:45 - 17:30"),
	"Kind2" => array (
	  	1  => "08:15 - 09:00",
	  	2  => "08:00 - 09:45",
	  	3  => "10:00 - 10:45",
	  	4  => "10:45 - 11:30",
	  	5  => "11:45 - 12:25",
	  	6  => "12:25 - 13:10",
	  	7  => "13:10 - 13:55",
	  	8  => "13:55 - 14:40",
	  	9  => "14:40 - 15:25",
	  	10 => "15:30 - 16:15",
	  	11 => "16:15 - 17:00",
	  	12 => "17:00 - 17:45")
);
#
# Benennung der Spalten
#
$header = array (
	"Zeit",
	"Montag",
	"Dienstag",
	"Mittwoch",
	"Donnerstag",
	"Freitag",
	"Samstag",
	"Sonntag"
);
#
################################################################################

// INSTALLATION
if ($_IPS['SENDER']=='Execute') {
	$pos = -1;
	// Daten
	$vid = CreateVariableByName($_IPS['SELF'], "Daten", 3);
	SetValue($vid, InitData($persons, $header));
	IPS_SetPosition($vid, $pos++);
	$json = json_decode(GetValue($vid), true);
	$less = count($persons[Key($persons)]);
	// Kinder
	$vid = CreateVariableByName($_IPS['SELF'], "Kinder", 1);
	CreateProfileInteger('Timetable.Childs', 'Robot', '', '', 0, 0, 0, 0, $childs);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Childs');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 0);	
	// Spalten
	$vid = CreateVariableByName($_IPS['SELF'], "Spalten", 1);
	CreateProfileInteger('Timetable.Cols', 'Distance', '', '', 0, 0, 0, 0, $cols);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Cols');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 5);
	// Zeilen
	$vid = CreateVariableByName($_IPS['SELF'], "Stunden", 1);
	CreateProfileInteger('Timetable.Rows', 'Database', '', '', 1, $less, 1, 0);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Rows');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, $less);
	// Tag
	$vid = CreateVariableByName($_IPS['SELF'], "Tag", 1);
	CreateProfileInteger('Timetable.Days', 'Calendar', '', '', 0, 0, 0, 0, $days);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Days');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 0);
	// Stunde
	$vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1);
	CreateProfileInteger('Timetable.Lesson', 'Clock', '', '. Stunde', 1, $less, 1, 0);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Lesson');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 1);
	// Fach
	$vid = CreateVariableByName($_IPS['SELF'], "Fach", 1);
	CreateProfileInteger('Timetable.Subjects', 'ErlenmeyerFlask', '', '', 0, 0, 0, 0, $subjects);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Subjects');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 0);	
	// Speichern
	$vid = CreateVariableByName($_IPS['SELF'], "Speichern", 1);
	CreateProfileInteger('Timetable.Save', 'Repeat', '', '', 0, 0, 0, 0, $save);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Save');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 0);	
	// Vorschau
	$vid = CreateVariableByName($_IPS['SELF'], "Vorschau", 3);
	IPS_SetVariableCustomProfile($vid, '~HTMLBox');
	IPS_SetIcon($vid, "Edit");
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, GeneratePreview(key($persons), $json));
	// Update Table
	$vid = CreateVariableByName($_IPS['SELF'], "Update", 1);
	CreateProfileInteger('Timetable.Update', 'Script', '', '', 0, 0, 0, 0, $write);
	IPS_SetVariableCustomProfile($vid, 'Timetable.Update');
	IPS_SetVariableCustomAction($vid, $_IPS['SELF']);
	IPS_SetPosition($vid, $pos++);
	SetValue($vid, 0);	
	// HTML Stundenpläne für Kinder
	foreach($persons as $key => $value) {
		$vid = CreateVariableByName($_IPS['SELF'], "Stundenplan ".$key, 3);
		IPS_SetVariableCustomProfile($vid, '~HTMLBox');
		IPS_SetIcon($vid, "Robot");
		IPS_SetPosition($vid, $pos++);
	}
}

// AKTION VIA WEBFRONT
else if($_IPS['SENDER'] == "WebFront") {
	// Speichern
  	SetValue($_IPS['VARIABLE'], $_IPS['VALUE']);
	
	$name = IPS_GetName($_IPS['VARIABLE']);
	// viel zu tun
	switch ($name) {
    case 'Kinder':
		// Kind
		$cid = GetValueFormatted($_IPS['VARIABLE']);
		// Daten 
		$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
		$dat = GetValue($did);
		$json = json_decode($dat, true);
		$col = $json[$cid]['days'];
		$row = $json[$cid]['lessons'];
		// Spalten korrekt setzen
		$vid = CreateVariableByName($_IPS['SELF'], "Spalten", 1);
		SetValue($vid, $col);
		// Stunden korrekt setzen
		$vid = CreateVariableByName($_IPS['SELF'], "Stunden", 1);
		SetValue($vid, $row);
		// Tag zurücksetzen	
		$vid = CreateVariableByName($_IPS['SELF'], "Tag", 1);
		SetValue($vid, 0);
		// Stunde zurücksetzen		
		$vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1);
		SetValue($vid, 1);
		// Preview neu rendern
		$vid = CreateVariableByName($_IPS['SELF'], "Vorschau", 3);
		SetValue($vid, GeneratePreview($cid, $json));	
		break;	
    case 'Spalten':
		// Kind
		$vid = CreateVariableByName($_IPS['SELF'], "Kinder", 1);
		$cid = GetValueFormatted($vid);	
		// Daten 
		$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
		$dat = GetValue($did);
		$json = json_decode($dat, true);
		$json[$cid]['days'] = $_IPS['VALUE'];
		SetValue($did, json_encode($json));	
		// Tag zurücksetzen
		$vid = CreateVariableByName($_IPS['SELF'], "Tag", 1);
	  	SetValue($vid, 0);
		// Stunde zurücksetzen
		$vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1);
	  	SetValue($vid, 1);
		// Preview neu rendern
		$vid = CreateVariableByName($_IPS['SELF'], "Vorschau", 3);
		SetValue($vid, GeneratePreview($cid, $json));				        
		break;
    case 'Stunden':
		// Kind
		$vid = CreateVariableByName($_IPS['SELF'], "Kinder", 1);
		$cid = GetValueFormatted($vid);	
		// Daten 
		$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
		$dat = GetValue($did);
		$json = json_decode($dat, true);
		$json[$cid]['lessons'] = $_IPS['VALUE'];
		SetValue($did, json_encode($json));	
		// Tag zurücksetzen
		$vid = CreateVariableByName($_IPS['SELF'], "Tag", 1);
	  	SetValue($vid, 0);
		// Stunde zurücksetzen
		$vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1);
	  	SetValue($vid, 1);
		// Preview neu rendern
		$vid = CreateVariableByName($_IPS['SELF'], "Vorschau", 3);
		SetValue($vid, GeneratePreview($cid, $json));				        
		break;
    case 'Tag':
		// Check ob Tag erlaubt
		$vid = CreateVariableByName($_IPS['SELF'], "Spalten", 1);
		$col = GetValue($vid);
		if($_IPS['VALUE'] >= $col) {
		  	SetValue($_IPS['VARIABLE'],$col-1);
		}
        break;
    case 'Stunde':
		// Check ob Stunde erlaubt
		$vid = CreateVariableByName($_IPS['SELF'], "Stunden", 1);
		$hours = GetValue($vid);
		if($_IPS['VALUE'] > $hours) {
		  	SetValue($_IPS['VARIABLE'],$hours);
		}
        break;
    case 'Fach':
        // nix zu tun
        break;
    case 'Speichern':
		// Kind,Spalte, Zeile, Fach & Daten 
		$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
		$dat = GetValue($did);
		$vid = CreateVariableByName($_IPS['SELF'], "Kinder", 1);
		$cid = GetValueFormatted($vid);
		$vid = CreateVariableByName($_IPS['SELF'], "Tag", 1);
		$col = GetValue($vid);
		$vid = CreateVariableByName($_IPS['SELF'], "Stunde", 1);
		$row = GetValue($vid);
		$vid = CreateVariableByName($_IPS['SELF'], "Fach", 1);
		$sub = GetValueFormatted($vid);
		// Fach Speichern
		$json = json_decode($dat, true);
		$lesson = sprintf('%02d.', $row);
		$json[$cid][$lesson][$col+1] = $sub;
		SetValue($did, json_encode($json));	
		// Preview neu rendern
		$vid = CreateVariableByName($_IPS['SELF'], "Vorschau", 3);
		SetValue($vid, GeneratePreview($cid, $json));		
		// Speichern Button zurückstellen
	  	SetValue($_IPS['VARIABLE'], 0);
        break;
    case 'Update':
		// Kind & Daten 
		$did = CreateVariableByName($_IPS['SELF'], "Daten", 3);
		$dat = GetValue($did);
		$vid = CreateVariableByName($_IPS['SELF'], "Kinder", 1);
		$cid = GetValueFormatted($vid);
		// Json 
		$json = json_decode($dat, true);
		// HTML neu rendern
		$vid = CreateVariableByName($_IPS['SELF'], "Stundenplan ".$cid, 3);
		SetValue($vid, GenerateTimetable($cid, $json));		
		// Update Button zurückstellen
	  	SetValue($_IPS['VARIABLE'], 0);
        break;
	}
}

# ------------------------------ Funktionen ------------------------------------

// Erzeugt initial die Json Struktur
function InitData($persons, $header)
{
	$json = array();
	foreach ($persons as $key => $value) {
		$json[$key]['days'] = 5;
		$json[$key]['lessons'] = count($value);
		$json[$key]['header'] = $header;
		for($l = 1; $l <= count($value); $l++) {
			$lesson = sprintf('%02d.', $l);
			$json[$key][$lesson] = array();
			$json[$key][$lesson][0] = $value[$l];
			for($d = 1; $d <= 7; $d++) {
				$json[$key][$lesson][$d] = "";
			}
		}
	}
	//var_dump($json);
	return json_encode($json);
}

// Erzeugt aus den JSON Daten eine "unformatierte " HTML Tabelle
function GeneratePreview($person, $json)
{
	$arr = $json[$person];
	$html = '<style>table{width:100%;border: 1px solid rgba(255, 255, 255, 0.2);border-collapse:collapse;} th,td{border:1px solid rgba(255, 255, 255, 0.2); text-align:center;}</style>';
	$html = $html.'<table>';
	$html = $html.'<tr>';
    for ($h = 0; $h <= $arr['days']; $h++) {
		$html = $html.'<th>'.$arr['header'][$h].'</th>';
	}		
    $html = $html.'</tr>';
    for ($z = 1; $z <= $arr['lessons']; $z++) {
		$lesson = sprintf('%02d.', $z);
        $html = $html.'<tr>';
		for ($s = 0; $s <= $arr['days']; $s++) {
			if($s == 0) {
			
	            $html = $html.'<td>'.$lesson.' Stunde ('.$arr[$lesson][$s].')</td>';
			}
			else {
	            $html = $html.'<td>'.$arr[$lesson][$s].'</td>';
			}
        }
        $html = $html.'</tr>';
    }
    $html = $html.'</table>';
	return $html;
}

// Erzeugt aus den JSON Daten eine HTML Tabelle
function GenerateTimetable($person, $json)
{
	// Kind wählen
	$arr = $json[$person];
	// styles definieren
	$style = "";
	$style = $style.'<style type="text/css">';
	$style = $style.'table  {border-collapse: collapse; font-size: 14px; width: 100%; }';
	$style = $style.'td.fst {vertical-align: middle; text-align: center; width: 120px; padding: 5px; border-left: 1px solid rgba(255, 255, 255, 0.2); border-right: 1px solid rgba(255, 255, 255, 0.2); border-top: 1px solid rgba(255, 255, 255, 0.1); }';
	$style = $style.'td.mid {vertical-align: middle; text-align: center; line-height: 20px; padding: 5px; border-right: 1px solid rgba(255, 255, 255, 0.2); border-top: 1px solid rgba(255, 255, 255, 0.1); }';
	$style = $style.'td.lst {vertical-align: middle; text-align: center; line-height: 20px; padding: 5px; border-right: 1px solid rgba(255, 255, 255, 0.2); border-top: 1px solid rgba(255, 255, 255, 0.1); }';
	$style = $style.'tr:last-child {border-bottom: 1px solid rgba(255, 255, 255, 0.2); }';
	$style = $style.'tr:nth-child(even) {  background-color: rgba(0, 0, 0, 0.2); }';	  
	$style = $style.'.th { color: rgb(255, 255, 255); background-color: rgb(0, 160, 255); font-weight:bold; background-image: linear-gradient(top,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0.3) 100%); background-image: -o-linear-gradient(top,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0.3) 100%); background-image: -moz-linear-gradient(top,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0.3) 100%); background-image: -webkit-linear-gradient(top,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0.3) 100%); background-image: -ms-linear-gradient(top,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0.3) 100%); }';
	$style = $style.'.num { font-size: 32px; font-weight:bold; color: rgb(0,160,255); float:left; }';
	$style = $style.'.ttt { font-size: 11px; width:30px; float:right;}';
	$style = $style.'.les { font-size: 1.5em; }';
	$style = $style.'</style>';
	// html table erzeugen
	$html = $style;	
	$html = $html.'<table>';
	$html = $html.'<tr>';
	// table head	
    for ($h = 0; $h <= $arr['days']; $h++) {
		// first
		if ($h == 0) {
			$html = $html.'<td class="fst th">'.$arr['header'][$h].'</td>';
		}
		// middle
		else if ($h < $arr['days']) {
			$html = $html.'<td class="mid th">'.$arr['header'][$h].'</td>';
		}
		// last
		else {
			$html = $html.'<td class="lst th">'.$arr['header'][$h].'</td>';
		}	
	}		
    $html = $html.'</tr>';
	// table rows
    for ($z = 1; $z <= $arr['lessons']; $z++) {
		$lesson = sprintf('%02d.', $z);
        $html = $html.'<tr>';
		for ($s = 0; $s <= $arr['days']; $s++) {
			// first
			if($s == 0) {
				$col ='<div class="num">'.$lesson.'</div><div class="ttt">'.$arr[$lesson][$s].'</div>';
	            $html = $html.'<td class="fst">'.$col.'</td>';
			}
			// middle
			else if ($s < $arr['days']) {
	            $html = $html.'<td class="mid les">'.$arr[$lesson][$s].'</td>';
			}
			// last
			else {
	            $html = $html.'<td class="lst les">'.$arr[$lesson][$s].'</td>';
			}
        }
        $html = $html.'</tr>';
    }
    $html = $html.'</table>';
	return $html;
}

// Erzeugt eine Variable unterhalb {id} mit dem Namen {name} vom Typ [type}
// Existiert die Variable schon wird diese zurückgeliefert.
// Types: 0 = Boolean, 1 = Integer, 2 = Float, 3 = String
function CreateVariableByName($id, $name, $type) 
{ 
   $vid = @IPS_GetVariableIDByName($name, $id); 
   if($vid===false) { 
      $vid = IPS_CreateVariable($type); 
      IPS_SetParent($vid, $id); 
      IPS_SetName($vid, $name); 
   } 
   return $vid; 
} 

// Erzeugt ein Variablenprofil vom Typ {type} mit Name n{name} 
function CreateProfile($name, $type)
{
	if(!IPS_VariableProfileExists($name)) {
	  IPS_CreateVariableProfile($name, $type);
	} 
	else {
	  $profile = IPS_GetVariableProfile($name);
	  if($profile['ProfileType'] != $type)
	    throw new Exception("Variable profile type does not match for profile ".$name);
	}
}

// Erzeugt ein Integer-Variablenprofil
function CreateProfileInteger($name, $icon, $prefix, $suffix, $minvalue, $maxvalue, $step, $digits, $asso = NULL)
{
	CreateProfile($name, 1);

	IPS_SetVariableProfileIcon($name, $icon);
	IPS_SetVariableProfileText($name, $prefix, $suffix);
	IPS_SetVariableProfileDigits($name, $digits);
	
	if(sizeof($asso) !== 0){
	  $minvalue = 0;
	  $maxvalue = 0;
	} 
	IPS_SetVariableProfileValues($name, $minvalue, $maxvalue, $step);
	
	if(sizeof($asso) !== 0){
	  foreach($asso as $ass) {
	    IPS_SetVariableProfileAssociation($name, $ass[0], $ass[1], $ass[2], $ass[3]);
	  }
	}         
}
 
?>

Ciao Pitti

Hi,

vielen dank echt tolles Script und vor allem von der Visu her finde ich das auch ansprechend und geschmackvoll …
Kein Teletubbieland :slight_smile:

Gruß
MacToolz

Danke MacToolz, freut mich wenn es Dir gefällt :smiley:

Hallo Pitti,

komme erst jetzt zum Anworten. Vielen, herzlichen Dank. Läuft, wie man so schön sagt, wie Schmidt’s Katze.

Viele Grüße,

Burkhard

Hi

könntest du mir erklären wie das mit den Tabellen in deiner Visu funktioniert …

Gruß

Gesendet von meinem SM-G930F mit Tapatalk

Klar, aber was genau meinst Du bzw. was willst wissen?

Gesendet von iPad mit Tapatalk

Hi,

ich meine wie du die Tabellen selber generiert hast.

Gruß

Hi mactoolz,

ich hatte heute auch eine Frage ins Forum gepostet, wo zuerst die Leute mich nicht verstanden haben weil sie zu trivial erschien. Zum Schluß habe ich aber meine gewünschte Anwort bekommen. Jetzt geht es mir wahrscheinlich genauso :wink:

Die Tabellen (Preview & gestylt) sind normales HTML, welches in String-Variablen mit dem Profil ~HTMLBox geschrieben wird. Die Daten dafür speichere ich in einer seperaten JSON Struktur die ich ebenfalls in einer String-Variable halte (Lesen bzw. Schreiben via json_encode()/json_decode())

Das tolle dabei ist, man kann dann einfach über die ARRAY-Struktur (json_decode) iterieren und so die Tabelle generieren.
Bei der Preview-Variante halt ohne große Stylesheets - einfache <table>, <tr> und <td> Struktur.
Bei der „schönen“ Variante ist es eigentlich auch nur diese Struktur plus class Attribute welche das Aussehen beeinflussen.

Das Design habe ich vor längerem mal erstellt um nah am Standard-Webfront-Design zu bleiben. Nutze ich bei fast allen meinen Scriptem. Beim Stundenplan habe ich es extra etwas „vergrößert“ um eine „echten“ Stundenplan nachzustellen. Mir gefällts :smiley:

Passt das - oder meintest Du was anderes?

Ciao Pitti

Tolles Skript, läuft einwandfrei, danke! :slight_smile:

Mal sehen, ob/wie ich die Vertretungen (VpMobil) einbauen kann.

Viele Grüße
galleto

Hallo Pitti,

danke für dein tolles Skript, läuft ohne Probleme.

Eine Frage habe ich noch. Wie kann ich eine Mittagspause in die Visu einbauen? Nach der 5. Stunde soll Mittagspause sein und die 6. Stunde beginnt erst anschließend.

Gruß
AKL

Ja super danke … werde dann mal selber was probieren etc … Gruß

Gesendet von meinem SM-G930F mit Tapatalk

Hi mactoolz,

Okay, melde Dich einfach wenn ich Du nicht weiter kommst.

Gruß Heiko

Gesendet von iPad mit Tapatalk

Hi AKL,

naja, durch die Angabe der Zeiten sind ja Pausen eigentlich abgebildet. Bei meinen Script sieht man das ja auch.
Aber ich denke mal Du willst eine extra Zeile für die Pause haben. Das wir dann etwas aufwendiger. Müsste man einen Schalter/Flag dafür einführen. Muss ich mir mal anschauen.

Bin gerade im Skiurlaub und deshalb könnte es erst nächste Woche werden. Mal schauen wie K.O. ich abends bin :slight_smile:

Ciao Pitti

Gesendet von iPad mit Tapatalk

Hi Pitti,

Ja, ich dachte an eine leere Zeile, damit die Pause grafisch hervorgehoben wird.

Mach dir bloß keinen Stress. Urlaub geht vor :). Viel Spaß beim Ski fahren.

Gruß
AKL