Fixing document.php to work with certificates

skala
Julio Montoya 16 years ago
parent 021be495d4
commit f5f1d8389c
  1. 20
      main/document/document.php

@ -32,7 +32,7 @@
/* INIT SECTION */
// Name of the language file that needs to be included
$language_file = array('document', 'slideshow');
$language_file = array('document', 'slideshow', 'gradebook');
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
@ -59,7 +59,7 @@ $(document).ready( function() {
</script>';
//session
if (isset($_GET['id_session'])) {
$_SESSION['id_session'] = Security::remove_XSS($_GET['id_session']);
$_SESSION['id_session'] = intval($_GET['id_session']);
}
//create directory certificates
$course_id=api_get_course_id();
@ -132,6 +132,9 @@ if (isset($_GET['curdirpath']) && $_GET['curdirpath'] != '') {
}
$curdirpathurl = urlencode($curdirpath);
//I'm in the certification module?
$is_certificate_mode = DocumentManager::is_certificate_mode($curdirpath);
$course_dir = $_course['path'].'/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$course_dir;
@ -272,19 +275,25 @@ $image_files_only = '';
/* Header */
$interbreadcrumb[]= array ('url' => '', 'name' => get_lang('ToolDocument'));
if ($is_certificate_mode) {
$interbreadcrumb[]= array ( 'url' => '../gradebook/index.php', 'name' => get_lang('Gradebook'));
} else {
$interbreadcrumb[]= array ('url'=>'', 'name'=> get_lang('Document'));
}
// Interbreadcrumb for the current directory root path
$dir_array = explode('/', $curdirpath);
$array_len = count($dir_array);
if (!$is_certificate_mode) {
if ($array_len > 1) {
if (empty($_SESSION['_gid'])) {
$url_dir = 'document.php?&curdirpath=/';
$interbreadcrumb[] = array('url' => $url_dir, 'name' => get_lang('HomeDirectory'));
}
}
}
$dir_acum = '';
for ($i = 0; $i < $array_len; $i++) {
@ -296,7 +305,12 @@ for ($i = 0; $i < $array_len; $i++) {
}
$url_dir = 'document.php?&curdirpath='.$dir_acum.$dir_array[$i];
if ($is_certificate_mode) {
$interbreadcrumb[]= array ('url'=>$url_dir.'&selectcat='.Security::remove_XSS($_GET['selectcat']), 'name'=> $dir_array[$i]);
} else {
$interbreadcrumb[]= array ('url'=>$url_dir, 'name'=> $dir_array[$i]);
}
$dir_acum.=$dir_array[$i].'/';
}

Loading…
Cancel
Save