You are here

function votingapi_actions_admin_import_page_submit in Voting API 5

File

./votingapi_actions_ui.inc, line 155

Code

function votingapi_actions_admin_import_page_submit($formid, $form) {
  ob_start();
  eval($form['set']);
  ob_end_clean();
  if (is_array($sets)) {
    foreach ($sets as $name => $set) {
      if ($name) {
        $errors = _votingapi_validate_action_set($name, $set);
        if (count($errors) == 0) {
          _votingapi_insert_set($name, $set);
          votingapi_rebuild_action_cache();
          drupal_goto('admin/settings/voting_actions');
        }
        else {
          foreach ($errors as $error) {
            drupal_set_message($error);
          }
        }
      }
      else {
        drupal_set_message(t('Unable to get an action set out of that.'));
        return;
      }
    }
  }
}