'../group/group.php?', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$current_group_name);
$name_to_show = explode('/', $name_to_show);
unset ($name_to_show[1]);
$name_to_show = implode('/', $name_to_show);
}
$interbreadcrumb[] = array('url' => './document.php?curdirpath='.dirname($header_file).$req_gid, 'name' => get_lang('Documents'));
if (empty($document_data['parents'])) {
if (isset($_GET['createdir'])) {
$interbreadcrumb[] = array('url' => $document_data['document_url'], 'name' => $document_data['title']);
} else {
$interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
}
} else {
foreach($document_data['parents'] as $document_sub_data) {
if (!isset($_GET['createdir']) && $document_sub_data['id'] == $document_data['id']) {
$document_sub_data['document_url'] = '#';
}
$interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']);
}
}
$this_section = SECTION_COURSES;
$_SESSION['whereami'] = 'document/view';
$nameTools = get_lang('Documents');
/**
* Main code section
*/
header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
//header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Last-Modified: Wed, 01 Jan 2100 00:00:00 GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
$browser_display_title = 'Documents - '.Security::remove_XSS($_GET['cidReq']).' - '.$file;
// Only admins get to see the "no frames" link in pageheader.php, so students get a header that's not so high
$frameheight = 135;
if ($is_courseAdmin) {
$frameheight = 165;
}
$js_glossary_in_documents = '';
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$js_glossary_in_documents = ' // $(document).ready(function() {
$.frameReady(function() {
// $("
I am a div courses
").prependTo("body");
}, "top.mainFrame",
{ load: [
{type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
{type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/plugins/glossary/fck_glossary_manual.js"}
]
}
);
//});';
} elseif (api_get_setting('show_glossary_in_documents') == 'isautomatic') {
$js_glossary_in_documents = '// $(document).ready(function() {
$.frameReady(function(){
// $("I am a div courses
").prependTo("body");
}, "top.mainFrame",
{ load: [
{type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"},
{type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/plugins/glossary/fck_glossary_automatic.js"}
]
}
);
// });';
}
$web_odf_supported_files = DocumentManager::get_web_odf_extension_list();
if (in_array(strtolower($pathinfo['extension']), $web_odf_supported_files)) {
$show_web_odf = true;
$htmlHeadXtra[] = api_get_js('webodf/webodf.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/webodf/webodf.css');
$htmlHeadXtra[] = '
';
}
$execute_iframe = true;
if ($jplayer_supported) {
$extension = api_strtolower($pathinfo['extension']);
$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
$htmlHeadXtra[] = '';
$htmlHeadXtra[] = '';
$jquery = ' $("#jquery_jplayer_1").jPlayer({
ready: function() {
$(this).jPlayer("setMedia", {
'.$extension.' : "'.$document_data['direct_url'].'"
});
},
errorAlerts: false,
warningAlerts: false,
//swfPath: "../inc/lib/javascript/jquery-jplayer",
swfPath: "'.$js_path.'jquery-jplayer",
//supplied: "m4a, oga, mp3, ogg, wav",
supplied: "'.$extension.'",
//wmode: "window",
solution: "flash, html", // Do not change this setting
cssSelectorAncestor: "#jp_container_1",
});';
$htmlHeadXtra[] = '';
$execute_iframe = false;
}
if ($show_web_odf) {
$execute_iframe = false;
}
$is_nanogong_available = $pathinfo['extension']=='wav' && preg_match('/_chnano_.wav/i', $file_url_web) && api_get_setting('enable_nanogong') == 'true';
if ($is_nanogong_available){
$execute_iframe = false;
}
if (!$jplayer_supported && $execute_iframe) {
$htmlHeadXtra[] = '';
$htmlHeadXtra[] = '';
$htmlHeadXtra[] = '';
}
Display::display_header('');
echo '';
$file_url_web = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$header_file.'?'.api_get_cidreq();
if (!$is_nanogong_available) {
if (in_array(strtolower($pathinfo['extension']) , array('html', "htm"))) {
echo '
'.get_lang('_cut_paste_link').'';
} else {
echo '
'.get_lang('Download').'';
}
}
if ($show_web_odf) {
//echo Display::url(get_lang('Show'), api_get_path(WEB_CODE_PATH).'document/edit_odf.php?id='.$document_data['id'], array('class' => 'btn'));
echo '
';
}
echo '
';
if ($jplayer_supported) {
echo '
';
echo DocumentManager::generate_video_preview($document_data);
echo '
';
}
if ($is_nanogong_available) {
//make temp audio
$temp_folder=api_get_path(SYS_ARCHIVE_PATH).'temp/audio';
if (!file_exists($temp_folder)) {
@mkdir($temp_folder, api_get_permissions_for_new_directories(), true);
}
//make htaccess with allow from all, and file index.html into temp/audio
$htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess';
if (!file_exists($htaccess)) {
$htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess', 'w');
if ($fp) {
fwrite($fp, $htaccess_content);
fclose($fp);
}
}
//encript temp name file
$name_crip = sha1(uniqid());//encript
$findext= explode(".", $file);
$extension= $findext[count($findext)-1];
$file_crip=$name_crip.'.'.$extension;
//copy file to temp/audio directory
$from_sys=$file_url_sys;
$to_sys=api_get_path(SYS_ARCHIVE_PATH).'temp/audio/'.$file_crip;
if (file_exists($from_sys)) {
copy($from_sys, $to_sys);
}
//get file from tmp directory
$to_url=api_get_path(WEB_ARCHIVE_PATH).'temp/audio/'.$file_crip;
echo '';
echo '
'.get_lang('Download').'';
echo '
';
echo '
';
echo '
';
//erase temp file in tmp directory when return to documents
$_SESSION['temp_audio_nanogong']=$to_sys;
echo '
';
}
if ($execute_iframe) {
echo '';
}
Display::display_footer();