You are here

function kaltura_clone_mix in Kaltura 6.2

1 string reference to 'kaltura_clone_mix'
node_kaltura_mix_menu in plugins/node_kaltura_mix/node_kaltura_mix.module
Implementation of hook_menu().

File

plugins/node_kaltura_mix/node_kaltura_mix.module, line 633

Code

function kaltura_clone_mix() {
  $op = arg(2);
  $content_type = arg(3);
  $entry_id = arg(2);
  $confirm = arg(4);

  //If we are asking for confirmation from the user....
  if (isset($confirm) && $confirm == 'confirm' && isset($entry_id) && $entry_id != '') {
    return drupal_get_form('kaltura_clone_mix_confirm');
  }
  else {
    if ((!isset($confirm) || $confirm === '') && user_access('clone kaltura mixes')) {
      $kaltura_client = KalturaHelpers::getKalturaClient();
      $session_user = KalturaHelpers::getSessionUser();
      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;
      }

      // create roughcut at this point by API call,
      $rc = new KalturaMixEntry();
      $rc->name = $title;
      $session_user = KalturaHelpers::getSessionUser();
      $result = $kaltura_client->mixing
        ->cloneAction($entry_id);
      if ($content_type == 'kaltura_mix' || !isset($content_type)) {
        $nid = kaltura_create_node_from_roughcut($result);
        drupal_goto('node/' . $nid . '/edit');
      }
      else {
        $cloned_entry_id = $result->id;
        $content_type_url = str_replace('_', '-', $content_type);
        drupal_goto('node/add/' . $content_type_url . '/' . $cloned_entry_id);
      }
    }
    else {
      drupal_set_message('You do not have access to remix this content.', 'error');
      drupal_goto('');
    }
  }
}