You are here

function kaltura_get_view_raw_data in Kaltura 6

Same name and namespace in other branches
  1. 5 plugins/kaltura_playlist/kaltura_playlist.module \kaltura_get_view_raw_data()
  2. 6.2 plugins/kaltura_playlist/kaltura_playlist.module \kaltura_get_view_raw_data()
1 call to kaltura_get_view_raw_data()
theme_kaltura_playlist_view in plugins/kaltura_playlist/kaltura_playlist.module

File

plugins/kaltura_playlist/kaltura_playlist.module, line 248

Code

function kaltura_get_view_raw_data($view_details) {
  global $user;
  list($view_name, $view_display) = kaltura_get_view_details($view_details);
  $view = views_get_view($view_name);
  if ($view) {
    $view->display['default']->display_options['fields']['kaltura_media_type'] = array(
      'label' => 'Kaltura Media Type',
      'link_to_node' => 0,
      'exclude' => 1,
      'id' => 'kaltura_media_type',
      'table' => 'node_kaltura',
      'field' => 'kaltura_media_type',
      'relationship' => 'none',
    );
    if (!key_exists('kaltura_entryId', $view->display['default']->display_options['fields'])) {
      $view->display['default']->display_options['fields']['kaltura_entryId'] = array(
        'label' => '',
        'exclude' => 1,
        'id' => 'kaltura_entryId',
        'table' => 'node_kaltura',
        'field' => 'kaltura_entryId',
        'relationship' => 'none',
      );
    }
    $view->display['default']->display_options['filters']['kaltura_media_type_1'] = array(
      'operator' => 'not in',
      'value' => array(
        '2' => '2',
      ),
      'group' => '0',
      'exposed' => FALSE,
      'expose' => array(
        'operator' => FALSE,
        'label' => '',
      ),
      'id' => 'kaltura_media_type_1',
      'table' => 'node_kaltura',
      'field' => 'kaltura_media_type',
      'relationship' => 'none',
    );
    $view_fields = kaltura_extract_fields_from_view($view);
    require_once drupal_get_path('module', 'views') . '/includes/admin.inc';
    @$view
      ->preview('default', $args);
    $query = db_prefix_tables($view->build_info['query']);
    $query = str_replace('***CURRENT_USER***', $user->uid, $query);
    $query = str_replace('***ADMINISTER_NODES***', intval(user_access('administer nodes')), $query);
    if ($view->build_info['query_args']) {
      _db_query_callback($view->build_info['query_args'], TRUE);
      $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
    }
    $results = db_query($query);
    while ($node = db_fetch_object($results)) {
      $nodes[] = $node;
    }
    return array(
      $nodes,
      $view_fields,
    );
  }
  return array(
    $view_name,
    $view_fields,
  );
}