35 lines
981 B
PHP
35 lines
981 B
PHP
<?php
|
|
|
|
class renderImageClass extends renderClass_abstract
|
|
{
|
|
private $_imgData = array();
|
|
|
|
public function createImage($imgData, $isEditable, $type)
|
|
{
|
|
$this->_imgData = $imgData;
|
|
$new_node = $this->_tpl->createDocumentFragment();
|
|
$node = $this->_tpl->createElement('img');
|
|
|
|
$node->setAttributeNode(new DOMAttr ('src', $this->_imgData['path'] . $this->_imgData['navId'] . $this->_imgData['src']));
|
|
if (!is_null($imgData['title']) && $imgData['title'] !== '')
|
|
{
|
|
$node->setAttributeNode(new DOMAttr ('title', $this->_imgData['title']));
|
|
}
|
|
|
|
if (isset ($imgData['id']) && $isEditable)
|
|
{
|
|
$node->setAttributeNode(new DOMAttr ('data-editable', $type));
|
|
$node->setAttributeNode(new DOMAttr ('id', $type . '_' . $this->_imgData['id']));
|
|
}
|
|
else if ($isEditable)
|
|
{
|
|
$node->setAttributeNode(new DOMAttr ('data-editable', $type));
|
|
$node->setAttributeNode(new DOMAttr ('id', $type . '_0'));
|
|
}
|
|
|
|
$new_node->appendChild($node);
|
|
|
|
return $new_node;
|
|
}
|
|
|
|
} |