/** Returns the group/key config as XML.
* @return mixed
*/
public static function export()
{
$xml = new \SimpleXMLElement('<xml/>');
$groupConfigList = new Object\KeyValue\GroupConfig\Listing();
$groupConfigList->load();
$groupConfigItems = $groupConfigList->getList();
$groups = $xml->addChild('groups');
foreach ($groupConfigItems as $item) {
$group = $groups->addChild('group');
$group->addChild("id", $item->getId());
$group->addChild("name", $item->getName());
$group->addChild("description", $item->getDescription());
}
$keyConfigList = new Object\KeyValue\KeyConfig\Listing();
$keyConfigList->load();
$keyConfigItems = $keyConfigList->getList();
$keys = $xml->addChild('keys');
foreach ($keyConfigItems as $item) {
$key = $keys->addChild('key');
$id = $key->addChild('id', $item->getId());
$name = $key->addChild('name', $item->getName());
$description = $key->addChild('description', $item->getDescription());
$type = $key->addChild('type', $item->getType());
$unit = $key->addChild('unit', $item->getUnit());
$group = $key->addChild('group', $item->getGroup());
$possiblevalues = $key->addChild('possiblevalues', $item->getPossibleValues());
}
return $xml->asXML();
}