X-Git-Url: https://git-public.kairo.at/?a=blobdiff_plain;f=classes%2Fdocument.php-class;h=a0800f2889c4643a36164cedd901820fdc823978;hb=refs%2Fheads%2Fmaster;hp=ebde6ec965f8ec52f16bbfaa6f40610519351e7e;hpb=0fe05664db27eb226c6c626543b89525de2c8220;p=php-utility-classes.git
diff --git a/classes/document.php-class b/classes/document.php-class
index ebde6ec..00852d5 100755
--- a/classes/document.php-class
+++ b/classes/document.php-class
@@ -89,6 +89,10 @@ class ExtendedDocument extends DOMDocument {
// appends an ExtendedDocument::createElementInputTime() as a child of this document (see there for params)
// returns the new child
//
+ // public function appendInputDateTime($name, [$id], [$min], [$max], [$value])
+ // appends an ExtendedDocument::createElementInputDateTime() as a child of this document (see there for params)
+ // returns the new child
+ //
// public function appendInputColor($name, [$id], [$value])
// appends an ExtendedDocument::createElementInputColor() as a child of this document (see there for params)
// returns the new child
@@ -226,6 +230,10 @@ class ExtendedDocument extends DOMDocument {
// returns an ExtendedElement that is an HTML of type 'time' with the given name,
// and optionally id, min, max, and value
//
+ // public function createElementInputDateTime($name, [$id], [$min], [$max], [$value])
+ // returns an ExtendedElement that is an HTML of type 'datetime-local' with the given name,
+ // and optionally id, min, max, and value
+ //
// public function createElementInputColor($name, [$id], [$value])
// returns an ExtendedElement that is an HTML of type 'color' with the given name,
// and optionally id and value
@@ -383,6 +391,9 @@ class ExtendedDocument extends DOMDocument {
public function appendInputTime($name, $id = null, $min = null, $max = null, $value = null) {
return $this->appendChild($this->createElementInputTime($name, $id, $min, $max, $value));
}
+ public function appendInputDateTime($name, $id = null, $min = null, $max = null, $value = null) {
+ return $this->appendChild($this->createElementInputDateTime($name, $id, $min, $max, $value));
+ }
public function appendInputColor($name, $id = null, $value = null) {
return $this->appendChild($this->createElementInputColor($name, $id, $value));
}
@@ -613,6 +624,17 @@ class ExtendedDocument extends DOMDocument {
return $timefield;
}
+ public function createElementInputDateTime($name, $id = null, $min = null, $max = null, $value = null) {
+ $dtfield = $this->createElement('input');
+ $dtfield->setAttribute('type', 'datetime-local');
+ if (!is_null($id)) { $dtfield->setAttribute('id', $id); }
+ $dtfield->setAttribute('name', $name);
+ if (!is_null($min)) { $dtfield->setAttribute('min', $min); }
+ if (!is_null($max)) { $dtfield->setAttribute('max', $max); }
+ if (!is_null($value)) { $dtfield->setAttribute('value', str_replace(' ', 'T', $value)); }
+ return $dtfield;
+ }
+
public function createElementInputColor($name, $id = null, $value = null) {
$colfield = $this->createElement('input');
$colfield->setAttribute('type', 'color');
@@ -687,10 +709,12 @@ class ExtendedDocument extends DOMDocument {
public function createElementOption($key, $desc, $selected = false) {
$option = $this->createElement('option', $desc);
- if ($key) {
+ if (is_numeric($key) || is_string($key)) {
$option->setAttribute('value', $key);
}
- if ($selected) { $option->setAttribute('selected', ''); }
+ if ($selected) {
+ $option->setAttribute('selected', '');
+ }
return $option;
}
@@ -813,6 +837,10 @@ class ExtendedElement extends DOMElement {
// appends an ExtendedDocument::createElementInputTime() as a child of this element (see there for params)
// returns the new child
//
+ // public function appendInputDateTime($name, [$id], [$min], [$max], [$value])
+ // appends an ExtendedDocument::createElementInputDateTime() as a child of this element (see there for params)
+ // returns the new child
+ //
// public function appendInputColor($name, [$id], [$value])
// appends an ExtendedDocument::createElementInputColor() as a child of this element (see there for params)
//
@@ -961,6 +989,9 @@ class ExtendedElement extends DOMElement {
public function appendInputTime($name, $id = null, $min = null, $max = null, $value = null) {
return $this->appendChild($this->ownerDocument->createElementInputTime($name, $id, $min, $max, $value));
}
+ public function appendInputDateTime($name, $id = null, $min = null, $max = null, $value = null) {
+ return $this->appendChild($this->ownerDocument->createElementInputDateTime($name, $id, $min, $max, $value));
+ }
public function appendInputColor($name, $id = null, $value = null) {
return $this->appendChild($this->ownerDocument->createElementInputColor($name, $id, $value));
}
@@ -1112,6 +1143,10 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
// appends an ExtendedDocument::createElementInputTime() as a child of this fragment (see there for params)
// returns the new child
//
+ // public function appendInputDateTime($name, [$id], [$min], [$max], [$value])
+ // appends an ExtendedDocument::createElementInputDateTime() as a child of this fragment (see there for params)
+ // returns the new child
+ //
// public function appendInputColor($name, [$id], [$value])
// appends an ExtendedDocument::createElementInputColor() as a child of this fragment (see there for params)
//
@@ -1250,6 +1285,9 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
public function appendInputTime($name, $id = null, $min = null, $max = null, $value = null) {
return $this->appendChild($this->ownerDocument->createElementInputTime($name, $id, $min, $max, $value));
}
+ public function appendInputDateTime($name, $id = null, $min = null, $max = null, $value = null) {
+ return $this->appendChild($this->ownerDocument->createElementInputDateTime($name, $id, $min, $max, $value));
+ }
public function appendInputColor($name, $id = null, $value = null) {
return $this->appendChild($this->ownerDocument->createElementInputColor($name, $id, $value));
}