diff --git a/main/document/document.php b/main/document/document.php index 986525113e..469300a824 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -31,7 +31,7 @@ /* INIT SECTION */ -// Name of the language file that needs to be included +// Language files that need to be included $language_file = array('document', 'slideshow', 'gradebook'); require_once '../inc/global.inc.php'; @@ -41,9 +41,9 @@ require_once 'document.inc.php'; $lib_path = api_get_path(LIBRARY_PATH); require_once $lib_path.'usermanager.lib.php'; -require_once api_get_path(LIBRARY_PATH).'document.lib.php'; -require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; -require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php'; +require_once $lib_path.'document.lib.php'; +require_once $lib_path.'fileUpload.lib.php'; +require_once $lib_path.'sortabletable.class.php'; api_protect_course_script(true); $htmlHeadXtra[] = ''; //jQuery @@ -58,40 +58,39 @@ $(document).ready( function() { } } ); '; -//session +// Session if (isset($_GET['id_session'])) { $_SESSION['id_session'] = intval($_GET['id_session']); } -//create directory certificates -$course_id=api_get_course_id(); +// Create directory certificates +$course_id = api_get_course_id(); DocumentManager::create_directory_certificate_in_course($course_id); -//show preview -if (isset($_GET['curdirpath']) && $_GET['curdirpath']=='/certificates' && isset($_GET['set_preview']) && $_GET['set_preview']==strval(intval($_GET['set_preview']))) { +// Show preview +if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' && isset($_GET['set_preview']) && $_GET['set_preview'] == strval(intval($_GET['set_preview']))) { if (isset($_GET['set_preview'])) { - //generate document HTML - $course_id=api_get_course_id(); - $content_html=DocumentManager::replace_user_info_into_html($course_id); + // Generate document HTML + $course_id = api_get_course_id(); + $content_html = DocumentManager::replace_user_info_into_html($course_id); - $new_content_html=$content_html; + $new_content_html = $content_html; - $path_image=api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/gallery'; - $new_content_html=str_replace('../images/gallery',$path_image,$new_content_html); + $path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/gallery'; + $new_content_html = str_replace('../images/gallery', $path_image, $new_content_html); - $path_image_in_default_course=api_get_path(WEB_CODE_PATH).'default_course_document'; - $new_content_html=str_replace('/main/default_course_document',$path_image_in_default_course,$new_content_html); + $path_image_in_default_course = api_get_path(WEB_CODE_PATH).'default_course_document'; + $new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html); - $path_image_in_dokeos_main=api_get_path(WEB_IMG_PATH); - $new_content_html=str_replace('/main/img/',$path_image_in_dokeos_main,$new_content_html); - echo ' - '; - echo '' . get_lang('Print') . ' ' . get_lang('Print') . ''; - print_r($new_content_html); - exit; + $new_content_html = str_replace('/main/img/', api_get_path(WEB_IMG_PATH), $new_content_html); + echo ' + '; + echo '' . get_lang('Print') . ' ' . get_lang('Print') . ''; + print_r($new_content_html); + exit; } } @@ -133,7 +132,7 @@ if (isset($_GET['curdirpath']) && $_GET['curdirpath'] != '') { } $curdirpathurl = urlencode($curdirpath); -//I'm in the certification module? +// I'm in the certification module? $is_certificate_mode = DocumentManager::is_certificate_mode($curdirpath); $course_dir = $_course['path'].'/document'; @@ -146,12 +145,12 @@ $is_allowed_to_edit = api_is_allowed_to_edit(null, true); $group_member_with_upload_rights = false; // If the group id is set, we show them group documents -if (isset($_SESSION['_gid']) && $_SESSION['_gid']!='') { +if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') { // Needed for group related stuff - require_once($lib_path. 'groupmanager.lib.php'); + require_once $lib_path.'groupmanager.lib.php'; // Get group info $group_properties = GroupManager::get_group_properties($_SESSION['_gid']); - $noPHP_SELF=true; + $noPHP_SELF = true; // Let's assume the user cannot upload files for the group $group_member_with_upload_rights = false; @@ -170,13 +169,13 @@ if (isset($_SESSION['_gid']) && $_SESSION['_gid']!='') { } elseif ($group_properties['doc_state'] == 1) { // Documents are public $to_group_id = $_SESSION['_gid']; $req_gid = '&gidReq='.$_SESSION['_gid']; - $interbreadcrumb[] = array ('url' => '../group/group.php', 'name' => get_lang('Groups')); - $interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')'); + $interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups')); + $interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')'); //allowed to upload? if ($is_allowed_to_edit || GroupManager::is_subscribed($_user['user_id'], $_SESSION['_gid'])) { // Only courseadmin or group members can upload $group_member_with_upload_rights = true; } - } else { //documents not active for this group + } else { // Documents not active for this group $to_group_id = 0; $req_gid = ''; } @@ -212,7 +211,7 @@ if ($to_group_id != 0 && $curdirpath == '/') { } // Check visibility of the current dir path. Don't show anything if not allowed -if (!(DocumentManager::is_visible($curdirpath, $_course)||$is_allowed_to_edit)) { +if (!(DocumentManager::is_visible($curdirpath, $_course) || $is_allowed_to_edit)) { api_not_allowed(); } @@ -247,7 +246,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'download') { $error404 .= '

