projects
/
php-utility-classes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a8816f4
)
add support for file input
author
Robert Kaiser
<kairo@kairo.at>
Thu, 6 Oct 2016 22:21:08 +0000
(
00:21
+0200)
committer
Robert Kaiser
<kairo@kairo.at>
Thu, 6 Oct 2016 22:21:08 +0000
(
00:21
+0200)
include/cbsm/util/document.php-class
patch
|
blob
|
blame
|
history
diff --git
a/include/cbsm/util/document.php-class
b/include/cbsm/util/document.php-class
index d023c997d781afeafe809a6ad6e4fb8a5259cd5d..c267623a5f26831a85b21a281399d066cb576c42 100755
(executable)
--- a/
include/cbsm/util/document.php-class
+++ b/
include/cbsm/util/document.php-class
@@
-82,6
+82,10
@@
class ExtendedDocument extends DOMDocument {
// appends an ExtendedDocument::createElementInputCheckbox() as a child of this document (see there for params)
// returns the new child
//
// appends an ExtendedDocument::createElementInputCheckbox() as a child of this document (see there for params)
// returns the new child
//
+ // function appendInputFile($name, $id, $accept)
+ // appends an ExtendedDocument::createElementInputFile() as a child of this document (see there for params)
+ // returns the new child
+ //
// function appendInputSubmit($value)
// appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
// returns the new child
// function appendInputSubmit($value)
// appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
// returns the new child
@@
-163,6
+167,9
@@
class ExtendedDocument extends DOMDocument {
// returns an ExtendedElement that is an HTML <input> of type 'checkbox' with the given name, id, value and
// checked state
//
// returns an ExtendedElement that is an HTML <input> of type 'checkbox' with the given name, id, value and
// checked state
//
+ // function createElementInputFile($name, $id, $accept)
+ // returns an ExtendedElement that is an HTML <input> of type 'file' with the given name, id and accept
+ //
// function createElementInputSubmit($value)
// returns an ExtendedElement that is an HTML <input> of type 'submit' with the given value as label
//
// function createElementInputSubmit($value)
// returns an ExtendedElement that is an HTML <input> of type 'submit' with the given value as label
//
@@
-238,6
+245,9
@@
class ExtendedDocument extends DOMDocument {
function appendInputCheckbox($name, $id, $value, $checked) {
return $this->appendChild($this->createElementInputCheckbox($name, $id, $value, $checked));
}
function appendInputCheckbox($name, $id, $value, $checked) {
return $this->appendChild($this->createElementInputCheckbox($name, $id, $value, $checked));
}
+ function appendInputFile($name, $id, $accept) {
+ return $this->appendChild($this->createElementInputFile($name, $id, $accept));
+ }
function appendInputSubmit($value) {
return $this->appendChild($this->createElementInputSubmit($value));
}
function appendInputSubmit($value) {
return $this->appendChild($this->createElementInputSubmit($value));
}
@@
-361,7
+371,7
@@
class ExtendedDocument extends DOMDocument {
$radio = $this->createElement('input');
$radio->setAttribute('type', 'radio');
$radio->setAttribute('name', $name);
$radio = $this->createElement('input');
$radio->setAttribute('type', 'radio');
$radio->setAttribute('name', $name);
- $radio->setAttribute('id', $id);
+ if (!is_null($id)) { $radio->setAttribute('id', $id); }
$radio->setAttribute('value', $value);
if ($checked) { $radio->setAttribute('checked', ''); }
return $radio;
$radio->setAttribute('value', $value);
if ($checked) { $radio->setAttribute('checked', ''); }
return $radio;
@@
-371,12
+381,21
@@
class ExtendedDocument extends DOMDocument {
$cbox = $this->createElement('input');
$cbox->setAttribute('type', 'checkbox');
$cbox->setAttribute('name', $name);
$cbox = $this->createElement('input');
$cbox->setAttribute('type', 'checkbox');
$cbox->setAttribute('name', $name);
- $cbox->setAttribute('id', $id);
+ if (!is_null($id)) { $cbox->setAttribute('id', $id); }
$cbox->setAttribute('value', $value);
if ($checked) { $cbox->setAttribute('checked', ''); }
return $cbox;
}
$cbox->setAttribute('value', $value);
if ($checked) { $cbox->setAttribute('checked', ''); }
return $cbox;
}
+ function createElementInputFile($name, $id, $accept) {
+ $fileinput = $this->createElement('input');
+ $fileinput->setAttribute('type', 'file');
+ $fileinput->setAttribute('name', $name);
+ if (!is_null($id)) { $fileinput->setAttribute('id', $id); }
+ $fileinput->setAttribute('accept', $accept);
+ return $fileinput;
+ }
+
function createElementInputSubmit($value) {
$submitbtn = $this->createElement('input');
$submitbtn->setAttribute('type', 'submit');
function createElementInputSubmit($value) {
$submitbtn = $this->createElement('input');
$submitbtn->setAttribute('type', 'submit');
@@
-495,6
+514,10
@@
class ExtendedElement extends DOMElement {
// appends an ExtendedDocument::createElementInputCheckbox() as a child of this element (see there for params)
// returns the new child
//
// appends an ExtendedDocument::createElementInputCheckbox() as a child of this element (see there for params)
// returns the new child
//
+ // function appendInputFile($name, $id, $accept)
+ // appends an ExtendedDocument::createElementInputFile() as a child of this element (see there for params)
+ // returns the new child
+ //
// function appendInputSubmit($value)
// appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
// returns the new child
// function appendInputSubmit($value)
// appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
// returns the new child
@@
-582,6
+605,9
@@
class ExtendedElement extends DOMElement {
function appendInputCheckbox($name, $id, $value, $checked) {
return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
}
function appendInputCheckbox($name, $id, $value, $checked) {
return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
}
+ function appendInputFile($name, $id, $accept) {
+ return $this->appendChild($this->ownerDocument->createElementInputFile($name, $id, $accept));
+ }
function appendInputSubmit($value) {
return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
}
function appendInputSubmit($value) {
return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
}
@@
-673,6
+699,10
@@
class ExtendedDocumentFragment extends DOMDocumentFragment {
// appends an ExtendedDocument::createElementInputCheckbox() as a child of this fragment (see there for params)
// returns the new child
//
// appends an ExtendedDocument::createElementInputCheckbox() as a child of this fragment (see there for params)
// returns the new child
//
+ // function appendInputFile($name, $id, $accept)
+ // appends an ExtendedDocument::createElementInputFile() as a child of this fragment (see there for params)
+ // returns the new child
+ //
// function appendInputSubmit($value)
// appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
// returns the new child
// function appendInputSubmit($value)
// appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
// returns the new child
@@
-760,6
+790,9
@@
class ExtendedDocumentFragment extends DOMDocumentFragment {
function appendInputCheckbox($name, $id, $value, $checked) {
return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
}
function appendInputCheckbox($name, $id, $value, $checked) {
return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
}
+ function appendInputFile($name, $id, $accept) {
+ return $this->appendChild($this->ownerDocument->createElementInputFile($name, $id, $accept));
+ }
function appendInputSubmit($value) {
return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
}
function appendInputSubmit($value) {
return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
}