';
+ echo '
'.$icon_assignment.str_repeat(' ',3).$title.'
';
+
if((api_is_allowed_to_edit(false,true) || api_is_platform_admin()) && $row['reflink']!='index')
{
diff --git a/main/wiki/wiki.inc.php b/main/wiki/wiki.inc.php
index 2a0a83deb3..d8bf4a5808 100755
--- a/main/wiki/wiki.inc.php
+++ b/main/wiki/wiki.inc.php
@@ -205,6 +205,8 @@ function detect_irc_link($input)
**/
function make_wiki_link_clickable($input)
{
+ global $_course;
+
if (isset($_SESSION['_gid']))
{
$_clean['group_id']=(int)$_SESSION['_gid'];
@@ -285,9 +287,7 @@ function make_wiki_link_clickable($input)
* @return language string saying that the changes are stored
**/
function save_wiki() {
- global $charset;
- global $tbl_wiki;
- global $tbl_wiki_conf;
+ global $charset, $tbl_wiki, $_course, $tbl_wiki_conf;
// NOTE: visibility, visibility_disc and ratinglock_disc changes are not made here, but through the interce buttons
@@ -398,7 +398,7 @@ function save_wiki() {
function restore_wikipage($r_page_id, $r_reflink, $r_title, $r_content, $r_group_id, $r_assignment, $r_progress, $c_version, $r_version, $r_linksto)
{
- global $tbl_wiki;
+ global $tbl_wiki, $_course;
$r_user_id= api_get_user_id();
$r_dtime = date( "Y-m-d H:i:s" );
@@ -580,7 +580,7 @@ function save_new_wiki() {
**/
function display_new_wiki_form()
{
-
+global $_course;
?>
';
+ echo '
';
echo '
';
echo '';
@@ -976,16 +972,6 @@ function display_wiki_entry($newtitle)
}//end filter visibility
} // end function display_wiki_entry
-
-//more for export to course document area. See display_wiki_entry
-if ($_POST['export2DOC'])
-{
- $titleDOC=$_POST['titleDOC'];
- $contentDOC=$_POST['contentDOC'];
- $groupIdDOC=(int)$_SESSION['_gid'];
- export2doc($titleDOC,$contentDOC,$groupIdDOC);
-}
-
/**
* This function counted the words in a document. Thanks Adeel Khan
*/
@@ -1720,6 +1706,8 @@ function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='')
*/
function export2doc($wikiTitle, $wikiContents, $groupId)
{
+ global $_course;
+
$template =
'
@@ -1771,6 +1759,13 @@ function export2doc($wikiTitle, $wikiContents, $groupId)
$wikiContents = str_replace('{CONTENT}', $wikiContents, $template);
+ // replace relative path by absolute path for courses, so you can see items into this page wiki (images, mp3, etc..) exported in documents
+ if (api_strpos($wikiContents,'../../courses/') !== false) {
+ $web_course_path = api_get_path(WEB_COURSE_PATH);
+ $wikiContents = str_replace('../../courses/',$web_course_path,$wikiContents);
+ }
+
+ $doc_id = 0;
$i = 1;
while ( file_exists($exportDir . '/' .$exportFile.'_'.$i.'.html') ) $i++; //only export last version, but in new export new version in document area
$wikiFileName = $exportFile . '_' . $i . '.html';
@@ -1778,6 +1773,8 @@ function export2doc($wikiTitle, $wikiContents, $groupId)
file_put_contents( $exportPath, $wikiContents );
$doc_id = add_document($_course, $groupPath.'/'.$wikiFileName, 'file', filesize($exportPath), $wikiTitle);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(), $groupId);
+
+ return $doc_id;
// TODO: link to go document area
}
@@ -2122,4 +2119,4 @@ function two_digits($number)
return ($number < 10) ? '0'.$number : $number;
}
-?>
\ No newline at end of file
+?>