function globallink_block_receive_filter_form in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.5 globallink_block/globallink_block_receive.inc \globallink_block_receive_filter_form()
Builds form to filter blocks to receive on dashboard.
1 string reference to 'globallink_block_receive_filter_form'
- globallink_block_receive_submissions in globallink_block/
globallink_block_receive.inc - Builds forms on block receive dashboard.
File
- globallink_block/
globallink_block_receive.inc, line 27
Code
function globallink_block_receive_filter_form() {
module_load_include('inc', 'globallink', 'globallink');
module_load_include('inc', 'globallink', 'globallink_settings');
module_load_include('inc', 'globallink_block', 'globallink_block');
$form = array();
$filter = FALSE;
$submission_options = globallink_block_get_distinct_active_submission_names();
$default_submission = '[any]';
if (!empty($_SESSION['globallink_block_receive_filter_submission']) && !array_key_exists($_SESSION['globallink_block_receive_filter_submission'], $submission_options)) {
$_SESSION['globallink_block_receive_filter_submission'] = '';
$_SESSION['globallink_block_globalLink_arr'] = array();
unset($_SESSION['globallink_block_globalLink_arr_last_refreshed']);
}
if (!empty($_SESSION['globallink_block_receive_filter_submission'])) {
$default_submission = $_SESSION['globallink_block_receive_filter_submission'];
$filter = TRUE;
}
$n_arr = array(
'[any]' => t('Any'),
);
$t_arr = globallink_get_mapped_locales_with_drupal_desc(FALSE);
$languages = $n_arr + $t_arr;
$status_arr = array(
'[any]' => t('Any'),
'Translation Completed' => 'Translation Completed',
'Error' => 'Error',
'Source Deleted' => 'Source Deleted',
);
$default = '[any]';
if (!empty($_SESSION['globallink_block_receive_filter_language'])) {
$default = $_SESSION['globallink_block_receive_filter_language'];
$filter = TRUE;
}
$default_status = '[any]';
if (!empty($_SESSION['globallink_block_receive_filter_status'])) {
$default_status = $_SESSION['globallink_block_receive_filter_status'];
$filter = TRUE;
}
$form['block_receive_filter'] = array(
'#type' => 'fieldset',
'#title' => t('FILTER RECORDS'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['block_receive_filter']['filters'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['block_receive_filter']['filters'][] = array(
'#markup' => '<table>',
);
$form['block_receive_filter']['filters']['language'] = array(
'#type' => 'select',
'#title' => t('Target Language'),
'#options' => $languages,
'#default_value' => $default,
'#field_suffix' => ' ',
'#prefix' => '<tr><td style="text-align: left;width: 15%;vertical-align: middle;border: none;">',
'#suffix' => '</tr>',
'#field_suffix' => '</td>',
'#field_prefix' => '</td><td>',
);
$form['block_receive_filter']['filters']['status'] = array(
'#type' => 'select',
'#title' => t('Status'),
'#options' => $status_arr,
'#default_value' => $default_status,
'#field_suffix' => ' ',
'#prefix' => '<tr><td style="text-align: left;width: 15%;vertical-align: middle;border: none;">',
'#suffix' => '</tr>',
'#field_suffix' => '</td>',
'#field_prefix' => '</td><td>',
);
$form['block_receive_filter']['filters']['submission'] = array(
'#type' => 'select',
'#title' => t('Submission'),
'#options' => $submission_options,
'#default_value' => $default_submission,
'#field_suffix' => ' ',
'#prefix' => '<tr><td style="text-align: left;width: 15%;vertical-align: middle;border: none;">',
'#suffix' => '</tr>',
'#field_suffix' => '</td>',
'#field_prefix' => '</td><td>',
);
$form['block_receive_filter']['filters'][] = array(
'#markup' => '</table>',
);
$disable_submit = $filter ? TRUE : FALSE;
$form['block_receive_filter']['filters']['filter'] = array(
'#type' => 'submit',
'#value' => t('Filter'),
'#disabled' => $disable_submit,
);
if ($filter) {
$form['filter-search'] = array(
'#type' => 'fieldset',
'#title' => t('FILTER CRITERIA'),
);
$form['filter-search']['filter-markup'] = array(
'#type' => 'container',
);
$form['filter-search']['filter-markup'][] = array(
'#markup' => '<table>',
);
$form['filter-search']['filter-markup'][] = array(
'#prefix' => '<tr><td style="text-align: left;width: 15%;vertical-align: middle;border: none;"><b>',
'#markup' => t('Target Language'),
'#suffix' => '</b>: </td><td style="text-align: left;width: 85%;vertical-align: middle;border: none;">' . $languages[$default] . '</td></tr>',
);
$form['filter-search']['filter-markup'][] = array(
'#prefix' => '<tr><td style="text-align: left;width: 15%;vertical-align: middle;border: none;"><b>',
'#markup' => t('Status'),
'#suffix' => '</b>: </td><td style="text-align: left;width: 85%;vertical-align: middle;border: none;">' . $status_arr[$default_status] . '</td></tr>',
);
$form['filter-search']['filter-markup'][] = array(
'#prefix' => '<tr><td style="text-align: left;width: 15%;vertical-align: middle;border: none;"><b>',
'#markup' => t('Submission'),
'#suffix' => '</b>: </td><td style="text-align: left;width: 85%;vertical-align: middle;border: none;">' . $submission_options[$default_submission] . '</td></tr>',
);
$form['filter-search']['filter-markup'][] = array(
'#markup' => '</table>',
);
$form['filter-search']['status']['actions'] = array(
'#type' => 'actions',
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['filter-search']['status']['actions']['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset'),
);
}
return $form;
}