function globallink_menu_get_active_submission_rows in GlobalLink Connect for Drupal 7.5
Same name and namespace in other branches
- 7.6 globallink_menu/globallink_menu.inc \globallink_menu_get_active_submission_rows()
Gets active menu submission rows by object ID.
Parameters
string $object_id: The object ID.
Return value
Associative array of menu active submission rows. FALSE if the array is empty.
1 call to globallink_menu_get_active_submission_rows()
- globallink_menu_dashboard_form in globallink_menu/
globallink_menu_send.inc - Builds form to create a menu submission.
File
- globallink_menu/
globallink_menu.inc, line 759
Code
function globallink_menu_get_active_submission_rows($object_id) {
$query = db_select('globallink_core_menu', 'tc');
$query
->condition('status', 'Sent for Translations', '=');
$query
->condition('object_id', $object_id, '=');
$query
->fields('tc');
$results = $query
->execute();
$arr = array();
foreach ($results as $row) {
if (array_key_exists($row->object_id, $arr)) {
array_push($arr[$row->object_id], $row);
}
else {
$arr[$row->object_id] = array(
$row,
);
}
}
$final_arr = array();
foreach ($arr as $mlid => $mlid_arr) {
$sub_arr = array();
foreach ($mlid_arr as $r) {
if (array_key_exists($r->submission, $sub_arr)) {
array_push($sub_arr[$r->submission], $r->target);
}
else {
$sub_arr[$r->submission] = array(
$r->target,
);
}
}
if (count($sub_arr) > 0) {
$final_arr[$mlid] = $sub_arr;
}
}
if (count($final_arr) > 0) {
return $final_arr;
}
return FALSE;
}