当前位置: 首页>>代码示例>>PHP>>正文


PHP zip_packer::extract_to_storage方法代码示例

本文整理汇总了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";
开发者ID:royalroads,项目名称:RRU-Moodle,代码行数:31,代码来源:responsezip.php


注:本文中的zip_packer::extract_to_storage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。