本文整理匯總了PHP中zip_packer::extract_to_storage方法的典型用法代碼示例。如果您正苦於以下問題:PHP zip_packer::extract_to_storage方法的具體用法?PHP zip_packer::extract_to_storage怎麽用?PHP zip_packer::extract_to_storage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zip_packer
的用法示例。
在下文中一共展示了zip_packer::extract_to_storage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: foreach
} else {
if ($fromform = $uploadform->get_data()) {
//Process the form data so long as it's validated
$uploadedfile = $uploadform->get_file_content('response_zip');
require_once $CFG->dirroot . '/mod/assignment/lib.php';
require_once $CFG->dirroot . '/mod/assignment/type/' . $assignment->assignmenttype . '/assignment.class.php';
$assignmentclass = 'assignment_' . $assignment->assignmenttype;
$assignmentinstance = new $assignmentclass($cm->id, $assignment, $cm, $course);
$zipfile = $uploadform->save_temp_file('response_zip');
// Unzip uploaded file to the appropriate storage area
require_once $CFG->dirroot . '/lib/filestorage/zip_packer.php';
$ziplib = new zip_packer();
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
print "Course ID: {$id}<br>\n";
print "Context ID: {$context->id}<br>\n";
$response_files = $ziplib->extract_to_storage($zipfile, $context->id, 'mod_assignment', 'response', 0, 'feedback');
// Associate the response files with their appropriate submissions...
$fs = get_file_storage();
$users = get_enrolled_users($context);
$groups = groups_get_all_groups($COURSE->id);
foreach ($response_files as $file => $value) {
preg_match('/(.*?)_(.*)_\\d*(\\..*)/', $file, $matches);
$username = $matches[1];
$filename = $matches[2];
$fileextension = $matches[3];
$userID = '';
$groupID = '';
$submission = '';
print "Processing :{$filename}{$fileextension}<br>\n";
if (!$assignmentinstance->assignment->groupassignment) {
print "This is not a group assignment<br>\n";