asset_batch_form_submit

Versions
mediamosa-174
asset_batch_form_submit($form, &$form_state)

Implementation of hook_submit().

Code

vpx_beheer_mm/asset/asset_batch.inc, line 435

<?php
function asset_batch_form_submit($form, &$form_state) {

// gather acl POST values
  $acl_values = $_POST['acl_value']; // not-so-nice hack!
  $acl = array();
  foreach ($acl_values as $acl_value) {
    // Omit non-selectable element at the top.
    if ($acl_value != '0') {
      $acl[] = $acl_value;
    }
  }

// gather app POST values
  $app_values = $_POST['app_value']; // not-so-nice hack!
  $apps = array();
  foreach ($app_values as $app_value) {
    // Omit non-selectable element at the top.
    if ($app_value != '0') {
      $apps[] = $app_value;
    }
  }

  $show_assets = $_SESSION['show_assets'];

  // gather selected asset_id's & coll_id's
  $assets = array();
  $asset_prefix = 'asset_';
  $collections = array();
  $collection_prefix = 'collection_';
  foreach ($form_state['values'] as $key => $value) {
    if (strpos($key, $asset_prefix) === 0 && $value == 1) {
      $assets[] = drupal_substr($key, drupal_strlen($asset_prefix));
    }
    if (strpos($key, $collection_prefix) === 0 && $value == 1) {
      $collections[] = drupal_substr($key, drupal_strlen($collection_prefix));
    }
  }

  if($show_assets == FALSE) {
    $assets = $_SESSION['asset_list'];
  }

  // pass POST values to the process page
  $_SESSION['asset_batch_post_values'] = array(
    'apps' => $apps,
    'acl' => $acl,
    'assets' => $assets,
    'collections' => $collections
  );

  if (isset($form_state['clicked_button']['#name']) && $form_state['clicked_button']['#name'] == 'generate_xml') {
    $_SESSION['template'] = $form_state['values']['template'];
    if($form_state['values']['save_file']) {
      drupal_goto('asset/batch/generate_xml/save');
    }
    else {
      drupal_goto('asset/batch/generate_xml');
    }
  }
  drupal_goto('asset/batch/process');
}
?>