/** * Construct a proper <a href> html tag for opening media links in a modal box. * * @global string $userServer * @global string $course_code * @param MediaResource $mediaRsrc * @return string */ public static function chooseMedialinkAhref($mediaRsrc) { $title = q($mediaRsrc->getTitle()); $ahref = "<a href='" . q($mediaRsrc->getPath()) . "' class='fileURL' target='_blank' title='{$title}'>" . $title . "</a>"; if (self::isEmbeddableMedialink($mediaRsrc->getPath())) { $class = ''; $extraParams = ''; if (file_exists(ModalBoxHelper::getShadowboxDir())) { $class = 'shadowbox'; $extraParams = "rel='shadowbox;width=" . ModalBoxHelper::getShadowboxWidth() . ";height=" . ModalBoxHelper::getShadowboxHeight() . "'"; } else { if (file_exists(ModalBoxHelper::getFancybox2Dir())) { $class = 'fancybox iframe'; } else { if (file_exists(ModalBoxHelper::getColorboxDir())) { $class = 'colorboxframe'; } } } $ahref = "<a href='" . $mediaRsrc->getPlayURL() . "' class='{$class} fileURL' {$extraParams} title='{$title}'>{$title}</a>"; } return $ahref; }