Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion assessment/libs/virtmanip.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function vmchipmodelgetcount($state) {
}

//vmsetupnumbertiles(stuans,qn,[part])
//Set up a number tiles manipulative
//Set up a number tiles manipulative with 100, 10 and 1 blocks
function vmsetupnumbertiles($state,$qn,$part=null) {
if ($part !== null) {$qn = 1000*($qn)+$part;} else {$qn--;}
$initbase = "[]";
Expand All @@ -150,6 +150,28 @@ function vmsetupnumbertiles($state,$qn,$part=null) {
return $out;
}

//vmsetupnumbertiles_ten_one(stuans,qn,[part])
//Set up a number tiles manipulative with 10 and 1 blocks
//This VM uses vmnumbertilesgetcount to get the user input, with the 100's always at zero
function vmsetupnumbertiles_ten_one($state,$qn,$part=null) {
if ($part !== null) {$qn = 1000*($qn)+$part;} else {$qn--;}
$initbase = "[]";
$initobj = "[]";
if ($state!="") {
list($initbasestr,$initobjstr,$cont) = explode('|',$state);
if ($initbasestr != '') {
$initbase = '[['.str_replace(';','],[',$initbasestr).']]';
$initbase = preg_replace('/\[([^\[\]]+?),/','["$1",',$initbase);
}
if ($initobjstr != '') {
$initobj = '[['.str_replace(';','],[',$initobjstr).']]';
$initobj = preg_replace('/\[([^\[\]]+?),/','["$1",',$initobj);
}
}
$out = '<iframe src="https://s3-us-west-2.amazonaws.com/oervm/numbertiles/numbertiles_ten_one.html?qn='.$qn.'&initbase='.$initbase.'&initobj='.$initobj.'" width="450" height="300" frameborder="0"></iframe>';
return $out;
}

//vmnumbertilesgetcount(stuans)
//return an array array(hundredcount,tencount,onecount) of the count of
//hundred blocks, ten blocks, and ones blocks in the drop area
Expand Down