Пример #1
0
function webquest_delete_submitted_files($webquest, $submission)
{
    // Deletes the files in the Webquest area for this submission
    if ($basedir = webquest_file_area($webquest, $submission)) {
        if ($files = get_directory_list($basedir)) {
            foreach ($files as $file) {
                if (unlink("{$basedir}/{$file}")) {
                    notify("File '{$file}' has been deleted!");
                } else {
                    notify("Attempt to delete file {$basedir}/{$file} has failed!");
                }
            }
        }
    }
}
Пример #2
0
        <input type="hidden" name="sid" value="<?php 
    echo $sid;
    ?>
" />
        <center>
        <table cellpadding="5" border="1">
        <?php 
    echo "<tr valign=\"top\"><td><b>" . get_string("title", "webquest") . ":</b>\n";
    echo "<input type=\"text\" name=\"title\" size=\"60\" maxlength=\"100\" value=\"{$submission->title}\" />\n";
    echo "</td></tr><tr><td><b>" . get_string("submission", "webquest") . ":</b><br />\n";
    print_textarea($usehtmleditor, 25, 70, 630, 400, "description", $submission->description);
    use_html_editor("description");
    echo "</td></tr>\n";
    if ($webquest->nattachments) {
        $filearea = webquest_file_area_name($webquest, $submission);
        if ($basedir = webquest_file_area($webquest, $submission)) {
            if ($files = get_directory_list($basedir)) {
                echo "<tr><td><b>" . get_string("attachments", "webquest") . "</b><div align=\"right\"><input type=\"button\" value=\"" . get_string("removeallattachments", "webquest") . "\" onclick=\"document.editform.action.value='removeattachments';\n                        document.editform.submit();\"/></div></td></tr>\n";
                $n = 0;
                foreach ($files as $file) {
                    $n++;
                    $icon = mimeinfo("icon", $file);
                    if ($CFG->slasharguments) {
                        $ffurl = "file.php/{$filearea}/{$file}";
                    } else {
                        $ffurl = "file.php?file=/{$filearea}/{$file}";
                    }
                    echo "<tr><td>" . get_string("attachment", "webquest") . " {$n}: <img src=\"{$CFG->pixpath}/f/{$icon}\"\n                            height=\"16\" width=\"16\" border=\"0\" alt=\"File\" />" . "&nbsp;<a target=\"uploadedfile\" href=\"{$CFG->wwwroot}/{$ffurl}\">{$file}</a></td></tr>\n";
                }
                unset($n);
            } else {