function globallink_block_get_active_submission_rows in GlobalLink Connect for Drupal 7.5
Same name and namespace in other branches
- 7.6 globallink_block/globallink_block.inc \globallink_block_get_active_submission_rows()
Gets active block submission rows.
Parameters
string $object_id: The GlobalLink object ID.
Return value
Array of active block submission rows if there are any. FALSE if not.
1 call to globallink_block_get_active_submission_rows()
- globallink_block_dashboard_form in globallink_block/
globallink_block_send.inc - Builds form to create a block submission.
File
- globallink_block/
globallink_block.inc, line 649
Code
function globallink_block_get_active_submission_rows($object_id) {
$query = db_select('globallink_core_block', '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 $bid => $bid_arr) {
$sub_arr = array();
foreach ($bid_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[$bid] = $sub_arr;
}
}
if (count($final_arr) > 0) {
return $final_arr;
}
return FALSE;
}