function globallink_webform_get_xml in GlobalLink Connect for Drupal 7.5
Same name and namespace in other branches
- 7.7 globallink_webform/globallink_webform.inc \globallink_webform_get_xml()
- 7.6 globallink_webform/globallink_webform.inc \globallink_webform_get_xml()
Gets XML data from specific webform.
Parameters
string $lid: The webform LID.
Return value
array Associative array of block XML data.
2 calls to globallink_webform_get_xml()
- globallink_webform_get_translations_for_row_id in globallink_webform/
globallink_webform_receive.inc - Gets webform translations by row ID.
- globallink_webform_send_for_translations in globallink_webform/
globallink_webform.inc - Sends webforms for translation.
File
- globallink_webform/
globallink_webform.inc, line 84
Code
function globallink_webform_get_xml($lid) {
$property_arr = array();
$string_result = db_select('i18n_string', 's')
->fields('s')
->condition('lid', $lid, '=')
->execute();
foreach ($string_result as $row) {
$property_arr['property'] = $row->property;
}
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = TRUE;
$root = $dom
->createElement('content');
$dom
->appendChild($root);
$id = $dom
->createAttribute('lid');
$id->value = $lid;
$root
->appendChild($id);
$result = db_select('locales_source', 'ls')
->fields('ls')
->condition('lid', $lid, '=')
->execute();
foreach ($result as $row) {
globallink_insert_child_element($dom, $root, 'webform', $row->source, array(
'name' => $property_arr['property'],
'lid' => $lid,
'location' => $row->location,
'format' => isset($lid['format']) ? $lid['format'] : '',
));
}
$xml = $dom
->saveXML();
return $xml;
}