コード例 #1
0
function wiki_export_html(&$WS)
{
    global $CFG;
    check_dir_exists("{$CFG->dataroot}/temp", true);
    check_dir_exists("{$CFG->dataroot}/temp/html", true);
    check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}", true);
    check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/atachments", true);
    check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}", true);
    check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata", true);
    check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}", true);
    //export contents
    wiki_export_html_content($WS);
    //export attached files
    $flist = list_directories_and_files("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}");
    if ($flist != null) {
        foreach ($flist as $fil) {
            $from_file = "{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}/{$fil}";
            $to_file = "{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/atachments/{$fil}";
            copy($from_file, $to_file);
        }
    }
    //zip file name
    $times = time();
    $name = $WS->dfwiki->name . '-' . $times . '.zip';
    $cleanzipname = clean_filename($name);
    //List of files and directories
    $filelist = list_directories_and_files("{$CFG->dataroot}/temp/html");
    //Convert them to full paths
    $files = array();
    if ($filelist != null) {
        foreach ($filelist as $file) {
            $files[] = "{$CFG->dataroot}/temp/html/{$file}";
        }
    }
    check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}", true);
    check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/exportedhtml", true);
    $destination = "{$CFG->dataroot}/{$WS->dfwiki->course}/exportedhtml/{$cleanzipname}";
    $status = zip_files($files, $destination);
    //delete the folder created in temp
    $filelist2 = list_directories_and_files("{$CFG->dataroot}/temp/html");
    if ($filelist2 != null) {
        $del = delete_dir_contents("{$CFG->dataroot}/temp/html");
    }
    //show it all to be albe to download the file
    $prop = null;
    $prop->class = "textcenter";
    wiki_div_start($prop);
    wiki_size_text(get_string("exporthtmlcorrectly", "wiki"), 2);
    wiki_div_end();
    $prop = null;
    $prop->border = "0";
    $prop->class = "boxaligncenter";
    $prop->classtd = "nwikileftnow";
    wiki_table_start($prop);
    $wdir = '/exportedhtml';
    $fileurl = "{$wdir}/{$cleanzipname}";
    $ffurl = "/file.php?file=/{$WS->cm->course}{$fileurl}";
    $icon = mimeinfo("icon", $cleanzipname);
    link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" height=\"16\" width=\"16\" alt=\"File\" />", 480, 640);
    echo "\n" . '&nbsp;';
    link_to_popup_window($ffurl, "display", htmlspecialchars($cleanzipname), 480, 640);
    $prop = null;
    $prop->class = "nwikileftnow";
    wiki_change_row($prop);
    echo '&nbsp;';
    wiki_table_end();
    $prop = null;
    $prop->border = "0";
    $prop->class = "boxaligncenter";
    $prop->classtd = "nwikileftnow";
    wiki_table_start($prop);
    $prop = null;
    $prop->id = "form";
    $prop->method = "post";
    $prop->action = '../xml/index.php?id=' . $WS->dfwiki->course . '&amp;wdir=/exportedhtml';
    wiki_form_start($prop);
    wiki_div_start();
    $prop = null;
    $prop->name = "dfform[viewexported]";
    $prop->value = get_string('viewexported', 'wiki');
    wiki_input_submit($prop);
    wiki_div_end();
    wiki_form_end();
    wiki_change_column();
    print_continue("{$CFG->wwwroot}/mod/wiki/view.php?id={$WS->cm->id}");
    wiki_table_end();
}
コード例 #2
0
function displaydir($wdir)
{
    //  $wdir == / or /a or /a/b/c/d  etc
    global $basedir;
    global $id;
    global $USER, $CFG;
    global $choose;
    $fullpath = $basedir . $wdir;
    check_dir_exists($fullpath, true);
    $directory = opendir($fullpath);
    // Find all files
    while (false !== ($file = readdir($directory))) {
        if ($file == "." || $file == "..") {
            continue;
        }
        if (is_dir($fullpath . "/" . $file)) {
            $dirlist[] = $file;
        } else {
            $filelist[] = $file;
        }
    }
    closedir($directory);
    $strname = get_string("name");
    $strsize = get_string("size");
    $strmodified = get_string("modified");
    $straction = get_string("action");
    $strmakeafolder = get_string("makeafolder");
    $struploadafile = get_string("uploadafile");
    $strwithchosenfiles = get_string("withchosenfiles");
    $strmovetoanotherfolder = get_string("movetoanotherfolder");
    $strmovefilestohere = get_string("movefilestohere");
    $strdeletecompletely = get_string("deletecompletely");
    $strcreateziparchive = get_string("createziparchive");
    $strrename = get_string("rename");
    $stredit = get_string("edit");
    $strunzip = get_string("unzip");
    $strlist = get_string("list");
    $strrestore = get_string("restore");
    $strchoose = get_string("choose");
    $prop = null;
    $prop->action = "index.php";
    $prop->method = "post";
    $prop->id = "dirform";
    wiki_form_start($prop);
    wiki_div_start();
    $prop = null;
    $prop->name = "choose";
    $prop->value = $choose;
    wiki_input_hidden($prop);
    wiki_hr();
    $prop = null;
    $prop->border = "0";
    $prop->spacing = "2";
    $prop->padding = "2";
    $prop->width = "640";
    $prop->class = "files";
    $prop->header = true;
    $prop->styleth = "width:5%";
    wiki_table_start($prop);
    $prop = null;
    $prop->header = true;
    $prop->align = "left";
    $prop->class = "header name";
    wiki_change_column($prop);
    echo $strname;
    $prop = null;
    $prop->header = true;
    $prop->align = "right";
    $prop->class = "header size";
    wiki_change_column($prop);
    echo $strsize;
    $prop = null;
    $prop->header = true;
    $prop->align = "right";
    $prop->class = "header date";
    wiki_change_column($prop);
    echo $strmodified;
    $prop = null;
    $prop->header = true;
    $prop->align = "right";
    $prop->class = "header commands";
    wiki_change_column($prop);
    echo $straction;
    if ($wdir == "/") {
        $wdir = "";
    }
    if (!empty($wdir)) {
        $dirlist[] = '..';
    }
    $count = 0;
    $header = true;
    if (!empty($dirlist)) {
        asort($dirlist);
        foreach ($dirlist as $dir) {
            if ($header) {
                $header = false;
                $prop = null;
                $prop->header = true;
            } else {
                $prop = null;
            }
            if ($dir == '..') {
                $fileurl = rawurlencode(dirname($wdir));
                $prop->style = "white-space: nowrap;";
                $prop->align = "center";
                $prop->classtr = "folder";
                wiki_change_row($prop);
                echo '&nbsp;';
                $prop = null;
                $prop->class = 'name';
                $prop->align = 'left';
                $prop->style = "white-space: nowrap;";
                wiki_change_column($prop);
                $prop = null;
                $prop->src = $CFG->pixpath . '/f/parent.gif';
                $prop->height = "16";
                $prop->width = "16";
                $prop->alt = get_string('parentfolder');
                $out = wiki_img($prop, true);
                $prop = null;
                $prop->href = 'index.php?id=' . $id . '&amp;wdir=' . $fileurl;
                wiki_a($out, $prop);
                $prop = null;
                $prop->href = 'index.php?id=' . $id . '&amp;wdir=' . $fileurl;
                wiki_a(get_string('parentfolder'), $prop);
                wiki_change_column();
                echo '&nbsp;';
                wiki_change_column();
                echo '&nbsp;';
                wiki_change_column();
                echo '&nbsp;';
            } else {
                $count++;
                $filename = $fullpath . "/" . $dir;
                $fileurl = rawurlencode($wdir . "/" . $dir);
                $filesafe = rawurlencode($dir);
                $filesize = display_size(get_directory_size("{$fullpath}/{$dir}"));
                $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
                $prop->align = "center";
                $prop->style = "white-space: nowrap;";
                $prop->class = "checkbox";
                $prop->classtr = "folder";
                wiki_change_row($prop);
                $prop = null;
                $prop->name = 'file' . $count;
                $prop->value = $fileurl;
                wiki_input_checkbox($prop);
                $prop = null;
                $prop->class = 'name';
                $prop->align = "left";
                $prop->style = "white-space: nowrap;";
                wiki_change_column($prop);
                $prop = null;
                $prop->src = $CFG->pixpath . '/f/folder.gif';
                $prop->height = "16";
                $prop->width = "16";
                $prop->alt = "Folder";
                $out = wiki_img($prop, true);
                $prop = null;
                $prop->href = 'index.php?id=' . $id . '&amp;wdir=' . $fileurl . '&amp;choose=' . $choose;
                wiki_a($out, $prop);
                $prop = null;
                $prop->href = 'index.php?id=' . $id . '&amp;wdir=' . $fileurl . '&amp;choose=' . $choose;
                wiki_a(htmlspecialchars($dir), $prop);
                $prop = null;
                $prop->class = 'size';
                $prop->align = "right";
                $prop->style = "white-space: nowrap;";
                wiki_change_column($prop);
                echo $filesize;
                $prop = null;
                $prop->class = 'date';
                $prop->align = "right";
                $prop->style = "white-space: nowrap;";
                wiki_change_column($prop);
                echo $filedate;
                $prop = null;
                $prop->class = 'commands';
                $prop->align = "right";
                $prop->style = "white-space: nowrap;";
                wiki_change_column($prop);
                $prop = null;
                $prop->href = 'index.php?id=' . $id . '&amp;wdir=' . $wdir . '&amp;file=' . $filesafe . '&amp;action=rename&amp;choose=' . $choose;
                wiki_a($strrename, $prop);
                //echo "<a href=\"index.php?id=$id&amp;wdir=$wdir&amp;file=$filesafe&amp;action=rename&amp;choose=$choose\">$strrename</a>";
            }
        }
    }
    if (!empty($filelist)) {
        asort($filelist);
        foreach ($filelist as $file) {
            $icon = mimeinfo("icon", $file);
            $count++;
            $filename = $fullpath . "/" . $file;
            $fileurl = "{$wdir}/{$file}";
            $filesafe = rawurlencode($file);
            $fileurlsafe = rawurlencode($fileurl);
            $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
            if (substr($fileurl, 0, 1) == '/') {
                $selectfile = substr($fileurl, 1);
            } else {
                $selectfile = $fileurl;
            }
            if ($header) {
                $header = false;
                $prop = null;
                $prop->header = true;
            } else {
                $prop = null;
            }
            $prop->align = "center";
            $prop->style = "white-space: nowrap;";
            $prop->class = "checkbox";
            $prop->classtr = "file";
            wiki_change_row($prop);
            $prop = null;
            $prop->name = 'file' . $count;
            $prop->value = $fileurl;
            wiki_input_checkbox($prop);
            $prop = null;
            $prop->align = "left";
            $prop->class = "name nwikileftnow";
            wiki_change_column($prop);
            if ($CFG->slasharguments) {
                $ffurl = "/file.php/" . $id . $fileurl;
            } else {
                $ffurl = "/file.php?file=/" . $id . $fileurl;
            }
            link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" height=\"16\" width=\"16\" alt=\"File\" />", 480, 640);
            echo '&nbsp;';
            link_to_popup_window($ffurl, "display", htmlspecialchars($file), 480, 640);
            $file_size = filesize($filename);
            $prop = null;
            $prop->class = 'size';
            $prop->align = "right";
            $prop->style = "white-space: nowrap;";
            wiki_change_column($prop);
            echo display_size($file_size);
            $prop = null;
            $prop->class = 'date';
            $prop->align = "right";
            $prop->style = "white-space: nowrap;";
            wiki_change_column($prop);
            echo $filedate;
            if ($choose) {
                $edittext = "<b><a onMouseDown=\"return set_value('{$selectfile}')\" href=\"\">{$strchoose}</a></b>&nbsp;";
            } else {
                $edittext = '';
            }
            if ($icon == "text.gif" || $icon == "html.gif") {
                $edittext .= "<a href=\"index.php?id={$id}&amp;wdir={$wdir}&amp;file={$fileurl}&amp;action=edit&amp;choose={$choose}\">{$stredit}</a>";
            } else {
                if ($icon == "zip.gif") {
                    $edittext .= "<a href=\"index.php?id={$id}&amp;wdir={$wdir}&amp;file={$fileurl}&amp;action=unzip&amp;sesskey={$USER->sesskey}&amp;choose={$choose}\">{$strunzip}</a>&nbsp;";
                    $edittext .= "<a href=\"index.php?id={$id}&amp;wdir={$wdir}&amp;file={$fileurl}&amp;action=listzip&amp;sesskey={$USER->sesskey}&amp;choose={$choose}\">{$strlist}</a> ";
                }
            }
            $prop = null;
            $prop->class = 'commands';
            $prop->align = "right";
            $prop->style = "white-space: nowrap;";
            wiki_change_column($prop);
            echo $edittext;
            echo "<a href=\"index.php?id={$id}&amp;wdir={$wdir}&amp;file={$filesafe}&amp;action=rename&amp;choose={$choose}\">{$strrename}</a>";
        }
    }
    if ($header) {
        $prop = null;
        $prop->header = true;
        wiki_table_end($prop);
        $header = false;
    } else {
        wiki_table_end();
    }
    wiki_hr();
    if (empty($wdir)) {
        $wdir = "/";
    }
    $prop = null;
    $prop->name = "id";
    $prop->value = $id;
    wiki_input_hidden($prop);
    $prop = null;
    $prop->name = "choose";
    $prop->value = $choose;
    wiki_input_hidden($prop);
    $prop = null;
    $prop->name = "wdir";
    $prop->value = $wdir;
    wiki_input_hidden($prop);
    $prop = null;
    $prop->name = "sesskey";
    $prop->value = $USER->sesskey;
    wiki_input_hidden($prop);
    $options = array("move" => "{$strmovetoanotherfolder}", "delete" => "{$strdeletecompletely}", "zip" => "{$strcreateziparchive}");
    if (!empty($count)) {
        choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:document.forms['dirform'].submit()");
    }
    wiki_div_end();
    wiki_form_end();
    $prop = null;
    $prop->border = "0";
    $prop->spacing = "2";
    $prop->padding = "2";
    $prop->class = "boxalignright";
    $prop->aligntd = "center";
    wiki_table_start($prop);
    if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) {
        $prop = null;
        $prop->action = "index.php";
        $prop->method = "get";
        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);
        $prop = null;
        $prop->name = "wdir";
        $prop->value = $wdir;
        wiki_input_hidden($prop);
        $prop = null;
        $prop->name = "action";
        $prop->value = "paste";
        wiki_input_hidden($prop);
        $prop = null;
        $prop->name = "sesskey";
        $prop->value = $USER->sesskey;
        wiki_input_hidden($prop);
        $prop = null;
        $prop->value = $strmovefilestohere;
        wiki_input_submit($prop);
        wiki_div_end();
        wiki_form_end();
        $prop = null;
        $prop->align = "right";
        wiki_change_column($prop);
    }
    $prop = null;
    $prop->action = "index.php";
    $prop->method = "get";
    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);
    $prop = null;
    $prop->name = "wdir";
    $prop->value = $wdir;
    wiki_input_hidden($prop);
    $prop = null;
    $prop->name = "action";
    $prop->value = "mkdir";
    wiki_input_hidden($prop);
    $prop = null;
    $prop->value = $strmakeafolder;
    wiki_input_submit($prop);
    wiki_div_end();
    wiki_form_end();
    $prop = null;
    $prop->align = "right";
    wiki_change_column($prop);
    $prop = null;
    $prop->action = "index.php";
    $prop->method = "get";
    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);
    $prop = null;
    $prop->name = "wdir";
    $prop->value = $wdir;
    wiki_input_hidden($prop);
    $prop = null;
    $prop->name = "action";
    $prop->value = "upload";
    wiki_input_hidden($prop);
    $prop = null;
    $prop->value = $struploadafile;
    wiki_input_submit($prop);
    wiki_div_end();
    wiki_form_end();
    wiki_table_end();
    wiki_hr();
}
コード例 #3
0
        $opt = null;
        foreach ($size_fonts as $size_fontop) {
            $prop = null;
            $prop->value = $size_fontop;
            if ($size_fontop == $size_font_default) {
                $prop->selected = "selected";
            }
            $opt .= wiki_option($size_fontop, $prop, true);
        }
        $prop = null;
        $prop->name = "size";
        $prop->size = "1";
        $prop->events = "onchange=\"javascript:view_evaluations(event)\"";
        wiki_select($opt, $prop);
    }
    $prop = null;
    $prop->colspan = '2';
    $prop->class = "textcenter";
    wiki_change_row($prop);
    wiki_br();
    $prop = null;
    $prop->name = "continue";
    $prop->value = get_string('continue');
    wiki_input_submit($prop);
    wiki_table_end();
    wiki_div_end();
    wiki_form_end();
    echo "<!-- Fi del Formulari -->" . "\n";
    /// Finish the page
    print_footer($COURSE);
}
コード例 #4
0
function wiki_print_menu_teachers($listteachers, $cm)
{
    //this function prints the list of theachers in the wiki's student
    if (empty($listteachers)) {
        return;
    }
    wiki_br(2);
    $prop = null;
    $prop->border = "0";
    $prop->class = "boxalignright";
    $prop->classtd = "nwikileftnow";
    wiki_table_start($prop);
    print_string('anotherteacher', 'wiki');
    wiki_change_column();
    $prop = null;
    $prop->id = "selectteacher";
    $prop->method = "post";
    $prop->action = 'view.php?id=' . $cm->id;
    wiki_form_start($prop);
    wiki_div_start();
    $opt = null;
    foreach ($listteachers as $lteacher) {
        $prop = null;
        $prop->value = $lteacher->id;
        $opt .= wiki_option($lteacher->lastname . ', ' . $lteacher->firstname, $prop, true);
    }
    $prop = null;
    $prop->name = "dfformselectteacher";
    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 "&nbsp;";
    wiki_table_end();
}
コード例 #5
0
function wiki_grade_print_edition_evaluation_box(&$WS)
{
    $context = get_context_instance(CONTEXT_MODULE, $WS->cm->id);
    if (has_capability('mod/wiki:evaluateawiki', $context)) {
        print_box_start();
        $prop = null;
        $prop->id = "form_grades";
        $prop->method = "post";
        $prop->action = 'view.php?id=' . $WS->linkid . '&amp;page=' . urlencode($WS->pageaction . '/' . stripslashes_safe($WS->page)) . '&amp;dfcontent=11&amp;ver=' . $WS->ver . '&amp;gid=' . $WS->groupmember->groupid . '&amp;uid=' . $WS->member->id;
        wiki_form_start($prop);
        $prop = null;
        $prop->padding = "2";
        $prop->aligntd = "right";
        wiki_table_start($prop);
        echo '<b>' . get_string('grade') . '</b>:&nbsp;';
        wiki_change_column();
        /// 1 -> "+", 2 -> "=", 3 -> "-"
        $prop = null;
        $prop->value = '1';
        $opt = wiki_option('+', $prop, true);
        $prop = null;
        $prop->value = '2';
        $opt .= wiki_option('=', $prop, true);
        $prop = null;
        $prop->value = '3';
        $opt .= wiki_option('-', $prop, true);
        $prop = null;
        $prop->name = "grade_edition";
        wiki_select($opt, $prop);
        echo '&nbsp';
        $prop = null;
        $prop->name = 'grade_edition_confirm';
        $prop->value = get_string('set', 'wiki');
        wiki_input_submit($prop);
        unset($prop);
        $prop->name = 'oldversion';
        $prop->value = $WS->pageolddata->version;
        wiki_input_hidden($prop);
        unset($prop);
        $prop->name = 'currentversion';
        $prop->value = $WS->pageverdata->version;
        wiki_input_hidden($prop);
        wiki_change_row();
        echo '<b>' . get_string('eval_feedback', 'wiki') . '</b>:&nbsp';
        wiki_change_column();
        unset($prop);
        $prop->size = 60;
        $prop->value = '';
        $prop->name = 'feedback';
        wiki_input_text($prop);
        $prop->align = 'right';
        wiki_change_row($prop);
        echo '<i>' . get_string('note', 'wiki') . '</i>:&nbsp;';
        wiki_change_column();
        $oldversion = $WS->pageolddata->version;
        $currentversion = $WS->pageverdata->version;
        if ($currentversion < $oldversion) {
            $tmp = $currentversion;
            $currentversion = $oldversion;
            $oldversion = $tmp;
        }
        $version = $oldversion + 1;
        $count = $version - $currentversion;
        if ($count == 1) {
            echo get_string('evaluate_hist_edition', 'wiki') . ' ' . $version;
        } else {
            echo '<i>' . get_string('evaluate_hist_editions', 'wiki') . ': ';
            for ($i = $version; $i <= $currentversion; $i++) {
                echo $i;
                if ($i < $currentversion) {
                    echo ', ';
                }
            }
            echo '</i>';
        }
        wiki_table_end();
        wiki_form_end();
        print_box_end();
    }
}
コード例 #6
0
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 . '&amp;pageaction=importxml&amp;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 . '&amp;pageaction=importewiki&amp;path=' . $WS->path . '&amp;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 . '&amp;pageaction=importewiki&amp;type=' . $WS->type . '&amp;path=' . $WS->path . '&amp;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();
        }
    }
}
コード例 #7
0
 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";
 $prop->id = "continue_pdf";
 $prop->value = get_string('continue');
 wiki_input_submit($prop);
 wiki_table_end();
 // Table parameter
 wiki_div_end();
 // Div parameter
 wiki_table_end();
 // Table General
 wiki_div_end();
 wiki_form_end();
