clearfilelist();
     displaydir($wdir);
 } else {
     html_header($course, $wdir, "form.name");
     if (setfilelist($_POST)) {
         $strcancel = get_string("cancel");
         $prop = null;
         $prop->class = "textcenter";
         wiki_paragraph(get_string("youareabouttocreatezip") . ":", $prop);
         print_simple_box_start("center");
         printfilelist($USER->filelist);
         print_simple_box_end();
         wiki_br();
         $prop = null;
         $prop->class = "textcenter";
         wiki_paragraph(get_string("whattocallzip"), $prop);
         $prop = null;
         $prop->class = "boxaligncenter";
         wiki_table_start($prop);
         $prop = null;
         $prop->action = "index.php";
         $prop->method = "post";
         $prop->id = "form";
         wiki_form_start($prop);
         wiki_div_start();
         $prop = null;
         $prop->name = "choose";
         $prop->value = $choose;
         wiki_input_hidden($prop);
         $prop = null;
         $prop->name = "id";
function wiki_navigator_content(&$WS)
{
    global $CFG;
    $table = new stdClass();
    $table->head = array(get_string('camefrom', 'wiki'), get_string('pagename', 'wiki'), get_string('goesto', 'wiki'));
    $ead = wiki_manager_get_instance();
    //new wiki_ead_tools();
    $camefroms = $ead->get_wiki_page_camefrom($WS->pagedata->pagename);
    $goestos = $ead->get_wiki_page_goesto($WS->pagedata->pagename);
    $out = wiki_b($WS->page, '', true);
    $prop = null;
    $prop->class = 'textcenter';
    $out2 = wiki_paragraph($out, $prop, true);
    $table->data[] = array("", $out2, "");
    $i = 0;
    foreach ($camefroms as $cpage) {
        $prop = null;
        $prop->href = $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&page=' . urlencode($cpage->pagename);
        $out = wiki_a($cpage->pagename, $prop, true);
        $prop = null;
        $prop->class = 'textcenter';
        $out2 = wiki_paragraph($out, $prop, true);
        $table->data[0][0] .= $out2;
    }
    foreach ($goestos as $gpage) {
        if (wiki_page_exists($WS, $gpage)) {
            $prop = null;
            $prop->href = $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&page=' . urlencode($gpage);
            $out = wiki_a($gpage, $prop, true);
            $prop = null;
            $prop->class = 'textcenter';
            $out2 = wiki_paragraph($out, $prop, true);
            $table->data[0][2] .= $out2;
        } else {
            $out = "";
            $prop = null;
            $prop->href = $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&page=' . urlencode($gpage);
            $out .= wiki_a($gpage, $prop, true);
            $prop = null;
            $prop->class = 'textcenter nwikiwanted';
            $out2 = wiki_paragraph($out, $prop, true);
            $table->data[0][2] .= $out2;
        }
    }
    $table->width = '100%';
    print_table($table);
}
        $prop = null;
        $prop->name = "continue";
        $prop->value = get_string('continue');
        wiki_input_submit($prop);
        wiki_div_end();
        wiki_form_end();
        wiki_br();
        print_simple_box_end();
    }
} else {
    // First time
    wiki_br();
    print_simple_box_start();
    $prop = null;
    $prop->class = "textcenter";
    wiki_paragraph(get_string("convertdfwikitonewwiki", "wiki"), $prop);
    $prop = null;
    $prop->class = "boxaligncenter";
    $prop->padding = "10";
    wiki_table_start($prop);
    $prop = null;
    $prop->id = "form1";
    $prop->method = "post";
    $prop->action = 'dfwikitonewwiki.php?id=' . $cm->id;
    wiki_form_start($prop);
    wiki_div_start();
    $prop = null;
    $prop->name = "sure";
    $prop->value = get_string('yes');
    wiki_input_submit($prop);
    wiki_div_end();
function wiki_import_wiki(&$WS)
{
    global $file;
    //if the form is complete
    $sure = optional_param('dfformsure', NULL, PARAM_ALPHA);
    if (isset($sure)) {
        //import to xml
        wiki_import_wiki_XML($WS);
        $prop = null;
        $prop->class = 'textcenter';
        $info = wiki_size_text(get_string("importcorrectly", 'wiki'), 2, '', true);
        wiki_div($info, $prop);
        $prop = null;
        $prop->action = '../view.php?id=' . $WS->cm->id;
        $prop->method = 'post';
        $prop->id = 'form';
        wiki_form_start($prop);
        $prop = null;
        $prop->border = '0';
        $prop->class = 'boxaligncenter';
        $prop->classtd = 'nwikileftnow';
        wiki_table_start($prop);
        $prop = null;
        $prop->name = 'dfformcontinue';
        $prop->value = get_string('continue');
        $input = wiki_input_submit($prop, true);
        wiki_div($input);
        wiki_table_end();
        wiki_form_end();
    } else {
        if (isset($WS->dfform['import'])) {
            $extension = explode("/", $WS->path);
            $num = count($extension) - 1;
            $name = $extension[$num];
            $info = wiki_b(get_string("importcheckwarning", 'wiki'), '', true);
            $info .= '    ' . $name;
            $prop = null;
            $prop->class = 'textcenter';
            wiki_paragraph($info, $prop);
            switch ($WS->dfform['incase']) {
                case 0:
                    $name = get_string("always", 'diki');
                    break;
                case 1:
                    $name = get_string("never", 'wiki');
                    break;
                case 2:
                    $name = get_string("before", 'wiki');
                    break;
                case 3:
                    $name = get_string("after", 'wiki');
                    break;
                default:
                    break;
            }
            $info = wiki_b(get_string("incase", 'wiki'), '', true);
            $info .= '  ' . $name;
            $prop = null;
            $prop->class = 'textcenter';
            wiki_paragraph($info, $prop);
            switch ($WS->dfform['incaseatach']) {
                case 0:
                    $name = get_string("alwaysatach", 'wiki');
                    break;
                case 1:
                    $name = get_string("neveratach", 'wiki');
                    break;
                case 2:
                    $name = get_string("beforeatach", 'wiki');
                    break;
                case 3:
                    $name = get_string("afteratach", 'wiki');
                    break;
                case 4:
                    $name = get_string("bigeratach", 'wiki');
                    break;
                case 5:
                    $name = get_string("smalleratach", 'wiki');
                    break;
                default:
                    break;
            }
            $info = wiki_b(get_string("incaseatach", 'wiki'), '', true);
            $info .= '  ' . $name;
            $prop = null;
            $prop->class = 'textcenter';
            wiki_paragraph($info, $prop);
            wiki_br();
            $prop = null;
            $prop->class = 'textcenter';
            wiki_paragraph(get_string("importcheckfiles", 'wiki'), $prop);
            $prop = null;
            $prop->class = 'boxaligncenter';
            wiki_table_start($prop);
            $prop = null;
            $prop->action = 'exportxml.php?id=' . $WS->cm->id . '&pageaction=importxml&path=' . $WS->path;
            $prop->method = 'post';
            $prop->id = 'form1';
            wiki_form_start($prop);
            $prop = null;
            $prop->name = 'dfformincase';
            $prop->value = $WS->dfform['incase'];
            wiki_input_hidden($prop);
            $prop = null;
            $prop->name = 'dfformincaseatach';
            $prop->value = $WS->dfform['incaseatach'];
            wiki_input_hidden($prop);
            $prop = null;
            $prop->name = 'dfformsure';
            $prop->value = get_string('yes');
            wiki_input_submit($prop);
            wiki_form_end();
            wiki_change_column();
            $prop = null;
            $prop->action = 'exportxml.php?id=' . $WS->cm->id . '&pageaction=importewiki&path=' . $WS->path . '&file=' . $file;
            $prop->method = 'post';
            $prop->id = 'form2';
            wiki_form_start($prop);
            $prop = null;
            $prop->name = 'dfformcancel';
            $prop->value = get_string('no');
            wiki_input_submit($prop);
            wiki_form_end();
            wiki_table_end();
        } else {
            //create the form to import
            $prop = null;
            $prop->action = 'exportxml.php?id=' . $WS->cm->id . '&pageaction=importewiki&type=' . $WS->type . '&path=' . $WS->path . '&file=' . $file;
            $prop->method = 'post';
            $prop->id = 'form';
            wiki_form_start($prop);
            $prop = null;
            $prop->border = '0';
            $prop->class = 'boxaligncenter';
            $prop->classtd = 'nwikileftnow';
            wiki_table_start($prop);
            wiki_b(get_string('incase', 'wiki'));
            wiki_table_start();
            $prop = null;
            $prop->name = 'dfformincase';
            $prop->value = '0';
            $prop->checked = 'checked';
            wiki_input_radio($prop);
            print_string('always', 'wiki');
            wiki_change_row();
            $prop = null;
            $prop->name = 'dfformincase';
            $prop->value = '1';
            wiki_input_radio($prop);
            print_string('never', 'wiki');
            wiki_change_row();
            $prop = null;
            $prop->name = 'dfformincase';
            $prop->value = '2';
            wiki_input_radio($prop);
            print_string('before', 'wiki');
            wiki_change_row();
            $prop = null;
            $prop->name = 'dfformincase';
            $prop->value = '3';
            wiki_input_radio($prop);
            print_string('after', 'wiki');
            wiki_table_end();
            wiki_br(2);
            $prop = null;
            $prop->class = "nwikileftnow";
            wiki_change_row($prop);
            wiki_b(get_string('incaseatach', 'wiki'));
            wiki_table_start();
            $prop = null;
            $prop->name = 'dfformincaseatach';
            $prop->value = '0';
            $prop->checked = 'checked';
            wiki_input_radio($prop);
            print_string('alwaysatach', 'wiki');
            wiki_change_row();
            $prop = null;
            $prop->name = 'dfformincaseatach';
            $prop->value = '1';
            wiki_input_radio($prop);
            print_string('neveratach', 'wiki');
            wiki_change_row();
            $prop = null;
            $prop->name = 'dfformincaseatach';
            $prop->value = '2';
            wiki_input_radio($prop);
            print_string('beforeatach', 'wiki');
            wiki_change_row();
            $prop = null;
            $prop->name = 'dfformincaseatach';
            $prop->value = '3';
            wiki_input_radio($prop);
            print_string('afteratach', 'wiki');
            wiki_change_row();
            $prop = null;
            $prop->name = 'dfformincaseatach';
            $prop->value = '4';
            wiki_input_radio($prop);
            print_string('bigeratach', 'wiki');
            wiki_change_row();
            $prop = null;
            $prop->name = 'dfformincaseatach';
            $prop->value = '5';
            wiki_input_radio($prop);
            print_string('smalleratach', 'wiki');
            wiki_table_end();
            wiki_br(2);
            $prop = null;
            $prop->class = "nwikicenternow";
            wiki_change_row($prop);
            $prop = null;
            $prop->name = 'dfformimport';
            $prop->value = get_string('import', 'wiki');
            wiki_input_submit($prop);
            wiki_table_end();
            wiki_form_end();
        }
    }
}
     $new = "{$newname}/{$name}";
     $old = $path;
     if (file_exists($new)) {
         echo "Error: {$name} already exists!";
     } else {
         if (!rename($old, $new)) {
             echo "Error: could not rename {$oldname} to {$name}";
         }
     }
     displaydir($wdir);
 } else {
     $strrename = get_string("rename");
     $strcancel = get_string("cancel");
     $strrenamefileto = get_string("renamefileto", "moodle", $file);
     html_header($course, $wdir, "form.name");
     wiki_paragraph($strrenamefileto . ":");
     wiki_table_start();
     $prop = null;
     $prop->action = "import.php";
     $prop->method = "post";
     $prop->id = "form";
     wiki_form_start($prop);
     wiki_div_start();
     $prop = null;
     $prop->name = "choose";
     $prop->value = $choose;
     wiki_input_hidden($prop);
     $prop = null;
     $prop->name = "id";
     $prop->value = $id;
     wiki_input_hidden($prop);
function wiki_hist_actions(&$WS)
{
    //print page title
    switch ($WS->pageaction) {
        case 'oldversion':
            wiki_table_start();
            wiki_size_text(wiki_hist_move_ver("<", 1, 'oldversion'));
            wiki_change_column();
            wiki_size_text(get_string('oldversion', 'wiki') . ': ' . stripslashes_safe($WS->page) . ' v.' . $WS->pageolddata->version);
            wiki_change_column();
            wiki_size_text(wiki_hist_move_ver(">", -1, 'oldversion'));
            wiki_table_end();
            print_box_start();
            wiki_hist_old($WS);
            break;
        case 'diff':
            wiki_table_start();
            wiki_size_text(wiki_hist_move_ver("<", 1));
            wiki_change_column();
            wiki_size_text(get_string('oldversion', 'wiki') . ': ' . stripslashes_safe($WS->page) . ' v.' . $WS->pageolddata->version);
            wiki_change_column();
            wiki_size_text(wiki_hist_move_ver(">", -1));
            wiki_table_end();
            ///// WIKI EVALUATION EDITION /////
            wiki_grade_print_edition_evaluation_box($WS);
            print_box_start();
            $prop = null;
            $prop->class = "textright";
            //wiki_paragraph(helpbutton('differences', get_string('version'), 'wiki',true,false,'',true), $prop);
            echo '<div align="right">' . helpbutton('differences', get_string('version'), 'wiki', true, false, '', true) . '</div>';
            wiki_hist_diff($WS);
            break;
        case 'newdiff':
            wiki_table_start();
            wiki_size_text(wiki_hist_move_ver("&lt;", 1, 'newdiff'));
            wiki_change_column();
            wiki_size_text(get_string('oldversion', 'wiki') . ': ' . stripslashes_safe($WS->page) . ' v.' . $WS->pageolddata->version);
            wiki_change_column();
            wiki_size_text(wiki_hist_move_ver("&gt;", -1, 'newdiff'));
            wiki_table_end();
            ///// WIKI EVALUATION EDITION /////
            wiki_grade_print_edition_evaluation_box($WS);
            print_box_start();
            $prop = null;
            $prop->class = "textright";
            wiki_paragraph('', $prop);
            wiki_hist_newdiff($WS);
            break;
    }
    print_box_end();
}
 $prop = null;
 $prop->name = "font_header";
 $prop->size = "1";
 $prop->class = "boxalignright";
 wiki_select($opt, $prop);
 wiki_table_end();
 // Table font header
 wiki_change_row();
 // Table parameter
 unset($prop);
 $prop->class = "box";
 wiki_table_start($prop);
 // Table question footer
 unset($prop);
 $prop->class = "boxalignleft";
 wiki_paragraph(get_string('wikibooks_footer_question', 'wiki'));
 wiki_change_column();
 unset($prop);
 $prop->name = "with_footer";
 wiki_input_checkbox($prop);
 wiki_table_end();
 // Table question footer
 wiki_change_row();
 // Table parameter
 wiki_br();
 //////////////////////////////////////////////////////////////////////////////////////////////////////////
 wiki_change_row();
 // Table parameter
 wiki_br();
 unset($prop);
 $prop->name = "continue";
        $grades['userid'] = $evaluateduser;
        // Valuated user/s
        $grades['rawgrade'] = (double) $evaluatedgrade;
        $grades['rawgrademax'] = $itemdetails['grademax'];
        $grades['rawgrademin'] = $itemdetails['grademin'];
        $grades['rawscaleid'] = $itemdetails['scaleid'];
        $grades['finalgrade'] = (double) $evaluatedgrade;
        $grades['usermodified'] = $USER->id;
        grade_update('mod/wiki', $course->id, 'mod', 'wiki', $wiki->id, $itemnumber, $grades, $itemdetails);
    }
    unset($prop);
    $prop->style = "text-align: center; color:green;";
    wiki_paragraph(get_string('eval_the_user', 'wiki') . "\"{$users[$evaluateduser]}\"" . get_string('eval_with_the_grade', 'wiki') . '"' . trim($scl[$evaluatedgrade - 1]) . '"', $prop);
    unset($prop);
    $prop->style = "text-align: center;";
    wiki_paragraph('&nbsp;' . get_string('check') . '&nbsp;<a href="' . "{$CFG->wwwroot}" . '/grade/report/index.php?id=' . "{$cid}" . '">' . strtolower(get_string('coursegrades')) . '</a>', $prop);
}
wiki_br();
print_box_start();
echo '<h2 class="headingblock header outline">';
unset($prop);
$prop->class = "nwikileft";
wiki_table_start($prop);
// TO PRINT MENU USER AND GROUP (OR EVERYTHING OF THIS WIKI)
wiki_b(get_string('eval_reports', 'wiki'));
wiki_b('&nbsp;&nbsp;-&nbsp;&nbsp;');
wiki_change_column();
if ($showgroups) {
    if ($cgroups = groups_get_all_groups($course->id)) {
        foreach ($cgroups as $cgroup) {
            $groups[$cgroup->id] = $cgroup->name;