You are here

function kaltura_contribution_wizard in Kaltura 6

Same name and namespace in other branches
  1. 5 includes/kaltura.themeing.inc \kaltura_contribution_wizard()
  2. 6.2 includes/kaltura.themeing.inc \kaltura_contribution_wizard()
1 string reference to 'kaltura_contribution_wizard'
kaltura_menu in ./kaltura.module

File

includes/kaltura.themeing.inc, line 172

Code

function kaltura_contribution_wizard() {
  $args = func_get_args();
  $temp_args = unserialize(urldecode($args[0]));

  // argument handling
  foreach ($temp_args as $key => $val) {
    ${$key} = $val;
  }
  $kaltura_client = KalturaHelpers::getKalturaClient();
  if (!$kaltura_client) {
    drupal_set_message('Failed to start Kaltura session. Please check your settings.', 'warning');
    echo theme_kaltura_maintenance_page("<br /><a href=\"#\" onclick=\"window.top.kalturaCloseModalBox()\">Close</a>", TRUE);
    exit;
  }

  /* TODO: remove the creation of RC */
  if ($context == 'field_mix') {
    if (isset($args[1]) && $args[1] != '') {
      $title = $args[1];
    }

    // create roughcut at this point by API call,
    $rc = new KalturaEntry();
    $rc->name = $title;
    $session_user = KalturaHelpers::getSessionUser();
    $result = $kaltura_client
      ->addRoughcutEntry($session_user, -2, $rc);

    // pass roughcut ID to CW.
    $kshow_id = $result['result']['entry']['id'];
    kaltura_create_node_from_roughcut($result['result'], 1);
  }
  $theme_params->height = 360;
  $theme_params->width = 680;
  $theme_params->swfUrl = KalturaHelpers::getContributionWizardUrl();
  $flash_vars = KalturaHelpers::getContributionWizardFlashVars($kaltura_client
    ->getKs(), $kshow_id, $partner_data, $type, $context == 'comment' ? TRUE : FALSE);
  $theme_params->flashVarsStr = KalturaHelpers::flashVarsToString($flash_vars);
  if ($partner_data && strpos($partner_data, 'kshow_exist@yes')) {
    $add_new = TRUE;
    $theme_params->mix_id = kaltura_get_node_for_mix($kshow_id);
  }
  if ($context == 'field' || $context == 'field_mix' || $context == 'comment') {
    $no_collect_entries = $context == 'field_mix' ? TRUE : FALSE;
    echo theme('contribution_wizard_field', $theme_params, $field_id, $no_collect_entries, $kshow_id, $add_filter);
    exit;
  }
  if ($navigate_back === NULL) {
    $navigate_back = TRUE;
  }
  if ($kshow_id != "-2" && !$add_new) {
    echo theme('contribution_wizard', $theme_params);
  }
  else {
    echo theme('contribution_wizard_add', $theme_params, $navigate_back);
  }
  exit;
}