function student_files_settings_form
Search API
7.x student_files.module | student_files_settings_form() |
6.x student_files.module | student_files_settings_form() |
File
- modules/
student_files/ student_files.module, line 598 - This is the student_files module, which will facilitate uploading (securely) files to be associated with student accounts.
Code
function student_files_settings_form() {
$form = array();
$files_path = $GLOBALS ["fp_system_settings"]["file_system_path"];
$form ["student_files_path"] = array(
"label" => t("Absolute system path to where student files are located/uploaded to:"),
"type" => "textfield",
"size" => 80,
"maxlength" => 1000,
"value" => variable_get("student_files_path", "$files_path/custom/files/student_files"),
"description" => t("This is a directory which must be writable by the webserver. When this module
was installed, %path was created automatically as the default location, but you
may set this to any path which already exists and is writable by the server.", array("%path" => "$files_path/custom/files/student_files")),
);
$form ["student_files_allowed_extensions"] = array(
"label" => t("Allowed file extensions (CSV):"),
"type" => "textfield",
"size" => 80,
"maxlength" => 1000,
"value" => strtolower(variable_get("student_files_allowed_extensions", "txt, pdf, doc, docx, csv, xls, xlsx, ppt, pptx, rtf, odt, jpg, jpeg, png, gif, zip, 7z")),
"description" => t("Enter the allowed file extensions, separated by commas (no periods!), that are allowed to be uploaded.<br>Ex:
<br><em> txt, pdf, doc, docx, csv, xls, xlsx, ppt, pptx, rtf, odt, jpg, jpeg, png, gif, zip, 7z</em>"),
);
$form ["student_files_sub_dir_pattern"] = array(
"type" => "textfield",
"label" => t("Sub directory pattern:"),
"value" => variable_get("student_files_sub_dir_pattern", "%year/%student_cwid"),
"description" => t("Enter the pattern of the sub directories for uploaded files.
<br> Ex: %year/%student_cwid would places files in /2006/12345 under the above
student files directory for a student with CWID 12345.
<br>Available replacement patterns:
<ul>
<li>%year - the year the file was uploaded.</li>
<li>%timestamp - the unix timstamp the file was uploaded.</li>
<li>%student_cwid - the CWID of the student the file belongs to.</li>
<li>%random - a random series of numbers and letters.</li>
</ul>
You may also enter static directory names like 'files' or 'uploads'. If unsure what to enter, leave blank."),
);
$form ["student_files_filename_pattern"] = array(
"type" => "textfield",
"label" => t("Saved server filename pattern:"),
"value" => variable_get("student_files_filename_pattern", "%student_cwid.%random.%ext"),
"description" => t("Enter the pattern for the stored files on the server.
<br> Ex: %student_cwid.%random.%ext might create a file named 12345.hgyK76.pdf under the above
student files directory for a student with CWID 12345.
If there are files with identical names being uploaded, the new file will automatically be given a random string
to ensure nothing is overwritten.
<br><b>Recommended:</b> It is recommended you do not use the original filename, especially if the files might contain
sensitive information. The use of the %random replacement pattern is recommended.
<br>Available replacement patterns:
<ul>
<li>%year - the year the file was uploaded.</li>
<li>%timestamp - the unix timstamp the file was uploaded.</li>
<li>%student_cwid - the CWID of the student the file belongs to.</li>
<li>%random - a random series of numbers and letters.</li>
<li>%original_filename - The original filename, including extension, of the uploaded file.</li>
<li>%ext - The original filename extension from the uploaded file.</li>
</ul>
You may also enter static directory names like 'files' or 'uploads'. If unsure what to enter, leave blank."),
);
if (module_enabled("encryption")) {
// The encryption module is installed. Let's add extra settings for it.
$form ["student_files_encryption"] = array(
"type" => "select",
"label" => "Encrypt uploaded files?",
"options" => array("yes" => t("Yes"), "no" => t("No")),
"value" => variable_get("student_files_encryption", "yes"),
"description" => t("Since you have installed the 'encryption' module, when files are uploaded to a student's History tab,
they can be automatically encrypted before being saved to the server. Do you wish
to do this? If so, the extension \".enc\" will be added to the end of encrypted files.
When files are downloaded through the Student Files module, they will be automatically decrypted
for the end user.
<br><br>
Note: this does not affect files attached in Engagements, like text messages or email file attachments. To configure
encryption of those files, see the Encryption settings page."),
"prefix" => "<fieldset><legend>" . t("Encryption Settings") . "</legend>",
"suffix" => "</fieldset>",
);
}
return $form;
}