function print_content() { global $PAGE, $CFG; if (wiki_user_can_view($this->subwiki)) { if (!empty($this->page)) { wiki_print_page_content($this->page, $this->modcontext, $this->subwiki->id); $wiki = $PAGE->activityrecord; } else { print_string('nocontent', 'wiki'); // TODO: fix this part $swid = 0; if (!empty($this->subwiki)) { $swid = $this->subwiki->id; } } } else { echo get_string('cannotviewpage', 'wiki'); } }
function wiki_hist_old(&$WS) { global $USER, $COURSE; //convert wiki content to html content wiki_print_page_content($WS->pageolddata->content, $WS); wiki_hist_restore($WS); //link lo evaluate_page $context = get_context_instance(CONTEXT_MODULE, $WS->cm->id); if ($WS->dfperms['evaluation'] == '2' and has_capability('mod/wiki:viewevaluationswiki', $context) or $WS->dfperms['evaluation'] == '1' && has_capability('mod/wiki:evaluateawiki', $context)) { $prop = null; $prop->href = "view.php?id={$WS->linkid}&page=" . urlencode("evaluate_page/{$WS->page}") . "&ver={$WS->ver}&gid={$WS->groupmember->groupid}&uid={$WS->member->id}"; wiki_a(get_string('evaluate_edition', 'wiki'), $prop); } }
function wiki_edit_content(&$WS) { global $CFG; $context = get_context_instance(CONTEXT_MODULE, $WS->cm->id); require_capability('mod/wiki:caneditawiki', $context); $cont = false; $txt = ''; $titlebox = ''; $oldcontentbox = ''; $viewtitle = '0'; if ($WS->pageaction == 'adddiscussion' or isset($WS->dfform['addtitle']) and $WS->pageaction == 'edit') { $viewtitle = '1'; if (isset($WS->dfform['addtitle'])) { $titlebox = $WS->dfform['addtitle']; $oldcontentbox = $WS->dfform['oldcontent']; $contentbox = $WS->dfform['content']; } else { $titlebox = ''; $oldcontentbox = $WS->dfform['content']; $contentbox = ''; } } else { if (isset($WS->dfform['content'])) { $contentbox = $WS->dfform['content']; } else { $contentbox = ''; } } //need to check if we have preview mode $preview = optional_param('dfformpreview', NULL, PARAM_ALPHA); if (isset($preview)) { //we're in preview mode print_simple_box_start('center', '100%', '', '20'); wiki_size_text("Preview", 2); // discussions if ($titlebox == '') { $txt = $oldcontentbox . $contentbox; } else { switch ($WS->dfwiki->editor) { case 'ewiki': $txt = $oldcontentbox . chr(13) . chr(10) . '!!! ' . $titlebox . ' ' . chr(13) . chr(10) . $contentbox . chr(10); break; case 'htmleditor': $txt = $oldcontentbox . chr(13) . chr(10) . '<h1> ' . $titlebox . ' </h1>' . chr(13) . chr(10) . $contentbox . chr(10); break; default: $txt = $oldcontentbox . chr(13) . chr(10) . '= ' . $titlebox . ' =' . chr(13) . chr(10) . $contentbox . chr(10); break; } } wiki_print_page_content(stripslashes_safe($txt), $WS); print_simple_box_end(); } else { //we're not in preview mode //check if there's content //echo 'wiki_forceeditorchange='.$CFG->wiki_forceeditorchange; if (!isset($WS->pagedata->content) || $CFG->wiki_forceeditorchange) { if (!isset($WS->pagedata->content)) { $WS->pagedata->content = ''; } // si no hem decidit encara l'editor per aquesta pagina i no hem adjuntat cap arxiu demanem l'editor if (!isset($WS->dfform['selectedit']) && (!isset($WS->pagedata->editor) || $WS->pagedata->editor == '') || $CFG->wiki_forceeditorchange) { $cont = true; //$pagename=stripslashes($pagename); $prop = null; $prop->border = "0"; $prop->class = "nwikileftnow"; wiki_table_start($prop); /// removed "choose different wiki syntax on new page listbox" so teachers will not get confused (nadavkav 25.10.09) /* print_string('anothereditor','wiki'); //Converts reserved chars for html to prevent chars misreading $pagetemp = stripslashes_safe($WS->page); wiki_change_column(); $prop = null; $prop->id = "sel_edit"; $prop->method = "post"; $prop->action = 'view.php?id='.$WS->linkid.'&page=edit/'.urlencode($pagetemp).'&gid='.$WS->groupmember->groupid.'&uid='.$WS->member->id; wiki_form_start($prop); wiki_div_start(); $opt = ""; if ($WS->dfwiki->editor != 'dfwiki'){ $prop = null; $prop->value = "0"; $opt = wiki_option(get_string('dfwiki','wiki'), $prop, true); } if ($WS->dfwiki->editor != 'nwiki'){ $prop = null; $prop->value = "3"; $opt .= wiki_option(get_string('nwiki','wiki'), $prop, true); } if ($WS->dfwiki->editor != 'ewiki'){ $prop = null; $prop->value = "1"; $opt .= wiki_option(get_string('ewiki','wiki'), $prop, true); } if ($WS->dfwiki->editor != 'htmleditor'){ $prop = null; $prop->value = "2"; $opt .= wiki_option(get_string('htmleditor','wiki'), $prop, true); } $prop = null; $prop->name = "dfformselectedit"; wiki_select($opt,$prop); $prop = null; $prop->value = get_string("continue"); wiki_input_submit($prop); wiki_div_end(); wiki_form_end(); */ $prop = null; $prop->class = "nwikileftnow"; wiki_change_row($prop); echo " "; wiki_table_end(); if (isset($WS->dfform['content'])) { $content_text =& $WS->dfform['content']; } else { $content_text =& $WS->pagedata->content; } if (isset($WS->dfform['selectedit'])) { switch ($WS->dfform['selectedit']) { case '0': $WS->pagedata->editor = $WS->dfwiki->editor = 'dfwiki'; break; case '1': $WS->pagedata->editor = $WS->dfwiki->editor = 'ewiki'; break; case '2': $WS->pagedata->editor = $WS->dfwiki->editor = 'htmleditor'; break; case '3': $WS->pagedata->editor = $WS->dfwiki->editor = 'nwiki'; break; default: error('No editor was selected'); break; } } else { $WS->pagedata->editor = $WS->dfwiki->editor; } wiki_print_editor($content_text, $viewtitle, $titlebox, '', $WS); } } } if (isset($WS->dfform['content'])) { $content_text = stripslashes_safe($WS->dfform['content']); } else { $content_text = stripslashes_safe($WS->pagedata->content); } // partial editing of a section available only with nwiki editor $section = optional_param('section', '', PARAM_TEXT); $sectionnum = optional_param('sectionnum', 0, PARAM_INTEGER); if (!isset($preview) && $WS->pagedata->editor == 'nwiki' && !($section == '' && $sectionnum == 0) && !wiki_is_uploading_modified()) { $section = stripslashes($section); $sectionnum = wiki_get_real_section_position($WS->page, $section, $sectionnum); $res = wiki_split_sections($content_text, $section, $sectionnum); if ($res->error != '') { $sectionhash = optional_param('sectionhash', '', PARAM_TEXT); wiki_release_lock($WS, $WS->dfwiki->id, $WS->pagedata->pagename . '#' . $sectionhash); error($res->error); } else { $content_text = $res->current_part; } } //print the editor if ($cont == false) { if (!isset($WS->dfform['selectedit'])) { $editor = optional_param('editor', '', PARAM_ALPHA); if (!empty($WS->dfform['editor'])) { $WS->pagedata->editor = $WS->dfform['editor']; } else { if (!empty($editor)) { $WS->pagedata->editor = $editor; } } if ($WS->pageaction == 'adddiscussion' or isset($WS->dfform['addtitle'])) { if (!isset($oldcontentbox)) { wiki_print_editor($contentbox, $viewtitle, $titlebox, $content_text, $WS); } else { wiki_print_editor($contentbox, $viewtitle, $titlebox, $oldcontentbox, $WS); } } else { wiki_print_editor($content_text, $viewtitle, $titlebox, '', $WS); } } else { //comming from the above form switch ($WS->dfform['selectedit']) { case '0': $WS->pagedata->editor = 'dfwiki'; wiki_print_editor($contentbox, $viewtitle, $titlebox, $oldcontentbox, $WS); break; case '1': $WS->pagedata->editor = 'ewiki'; wiki_print_editor($contentbox, $viewtitle, $titlebox, $oldcontentbox, $WS); break; case '2': $WS->pagedata->editor = 'htmleditor'; wiki_print_editor($contentbox, $viewtitle, $titlebox, $oldcontentbox, $WS); break; case '3': $WS->pagedata->editor = 'nwiki'; wiki_print_editor($contentbox, $viewtitle, $titlebox, $oldcontentbox, $WS); break; default: error('No editor was selected'); break; } } } }
function print_content() { global $PAGE, $CFG; $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id); if (wiki_user_can_view($this->subwiki)) { if (!empty($this->page)) { wiki_print_page_content($this->page, $context, $this->subwiki->id); $wiki = $PAGE->activityrecord; } else { print_string('nocontent', 'wiki'); // TODO: fix this part $swid = 0; if (!empty($this->subwiki)) { $swid = $this->subwiki->id; } } } else { // @TODO: Tranlate it echo "You can not view this page"; } }