コード例 #8
0
function wiki_print_edit_area(&$content_text, &$WS)
{
    global $USER, $dfwiki_editor;
    //select editor:
    switch ($WS->pagedata->editor) {
        case 'htmleditor':
            //moodle html editor
            $prop = null;
            $prop->border = 0;
            $prop->width = '100%';
            $prop->aligntd = 'right';
            wiki_table_start($prop);
            helpbutton('howtowiki_htmleditor', get_string('helpeditor', 'wiki'), 'wiki');
            wiki_change_row();
            print_textarea(true, 20, 70, 0, 0, 'dfformcontent', $content_text);
            use_html_editor('dfformcontent');
            wiki_table_end();
            break;
        default:
            //default and dfwiki editor
            //print buttons
            wiki_table_start();
            $prop = null;
            $prop->width = '100%';
            $prop->valigntd = 'top';
            $prop->classtd = 'nwikitambuttons';
            wiki_table_start($prop);
            $prop = null;
            $prop->type = 'text/javascript';
            $prop->src = 'editor/buttons.js';
            wiki_script('', $prop);
            $prop = null;
            $prop->type = 'text/javascript';
            $prop->src = '../mod/wiki/editor/buttons.js';
            wiki_script('', $prop);
            $info = "";
            if (isset($dfwiki_editor)) {
                foreach ($dfwiki_editor as $button) {
                    $text = $button[4] != '' ? get_string($button[4], 'wiki') : '';
                    if (isset($WS->dfcourse)) {
                        $info .= 'addButton(\'../mod/wiki/editor/images/' . $button[0] . '\',\'' . get_string($button[1], 'wiki') . '\',\'' . $button[2] . '\',\'' . $button[3] . '\',\'' . $text . "');\n";
                    } else {
                        $info .= 'addButton(\'editor/images/' . $button[0] . '\',\'' . get_string($button[1], 'wiki') . '\',\'' . $button[2] . '\',\'' . $button[3] . '\',\'' . $text . "');\n";
                    }
                }
            }
            $prop = null;
            $prop->type = 'text/javascript';
            wiki_script($info, $prop);
            $prop = null;
            $prop->valign = 'top';
            wiki_change_column($prop);
            wiki_print_edit_smileis($WS);
            $prop = null;
            $prop->align = 'right';
            $prop->valign = 'top';
            wiki_change_column($prop);
            helpbutton('howtowiki_' . $WS->pagedata->editor, get_string('helpeditor', 'wiki'), 'wiki');
            wiki_table_end();
            wiki_change_row();
            $info = '
					var cont=0;
					function onKeyPress(e)
					{
						cont++;
						if(cont==200){
							<!-- 	No es pot accedir al checkbox a traves de document.form.dfform[definitive] -->
							document.getElementById("checkbox").click()
						}
					}';
            $prop = null;
            $prop->type = 'text/javascript';
            wiki_script($info, $prop);
            $prop = null;
            $prop->cols = $WS->editor_size->editorcols;
            $prop->rows = $WS->editor_size->editorrows;
            $prop->name = 'dfformcontent';
            $prop->events = 'onkeypress="return onKeyPress(event);"';
            wiki_textarea(s($content_text), $prop);
            wiki_table_end();
            break;
    }
}