function globallink_beans_get_active_submission_rows in GlobalLink Connect for Drupal 7.6
Gets active beans submission rows by node ID.
Parameters
string $bids: The array of beans IDs.
Return value
Associative array of beans active submission rows. FALSE if the array is empty.
1 call to globallink_beans_get_active_submission_rows()
- globallink_beans_dashboard_form in globallink_beans/
globallink_beans_send.inc - Builds form to create a beans submission.
File
- globallink_beans/
globallink_beans.inc, line 87
Code
function globallink_beans_get_active_submission_rows($bid) {
$query = db_select('globallink_core_beans', 'gcb');
$query
->condition('status', 'Sent for Translations', '=');
$query
->condition('object_id', $bid, '=');
$query
->fields('gcb');
$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 $bnid => $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[$bnid] = $sub_arr;
}
}
if (count($final_arr) > 0) {
return $final_arr;
}
return FALSE;
}