定制 dlnsk/uqfi 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dlnsk/uqfi

最新稳定版本:v0.1.6

Composer 安装命令:

composer require dlnsk/uqfi

包简介

Universal question format importer

README 文档

README

Overview

Universal question format importer is a wrapper to native Moodle's question engine. It uses code of Moodle format imports as is. Some classes and libraries are replaced by stub.

It supports next question's bank formats:

  1. GIFT
  2. AIKEN
  3. MissingWord
  4. MoodleXML
  5. BlackBoard 6

Installation

Simply add a dependency on dlnsk/uqfi to your project's composer.json file if you use Composer to manage the dependencies of your project. Use following command to add the package to your project's dependencies:

composer require dlnsk/uqfi

Usage

// Autoload the dependencies
require 'vendor/autoload.php';

// Initialize library
\Dlnsk\UQFI\Importer::init();

// Use
$format = Dlnsk\UQFI\Importer::getFormat('gift', $file_path);
$questions = $format->readQuestions(); // or
$decorated = $format->readDecoratedQuestions(); // to get questions with much nicer structure

Laravel

If you're going to use this package in Laravel, you don't need to load dependencies and initialise. Just use.

Methods

init()

Importer::init();

Some simple steps to fool Moodle native library.

getFormat()

$format = Importer::getFormat($format, $file_path);

Creates a formatter class for given format and file. The format parameter can be one of "gift", "aiken", "missingword", "moodlexml" or "blackboard6". Keep in mind that "blackboard6" format require zip file as source of a questions bank.

You also can directly create a necessary class:

$format = new Gift($file_path);

readQuestions()

$questions = $format->readQuestions();

Returns the set of question objects with native Moodle structure. This structure maybe good to save questions into Moodle database, but not quite well to use.

readDecoratedQuestions()

$questions = $format->readDecoratedQuestions();

Returns a set of question objects with a slightly fixed structure. We move some dependent fields into parent elements, transform files' data, and so on. The structure of a decorated question is quite close to MoodleXML file.

See BaseFormat class for some helpful methods.

Question types

Currently, the package supports next question types:

  1. calculated / calculatedsimple
  2. essay
  3. matching / match / ddmatch
  4. multichoice
  5. numerical
  6. ordering
  7. shortanswer

Third party question types

To add support for any other type:

  1. Copy third party question type sources to qtypes directory of the package.
  2. Suppress any errors.
  3. Make pull request.

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2025-12-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固