function get_item_image()
{
    global $item_pid, $data, $errors;
    if (check_for_bad_data()) {
        echo check_for_bad_data();
        return false;
    }
    if (isset($data->thumbnails)) {
        $img = $data->thumbnails[count($data->thumbnails) - 2];
    }
    if (isset($data->canonical_object)) {
        foreach ($data->canonical_object as $key => $val) {
            if ($val == 'Master Image') {
                $zoom_img = $data->thumbnails[count($data->thumbnails) - 1];
                echo '<img id="drs-item-img" src="' . $img . '" data-zoom-image="' . $zoom_img . '"/>';
                echo '<script type="text/javascript"> jQuery("#drs-item-img").elevateZoom();</script>';
            } else {
                if ($val == 'PDF') {
                    if (isset($data->mods->Location) && strpos($data->mods->Location[0], "issuu") !== FALSE) {
                        $location_href = explode("'", strval(htmlentities($data->mods->Location[0])));
                        if (count($location_href) == 1) {
                            $location_href = explode('"', strval(htmlentities($data->mods->Location[0])));
                        }
                        $issu_id = explode('?', $location_href[1]);
                        $issu_id = explode('=', $issu_id[1]);
                        $issu_id = $issu_id[1];
                        echo '<div data-configid="' . $issu_id . '" style="width:100%; height:500px;" class="issuuembed"></div><script type="text/javascript" src="//e.issuu.com/embed.js" async="true"></script>';
                    } else {
                        echo '<img id="drs-item-img" src="' . $img . '" />';
                    }
                } else {
                    if ($val == 'Video File' || $val == 'Audio File') {
                        $av_pid = $key;
                        $av_pid = explode("/", $av_pid);
                        $av_pid = end($av_pid);
                        $encoded_av_pid = str_replace(':', '%3A', $av_pid);
                        $av_dir = substr(md5("info:fedora/" . $av_pid . "/content/content.0"), 0, 2);
                        $av_type = "";
                        if ($data->thumbnails) {
                            $av_poster = $data->thumbnails[3];
                        }
                        if ($val == 'Video File') {
                            $av_provider = 'video';
                            $av_type = "MP4";
                        }
                        if ($val == 'Audio File') {
                            $av_provider = 'sound';
                            $av_type = "MP3";
                        }
                        echo "<div id='drs-item-video'></div>";
                        echo '<script type="text/javascript">
        jwplayer.key="gi5wgpwDtAXG4xdj1uuW/NyMsECyiATOBxEO7A=="
        var primary = "flash"
        if (typeof swfobject == "undefined" || swfobject.getFlashPlayerVersion().major == 0) {
          primary == "html5"
        }
        jwplayer("drs-item-video").setup({
        sources:
        [
        { file: "rtmp://libwowza.neu.edu:1935/vod/_definst_/' . $av_type . ':datastreamStore/cerberusData/newfedoradata/datastreamStore/' . $av_dir . '/info%3Afedora%2F' . $encoded_av_pid . '%2Fcontent%2Fcontent.0"},
        { file: "http://libwowza.neu.edu:1935/vod/_definst_/datastreamStore/cerberusData/newfedoradata/datastreamStore/' . $av_dir . '/' . $av_type . ':" + "info%3Afedora%2F' . $encoded_av_pid . '%2Fcontent%2Fcontent.0" + "/playlist.m3u8", type:"' . $av_type . '"}
        ],
        image: "' . $av_poster . '",
        provider: "' . $av_provider . '",
        fallback: "true",
        androidhls: "true",
        primary: primary,
        width: "100%",
        height: 400,
        })

        var errorMessage = function() {
          $("#drs-item-img").before("<div class=\'alert alert-warning\'>' . $errors['item']['jwplayer_fail'] . '</div>");
          $("#drs-item-img").show();
          $("#drs-item-video").hide();
        };
       jwplayer().onError(errorMessage);
       jwplayer().onSetupError(errorMessage);
       jwplayer().onBuffer(function() {
         theTimeout = setTimeout(function() {
           errorMessage;
         }, 5000);
       });</script>';
                    }
                }
            }
        }
    }
}
Example #2
0
function get_associated_files()
{
    global $data, $errors, $assoc_meta_options;
    if (isset($data->associated) && $data->associated != NULL && get_option('drstk_assoc') == 'on') {
        $associated_html = '';
        $title = get_option('drstk_assoc_title') != '' ? get_option('drstk_assoc_title') : 'Associated Files';
        $associated_html .= "<div class='panel panel-default assoc_files'><div class='panel-heading'>" . $title . "</div><div class='panel-body'>";
        // foreach($data->associated as $assoc_pid => $assoc_title){ //disabling multivalued associated files until a new less resource intensive api call for associated files exists
        $assoc_pid = key(get_object_vars($data->associated));
        //using this just to get the first title
        $assoc_title = $data->associated->{$assoc_pid};
        //using this just to get the first title
        $url = "https://repository.library.northeastern.edu/api/v1/files/" . $assoc_pid . "?solr_only=true";
        $assoc_data = get_response($url);
        $assoc_data = json_decode($assoc_data);
        if (check_for_bad_data($assoc_data)) {
            return false;
        } else {
            if (isset($assoc_data->_source->fields_thumbnail_list_tesim)) {
                $associated_html .= "<a href='" . drstk_home_url() . "item/" . $assoc_data->_source->id . "'><img src='https://repository.library.northeastern.edu" . $assoc_data->_source->fields_thumbnail_list_tesim[1] . "'/></a>";
            }
            $associated_html .= get_item_details($assoc_data, $assoc_meta_options);
        }
        // }
        $associated_html .= "</div></div>";
        echo $associated_html;
    }
}