You are here

function kaltura_use_uiconf in Kaltura 6.2

Same name and namespace in other branches
  1. 5 kaltura.module \kaltura_use_uiconf()
  2. 6 kaltura.module \kaltura_use_uiconf()
1 call to kaltura_use_uiconf()
kaltura_get_embed_options in includes/kaltura.themeing.inc

File

./kaltura.module, line 278
kaltura integration module - core functions

Code

function kaltura_use_uiconf($default_uicid, $node_type, $theme_uicid, $media_type = 'roughcut') {

  // invoke hook use_widget
  $new_uicid = kaltura_invoke('use_uiconf', array(
    $node_type,
    $media_type,
  ));

  // if returned $wid from hooks, use it
  if ($new_uicid) {
    return $new_uicid[0];
  }

  // if no module implements the hook, and a theme widget was specified, return theme widget
  if ($theme_uicid) {
    return $theme_uicid;
  }

  /*  if ($media_type == 'viewplaylist')
    {
      return KalturaSettings_DEFAULT_VIEWPLAYLIST_UICONF;
    }
  */

  // if no $wid from hooks or theme, check for widgets in settings, for specific type (entry, kshow, mix)
  $widgets = new KalturaSettings();
  if ($node_type == 'mix' || $node_type == 'roughcut') {
    $uiconf_type = user_access('edit own kaltura mixes') ? 'remix' : 'view';
  }
  else {

    //$uiconf_type = (user_access('edit kaltura items'))? 'remix': 'view';
    $uiconf_type = 'view';
  }
  $default = kaltura_default_uiconf_by_type($media_type);
  $widget = variable_get('kaltura_' . $media_type . '_' . $node_type . '_widget', $default);
  if (is_numeric($widget)) {

    //we currently support names (to be fetched from static settings or numbers (real uiconf)
    return $widget;
  }
  if ($widgets->kdp_widgets[$media_type][$widget][$uiconf_type . '_uiconf'] != 'XXX') {
    $ui_conf = $widgets->kdp_widgets[$media_type][$widget][$uiconf_type . '_uiconf'];
  }
  if ($ui_conf) {
    return $ui_conf;
  }

  // if settings widget for specified type is XXX => not defined, use default
  return $default_uicid;
}