diff --git a/main/wiki/index.php b/main/wiki/index.php index c0bf3ac4bc..f6edd65722 100644 --- a/main/wiki/index.php +++ b/main/wiki/index.php @@ -77,7 +77,7 @@ api_block_anonymous_users(); TRACKING ----------------------------------------------------------- */ -event_access_tool('TOOL_WIKI'); +event_access_tool(TOOL_WIKI); /* ----------------------------------------------------------- @@ -288,7 +288,7 @@ echo '
  • '; //menu more -//echo '
  • '; //no avalaible so far. TO DO +//echo '
  • '; // by now turn off //menu add page echo '
  • '; @@ -341,8 +341,16 @@ echo "
    "; if ($_GET['action']=='more') { -//to do + echo '
    '; + echo ''.get_lang('More').'
    '; + echo '
    '; + if(api_is_allowed_to_edit() || api_is_platform_admin()) + { + //TODO + + } + //TODO } @@ -369,7 +377,7 @@ if ($_GET['action']=='delete') api_sql_query($sql,__FILE__,__LINE__); //// - //here to do: delete discussion and mailcue too + //here TODO: delete discussion and mailcue too /// check_emailcue(0, 'E'); @@ -603,8 +611,15 @@ if ($_GET['action']=='addnew') //first, check if page index was created. chektitle=false if (checktitle('index')) - { - Display::display_normal_message(get_lang('GoAndEditMainPage')); + { + if(api_is_allowed_to_edit() || api_is_platform_admin()) + { + Display::display_normal_message(get_lang('GoAndEditMainPage')); + } + else + { + return Display::display_normal_message(get_lang('WikiStandBy')); + } } elseif (check_addnewpagelock() && (api_is_allowed_to_edit()==false || api_is_platform_admin()==false)) @@ -667,7 +682,7 @@ if ($_GET['action']=='edit') $row=Database::fetch_array($result); // we do not need a while loop since we are always displaying the last version //Only teachers and platform admin can edit the index page. Only teachers and platform admin can edit an assignment teacher - if(($row['reflink']=='index' || $row['assignment']==1) && (!api_is_allowed_to_edit() || !api_is_platform_admin())) + if(($row['reflink']=='index' || $row['reflink']=='' || $row['assignment']==1) && (!api_is_allowed_to_edit() || !api_is_platform_admin())) { Display::display_normal_message(get_lang('OnlyEditPagesCourseManager')); @@ -739,8 +754,10 @@ if ($_GET['action']=='edit') //} echo ''; - //echo ''; //off for now - //echo ''; //off for now + //echo ''; //off for now + //echo ''; //off for now + //echo ''; //off for now + echo ''; //get current version echo get_lang('Progress').':  '; // 1 teacher 2 student - //echo'
    ';//by now turned off - //echo ' Start. Date and time: (yyyy-mm-dd hh:mm:ss)'; //by now turned off - //echo ' End. Date and time: (yyyy-mm-dd hh:mm:ss)'; //by now turned off - //echo'
    '; + echo '    '.get_lang('DefineAssignmentPage').' '; // 1= teacher 2 =student + + //by now turned off + + //echo'
    '; + //echo ' '.get_lang('StartDate').': (yyyy-mm-dd hh:mm:ss)'; //by now turned off + //echo ' '.get_lang('EndDate').': (yyyy-mm-dd hh:mm:ss)'; //by now turned off + //echo '
     '.get_lang('AllowLaterSends').' '; // + //echo'
    '; } } echo '
    '; @@ -1828,10 +1852,15 @@ function display_wiki_entry() // if both are empty and we are displaying the index page then we display the default text. if ($row['content']=='' AND $row['title']=='' AND $page='index') { - - $content=sprintf(get_lang('DefaultContent'),api_get_path(WEB_IMG_PATH)); - $title=get_lang('DefaultTitle'); - + if(api_is_allowed_to_edit() || api_is_platform_admin()) + { + $content=sprintf(get_lang('DefaultContent'),api_get_path(WEB_IMG_PATH)); + $title=get_lang('DefaultTitle'); + } + else + { + return Display::display_normal_message(get_lang('WikiStandBy')); + } } else { @@ -1936,15 +1965,17 @@ function display_wiki_entry() echo ''; //copy last version to doc area - echo ''; - echo '
    '; - echo ''; - echo ''; - echo ''; - echo ''; - echo '
    '; - echo '
    '; - + if(api_is_allowed_to_edit() || api_is_platform_admin()) + { + echo ''; + echo '
    '; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
    '; + echo '
    '; + } //export to print ?> @@ -1965,7 +1996,7 @@ function display_wiki_entry() //export to zip - echo ''.get_lang('Export2ZIP').''; //to do. + echo ''.get_lang('Export2ZIP').''; //TODO echo ''; echo '
    '.make_wiki_link_clickable(stripslashes($content)).'
    '; @@ -1973,11 +2004,12 @@ function display_wiki_entry() }//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']; //check. to do. + $contentDOC=$_POST['contentDOC']; //check. TODO $groupIdDOC=$_clean['group_id']; export2doc($titleDOC,$contentDOC,$groupIdDOC); } @@ -2149,7 +2181,7 @@ function check_visibility_page() $row=Database::fetch_array($result); $status_visibility=$row['visibility']; - $id=$row['id']; //need ? check. to do + $id=$row['id']; //need ? check. TODO //change status if ($_GET['actionpage']=='visibility' && (api_is_allowed_to_edit() || api_is_platform_admin())) @@ -2204,7 +2236,7 @@ function check_visibility_discuss() $row=Database::fetch_array($result); $status_visibility_disc=$row['visibility_disc']; - $id=$row['id']; //need ? check. to do + $id=$row['id']; //need ? check. TODO //change status if ($_GET['actionpage']=='visibility_disc' && (api_is_allowed_to_edit() || api_is_platform_admin())) @@ -2259,7 +2291,7 @@ function check_addlock_discuss() $row=Database::fetch_array($result); $status_addlock_disc=$row['addlock_disc']; - $id=$row['id']; //need ? check. to do + $id=$row['id']; //need ? check. TODO //change status if ($_GET['actionpage']=='addlock_disc' && (api_is_allowed_to_edit() || api_is_platform_admin())) @@ -2315,7 +2347,7 @@ function check_ratinglock_discuss() $row=Database::fetch_array($result); $status_ratinglock_disc=$row['ratinglock_disc']; - $id=$row['id']; //need ? check. to do + $id=$row['id']; //need ? check. TODO //change status if ($_GET['actionpage']=='ratinglock_disc' && (api_is_allowed_to_edit() || api_is_platform_admin())) @@ -2635,8 +2667,8 @@ function check_emailcue($id_or_ref, $type) $email_subject = get_lang('EmailWikiChanges').' - '.$_course['official_code']; $email_body= get_lang('DearUser').' '.$userinfo['firstname'].' '.$userinfo['lastname'].',

    \n\r'; $email_body .= $emailtext.' '.$_course['name'].' - '.$group_name.'


    \n'; - $email_body .= ''.get_lang('EmailWikiChangesExt_1').': '.get_lang('NotifyChanges').'
    \n'; - $email_body .= get_lang('EmailWikiChangesExt_2').': '.get_lang('NotNotifyChanges').'

    \n'; + $email_body .= ''.get_lang('EmailWikiChangesExt_1').': '.get_lang('NotifyChanges').'
    \n'; + $email_body .= get_lang('EmailWikiChangesExt_2').': '.get_lang('NotNotifyChanges').'

    \n'; api_mail_html($name_to, $email_to, $email_subject, $email_body, $sender_name, $sender_email, $headers); } @@ -2676,7 +2708,7 @@ function export2doc($wikiTitle, $wikiContents, $groupId) file_put_contents( $exportPath, $wikiContents ); $doc_id = add_document($_course, $groupPath.'/'.$wikiFileName,'file',filesize($exportPath),$wikiFileName); api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(), $groupId); - // to do: link to go document area + // TODO: link to go document area }