function globallink_webform_get_xml in GlobalLink Connect for Drupal 7.7
Same name and namespace in other branches
- 7.5 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.
1 call to globallink_webform_get_xml()
- globallink_webform_send_for_translations in globallink_webform/
globallink_webform.inc - Sends webforms for translation.
File
- globallink_webform/
globallink_webform.inc, line 99
Code
function globallink_webform_get_xml($parents) {
$xmls = array();
foreach ($parents as $parent => $lids) {
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = TRUE;
$root = $dom
->createElement('content');
$dom
->appendChild($root);
# code...
$property_arr = array();
if (!is_array($lids)) {
$string_result = db_select('i18n_string', 's')
->fields('s')
->condition('lid', $lids, '=')
->execute();
foreach ($string_result as $row) {
$property_arr['property'] = $row->property;
}
$id = $dom
->createAttribute('pid');
$id->value = $parent;
$root
->appendChild($id);
$result = db_select('locales_source', 'ls')
->fields('ls')
->condition('lid', $lids, '=')
->execute();
foreach ($result as $row) {
globallink_insert_child_element($dom, $root, GLOBALLINK_ENTITY_TYPE_WEBFORM, $row->source, array(
'name' => $property_arr['property'],
'lid' => $lids,
'location' => $row->location,
'format' => isset($lids['format']) ? $lids['format'] : '',
));
}
}
else {
foreach ($lids as $lid) {
$string_result = db_select('i18n_string', 's')
->fields('s')
->condition('lid', $lid, '=')
->execute();
foreach ($string_result as $row) {
$property_arr['property'] = $row->property;
}
$id = $dom
->createAttribute('pid');
$id->value = $parent;
$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, GLOBALLINK_ENTITY_TYPE_WEBFORM, $row->source, array(
'name' => $property_arr['property'],
'lid' => $lid,
'location' => $row->location,
'format' => isset($lid['format']) ? $lid['format'] : '',
));
}
}
}
$xml = $dom
->saveXML();
$xmls[$parent] = $xml;
}
return $xmls;
}