You are here

function globallink_fieldable_panels_check_status in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.6 globallink_fieldable_panels/globallink_fieldable_panels.inc \globallink_fieldable_panels_check_status()

Checks fieldable panel status based on row IDs.

Parameters

array $rids_arr: Array of row IDs.

Return value

array Array of row IDs that have been sent for translation or threw an error.

1 call to globallink_fieldable_panels_check_status()
globallink_fieldable_panels_active_form_submit in globallink_fieldable_panels/globallink_fieldable_panels_active_submissions.inc
Handles submission of active fieldable panels form.

File

globallink_fieldable_panels/globallink_fieldable_panels.inc, line 226

Code

function globallink_fieldable_panels_check_status($ids_arr) {
  $status = TRUE;
  $query = db_select('globallink_core_fieldable_panels', 'tcfp')
    ->fields('tcfp', array(
    'id',
  ))
    ->condition('status', array(
    'Sent for Translations',
    'Error',
  ), 'IN');
  $results = $query
    ->execute();
  $rows = array();
  foreach ($results as $item) {
    $rows[$item->id] = $item->id;
  }
  foreach ($ids_arr as $val) {
    if (!in_array($val, $rows)) {
      unset($ids_arr[$val]);
      $status = FALSE;
    }
  }
  if (!$status) {
    drupal_set_message(t('Cannot cancel documents that have been cancelled in Globallink.'), 'warning', NULL);
  }
  return $ids_arr;
}