You are here

function lingotek_profile_condition in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.util.inc \lingotek_profile_condition()
  2. 7.5 lingotek.util.inc \lingotek_profile_condition()
  3. 7.6 lingotek.util.inc \lingotek_profile_condition()
3 calls to lingotek_profile_condition()
lingotek_admin_get_nids_by_profile in ./lingotek.admin.inc
lingotek_admin_profile_usage in ./lingotek.admin.inc
lingotek_grid_get_rows in ./lingotek.bulk_grid.inc
Dynamic query processing function for the grid Since the header defines which columns are shown, this query gets all possible values and refines the header using the columns selected in the UI The filters are also processed here

File

./lingotek.util.inc, line 1283
Utility functions.

Code

function lingotek_profile_condition($node_table, $table_auto_upload, $table_profile, $profile_id) {
  $or = db_or();
  $fields = variable_get('lingotek_enabled_fields');
  $types = array();
  foreach (lingotek_load_profile_defaults('node') as $content_type => $profile) {
    if ($profile['profile'] == (string) $profile_id && isset($fields['node'][$content_type])) {
      $types[] = $content_type;
    }
  }
  if (!empty($types)) {
    $an = db_and();
    $an
      ->condition($node_table . '.type', $types, 'IN');

    //$an->condition($table_auto_upload . '.lingovalue', NULL);
    $an
      ->condition($table_profile . '.lingovalue', NULL);
    $or
      ->condition($an);
  }
  $or
    ->condition($table_profile . '.lingovalue', $profile_id);
  return $or;
}