You are here

function rec_example_settings_form_submit in Recommender API 7.3

Same name and namespace in other branches
  1. 7.5 rec_example/rec_example.module \rec_example_settings_form_submit()

File

rec_example/rec_example.module, line 61

Code

function rec_example_settings_form_submit($form, &$form_state) {
  switch ($form_state['clicked_button']['#name']) {
    case 'rebuild':
      $new_params = array(
        'algorithm' => 'svd',
      );

      //recommender_app_update('rec_example', $new_params);
      recommender_create_command('rec_example');
      break;
    case 'refresh':
      recommender_create_command('rec_example_update');
      break;
    case 'load_file':
      $batch = array(
        'title' => t('Importing Data'),
        'operations' => array(
          array(
            'rec_example_load_file_small_ram',
            array(
              '/tmp/100k/u1.base',
            ),
          ),
        ),
        'finished' => 'rec_example_batch_finish',
      );
      batch_set($batch);

      // only needed if not inside a form _submit handler :
      batch_process();
      break;
  }
}