function kaltura_contribution_wizard in Kaltura 6.2
Same name and namespace in other branches
- 5 includes/kaltura.themeing.inc \kaltura_contribution_wizard()
- 6 includes/kaltura.themeing.inc \kaltura_contribution_wizard()
1 call to kaltura_contribution_wizard()
1 string reference to 'kaltura_contribution_wizard'
File
- includes/
kaltura.themeing.inc, line 250
Code
function kaltura_contribution_wizard() {
global $user;
$args = func_get_args();
$temp_args = unserialize(urldecode($args[0]));
// argument handling
foreach ($temp_args as $key => $val) {
${$key} = $val;
}
$temp_ui_conf = kaltura_invoke('use_cw', $temp_args);
if (!empty($temp_ui_conf[0])) {
$ui_conf = $temp_ui_conf[0];
}
$is_entry_node = false;
if ($kshow_id == -2) {
$is_entry_node = true;
}
$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 (isset($args[1]) && $args[1] != '') {
$title = $args[1];
}
// create roughcut at this point by API call,
$session_user = KalturaHelpers::getSessionUser();
if (empty($partner_data)) {
$partner_data = "user_id@" . $user->uid;
$partner_data .= "|kshow_exist@no";
}
/* $partner_data = "user_id@". $user->uid;
$partner_data .= "|kshow_exist@no";
*/
if ($context == 'field_mix') {
$rc = new KalturaMixEntry();
$rc->name = $title;
$rc->userId = $session_user->screenName;
//$rc->type = ENTRY_TYPE_ROUGHCUT;
//$rc->tags = $_REQUEST['kaltura_tags'];
//$rc->adminTags = $_REQUEST['kaltura_admin_tags'];
$rc->partnerId = variable_get('kaltura_partner_id', '');
$rc->partner_data = $partner_data;
//NOTE: CM TO DO - make SIMPLE/ADVANCED variable
$rc->editorType = KalturaEditorType::ADVANCED;
$result = $kaltura_client->mixing
->add($rc);
// pass roughcut ID to CW.
$kshow_id = $result->id;
}
//Don't create a node for field_mix
if ($context != 'field_mix' && $is_entry_node == false && !empty($result)) {
//NOTE: CM - add an argument for updates vs. new node. right now this is causing two nodes to be created for every mix..
kaltura_create_node_from_roughcut($result, 1);
}
$theme_params->height = 360;
$theme_params->width = 680;
if ($context == 'comment') {
$theme_params->swfUrl = KalturaHelpers::getContributionWizardUrl(KalturaSettings_CW_COMMENTS_UICONF_ID);
}
else {
if (empty($ui_conf)) {
// ui_conf was not supplied by external vars (like block button)
$theme_params->swfUrl = KalturaHelpers::getContributionWizardUrl();
if (empty($context) && is_entry_node == true) {
// this is entry
$ui_conf = variable_get('kaltura_video_entry_cw_type', '');
if (!empty($ui_conf)) {
//found
if ($ui_conf == 1) {
// this is custom
$ui_conf = variable_get('kaltura_video_entry_cw_custom', KalturaSettings_CW_UICONF_ID);
}
$theme_params->swfUrl = KalturaHelpers::getContributionWizardUrl($ui_conf);
}
}
else {
if ($context == 'kaltura_mix') {
$ui_conf = variable_get('kaltura_mix_roughcut_cw_type', '');
if (!empty($ui_conf)) {
//found
if ($ui_conf == 1) {
// this is custom
$ui_conf = variable_get('kaltura_mix_roughcut_cw_custom', KalturaSettings_CW_UICONF_ID);
}
$theme_params->swfUrl = KalturaHelpers::getContributionWizardUrl($ui_conf);
}
}
}
}
else {
$theme_params->swfUrl = KalturaHelpers::getContributionWizardUrl($ui_conf);
}
}
$simple = false;
if (KalturaSettings_CW_UICONF_ID_SIMPLE == $ui_conf) {
$simple = true;
}
$flash_vars = KalturaHelpers::getContributionWizardFlashVars($kaltura_client
->getKs(), $kshow_id, $partner_data, $type, $context == 'comment' ? TRUE : FALSE, $simple, $ui_conf);
$theme_params->flashVarsStr = KalturaHelpers::flashVarsToString($flash_vars);
if ($partner_data) {
$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('kaltura_contribution_wizard_field', $theme_params, $field_id, $no_collect_entries, $kshow_id, $add_filter);
exit;
}
if ($navigate_back === NULL) {
$navigate_back = TRUE;
}
if (KalturaSettings_CW_UICONF_ID_SIMPLE == $ui_conf) {
if (isset($write_output) && $write_output == 0) {
return theme('kaltura_contribution_wizard_simple', $theme_params);
}
else {
echo theme('kaltura_contribution_wizard_simple', $theme_params);
}
}
else {
if ($kshow_id != "-2" && !$add_new) {
echo theme('kaltura_contribution_wizard', $theme_params);
}
else {
echo theme('kaltura_contribution_wizard_add', $theme_params, $navigate_back);
}
}
exit;
}