You are here

function theme_kaltura_list_of_entries in Kaltura 6.2

1 theme call to theme_kaltura_list_of_entries()
kaltura_list_entries in ./kaltura.module

File

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

Code

function theme_kaltura_list_of_entries($arr_nodes_nids, $allow_insert = FALSE, $field_name = '') {
  $url_option = array(
    'query' => array(
      'cwurl' => $_GET['cwurl'],
    ),
  );
  $filter = 'Show only: ' . l('All', $_GET['q'], $url_option) . ' | ' . l('Videos', $_GET['q'], array(
    'query' => array(
      'filter' => '1',
      'cwurl' => $_GET['cwurl'],
    ),
  )) . ' | ';
  $filter .= l('Photos', $_GET['q'], array(
    'query' => array(
      'filter' => '2',
      'cwurl' => $_GET['cwurl'],
    ),
  )) . ' | ' . l('Remixes', $_GET['q'], array(
    'query' => array(
      'filter' => '6',
      'cwurl' => $_GET['cwurl'],
    ),
  ));
  $filter .= ' | ' . l('Audio', $_GET['q'], array(
    'query' => array(
      'filter' => '5',
      'cwurl' => $_GET['cwurl'],
    ),
  ));
  $str = '<div id="kaltura_entries_page" class="' . ($allow_insert ? 'minimal_mode' : '') . '">';
  if (user_access('administer kaltura')) {
    $str .= l('Import entries from Kaltura', 'admin/settings/kaltura/entries/import');
  }
  $str .= '<div class="kfilter">' . $filter . '</div><ul>';
  if (is_array($arr_nodes_nids) && count($arr_nodes_nids)) {
    foreach ($arr_nodes_nids as $nid => $dets) {
      $str .= '<li class="kentry"><div class="kentry_title">' . l($dets->title, 'node/' . $nid, array(
        'attributes' => array(
          'target' => '_blank',
        ),
      )) . '</div>' . PHP_EOL;
      $str .= '<div class="kentry_thumb">' . theme('node_' . $dets->type . '_thumbnail_url', $dets, 0, $nosize = TRUE) . '</div>';
      if ($allow_insert) {
        $str .= '<input type="button" class="kentry_add" value="" title="Insert" onclick="add_existing_media(\'' . $field_name . '\', \'' . $dets->kaltura_entryId . '\');" />';
      }
      $str .= '</li>';
    }
  }
  else {
    $str .= '<div>None</div>' . PHP_EOL;
  }
  $str .= '</div><div class="clear-block"></div>';
  global $_kaltura_thumbnail_base_url;
  if ($allow_insert) {
    $str .= '<script>
              function add_existing_media(field_id, entry) {
                field = window.top.document.getElementById(field_id);
                field.value = entry;
                update_field_thumbs(field, \'' . $_kaltura_thumbnail_base_url . '\');
                window.top.kalturaCloseModalBox();
              }
              </script>';
  }
  return $str;
}