diff --git a/main/document/document_with_glossary_terms.php b/main/document/document_with_glossary_terms.php new file mode 100644 index 0000000000..6cc4da98a4 --- /dev/null +++ b/main/document/document_with_glossary_terms.php @@ -0,0 +1,62 @@ +0) { + foreach ($array_glossary as $index_glossary => $value_glossary) { + $to_be_replaced[]=$str_href=''.$value_glossary['name'].''; + $to_replaced[]=$value_glossary['name']; + } +} + +$new_file=str_replace($to_replaced,$to_be_replaced,$content_html); +$new_file=str_replace('','',$new_file); +echo $new_file; +?> diff --git a/main/document/headerpage.php b/main/document/headerpage.php index 06f1800fd8..676397a0e7 100644 --- a/main/document/headerpage.php +++ b/main/document/headerpage.php @@ -29,6 +29,8 @@ $interbreadcrumb[]= array ("url"=>"showinframes.php?file=".$header_file, "name"= Display::display_header(null,"Doc"); echo "
"; -echo "".$lang_cut_paste_link."
"; +$file_url_web='document_with_glossary_terms.php?file='.urlencode(Security::remove_XSS($_GET['file'])); +$file_origin_url_web=api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$header_file."?".api_get_cidreq(); +echo "".$lang_cut_paste_link.""; ?> \ No newline at end of file diff --git a/main/document/showinframes.php b/main/document/showinframes.php index 5baf27523d..8687fe0a10 100644 --- a/main/document/showinframes.php +++ b/main/document/showinframes.php @@ -1,4 +1,4 @@ -'./document.php', 'name'=> get_lang('Documents')); $nameTools = get_lang('Documents'); $file = Security::remove_XSS(urldecode($_GET['file'])); - /* ============================================================================== Main section @@ -92,15 +91,17 @@ if($is_courseAdmin) { $frameheight = 165; } -$file_root=$_course['path'].'/document'.str_replace('%2F', '/',$file); -$file_url_sys=api_get_path('SYS_COURSE_PATH').$file_root; -$file_url_web=api_get_path('WEB_COURSE_PATH').$file_root; - +$file_root=$_course['path'].'/document'.str_replace('%2F', '/',$file); +$file_url_sys=api_get_path(SYS_COURSE_PATH).$file_root; +$file_url_web=api_get_path(WEB_COURSE_PATH).$file_root; +$file_url_web='document_with_glossary_terms.php?file='.urlencode($_GET['file']); ?> -<?php echo $browser_display_title;?> + +<?php echo $browser_display_title;?> + diff --git a/main/glossary/glossary.class.php b/main/glossary/glossary.class.php new file mode 100644 index 0000000000..3660efe953 --- /dev/null +++ b/main/glossary/glossary.class.php @@ -0,0 +1,41 @@ + + * @return Array Contain glossary terms + */ + public static function get_glossary_terms () { + global $course; + $glossary_id=array(); + $glossary_name=array(); + $glossary_desc=array(); + $glossary_table = Database::get_course_table(TABLE_GLOSSARY); + $sql='SELECT glossary_id as id,name,description FROM '.$glossary_table; + $rs=Database::query($sql,__FILE__,__LINE__); + while ($row=Database::fetch_array($rs)) { + $glossary_data[]=$row; + } + return $glossary_data; + } + /** + * Get glossary term by glossary id + * @author Isaac Flores + * @param Integer The glossay id + * @return String The glossary description + */ + public static function get_glossary_term_by_glossary_id ($glossary_id) { + global $course; + $glossary_table = Database::get_course_table(TABLE_GLOSSARY); + $sql='SELECT description FROM '.$glossary_table.' WHERE glossary_id="'.Database::escape_string($glossary_id).'"'; + $rs=Database::query($sql,__FILE__,__LINE__); + $row=Database::fetch_array($rs); + return $row['description']; + } +} +?> \ No newline at end of file diff --git a/main/glossary/glossary_ajax_request.php b/main/glossary/glossary_ajax_request.php new file mode 100644 index 0000000000..5dd37f81ce --- /dev/null +++ b/main/glossary/glossary_ajax_request.php @@ -0,0 +1,21 @@ +