You are here

function theme_list_of_entries in Kaltura 5

Same name and namespace in other branches
  1. 6 kaltura.module \theme_list_of_entries()
1 theme call to theme_list_of_entries()
kaltura_list_entries in ./kaltura.module

File

./kaltura.module, line 343

Code

function theme_list_of_entries($arr_nodes_nids, $allow_insert = FALSE, $field_name = '') {
  $url_option = 'cwurl=' . $_GET['cwurl'];
  $filter = 'Show only: ' . l('All', $_GET['q'], array(), $url_option) . ' | ' . l('Videos', $_GET['q'], array(), 'filter=1&cwurl=' . $_GET['cwurl']) . ' | ';
  $filter .= l('Photos', $_GET['q'], array(), 'filter=2&cwurl=' . $_GET['cwurl']) . ' | ' . l('Remixes', $_GET['q'], array(), 'filter=6&cwurl=' . $_GET['cwurl']);
  $filter .= ' | ' . l('Audio', $_GET['q'], array(), 'filter=5&cwurl=' . $_GET['cwurl']);
  $str = '<div id="kaltura_entries_page" class="' . ($allow_insert ? 'minimal_mode' : '') . '"><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(
        '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;
}