You are here

function advpoll_converter_form_submit in Advanced Poll 7.3

Same name and namespace in other branches
  1. 7 advpoll_converter/advpoll_converter.admin.inc \advpoll_converter_form_submit()
  2. 7.2 advpoll_converter/advpoll_converter.admin.inc \advpoll_converter_form_submit()

Submit for administrative form.

File

advpoll_converter/advpoll_converter.admin.inc, line 59
Advanced Poll Converter Module Admin Forms and Functions.

Code

function advpoll_converter_form_submit($form, $form_state) {
  $nids = array();
  $delete = 0;
  if (isset($form_state['values']['advpoll_converter_select'])) {
    $delete = $form_state['values']['advpoll_converter_delete'];
    $selections = $form_state['values']['advpoll_converter_select'];
    if ($selections) {
      foreach ($selections as $nid) {
        $nids[] = $nid;
      }
      _advpoll_converter_create_nodes($nids);
      if ($delete) {
        node_delete_multiple($nids);
      }
    }
    else {
      form_set_error('advpoll_converter_select', t('Please select at least one poll to convert.'));
    }
  }
}