. */ namespace Volkszaehler\View\XML; use Volkszaehler\View\HTTP; /** * XML group view * * @author Steffen Vogel * @package group */ class XMLGroupView extends XMLView { protected $xml; public function __construct(HTTP\Request $request, HTTP\Request $response) { parent::__construct($request, $response); $this->xml = $this->xmlDoc->createElement('groups'); } public function add(\Volkszaehler\Model\Group $obj) { $xmlGroup = $this->xmlDoc->createElement('group'); $xmlGroup->setAttribute('uuid', $obj->getUuid()); $xmlGroup->appendChild($this->xmlDoc->createElement('name', $obj->getName())); $xmlGroup->appendChild($this->xmlDoc->createElement('description', $obj->getDescription())); // TODO include sub groups? $this->xml->appendChild($xmlGroup); } public function render() { $this->xmlRoot->appendChild($this->xml); parent::render(); } } ?>