The requested URL was not found on this server.

'; $error404 .= '
'; $error404 .= ''; - echo($error404); + echo $error404; exit; } @@ -277,9 +276,9 @@ $image_files_only = ''; /* Header */ if ($is_certificate_mode) { - $interbreadcrumb[]= array ( 'url' => '../gradebook/index.php', 'name' => get_lang('Gradebook')); + $interbreadcrumb[]= array('url' => '../gradebook/index.php', 'name' => get_lang('Gradebook')); } else { - $interbreadcrumb[]= array ('url'=>'', 'name'=> get_lang('Document')); + $interbreadcrumb[]= array('url' => '', 'name' => get_lang('Document')); } // Interbreadcrumb for the current directory root path @@ -298,7 +297,7 @@ if (!$is_certificate_mode) { $dir_acum = ''; for ($i = 0; $i < $array_len; $i++) { - if ($dir_array[$i] =='shared_folder') { + if ($dir_array[$i] == 'shared_folder') { $dir_array[$i] = get_lang('SharedFolder'); } elseif (strpos($dir_array[$i], 'sf_user_') !== false) { $userinfo = Database::get_user_info_from_id(substr($dir_array[$i], 8)); @@ -307,12 +306,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]); + $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]); + $interbreadcrumb[] = array('url' => $url_dir, 'name' => $dir_array[$i]); } - $dir_acum.=$dir_array[$i].'/'; + $dir_acum .= $dir_array[$i].'/'; } Display::display_header('','Doc'); @@ -360,9 +359,9 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights) { // TEACHER ONLY } } - require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; + require_once $lib_path.'fileManage.lib.php'; // This is needed for the update_db_info function - //$dbTable = $_course['dbNameGlu']."document"; + //$dbTable = $_course['dbNameGlu'].'document'; $dbTable = Database::get_course_table(TABLE_DOCUMENT); // Security fix: make sure they can't move files that are not in the document table @@ -392,12 +391,11 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights) { // TEACHER ONLY require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; - if(DocumentManager::delete_document($_course,$_GET['delete'],$base_work_dir)) - { - if ( isset($_GET['delete_certificate_id']) && $_GET['delete_certificate_id']==strval(intval($_GET['delete_certificate_id'])) ) { - $course_id=api_get_course_id(); - $default_certificate_id=$_GET['delete_certificate_id']; - DocumentManager::remove_attach_certificate ($course_id,$default_certificate_id); + if (DocumentManager::delete_document($_course, $_GET['delete'], $base_work_dir)) { + if ( isset($_GET['delete_certificate_id']) && $_GET['delete_certificate_id'] == strval(intval($_GET['delete_certificate_id']))) { + $course_id = api_get_course_id(); + $default_certificate_id = $_GET['delete_certificate_id']; + DocumentManager::remove_attach_certificate($course_id, $default_certificate_id); } Display::display_confirmation_message(get_lang('DocDeleted')); } else { @@ -588,12 +586,12 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights) { // TEACHER ONLY } } // END is allowed to edit -//attach certificate in the gradebook -if (isset($_GET['curdirpath']) && $_GET['curdirpath']=='/certificates' && isset($_GET['set_certificate']) && $_GET['set_certificate']==strval(intval($_GET['set_certificate']))) { +// Attach certificate in the gradebook +if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' && isset($_GET['set_certificate']) && $_GET['set_certificate'] == strval(intval($_GET['set_certificate']))) { if (isset($_GET['cidReq'])) { - $course_id=Security::remove_XSS($_GET['cidReq']);//course id - $document_id=Security::remove_XSS($_GET['set_certificate']);//document id - DocumentManager::attach_gradebook_certificate ($course_id,$document_id) ; + $course_id = Security::remove_XSS($_GET['cidReq']); // course id + $document_id = Security::remove_XSS($_GET['set_certificate']); // document id + DocumentManager::attach_gradebook_certificate ($course_id,$document_id); Display::display_normal_message(get_lang('IsDefaultCertificate')); } } @@ -609,22 +607,21 @@ if ($folders === false) { echo '
'; - /* GO TO PARENT DIRECTORY */ - if ($curdirpath!= '/' && $curdirpath!=$group_properties['directory']&& !$is_certificate_mode) { - ?> - - -   - - - -   - + +   + + +   +'); @@ -649,8 +646,8 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) { $document_name = $id['title']; } else { $document_name = basename($id['path']); - //Juan Carlos Raña: Get firstname and lastname when folder is in shared_folder. - //TODO: Check if is also necessary (above else) + // Juan Carlos Raña: Get firstname and lastname when folder is in shared_folder. + // TODO: Check if is also necessary (above else) if (strstr($document_name, 'sf_user_')) { $userinfo = Database::get_user_info_from_id(substr($document_name, 8)); $document_name = api_get_person_name($userinfo['firstname'], $userinfo['lastname']); @@ -719,46 +716,52 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) { $column_show = array(); if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder($_user['user_id'], $curdirpath)) { + // @TODO:check enable more options for shared folders /* CREATE NEW DOCUMENT OR NEW DIRECTORY / GO TO UPLOAD / DOWNLOAD ZIPPED FOLDER */ + + // Create new document + if (!$is_certificate_mode && !is_my_shared_folder($_user['user_id'], $curdirpath)) { ?> - - - -    - - - - - -    - - - - - - -   - - - -   - - &dir="> +   + + +   + + +   + + +   + +   + - - (ZIP)" alt="" /> - (ZIP)  + if (!$is_certificate_mode && $total_size != 0 && (api_get_setting('students_download_folders') == 'true' || api_is_allowed_to_edit() || api_is_platform_admin())) { +?> + +    ". get_lang('ViewSlideshow') . ""; + echo ''.get_lang('ViewSlideshow').''; } echo '
'; -if (!$is_certificate_mode) + +if (!$is_certificate_mode) { echo build_directory_selector($folders, $curdirpath, (isset($group_properties['directory']) ? $group_properties['directory'] : array()), true); +} if (($is_allowed_to_edit || $group_member_with_upload_rights) && count($docs_and_folders) > 1) { $column_show[] = 1; diff --git a/main/document/downloadfolder.inc.php b/main/document/downloadfolder.inc.php index a32646fc85..c88fb4576a 100755 --- a/main/document/downloadfolder.inc.php +++ b/main/document/downloadfolder.inc.php @@ -6,7 +6,7 @@ * * @package chamilo.document */ - + set_time_limit(0); $path = $_GET['path']; @@ -29,7 +29,7 @@ include api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php'; $remove_dir = ($path != '/') ? substr($path, 0, strlen($path) - strlen(basename($path))) : '/'; // Place to temporarily stash the zipfiles -$temp_zip_dir = $sys_course_path.$_course['path']."/temp"; +$temp_zip_dir = $sys_course_path.$_course['path'].'/temp'; // Create the temp dir if it doesn't exist or do a cleanup befor creating the zipfile if (!is_dir($temp_zip_dir)) { @@ -135,7 +135,7 @@ event_download(($path == '/') ? 'documents.zip (folder)' : basename($path).'.zip // Start download of created file //send_file_to_client($temp_zip_file, basename(empty($_GET['id']) ? 'documents' : $_GET['id']).'.zip'); -$name = ($path=='/') ? 'documents.zip' : basename($path).'.zip'; +$name = ($path == '/') ? 'documents.zip' : basename($path).'.zip'; DocumentManager::file_send_for_download($temp_zip_file, true, $name); @unlink($temp_zip_file); diff --git a/main/document/upload.php b/main/document/upload.php index 4737639d68..7100dffd55 100755 --- a/main/document/upload.php +++ b/main/document/upload.php @@ -30,7 +30,7 @@ * @todo eliminate code duplication between * document/document.php, scormdocument.php * - * @package dokeos.document + * @package chamilo.document */ // Name of the language file that needs to be included @@ -191,7 +191,7 @@ if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') { // If the group id is $group_properties = GroupManager::get_group_properties($_SESSION['_gid']); $noPHP_SELF = true; - if ($is_allowed_to_edit || GroupManager::is_user_in_group($_user['user_id'],$_SESSION['_gid'])) { // Only courseadmin or group members allowed + if ($is_allowed_to_edit || GroupManager::is_user_in_group($_user['user_id'], $_SESSION['_gid'])) { // Only courseadmin or group members allowed $to_group_id = $_SESSION['_gid']; $req_gid = '&gidReq='.$_SESSION['_gid']; $interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], 'name' => get_lang('GroupSpace')); @@ -205,17 +205,16 @@ if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') { // If the group id is api_not_allowed(true); } - // Group docs can only be uploaded in the group directory if ($to_group_id != 0 && $path == '/') { $path = $group_properties['directory']; } -//I'm in the certification module? +// I'm in the certification module? $is_certificate_mode = false; -$is_certificate_array = explode('/',$path); +$is_certificate_array = explode('/', $path); array_shift($is_certificate_array); -if ($is_certificate_array[0]=='certificates') { +if ($is_certificate_array[0] == 'certificates') { $is_certificate_mode = true; } @@ -234,13 +233,15 @@ if ($to_group_id != 0) { // Add group name after for group documents if (isset($_REQUEST['certificate'])) { $nameTools = get_lang('UploadCertificate').$add_group_to_title; } else { - $nameTools = get_lang('UplUploadDocument').$add_group_to_title; + $nameTools = get_lang('UplUploadDocument').$add_group_to_title; } + // Breadcrumbs -if ($is_certificate_mode) - $interbreadcrumb[]= array ( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); -else - $interbreadcrumb[] = array('url' =>'./document.php?curdirpath='.urlencode($path).$req_gid, 'name'=> get_lang('Documents')); +if ($is_certificate_mode) { + $interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); +} else { + $interbreadcrumb[] = array('url' => './document.php?curdirpath='.urlencode($path).$req_gid, 'name'=> get_lang('Documents')); +} // Display the header Display::display_header($nameTools, 'Doc'); @@ -292,7 +293,7 @@ if (isset($_FILES['user_upload'])) { if (empty($doc_mime)) { $allowed_extensions = array('ppt', 'pps', 'xls'); $extensions = preg_split("/[\/\\.]/", $doc_path) ; - $doc_ext = strtolower($extensions[count($extensions)-1]); + $doc_ext = strtolower($extensions[count($extensions) - 1]); if (in_array($doc_ext, $allowed_extensions)) { switch ($doc_ext) { case 'ppt': @@ -316,7 +317,7 @@ if (isset($_FILES['user_upload'])) { require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; $ic_slide = new IndexableChunk(); - $ic_slide->addValue("title", $file_title); + $ic_slide->addValue('title', $file_title); $ic_slide->addCourseId($courseid); $ic_slide->addToolId(TOOL_DOCUMENT); $xapian_data = array( @@ -327,7 +328,7 @@ if (isset($_FILES['user_upload'])) { ); $ic_slide->xapian_data = serialize($xapian_data); $di = new DokeosIndexer(); - $di->connectDb(NULL, NULL, $lang); + $di->connectDb(null, null, $lang); $specific_fields = get_specific_field_list(); @@ -367,7 +368,7 @@ if (isset($_FILES['user_upload'])) { } // Add terms also to content to make terms findable by probabilistic search $file_content = $all_specific_terms .' '. $file_content; - $ic_slide->addValue("content", $file_content); + $ic_slide->addValue('content', $file_content); $di->addChunk($ic_slide); // Index and return a new search engine document id $did = $di->index(); @@ -425,7 +426,7 @@ if (isset($_FILES['user_upload'])) { } // Missing images are submitted -if(isset($_POST['submit_image'])) { +if (isset($_POST['submit_image'])) { $number_of_uploaded_images = count($_FILES['img_file']['name']); //if images are uploaded if ($number_of_uploaded_images > 0) { @@ -478,28 +479,23 @@ if (isset($_GET['createdir'])) { echo '
'; // Link back to the documents overview -if ($is_certificate_mode) +if ($is_certificate_mode) { echo ''.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview')).get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview').''; -else +} else { echo ''.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview')).get_lang('BackTo').' '.get_lang('DocumentsOverview').''; +} -// link to create a folder -if(!isset($_GET['createdir']) && !is_my_shared_folder($_user['user_id'], $path) && !$is_certificate_mode) -{ +// Link to create a folder +if (!isset($_GET['createdir']) && !is_my_shared_folder($_user['user_id'], $path) && !$is_certificate_mode) { echo ''.Display::return_icon('folder_new.gif', get_lang('CreateDir')).get_lang('CreateDir').''; } echo '
'; -//form to select directory -$folders = DocumentManager::get_all_document_folders($_course,$to_group_id,$is_allowed_to_edit); -if (!$is_certificate_mode) - echo(build_directory_selector($folders,$path,$group_properties['directory'])); - -?> - - - -addElement('hidden', 'curdirpath', $path); @@ -552,10 +548,6 @@ $defaults = array('index_document' => 'checked="checked"'); $form->setDefaults($defaults); $form->display(); -?> - - -0) && (isset($_SESSION['st } -// ACTIONS +// ACTIONS //this is called when there is no data for the course admin if (isset ($_GET['createallcategories'])) { block_students(); @@ -449,7 +449,7 @@ if (isset ($_POST['submit']) && isset ($_POST['keyword'])) { } -// DISPLAY HEADERS AND MESSAGES +// DISPLAY HEADERS AND MESSAGES if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) { if (isset ($_GET['studentoverview'])) { @@ -522,7 +522,7 @@ if (isset ($move_form)){ Display :: display_normal_message($move_form->toHtml(),false); } -// LOAD DATA & DISPLAY TABLE +// LOAD DATA & DISPLAY TABLE $is_platform_admin= api_is_platform_admin(); $is_course_admin= api_is_allowed_to_create_course(); @@ -584,7 +584,7 @@ if (isset ($_GET['studentoverview'])) { exit; } } elseif (!empty($_GET['export_certificate'])) { - $user_id = strval(intval($_GET['user'])); + $user_id = strval(intval($_GET['user'])); if (!api_is_allowed_to_edit(true,true)) { $user_id = api_get_user_id(); } @@ -612,12 +612,12 @@ if (isset ($_GET['studentoverview'])) { $date = date('d/m/Y',time()); $path_info= UserManager::get_user_picture_path_by_id($user_id,'system',true); - + $path_directory_user_certificate=$path_info['dir'].'certificate/'; - + if (!is_dir($path_info['dir'])) { mkdir($path_info['dir'],0777); - } + } if (!is_dir($path_directory_user_certificate)) { mkdir($path_directory_user_certificate,0777); } @@ -625,65 +625,64 @@ if (isset ($_GET['studentoverview'])) { $user_id = api_get_user_id(); $cat_id = intval($_GET['cat_id']); $name=md5($user_id.$cat_id); - + //generate document HTML $course_id = api_get_course_id(); $content_html = DocumentManager::replace_user_info_into_html($course_id); - - + + $new_content=explode('',$content_html); - - + + if ($new_content[0]!='') { - + $new_content_html=$new_content[1]; $my_path_certificate=$path_directory_user_certificate.$name.'.html'; - - + + $path_image=api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/gallery'; $new_content_html=str_replace('../images/gallery',$path_image,$new_content_html); - + $path_image_in_default_course=api_get_path(WEB_CODE_PATH).'default_course_document'; $new_content_html=str_replace('/main/default_course_document',$path_image_in_default_course,$new_content_html); - - $path_image_in_dokeos_main=api_get_path(WEB_IMG_PATH); - $new_content_html=str_replace('/main/img/',$path_image_in_dokeos_main,$new_content_html); - + + $new_content_html = str_replace('/main/img/', api_get_path(WEB_IMG_PATH), $new_content_html); + //add print header $print= ' '; $print ='' . get_lang('Print') . ' ' . get_lang('Print') . ''; //add header $new_content_html=$new_content[0].$print.''.$new_content_html; - + if ($cat_id=strval(intval($cat_id))) { - if (UserManager::is_user_certified($cat_id,$user_id)===true){ + if (UserManager::is_user_certified($cat_id,$user_id)===true){ header('Content-Type: text/html; charset='. $charset); echo $new_content_html; - + exit; } else { $my_new_content_html=$new_content_html; $my_new_content_html=mb_convert_encoding($my_new_content_html,'UTF-8',$charset); - file_put_contents($my_path_certificate,$my_new_content_html); + file_put_contents($my_path_certificate,$my_new_content_html); header('Content-Type: text/html; charset='. $charset); - echo $new_content_html; + echo $new_content_html; } $path_certificate='/'.$name.'.html'; update_user_info_about_certificate($cat_id,$user_id,$path_certificate); - exit; + exit; } } else { Display :: display_reduced_header(); - Display :: display_warning_message(get_lang('NoCertificateAvailable')); + Display :: display_warning_message(get_lang('NoCertificateAvailable')); } } - + /*$pdf= new Cezpdf('a4','landscape'); $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm'); $pdf->ezSetMargins(30, 30, 50, 50); @@ -846,10 +845,10 @@ if ($category != '0') { $scoretotal= $cattotal[0]->calc_score(api_get_user_id()); $scoretotal_display = (isset($scoretotal)? round($scoretotal[0],2).'/'.round($scoretotal[1],2).'('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)': '-'); - $my_score_in_gradebook = round($scoretotal[0],2); + $my_score_in_gradebook = round($scoretotal[0],2); //show certificate - $certificate_min_score=$cats[0]->get_certificate_min_score(); - if (isset($certificate_min_score) && (int)$item_value >= (int)$certificate_min_score) { + $certificate_min_score=$cats[0]->get_certificate_min_score(); + if (isset($certificate_min_score) && (int)$item_value >= (int)$certificate_min_score) { $certificates = ''.get_lang('Certificates').' '.get_lang('langTotal').': '.$scoretotal_display; echo '
'; echo $certificates;