You are here

public function video_zencoder::admin_settings in Video 6.5

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

Overrides video_plugin::admin_settings

File

plugins/video_zencoder/transcoders/video_zencoder.inc, line 111
Transcoder class file to handle Zencoder settings and conversions.

Class

video_zencoder

Code

public function admin_settings(&$form_state) {
  global $user;

  // check amazon s3 module is exists or not
  if (!module_exists('video_s3')) {
    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',
    '#value' => '<div id="video_zencoder">',
  );
  $zencoder_api = variable_get('video_zencoder_api_key', NULL);
  if (empty($zencoder_api)) {
    $form['zencoder_user'] = array(
      '#type' => 'fieldset',
      '#title' => t('Zencoder user'),
      '#collapsible' => FALSE,
      '#collapsed' => FALSE,
      '#description' => t('Save configurations to create your !link account to transcode and manage your videos using Zencoder API. Once you save your configuration this will automatically create an account on Zencoder.com and password and all ther other relevant details will be emailed 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', variable_get('site_mail', '')),
      '#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.<br/>If you already have a Zencoder account, enter the e-mail address that is associated with your Zencoder account.'),
    );
    $form['zencoder_user']['agree_terms_zencoder'] = array(
      '#type' => 'checkbox',
      '#title' => t('Agree to Zencoder terms and conditions.'),
      '#default_value' => variable_get('agree_terms_zencoder', FALSE),
      '#description' => t('Read terms and conditions on !link.', array(
        '!link' => l(t('Zencoder.com'), 'http://zencoder.com'),
      )),
    );
  }
  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 a 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('Dimension 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', url('postback/jobs', array(
        'absolute' => TRUE,
      ))),
    );
  }
  $form['video_zencoder_end'] = array(
    '#type' => 'markup',
    '#value' => '</div>',
  );
  return $form;
}