Forum

I need to create Qti Item & test programmatically

I have an old plain item banking.

Is there any comprehensive documentation where i can read and learn how to create QTI items and test package programmatically ?

Here is my scenario

my item banking --> export as QTI Test Package 2.2 --> import to TAO.

Any help would be greatly appreciated.

Comments

  • Finally,

    I can make a simple Qti output using following snippets :

    <?php
    namespace openthinklabs\Playground\Qti\HelloWorld;
    
    error_reporting(E_ERROR);
    
    require_once __DIR__. '/../package-tao/taoQtiItem/includes/raw_start.php';
    require __DIR__ . '/../package-tao/vendor/autoload.php';
    include __DIR__ .'/../package-tao/config/generis.conf.php';
    
    use oat\taoQtiItem\model\qti\Item;
    use oat\taoQtiItem\model\qti\interaction\ChoiceInteraction;
    use oat\taoQtiItem\model\qti\ResponseDeclaration;
    
    
    $myItem = new Item();
    $myItem->setAttribute('title', 'My Coolest Item');
    $myItem->getBody()->edit('sth');
    
    $myInteraction = new ChoiceInteraction();
    $myInteraction->getPrompt()->edit('Prompt you');
    $myChoice1 = $myInteraction->createChoice(['fixed' => true], 'This is correct');
    $myChoice2 = $myInteraction->createChoice(['fixed' => true], 'This is not correct');
    
    $myItem->addInteraction($myInteraction, "Adding my interaction here {$myInteraction->getPlaceholder()}. And not there.");
    
    $myResponse = new ResponseDeclaration();
    $myItem->addResponse($myResponse);
    $myItem->addResponse($myResponse);
    
    echo $myItem->toXml()."\n";
    
  • That's cool. Great work!

Sign In or Register to comment.

We use cookies on our website to support technical features that enhance your user experience. Cookie Policy Privacy Policy

×