function globallink_menu_update_ticket_id in GlobalLink Connect for Drupal 7.5
Same name and namespace in other branches
- 7.6 globallink_menu/globallink_menu.inc \globallink_menu_update_ticket_id()
Updates menu ticket ID.
Parameters
array $arr: Array of GlobalLink objects.
string $project_code: The menu's project code.
1 call to globallink_menu_update_ticket_id()
- globallink_menu_dashboard_form_submit in globallink_menu/
globallink_menu_send.inc - Handles menu form submission.
File
- globallink_menu/
globallink_menu.inc, line 116
Code
function globallink_menu_update_ticket_id($arr, $project_code) {
foreach ($arr as $globallink) {
$target_locale_arr = $globallink->targetLocale;
$type = $globallink->type;
if ($type != 'menu') {
continue;
}
$mlid = $globallink->otherObjectId;
$link = menu_link_load($mlid);
foreach ($target_locale_arr as $target_locale) {
$row = globallink_menu_get_row($mlid, $type, $globallink->sourceLocale, $target_locale);
if ($row) {
db_update('globallink_core_menu')
->fields(array(
'title' => $link['link_title'],
'document_ticket' => $globallink->documentTicket,
'submission' => $globallink->submissionName,
'submission_ticket' => $globallink->submissionTicket,
'status' => 'Sent for Translations',
'timestamp' => REQUEST_TIME,
'last_modified' => REQUEST_TIME,
'project_code' => $project_code,
))
->condition('rid', $row->rid, '=')
->execute();
}
else {
db_insert('globallink_core_menu')
->fields(array(
'object_id' => $mlid,
'object_type' => $globallink->type,
'title' => $link['link_title'],
'source' => $globallink->sourceLocale,
'target' => $target_locale,
'document_ticket' => $globallink->documentTicket,
'submission' => $globallink->submissionName,
'submission_ticket' => $globallink->submissionTicket,
'status' => 'Sent for Translations',
'timestamp' => REQUEST_TIME,
'last_modified' => REQUEST_TIME,
'project_code' => $project_code,
))
->execute();
}
}
}
}