You are here

public function video_zencoder::admin_settings in Video 7

Same name and namespace in other branches
  1. 6.5 plugins/video_zencoder/transcoders/video_zencoder.inc \video_zencoder::admin_settings()
  2. 6.4 plugins/video_zencoder/transcoders/video_zencoder.inc \video_zencoder::admin_settings()

Interface Implementations

Overrides transcoder_interface::admin_settings

See also

sites/all/modules/video/includes/transcoder_interface#admin_settings()

File

modules/video_zencoder/transcoders/video_zencoder.inc, line 140

Class

video_zencoder

Code

public function admin_settings() {
  global $user;

  // check amazon s3 module is exists or not
  if (!module_exists('media_amazon')) {
    drupal_set_message(t('You must enable Video Amazon S3 Module to enable this module.'), 'error');
  }
  $form = array();
  $form['video_zencoder_start'] = array(
    '#type' => 'markup',
    '#markup' => '<div id="video_zencoder">',
  );
  $zencoder_api = variable_get('video_zencoder_api_key', null);
  if (!isset($zencoder_api) && empty($zencoder_api)) {
    $form['zencoder_user'] = array(
      '#type' => 'fieldset',
      '#title' => t('Zencoder User'),
      '#collapsible' => FALSE,
      '#collapsed' => FALSE,
      '#description' => t('Save configurations to creare your Zencoder account to transcode and manage your videos using Zencode  API. Once you save your configurations then this will automatically create an account on the Zencoder.com and password and all ther other relevent details will be emailled to you.', array(
        '!link' => l(t('Zencoder.com'), 'http://zencoder.com'),
      )),
    );
    $form['zencoder_user']['zencoder_username'] = array(
      '#type' => 'textfield',
      '#title' => t('Your email address'),
      '#default_value' => variable_get('zencoder_username', 'me@localhost'),
      '#size' => 50,
      '#description' => t('Make sure the email is accurate, since we will send all the password details to manage transcoding online and API key details to this.'),
    );
    $form['zencoder_user']['agree_terms_zencoder'] = array(
      '#type' => 'checkbox',
      '#title' => t('Agree Zencoder !link.', array(
        '!link' => l(t('Terms and Conditions'), 'http://zencoder.com/terms', array(
          'attributes' => array(
            'target' => '_blank',
          ),
        )),
      )),
      '#default_value' => variable_get('agree_terms_zencoder', TRUE),
    );
  }
  else {

    // Zencoder API is exists
    $form['zencoder_info'] = array(
      '#type' => 'fieldset',
      '#title' => t('Zencoder API'),
      '#collapsible' => FALSE,
      '#collapsed' => FALSE,
    );
    $form['zencoder_info']['video_zencoder_api_key'] = array(
      '#type' => 'textfield',
      '#title' => t('Zencoder API Key'),
      '#default_value' => variable_get('video_zencoder_api_key', null),
      '#description' => t('Zencoder API Key. Click <b>Reset to default</b> button to add new account.'),
    );
    $form['zencoder_info']['video_thumbs'] = array(
      '#type' => 'textfield',
      '#title' => t('Number of thumbnails'),
      '#description' => t('Number of thumbnails to display from video.'),
      '#default_value' => variable_get('video_thumbs', 5),
      '#size' => 5,
    );
    $form['zencoder_info']['video_thumbs_size'] = array(
      '#type' => 'textfield',
      '#title' => t('Dimention of thumbnails'),
      '#description' => t('Size of thumbnails to extract from video.'),
      '#default_value' => variable_get('video_thumbs_size', '160x120'),
      '#size' => 10,
    );
    global $base_url;
    $form['zencoder_info']['video_zencoder_postback'] = array(
      '#type' => 'textfield',
      '#title' => t('Postback URL for Zencoder'),
      '#description' => t('Important : Do not change this if you do not know
          what your doing.<br/> This postback URL will receive video data when they are completed.'),
      '#default_value' => variable_get('video_zencoder_postback', $base_url . '/postback/jobs'),
    );
  }
  $form['video_zencoder_end'] = array(
    '#type' => 'markup',
    '#markup' => '</div>',
  );
  return $form;
}