You are here

function kaltura_get_view_raw_data in Kaltura 5

Same name and namespace in other branches
  1. 6.2 plugins/kaltura_playlist/kaltura_playlist.module \kaltura_get_view_raw_data()
  2. 6 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 260

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) {
    foreach ($view->filter as $field_key => $filter_field) {
      if ($filter_field['field'] == 'node_kaltura.kaltura_media_type') {

        // remove media_type(2) - images
        foreach ($filter_field['value'] as $key => $value) {
          if ($value == 2) {
            unset($filter_field['value'][$key]);
          }
        }
      }
    }
    $view_fields = kaltura_extract_fields_from_view($view);

    //    require_once(drupal_get_path('module', 'views') .'/includes/admin.inc');
    $result = views_build_view('result', $view);
    $query = $result['query'];
    $query = str_replace('***CURRENT_USER***', $user->uid, $query);
    $query = str_replace('***ADMINISTER_NODES***', intval(user_access('administer nodes')), $query);
    $results = db_query($query);
    while ($node = db_fetch_object($results)) {
      $nodes[] = $node;
    }
    return array(
      $nodes,
      $view_fields,
    );
  }
  return array(
    $view_name,
    $view_fields,
  );
}