function student_files_upload_any_student_files_form
Search API
7.x student_files.module | student_files_upload_any_student_files_form() |
6.x student_files.module | student_files_upload_any_student_files_form() |
This is where we can upload (en masse?) to any arbitrary student.
File
- modules/
student_files/ student_files.module, line 94 - This is the student_files module, which will facilitate uploading (securely) files to be associated with student accounts.
Code
function student_files_upload_any_student_files_form() {
$form = array();
// Add our javascript file
fp_add_js(fp_get_module_path("student_files") . "/js/student_files.js");
$form ["#attributes"] = array("enctype" => 'multipart/form-data'); // allow the form itself to submit files.
$form ["mark_top"] = array(
"value" => t("Use this form to upload files to any student, either based on the filename, or by specifying the student's
CWID below."),
);
$form ["student_method"] = array(
"type" => "radios",
"label" => t("Select how the recipient student will be selected:"),
"options" => array(
"filename" => t("Filename - The file(s) you upload must begin with the student's CWID, followed by a _ (underscore). For example:
<em>33312943_new_file.txt</em>"),
"manual" => t("Manual - Enter the student's CWID in the box below. This is the CWID which files will be saved under, regardless of filename."),
),
"value" => "filename",
"required" => TRUE,
);
$form ["manual_cwid"] = array(
"type" => "textfield",
"label" => t("Manual CWID:"),
"description" => t("Only enter a student's CWID if 'Manual' was selected above."),
);
$form ["access_type"] = array(
"type" => "radios",
"label" => "Who will be able to see / download the uploaded file(s)?",
"options" => array(
"faculty" => "Faculty - Only faculty or staff users",
"public" => "Any user with access to view the student's files, including the student themselves",
),
"value" => "faculty",
);
$max_upload = ini_get('upload_max_filesize');
$max_post = ini_get('post_max_size');
$form ["student_files"] = array(
"type" => "file",
"label" => "Select file(s):",
"multiple" => TRUE, // allow multiple file uploads
"description" => t("<b>Allowed files:</b> <em>%ext</em>
<br><br>
Note: In your php.ini file, these are the filesize limits in place for any upload here:
<ul>
<li>Upload max filesize: %max_up </li>
<li>POST max size: %max_post </li>
</ul>
If you have problems with uploading multiple files, adjust these values.", array("%max_up" => $max_upload, "%max_post" => $max_post,
"%ext" => strtolower(variable_get("student_files_allowed_extensions", "txt, pdf, doc, docx, csv, xls, xlsx, ppt, pptx, rtf, odt, jpg, jpeg, png, gif, zip, 7z")))),
);
$form ["submit_btn"] = array(
"type" => "submit",
"value" => "Submit",
);
return $form;
}