本文整理汇总了PHP中upload_print_form_fragment函数的典型用法代码示例。如果您正苦于以下问题:PHP upload_print_form_fragment函数的具体用法?PHP upload_print_form_fragment怎么用?PHP upload_print_form_fragment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upload_print_form_fragment函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view_upload_form
function view_upload_form()
{
global $CFG;
$struploadafile = get_string("uploadafile");
$strmaxsize = get_string("maxsize", "", display_size($this->wqmaxbytes));
echo '<center>';
echo '<form enctype="multipart/form-data" method="post" ' . "action=\"{$CFG->wwwroot}/mod/webquestscorm/upload.php\">";
echo "<p>{$struploadafile} ({$strmaxsize})</p>";
echo '<input type="hidden" name="cmid" value="' . $this->cm->id . '" />';
require_once $CFG->libdir . '/uploadlib.php';
upload_print_form_fragment(1, array('newfile'), false, null, 0, $this->wqmaxbytes, false);
echo '<input type="submit" name="save" value="' . get_string('uploadthisfile') . '" />';
echo '</form>';
echo '</center>';
}
示例2: get_max_upload_file_size
$upload_max_filesize = get_max_upload_file_size($CFG->maxbytes);
$filesize = display_size($upload_max_filesize);
$struploadafile = get_string("uploadafile");
$struploadthisfile = get_string("uploadthisfile");
$strmaxsize = get_string("maxsize", "", $filesize);
$strcancel = get_string("cancel");
echo "<p>{$struploadafile} ({$strmaxsize}) --> <b>{$wdir}</b></p>";
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"index.php\">";
echo "<div>";
echo "<table><tr><td colspan=\"2\">";
echo ' <input type="hidden" name="choose" value="' . $choose . '" />';
echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />";
echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"upload\" />";
echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />";
upload_print_form_fragment(1, array('userfile'), null, false, null, $upload_max_filesize, 0, false);
echo " </td></tr></table>";
echo " <input type=\"submit\" name=\"save\" value=\"{$struploadthisfile}\" />";
echo "</div>";
echo "</form>";
echo "<form action=\"index.php\" method=\"get\">";
echo "<div>";
echo ' <input type="hidden" name="choose" value="' . $choose . '" />';
echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />";
echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />";
echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
echo " <input type=\"submit\" value=\"{$strcancel}\" />";
echo "</div>";
echo "</form>";
}
html_footer();
示例3: ewiki_page_fileupload
function ewiki_page_fileupload($id, $data, $action, $def_sec = "")
{
global $CFG, $ewiki_upload_sections, $ewiki_plugins;
$o = ewiki_make_title($id, $id, 2);
$upload_file = $_FILES[EWIKI_UP_UPLOAD];
if (empty($upload_file)) {
$o .= ewiki_t("UPLOAD0");
$o .= '<div class="upload">' . '<form action="' . ewiki_script($action != "view" ? $action : "", $id) . '" method="post" enctype="multipart/form-data">';
$o .= '<fieldset class="invisiblefieldset">';
require_once $CFG->dirroot . '/lib/uploadlib.php';
$o .= upload_print_form_fragment(1, array(EWIKI_UP_UPLOAD), array(ewiki_t("file")), false, null, 0, 0, true);
$o .= '<input type="submit" value="' . EWIKI_PAGE_UPLOAD . '" /><br /><br />' . '<b>' . ewiki_t("comment") . '</b><br /><textarea name="comment" cols="35" rows="3"></textarea><br /><br />';
if (empty($ewiki_upload_sections[$def_sec])) {
$ewiki_upload_sections[$def_sec] = $def_sec;
}
if (count($ewiki_upload_sections) > 1) {
if (empty($def_sec)) {
$def_sec = $_REQUEST["section"];
}
$o .= '<b>' . ewiki_t("UPL_INSECT") . '</b><br /><select name="section">';
foreach ($ewiki_upload_sections as $id => $title) {
$o .= '<option value="' . $id . '"' . ($id == $def_sec ? ' selected' : '') . '>' . $title . '</option>';
}
$o .= '</select><br /><br />';
}
$o .= '<b>' . ewiki_t("UPL_NEWNAM") . '</b><br /><input type="text" name="new_filename" size="20" /><br /><br />';
$o .= '</fieldset></form></div>';
} elseif ($upload_file["size"] > EWIKI_UPLOAD_MAXSIZE) {
$o .= ewiki_t("UPL_TOOLARGE");
} else {
$meta = array("X-Content-Type" => $upload_file["type"]);
if (($s = $upload_file["name"]) && strlen($s) >= 3 || ($s = substr(md5(time() + microtime()), 0, 8) . ".dat")) {
if (strlen($uu = trim($_REQUEST["new_filename"])) >= 3) {
if ($uu != $s) {
$meta["Original-Filename"] = $s;
}
$s = $uu;
}
$meta["Content-Location"] = $s;
$p = 0 or $p = strrpos($s, "/") and $p++ or $p = strrpos($s, '\\') and $p++;
$meta["Content-Disposition"] = 'attachment; filename="' . urlencode(substr($s, $p)) . '"';
}
if (strlen($sect = $_REQUEST["section"])) {
if ($ewiki_upload_sections[$sect] || $action == EWIKI_ACTION_ATTACHMENTS && $data["content"] && strlen($ewiki_plugins["action"][EWIKI_ACTION_ATTACHMENTS])) {
$meta["section"] = $sect;
} else {
$o .= ewiki_t("UPL_REJSECT", array('sect' => $sect));
return $o;
}
}
if (strlen($s = trim($_REQUEST["comment"]))) {
$meta["comment"] = $s;
}
$result = ewiki_binary_save_image($upload_file["tmp_name"], "", "RETURN", $meta, "ACCEPT_ALL", $care_for_images = 0);
if ($result) {
$o .= ewiki_t("UPL_OK", array('$script' => ewiki_script()));
} else {
$o .= ewiki_t("UPL_ERROR");
}
}
return $o;
}
示例4: view_upload_form
function view_upload_form()
{
global $CFG;
if (isset($this->assignment->var3) && $this->assignment->var3 == self::ONLINE_TEXT) {
notify(get_string("singleuploadwarning", "assignment_peerreview"));
$mform = new mod_assignment_peerreview_edit_form($CFG->wwwroot . '/mod/assignment/upload.php', array('id' => $this->cm->id));
$mform->display();
} else {
require_once $CFG->libdir . '/filelib.php';
$icon = mimeinfo('icon', 'xxx.' . $this->assignment->fileextension);
$type = mimeinfo('type', 'xxx.' . $this->assignment->fileextension);
$struploadafile = get_string("uploada", "assignment_peerreview") . " " . "<img align=\"middle\" src=\"" . $CFG->pixpath . "/f/" . $icon . "\" class=\"icon\" alt=\"" . $icon . "\" />" . "<strong>" . $type . "</strong> " . get_string("file", "assignment_peerreview") . " " . get_string("witha", "assignment_peerreview") . " <strong>." . $this->assignment->fileextension . "</strong> " . get_string("extension", "assignment_peerreview");
$strmaxsize = get_string("maxsize", "", display_size($this->assignment->maxbytes));
notify(get_string("singleuploadwarning", "assignment_peerreview"));
echo '<div style="text-align:center">';
echo '<form enctype="multipart/form-data" method="post" ' . "action=\"{$CFG->wwwroot}/mod/assignment/upload.php\">";
echo '<fieldset class="invisiblefieldset">';
echo "<p>{$struploadafile} ({$strmaxsize})</p>";
echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />';
require_once $CFG->libdir . '/uploadlib.php';
upload_print_form_fragment(1, array('newfile'), false, null, 0, $this->assignment->maxbytes, false);
echo '<input type="submit" name="save" value="' . get_string('uploadthisfile') . '" />';
echo '</fieldset>';
echo '</form>';
echo '</div>';
}
}
示例5: file_get_contents
$filename = $um->files['csvfile']['tmp_name'];
// Fix mac/dos newlines
$text = file_get_contents($filename);
$text = preg_replace('!\\r\\n?!', "\n", $text);
$fp = fopen($filename, "w");
fwrite($fp, $text);
fclose($fp);
authorize_process_csv($filename);
}
}
/// Print submit form
$maxuploadsize = get_max_upload_file_size();
echo '<center><form method="post" enctype="multipart/form-data" action="uploadcsv.php">
<input type="hidden" name="MAX_FILE_SIZE" value="' . $maxuploadsize . '" />
<input type="hidden" name="sesskey" value="' . $USER->sesskey . '">';
upload_print_form_fragment(1, array('csvfile'), array(get_string('file')));
echo '<input type="submit" value="' . get_string('upload') . '" />';
echo '</form></center><br />';
/// Print footer
print_footer();
function authorize_process_csv($filename)
{
global $CFG, $SITE;
/// We need these fields
$myfields = array('Transaction ID', 'Transaction Status', 'Transaction Type', 'Settlement Amount', 'Settlement Currency', 'Settlement Date/Time', 'Authorization Amount', 'Authorization Currency', 'Submit Date/Time', 'Reference Transaction ID', 'Total Amount', 'Currency', 'Invoice Number', 'Customer ID');
/// Open the file and get first line
$handle = fopen($filename, "r");
if (!$handle) {
error('CANNOT OPEN CSV FILE');
}
$firstline = fgetcsv($handle, 8192, ",");
示例6: get_string
}
// removed target=\"uploadedfile\"
// as it does not validate MDL_7861
echo "<tr><td>" . get_string("attachment", "workshop") . " {$n}: <img src=\"{$CFG->pixpath}/f/{$icon}\"\n class=\"icon\" alt=\"" . get_string('file') . "\" />" . " <a href=\"{$CFG->wwwroot}/{$ffurl}\">{$file}</a></td></tr>\n";
}
} else {
echo "<tr><td><b>" . get_string("noattachments", "workshop") . "</b></td></tr>\n";
}
}
echo "<tr><td>\n";
require_once $CFG->dirroot . '/lib/uploadlib.php';
for ($i = 0; $i < $workshop->nattachments; $i++) {
$iplus1 = $i + 1;
$tag[$i] = get_string("newattachment", "workshop") . " {$iplus1}:";
}
upload_print_form_fragment($workshop->nattachments, null, $tag, false, null, $course->maxbytes, $workshop->maxbytes, false);
echo "</td></tr>\n";
}
echo "</table>\n";
echo "<input type=\"submit\" value=\"" . get_string("savemysubmission", "workshop") . "\" />\n";
echo "</div></fieldset></form>\n";
} elseif ($action == 'listallsubmissions') {
if (!($users = workshop_get_students($workshop))) {
print_heading(get_string("nostudentsyet"));
print_footer($course);
exit;
}
print_heading(get_string("listofallsubmissions", "workshop") . ":", "CENTER");
workshop_list_all_submissions($workshop, $USER);
print_continue("view.php?id={$cm->id}");
} elseif ($action == 'listforassessmentstudent') {
示例7: view_upload_form
function view_upload_form($teamid)
{
global $CFG, $USER, $OUTPUT;
$submission = $this->get_submission($USER->id);
$struploadafile = get_string('teamsubmission', 'assignment_team');
$maxbytes = $this->assignment->maxbytes == 0 ? $this->course->maxbytes : $this->assignment->maxbytes;
$strmaxsize = get_string('maxsize', '', display_size($maxbytes));
if ($this->is_finalized($submission)) {
// no uploading
return;
}
if ($this->can_upload_file($submission, $teamid)) {
echo '<div style="text-align:center">';
echo '<form enctype="multipart/form-data" method="post" action="upload.php">';
echo '<fieldset class="invisiblefieldset">';
echo "<p>{$struploadafile} ({$strmaxsize})</p>";
echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
echo '<input type="hidden" name="action" value="uploadfile" />';
echo '<input type="hidden" name="teamid" value="' . $teamid . '" />';
require_once $CFG->libdir . '/uploadlib.php';
upload_print_form_fragment(1, array('newfile'), null, false, null, 0, $this->assignment->maxbytes, false);
echo '<input type="submit" name="save" value="' . get_string('uploadthisfile') . '" />';
echo '</fieldset>';
echo '</form>';
echo '</div>';
echo '<br />';
}
}
示例8: custom_team_feedbackform
/**
* to support team feedback
* Creating a uploading response file input box.
* @param $submission
* @param $return
*/
function custom_team_feedbackform($id, $teamid, $userrep, $mode)
{
global $CFG, $OUTPUT;
echo $output = get_string('responsefiles', 'assignment') . ': ';
$output .= '<form enctype="multipart/form-data" method="post" ' . "action=\"{$CFG->wwwroot}/mod/assignment/upload.php\">";
$output .= '<div>';
$output .= '<input type="hidden" name="id" value="' . $id . '" />';
$output .= '<input type="hidden" name="action" value="uploadteamresponse" />';
$output .= '<input type="hidden" name="mode" value="' . $mode . '" />';
$output .= '<input type="hidden" name="teamid" value="' . $teamid . '" />';
$output .= '<input type="hidden" name="userrep" value="' . $userrep . '" />';
$output .= '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
require_once $CFG->libdir . '/uploadlib.php';
$output .= upload_print_form_fragment(1, array('newfile'), null, false, null, 0, 0, true);
$output .= '<input type="submit" name="save" value="' . get_string('uploadthisfile') . '" />';
$output .= '</div>';
$output .= '</form>';
$responsefiles = $this->print_team_responsefiles($id, $teamid, $userrep, $mode);
if (!empty($responsefiles)) {
$output .= $responsefiles;
}
return $output;
}
示例9: print_question_formulation_and_controls
/**
* Format question display
*/
function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
{
global $CFG;
require_once $CFG->libdir . '/formslib.php';
$readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
static $htmleditorused = false;
// Print formulation
$questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
$image = get_question_image($question);
$maxbytes = $question->options->maxbytes;
$showessay = $question->options->essay;
$answers =& $question->options->answers;
$readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
// Only use the rich text editor for the first essay question on a page.
$usehtmleditor = can_use_html_editor() && !$htmleditorused;
$formatoptions = new stdClass();
$formatoptions->noclean = true;
$formatoptions->para = false;
$inputname = $question->name_prefix;
/// set question text and media
$questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course);
// get essay response value
if (isset($state->responses[''])) {
$value = stripslashes_safe($state->responses['']);
} else {
$value = "";
}
// essay answer
$answer = '';
if ($showessay) {
if (empty($options->readonly)) {
// the student needs to type in their answer so print out a text editor
$answer = print_textarea($usehtmleditor, 18, 80, 630, 400, $inputname, $value, $cmoptions->course, true);
} else {
// it is read only, so just format the students answer and output it
$safeformatoptions = new stdClass();
$safeformatoptions->para = false;
$answer = format_text($value, FORMAT_MOODLE, $safeformatoptions, $cmoptions->course);
}
}
// set the file input form
$struploadform = upload_print_form_fragment(1, array($question->name_prefix . "file"), null, false, null, 0, $maxbytes, true);
// set file upload feedback and display of uploaded file
$uploadfeedback = '';
if (isset($state->uploadfeedback)) {
$uploadfeedback = $state->uploadfeedback;
}
$struploadedfile = '';
$currentfile = get_student_answer($state->attempt, $question->id);
if ($currentfile) {
$struploadedfile = get_string('answer', 'quiz') . ': ' . $currentfile;
}
// string prompts for form
if ($currentfile) {
$struploadfile = get_string('uploadnew', 'qtype_fileresponse');
} else {
$struploadfile = get_string('uploadafile');
}
$strmaxsize = get_string('maximumupload') . ' ' . display_size($maxbytes);
include "{$CFG->dirroot}/question/type/fileresponse/display.html";
if ($usehtmleditor) {
use_html_editor($inputname);
$htmleditorused = true;
}
}
示例10: incremental_manual_download_form
function incremental_manual_download_form($id)
{
global $CFG;
echo '<div style="text-align:center">';
echo '<form enctype="multipart/form-data" method="post" action="upload_incremental.php">';
echo '<fieldset class="invisiblefieldset">';
echo '<input type="hidden" name="id" value="' . $id . '" />';
echo '<input type="hidden" name="action" value="uploadfile" />';
require_once $CFG->libdir . '/uploadlib.php';
upload_print_form_fragment(1, array('newfile'), null, false, null, 0, null, false);
echo '<input type="submit" name="save" value="' . get_string('restorethisfile', 'local') . '" />';
echo '</fieldset>';
echo '</form>';
echo '</div>';
echo '<br />';
}
示例11: show_image
function show_image($imagename, $templateid, $courseid, $hidden, $itemid)
{
global $CFG;
if ($imagename) {
$partpath = '/' . $courseid . IMAGE_PATH . '/' . $imagename;
$fullpath = $CFG->dataroot . $partpath;
if (file_exists($fullpath)) {
list($width, $height, $type, $attr) = getimagesize($fullpath);
echo "<div style='width: {$width}px; height: {$height}px; border: solid 1px black;'>";
echo '<div style="position: relative;">';
$imageurl = $CFG->wwwroot . '/file.php?file=' . $partpath . '&tmpl=' . $templateid;
// Templateid added to stop browser from showing incorrect cached image
echo '<img src="' . $imageurl . '" alt="Preview Template" style="position: absolute; top: 0px; left: 0px;" onclick="clicked_on_image(event);" />';
if ($templateid > 0) {
$templateitems = get_records('assignment_uploadpdf_tmplitm', 'template', $templateid);
if ($templateitems) {
foreach ($templateitems as $ti) {
$tiwidth = '';
if ($ti->type == 'text') {
$tiwidth = ' width: ' . $ti->width . 'px; ';
}
$cssid = '';
$border = '';
if ($itemid == $ti->id) {
$border = ' border: dashed 1px red; ';
$cssid = ' id = "current_template_item" ';
}
echo '<div style="position: absolute;' . $border . ' font-family: helvetica, arial, sans; font-size: 12px; ';
echo 'top: ' . $ti->ypos . 'px; left: ' . $ti->xpos . 'px; ' . $tiwidth;
echo '"' . $cssid . '>';
if ($ti->type == 'text' || $ti->type == 'shorttext') {
echo s($ti->setting);
} elseif ($ti->type == 'date') {
echo date($ti->setting);
}
echo '</div>';
}
}
if ($itemid == -1) {
echo '<div style="position: absolute; border: dashed 1px red; font-family: helvetica, arial, sans; font-size: 12px; ';
echo 'top: 0px; left: 0px;" id = "current_template_item">';
echo get_string('enterformtext', 'assignment_uploadpdf');
echo '</div>';
}
}
echo '</div>';
echo ' ';
echo '</div>';
return;
}
}
echo '<form enctype="multipart/form-data" method="post" action="edittemplates.php">';
echo '<fieldset>';
echo $hidden;
echo '<p>' . get_string('previewinstructions', 'assignment_uploadpdf') . '</p>';
require_once $CFG->libdir . '/uploadlib.php';
upload_print_form_fragment(1, array('preview'), null, false, null, 0, 0, false);
echo '<input type="submit" name="uploadpreview" value="' . get_string('uploadpreview', 'assignment_uploadpdf') . '" />';
echo '</fieldset>';
echo '</form>';
}
示例12: print_continue
}
}
print_continue($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $assignmentinstance->cm->id);
} else {
if (isset($assignmentinstance->assignment->var3) && $assignmentinstance->assignment->var3 == assignment_peerreview::ONLINE_TEXT) {
notify(get_string("resubmissionwarning", "assignment_peerreview"));
$mform = new mod_assignment_peerreview_edit_form($CFG->wwwroot . '/mod/assignment/type/peerreview/resubmit.php', array('id' => $assignmentinstance->cm->id, 'a' => $assignmentinstance->assignment->id, 'userid' => $userid));
$mform->display();
} else {
// Show form for resubmission
notify(get_string("resubmissionwarning", "assignment_peerreview"));
require_once $CFG->libdir . '/filelib.php';
$icon = mimeinfo('icon', 'xxx.' . $assignmentinstance->assignment->fileextension);
$type = mimeinfo('type', 'xxx.' . $assignmentinstance->assignment->fileextension);
$struploadafile = get_string("uploada", "assignment_peerreview") . " " . "<img align=\"middle\" src=\"" . $CFG->pixpath . "/f/" . $icon . "\" class=\"icon\" alt=\"" . $icon . "\" />" . "<strong>" . $type . "</strong> " . get_string("file", "assignment_peerreview") . " " . get_string("witha", "assignment_peerreview") . " <strong>." . $assignmentinstance->assignment->fileextension . "</strong> " . get_string("extension", "assignment_peerreview");
$strmaxsize = get_string("maxsize", "", display_size($assignmentinstance->assignment->maxbytes));
echo '<div style="text-align:center">';
echo '<form enctype="multipart/form-data" method="post" ' . "action=\"{$CFG->wwwroot}/mod/assignment/type/peerreview/resubmit.php\">";
echo '<fieldset class="invisiblefieldset">';
echo "<p>{$struploadafile} ({$strmaxsize})</p>";
echo '<input type="hidden" name="id" value="' . $assignmentinstance->cm->id . '" />';
echo '<input type="hidden" name="a" value="' . $assignmentinstance->assignment->id . '" />';
echo '<input type="hidden" name="userid" value="' . $userid . '" />';
require_once $CFG->libdir . '/uploadlib.php';
upload_print_form_fragment(1, array('newfile'), false, null, 0, $assignmentinstance->assignment->maxbytes, false);
echo '<input type="submit" name="save" value="' . get_string('uploadthisfile') . '" />';
echo '</fieldset>';
echo '</form>';
echo '</div>';
}
}
示例13: exercise_print_upload_form
function exercise_print_upload_form($exercise)
{
global $CFG;
if (!($course = get_record("course", "id", $exercise->course))) {
error("Course is misconfigured");
}
if (!($cm = get_coursemodule_from_instance("exercise", $exercise->id, $course->id))) {
error("Course Module ID was incorrect");
}
echo "<div align=\"center\">";
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"upload.php\">";
echo " <input type=\"hidden\" name=\"id\" value=\"{$cm->id}\" />";
require_once $CFG->dirroot . '/lib/uploadlib.php';
upload_print_form_fragment(1, array('newfile'), null, true, array('title'), $course->maxbytes, $exercise->maxbytes, false);
echo " <input type=\"submit\" name=\"save\" value=\"" . get_string("uploadthisfile") . "\" />";
echo " (" . get_string("maximumupload") . ": " . display_size($exercise->maxbytes) . ")\n";
echo "</form>";
echo "</div>";
}
示例14: custom_feedbackform
function custom_feedbackform($submission, $return = false)
{
global $CFG;
$mode = optional_param('mode', '', PARAM_ALPHA);
$offset = optional_param('offset', 0, PARAM_INT);
$forcerefresh = optional_param('forcerefresh', 0, PARAM_BOOL);
$output = get_string('responsefiles', 'assignment') . ': ';
$output .= '<form enctype="multipart/form-data" method="post" ' . "action=\"{$CFG->wwwroot}/mod/assignment/upload.php\">";
$output .= '<div>';
$output .= '<input type="hidden" name="id" value="' . $this->cm->id . '" />';
$output .= '<input type="hidden" name="action" value="uploadresponse" />';
$output .= '<input type="hidden" name="mode" value="' . $mode . '" />';
$output .= '<input type="hidden" name="offset" value="' . $offset . '" />';
$output .= '<input type="hidden" name="userid" value="' . $submission->userid . '" />';
$output .= '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
require_once $CFG->libdir . '/uploadlib.php';
$output .= upload_print_form_fragment(1, array('newfile'), null, false, null, 0, 0, true);
$output .= '<input type="submit" name="save" value="' . get_string('uploadthisfile') . '" />';
$output .= '</div>';
$output .= '</form>';
if ($forcerefresh) {
$output .= $this->update_main_listing($submission);
}
$responsefiles = $this->print_responsefiles($submission->userid, true);
if (!empty($responsefiles)) {
$output .= $responsefiles;
}
if ($return) {
return $output;
}
echo $output;
return;
}
示例15: notify
if ($um->process_file_uploads($dir)) {
notify(get_string('uploadedfile'));
}
// um will take care of error reporting.
displaydir($wdir);
} else {
$upload_max_filesize = get_max_upload_file_size($CFG->maxbytes);
$filesize = display_size($upload_max_filesize);
$struploadafile = get_string("uploadafile");
$struploadthisfile = get_string("uploadthisfile");
$strmaxsize = get_string("maxsize", "", $filesize);
$strcancel = get_string("cancel");
echo "<p>{$struploadafile} ({$strmaxsize}) --> <strong>{$wdir}</strong>";
echo "<table border=\"0\"><tr><td colspan=\"2\">\n";
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"coursefiles.php\">\n";
upload_print_form_fragment(1, array('userfile'), null, false, null, $course->maxbytes, 0, false);
echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n";
echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n";
echo " <input type=\"hidden\" name=\"action\" value=\"upload\" />\n";
echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n";
echo " </td><tr><td align=\"right\">";
echo " <input type=\"submit\" name=\"save\" value=\"{$struploadthisfile}\" />\n";
echo "</form>\n";
echo "</td>\n<td>\n";
echo "<form action=\"coursefiles.php\" method=\"get\">\n";
echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n";
echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n";
echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />\n";
echo " <input type=\"submit\" value=\"{$strcancel}\" />\n";
echo "</form>\n";
echo "</td>\n</tr>\n</table>\n";