X-Git-Url: https://git-public.kairo.at/?p=php-utility-classes.git;a=blobdiff_plain;f=include%2Fcbsm%2Futil%2Fdocument.php-class;h=58637850153d708b5015f58f128f0df484be1dec;hp=e641d23c56364fec3610153d65803280cf03c726;hb=53510e9ea65c1e344e0a3b2f8c75319f8bf5f001;hpb=c1666e91613b658a3711a51fa367a0d11e677fd2 diff --git a/include/cbsm/util/document.php-class b/include/cbsm/util/document.php-class index e641d23..5863785 100755 --- a/include/cbsm/util/document.php-class +++ b/include/cbsm/util/document.php-class @@ -46,6 +46,10 @@ class ExtendedDocument extends DOMDocument { // appends an ExtendedDocument::createElementLink() as a child of this document (see there for params) // returns the new child // + // function appendImage($src, [$alt_text]) + // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params) + // returns the new child + // // function appendFormDiv($action, $method, $name) // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params) // returns an HTML
that is a child of the new child @@ -109,6 +113,9 @@ class ExtendedDocument extends DOMDocument { // function createElementLink($target, [$value]) // returns an ExtendedElement that is an HTML with the given target (href) and (optional) value // + // function createElementImage($src, [$alt_text]) + // returns an ExtendedElement that is an HTML with the given (src) and alt attributes (set to '' by default) + // // function createElementForm($action, $method, $name) // returns an ExtendedElement that is an HTML
that is a child of an HTML
// with the given action, method, and name @@ -172,6 +179,9 @@ class ExtendedDocument extends DOMDocument { function appendLink($target, $value = '') { return $this->appendChild($this->createElementLink($target, $value)); } + function appendImage($src, $alt_text = '') { + return $this->appendChild($this->createElementImage($src, $alt_text)); + } function appendFormDiv($action, $method, $name) { $formelem = $this->appendChild($this->createElementForm($action, $method, $name)); return $formelem->appendElement('div'); @@ -237,6 +247,13 @@ class ExtendedDocument extends DOMDocument { return $link; } + function createElementImage($src, $alt_text = '') { + $link = $this->createElement('img'); + $link->setAttribute('src', $src); + $link->setAttribute('alt', $alt_text); + return $link; + } + function createElementForm($action, $method, $name) { $formelem = $this->createElement('form'); $formelem->setAttribute('action', $action); @@ -358,6 +375,10 @@ class ExtendedElement extends DOMElement { // appends an ExtendedDocument::createElementLink() as a child of this element (see there for params) // returns the new child // + // function appendImage($src, [$alt_text]) + // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params) + // returns the new child + // // function appendFormDiv($action, $method, $name) // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params) // returns an HTML
that is a child of the new child @@ -429,6 +450,9 @@ class ExtendedElement extends DOMElement { function appendLink($target, $value = '') { return $this->appendChild($this->ownerDocument->createElementLink($target, $value)); } + function appendImage($src, $alt_text = '') { + return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text)); + } function appendFormDiv($action, $method, $name) { $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name)); return $formelem->appendElement('div'); @@ -494,6 +518,10 @@ class ExtendedDocumentFragment extends DOMDocumentFragment { // appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params) // returns the new child // + // function appendImage($src, [$alt_text]) + // appends an ExtendedDocument::createElementImage() as a child of this document (see there for params) + // returns the new child + // // function appendFormDiv($action, $method, $name) // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params) // returns an HTML
that is a child of the new child @@ -565,6 +593,9 @@ class ExtendedDocumentFragment extends DOMDocumentFragment { function appendLink($target, $value = '') { return $this->appendChild($this->ownerDocument->createElementLink($target, $value)); } + function appendImage($src, $alt_text = '') { + return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text)); + } function appendFormDiv($action, $method, $name) { $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name)); return $formelem->appendElement('div');