<?php
if ($include_heading == "no") {
${'xml'.$test}=simplexml_load_file("inc_quarterly_tests/".$test_ref);// or die("Error: Cannot create object $ xml");
  // don't include heading in xml_load_clog.inc
  // test_ref used from clog
}

else {
// copy pasted from xml_load_quarterly_test_session.inc
/************* heading ***************/
echo "<div id=\"main\" class=\"main\" type=\"text/css\"> ";
echo "<div id=\"topic_area\" class=\"topic_area\" type=\"text/css\">";

$test_ref = "quarterly_test_rrwcgroup5_20230315.xml";
//$test_ref = "quarterly_test_leroyind133_20220317.xml";
//$test_ref = "quarterly_test_rrwcgroup5_20220316.xml";
//$test_ref = "quarterly_test_nlmkgroup04_20220317.xml";
//$test_ref = "quarterly_test_nlmkgroup06_20220315.xml";
//$test_ref = "quarterly_test_nlmkind01_20220315.xml";
//$test_ref = "quarterly_test_nlmkgroup01_20220315.xml";
//$test_ref = "quarterly_test_nlmkgroup02_20220314.xml";
//$test_ref = "quarterly_test_nlmkgroup03_20220314.xml";
//$test_ref = "quarterly_test_leroyind133_20211220.xml";
//$test_ref = "quarterly_test_leroyind138_20211216.xml";
//$test_ref = "quarterly_test_nlmkgroup06_20211214.xml";
//$test_ref = "quarterly_test_nlmkgroup04_20211216.xml";
//$test_ref = "quarterly_test_nlmkgroup03_20211214.xml";
//$test_ref = "quarterly_test_nlmkgroup02_20211213.xml";
//$test_ref = "quarterly_test_nlmkind01_20211216.xml";
//$test_ref = "quarterly_test_nlmkgroup01_20211216.xml";
//$test_ref = "quarterly_test_rrwcgroup5_20211207.xml";
//$test_ref = "quarterly_test_leroyind138_20210928.xml"; // todo XXXXXXXXXXXXXXXXX
//$test_ref = "quarterly_test_nlmkgroup01_20210930.xml";
//$test_ref = "quarterly_test_nlmkgroup04_20210930.xml";
//$test_ref = "quarterly_test_nlmkgroup06_20210928.xml";
//$test_ref = "quarterly_test_nlmkgroup03_20210928.xml";
//$test_ref = "quarterly_test_nlmkgroup02_20210927.xml";
//$test_ref = "quarterly_test_nlmkind01_20210927.xml";
//$test_ref = "quarterly_test_rrwcgroup5_20210928.xml";
//$test_ref = "quarterly_test_nlmkgroup01_20210617.xml"; // should be almost same as group 05 except task 1
//$test_ref = "quarterly_test_nlmkgroup05_20210615.xml";
//$test_ref = "quarterly_test_nlmkgroup04_20210615.xml";
//$test_ref = "quarterly_test_nlmkgroup03_20210615.xml";
//$test_ref = "quarterly_test_nlmkind01_20210610.xml";
//$test_ref = "quarterly_test_nlmkgroup02_20210621.xml";
//$test_ref = "quarterly_test_rrwcgroup5_20210615.xml";
//$test_ref = "quarterly_test_rrwlind05_20210316.xml";
//$test_ref = "quarterly_test_leroyind133_20210317.xml";
//$test_ref = "quarterly_test_rrwcgroup5_20210316.xml";
//$test_ref = "quarterly_test_kasperskyind185_20201008.xml"; 
//$test_ref = "quarterly_test_rrwcgroup5_20201007.xml";
//$test_ref = "quarterly_test_cherkizovogroup4_20201008.xml";
//$test_ref = "quarterly_test_kasperskyind185_20200618.xml"; 
//$test_ref = "quarterly_test_kasperskyind198_20200616.xml";
//$test_ref = "quarterly_test_rrwcgroup5_20200617.xml";
//$test_ref = "quarterly_test_cherkizovoind01_20200616.xml";
//$test_ref = "quarterly_test_rrwcgroup5_20200318.xml";
//$test_ref = "quarterly_test_vebind17_20200317.xml";
//$test_ref = "quarterly_test_vebind20_20200317.xml";
//$test_ref = "quarterly_test_cherkizovoind01_20200317.xml";
//$test_ref = "quarterly_test_cherkizovogroup4_20200317.xml";
//$test_ref = "exit_test_kasperskyind192_20191212.xml";
//$test_ref = "quarterly_test_yandexind15_20191210.xml";
//$test_ref = "quarterly_test_cherkizovogroup4_20191210.xml";
//$test_ref = "exit_test_kasperskyind211_20191118.xml";
//$test_ref = "quarterly_test_cherkizovogroup4_20190919.xml";
//$test_ref = "quarterly_test_rrwcgroup5_20190918.xml";
//$test_ref = "quarterly_test_yandexind15_20190917.xml";
//$test_ref = "quarterly_test_afigroup1_20190917.xml";
//$test_ref = "quarterly_test_cherkizovogroup4_20190620.xml";
//$test_ref = "quarterly_test_afigroup1_20190620.xml";
//$test_ref = "quarterly_test_rrwcgroup5_20190619.xml";
${'xml'.$test}=simplexml_load_file("inc_quarterly_tests/".$test_ref);// or die("Error: Cannot create object $ xml");

echo "<div width=\"40%;\" style=\"float: left;\">\n";
echo "<h1><img src=\"pix/icons8-quiz-100.png\" width=\"70em\" border=\"0\" alt=\"test name\">".${'xml'.$test}->sbook_test_name."</h1>\n";
echo "<div align=\"right\" style=\"font-size:70%; color: #cdcdcd;\">by D.Potter</div></div>\n";
echo "&nbsp;</div>\n";

echo "<div style=\"margin-left: 35%\" align=\"left\">\n";
echo "<h2>Company: ".${'xml'.$test}->sbook_test_company. "</h2><br />\n";
echo "<h3>Group: ".${'xml'.$test}->sbook_test_group. "</h3><br />\n";
echo "<h3>Target level: ".${'xml'.$test}->sbook_test_level. "</h3><br />\n";
echo "<h3>Test date: ".${'xml'.$test}->sbook_test_date. "</h3><br /><br />\n";
echo "<h3>Student name: ______________________________________________  </h3><br /><br />\n";
echo "<h3>Score: </h3><br />\n";
echo "</div>\n";
  /************* end heading *************/
}

echo "<div class=\"flex-container\">";

foreach (${'xml'.$test}->sbook_test_mcq as $sbook_test_mcq) {
echo "<div class=\"column_test\">";

$path_to_csv = trim($sbook_test_mcq->path_to_csv);
if (!empty($path_to_csv)) {
//echo "<ol class=\"zebra\">";
echo "<ol>";
$file = $path_to_csv;

//read first line
$first_line = file($file);
list($exercise_type, $exercise_name, $selection_number, $instructions) = explode(";", $first_line[0]);
//echo "<em>".$first_line[0]."</em><br />";
//echo "<img valign=\"bottom\" src=\"pix/icons8-drill-100.png\" width=\"35\" border=\"0\" alt=\"controlled practice\"> <h3>".$exercise_type."</h3> - ";
if ($sbook_test_mcq->exercise_nr[0] != null) {
echo "<h3><span class=\"sbook_exercise_no\">".$sbook_test_mcq->exercise_nr . "</span></h3> ";
}
echo "<h3>".$exercise_type."</h3> (".$selection_number.")";
echo "<h5>".$exercise_name."</h5><br />";
echo "<style=\"font-size:70%\"><em>".$instructions."</em></font><br /><br />";

//read first line, but do nothing with it
$handle = fopen($file, "r");
$line = fgets($handle);

//now read the rest of the file line by line
if ($handle) {
    while (($line = fgets($handle, 4096)) !== false) {
        // do something with $line here
list($question, $A1, $A2, $A3, $answer) = explode(";", $line);
echo "<li>".$question."<br />";
echo "<ol type=\"a\">";
$A1 = trim($A1);
if (!empty($A1)) {
  echo "<li>".$A1."</li>";
}
$A2 = trim($A2);
if (!empty($A2)) {
  echo "<li>".$A2."</li>";
}
$A3 = trim($A3);
if (!empty($A3)) {
  echo "<li>".$A3."</li>";
}
echo "</ol>";
echo "</li>";
echo "<div class=\"show_key3\">".$answer."</div>";
    }
    if (!feof($handle)) {
        echo "Error: unexpected fgets() fail\n";
    }
    fclose($handle);
}
echo "</ol>";
}

echo "</div><!-- class column test --> \n";
} // end foreach as mcq
//echo "</div> <!-- end flex-container -->\n";


foreach (${'xml'.$test}->sbook_test_match as $sbook_test_match) {
echo "<div class=\"column_test\">";

$path_to_csv_match = trim($sbook_test_match->path_to_csv);
if (!empty($path_to_csv_match)) {
//echo "<ol class=\"zebra\">";
$file_match = $path_to_csv_match;

//read first line
$first_line_match = file($file_match);
list($exercise_type, $exercise_name, $selection_number, $instructions) = explode(";", $first_line_match[0]);
if ($sbook_test_match->exercise_nr[0] != null) {
echo "<h3><span class=\"sbook_exercise_no\">".$sbook_test_match->exercise_nr . "</span></h3> ";
}
echo "<h3>".$exercise_type."</h3> (".$selection_number.")";
echo "<h5>".$exercise_name."</h5><br />";
echo "<style=\"font-size:70%\"><em>".$instructions."</em></font><br /><br />";
echo "<ol>\n";
//read first line, but do nothing with it
$handle_match = fopen($file_match, "r");
$line_match = fgets($handle_match);

//now read the rest of the file line by line
if ($handle_match) {
    while (($line_match = fgets($handle_match, 4096)) !== false) {
        // do something with $line here
//list($question, $A1, $A2, $A3, $answer) = explode(";", $line_match);
list($question, $answer) = explode(";", $line_match);
$word_to_scramble = $question;

include ("sbook_plugins/scramble_words.inc");

$search = $question;
$lines_to_number = str_replace("$search", '<span class="sbook_scrambled_word">'.$scrambled_word.'</span><!--<span class="show_key_sbook">'.$word_to_scramble.'</span>-->', $question);
$question = $lines_to_number;

echo "<div class=\"flex-container\">";
echo "<div class=\"column_test32\">";
echo "<li>".$question;
echo "<div class=\"show_key3\">".$word_to_scramble."<br /><br /><br /></div>";
echo "</div><!-- class column test --> \n";

echo "<div class=\"column_test\">\n";
echo "<span style=\"font-size: 90%\">".$answer."</span></li><br />";
echo "</div><!-- class column test --> \n";
echo "</div><!-- end flex --> \n";
    }
echo "</ol>\n";
echo "</div><!-- class column test --> \n";
}
if (!feof($handle_match)) {
        echo "Error: unexpected fgets() fail\n";
    }
    fclose($handle_match);
}
} // end foreach as match


foreach (${'xml'.$test}->sbook_test_match_jumbled_definitions as $sbook_test_match_jumbled_definitions) {
echo "<div class=\"column_test\">";

$path_to_csv_match = trim($sbook_test_match_jumbled_definitions->path_to_csv);
if (!empty($path_to_csv_match)) {
//echo "<ol class=\"zebra\">";
$file_match = $path_to_csv_match;

//read first line
$first_line_match = file($file_match);
list($exercise_type, $exercise_name, $selection_number, $instructions) = explode(";", $first_line_match[0]);
if ($sbook_test_match_jumbled_definitions->exercise_nr[0] != null) {
echo "<h3><span class=\"sbook_exercise_no\">".$sbook_test_match_jumbled_definitions->exercise_nr . "</span></h3> ";
}
echo "<h3>".$exercise_type."</h3> (".$selection_number.")";
echo "<h5>".$exercise_name."</h5><br />";
echo "<style=\"font-size:70%\"><em>".$instructions."</em></font><br /><br />";

echo "<ol>\n";
echo "<div class=\"flex-container\">";

$path_to_csv_match = trim($sbook_test_match_jumbled_definitions->path_to_csv);
if (!empty($path_to_csv_match)) {

// read all the lines in the file into an array with file( )
$lines_csv = file($path_to_csv_match);
// load file into an array
$lines_csv = array($lines_csv);

foreach ($lines_csv as $line_csv) {
  // remove 1st element from csv file, e.g. Instructions
  $line_csv = array_slice($line_csv, 1);
  // change order of lines
  shuffle($line_csv);
  foreach ($line_csv as $line) {
$line = preg_replace ('/;.*$/','', $line);
    echo "<span style=\"margin: 0.3em; border: solid 1px; padding: 0.5em\">".$line."</span>";
  }
}
  }
echo "</div><!-- end flex --> \n";
echo "</ol>\n";
} // if (!empty($path_to_csv_match))

if (!empty($path_to_csv_match)) {
//echo "<ol class=\"zebra\">";
echo "<ol>\n";
$file_match2 = $path_to_csv_match;
//read first line, but do nothing with it
$handle_match2 = fopen($file_match2, "r");
$line_match2 = fgets($handle_match2);

//now read the rest of the file line by line
if ($handle_match2) {
    while (($line_match2 = fgets($handle_match2, 4096)) !== false) {
        // do something with $line here
list($question, $answer) = explode(";", $line_match2);

echo "<div class=\"flex-container\">";
echo "<li><span style=\"font-size: 90%\">".$answer."</span><br />";
echo "<div class=\"show_key3\">".$question."<br /></div></li>";
echo "</div><!-- end flex --> \n";
    }
}
echo "</ol>\n";
echo "</div><!-- class column test --> \n";
if (!feof($handle_match2)) {
        echo "Error: unexpected fgets() fail 2\n";
    }
    fclose($handle_match2);
} // if (!empty($path_to_csv_match))
} // end foreach as match_jumbled_definitions


/****************** todo in feedback ****/
foreach (${'xml'.$test}->sbook_test_shuffled as $sbook_test_shuffled) {
echo "<div class=\"column_test\">";
// need to add '_match' from imported sbook_plugins/csv_load_deck_shuffled.inc 
// may have to add in box09 answer in csv file
// don't need to convert ^ to ;

$path_to_csv_match = trim($sbook_test_shuffled->path_to_csv);
if (!empty($path_to_csv_match)) {
//echo "<ol class=\"zebra\">";
$file_match = $path_to_csv_match;

//read first line
$first_line_match = file($file_match);
// imported from sbook_plugins/csv_load_deck_shuffled.inc
// need to add '_match' from imported sbook_plugins/csv_load_deck_shuffled.inc 
list($exercise_type, $exercise_name, $selection_number, $instructions,$background_image,$key_image) = explode("^", $first_line_match[0]); 
if ($sbook_test_shuffled->exercise_nr[0] != null) {
echo "<h3><span class=\"sbook_exercise_no\">".$sbook_test_shuffled->exercise_nr . "</span></h3> ";
}
echo "<h3>".$exercise_type."</h3> (".$selection_number.")";
echo "<h5>".$exercise_name."</h5><br />";
echo "<style=\"font-size:70%\"><em>".$instructions."</em></font><br /><br />";
echo "<ol>\n";
//read first line, but do nothing with it
$handle_match = fopen($file_match, "r");
$line_match = fgets($handle_match);

//now read the rest of the file line by line
if ($handle_match) {
    while (($line_match = fgets($handle_match, 4096)) !== false) {
      
//list($txt_id,$subject,$auxiliary_vb,$lexical_vb,$past_participle,$object,$preposition,$object2,$hint,$answer) = explode(";", $line);
// imported from sbook_plugins/csv_load_deck_shuffled.inc
list($txt_id,$subject,$auxiliary_vb,$lexical_vb,$past_participle,$object,$preposition,$object2,$hint,$answer) = explode("^", $line_match);

  if ((empty(trim($subject))) || (empty(trim($auxiliary_vb))) || (empty(trim($lexical_vb))) || (empty(trim($past_participle))) || (empty(trim($object))) || (empty(trim($preposition))) || (empty(trim($object2))) || (empty(trim($hint))) || (empty(trim($answer)))) {

$subject_wo_spaces = preg_replace('/^/m',"&nbsp;",$subject);
$subject = preg_replace('/^/m',"&nbsp;",$subject);
$auxiliary_vb_wo_spaces = preg_replace('/^/m',"&nbsp;",$auxiliary_vb);
$auxiliary_vb = preg_replace('/^/m',"&nbsp;",$auxiliary_vb);
$lexical_vb_wo_spaces = preg_replace('/^/m',"&nbsp;",$lexical_vb);
$lexical_vb = preg_replace('/^/m',"&nbsp;",$lexical_vb);
$past_participle_wo_spaces = preg_replace('/^/m',"&nbsp;",$past_participle);
$past_participle = preg_replace('/^/m',"&nbsp;",$past_participle);
$object_wo_spaces = preg_replace('/^/m',"&nbsp;",$object);
$object = preg_replace('/^/m',"&nbsp;",$object);
$preposition_wo_spaces = preg_replace('/^/m',"&nbsp;",$preposition);
$preposition = preg_replace('/^/m',"&nbsp;",$preposition);
$object2_wo_spaces = preg_replace('/^/m',"&nbsp;",$object2);
$object2 = preg_replace('/^/m',"&nbsp;",$object2);
$hint_wo_spaces = preg_replace('/^/m',"&nbsp;",$hint);
$hint = preg_replace('/^/m',"&nbsp;",$hint);
$answer_wo_spaces = preg_replace('/^/m',"&nbsp;",$answer);
$answer = preg_replace('/^/m',"&nbsp;",$answer);
  }

  if ((!empty(trim($subject))) || (!empty(trim($auxiliary_vb))) || (!empty(trim($lexical_vb))) || (!empty(trim($past_participle))) || (!empty(trim($object))) || (!empty(trim($preposition))) || (!empty(trim($object2))) || (!empty(trim($hint))) || (!empty(trim($answer)))) {

$subject_wo_spaces = preg_replace('/[^\da-z]/i',"_",$subject);
$auxiliary_vb_wo_spaces = preg_replace('/[^\da-z]/i',"_",$auxiliary_vb);
$lexical_vb_wo_spaces = preg_replace('/[^\da-z]/i',"_",$lexical_vb);
$past_participle_wo_spaces = preg_replace('/[^\da-z]/i',"_",$past_participle);
$object_wo_spaces = preg_replace('/[^\da-z]/i',"_",$object);
$preposition_wo_spaces = preg_replace('/[^\da-z]/i',"_",$preposition);
$object2_wo_spaces = preg_replace('/[^\da-z]/i',"_",$object2);
$hint_wo_spaces = preg_replace('/[^\da-z]/i',"_",$hint);
$answer_wo_spaces = preg_replace('/[^\da-z]/i',"_",$answer);

  }
echo "<div style=\"margin-left: 40%;\" class=\"show_key3\">".$answer."<br /></div>";

$box01 = "<div style=\"float: left; position: relative; width: 150%; margin-left: 0%; padding: 0.8em; font-size: 80%;\">";
$box01 = $box01. "<div id=\"div2mov_cards_box01_".$uniq_div_from_activity_title.$txt_id.$subject_wo_spaces."\">";
$box01 = $box01.  "<span contenteditable=\"true\">".$subject."</span>";
$box01 = $box01. "</div>";
$box01 = $box01. "</div>";

$box02 = "<div style=\"float: left; position: relative; width: 150%; margin-left: 0%; padding: 0.8em; font-size: 80%;\">";
$box02 = $box02. "<div id=\"div2mov_cards_box02_".$uniq_div_from_activity_title.$txt_id.$auxiliary_vb_wo_spaces."\">";
$box02 = $box02.  "<span contenteditable=\"true\">".$auxiliary_vb."</span>";
$box02 = $box02. "</div>";
$box02 = $box02. "</div>";

$box03 = "<div style=\"float: left; position: relative; width: 150%; margin-left: 0%; padding: 0.8em; font-size: 80%;\">";
$box03 = $box03. "<div id=\"div2mov_cards_box03_".$uniq_div_from_activity_title.$txt_id.$lexical_vb_wo_spaces."\">";
$box03 = $box03.  "<span contenteditable=\"true\">".$lexical_vb."</span>";
$box03 = $box03. "</div>";
$box03 = $box03. "</div>";

$box04 = "<div style=\"float: left; position: relative; width: 150%; margin-left: 0%; padding: 0.8em; font-size: 80%;\">";
$box04 = $box04. "<div id=\"div2mov_cards_box04_".$uniq_div_from_activity_title.$txt_id.$past_participle_wo_spaces."\">";
$box04 = $box04.  "<span contenteditable=\"true\">".$past_participle."</span>";
$box04 = $box04. "</div>";
$box04 = $box04. "</div>";

$box05 = "<div style=\"float: left; position: relative; width: 150%; margin-left: 0%; padding: 0.8em; font-size: 80%;\">";
$box05 = $box05. "<div id=\"div2mov_cards_box05_".$uniq_div_from_activity_title.$txt_id.$object_wo_spaces."\">";
$box05 = $box05.  "<span contenteditable=\"true\">".$object."</span>";
$box05 = $box05. "</div>";
$box05 = $box05. "</div>";

$box06 = "<div style=\"float: left; position: relative; width: 150%; margin-left: 0%; padding: 0.8em; font-size: 80%;\">";
$box06 = $box06. "<div id=\"div2mov_cards_box06_".$uniq_div_from_activity_title.$txt_id.$preposition_wo_spaces."\">";
$box06 = $box06.  "<span contenteditable=\"true\">".$preposition."</span>";
$box06 = $box06. "</div>";
$box06 = $box06. "</div>";

$box07 = "<div style=\"float: left; position: relative; width: 150%; margin-left: 0%; padding: 0.8em; font-size: 80%;\">";
$box07 = $box07. "<div id=\"div2mov_cards_box07_".$uniq_div_from_activity_title.$txt_id.$object2_wo_spaces."\">";
$box07 = $box07.  "<span contenteditable=\"true\">".$object2."</span>";
$box07 = $box07. "</div>";
$box07 = $box07. "</div>";

$box08 = "<div style=\"float: left; position: relative; width: 150%; margin-left: 0%; padding: 0.8em; font-size: 80%;\">";
$box08 = $box08. "<div id=\"div2mov_cards_box08_".$uniq_div_from_activity_title.$txt_id.$hint_wo_spaces."\">";
$box08 = $box08.  "<span contenteditable=\"true\">".$hint."</span>";
$box08 = $box08. "</div>";
$box08 = $box08. "</div>";

$box09 = "<div style=\"float: left; position: relative; width: 150%; margin-left: 0%; padding: 0.8em; font-size: 80%;\">";
$box09 = $box09. "<div id=\"div2mov_cards_box09_".$uniq_div_from_activity_title.$txt_id.$answer_wo_spaces."\">";
$box09 = $box09.  "<span contenteditable=\"true\">".$answer."</span>";
$box09 = $box09. "</div>";
$box09 = $box09. "</div>";

// important not to include answer!
//$shuffled_lines = (array($box01,$box02,$box03,$box04,$box05,$box06,$box07,$box08,$box09));
$shuffled_lines = (array($box01,$box02,$box03,$box04,$box05,$box06,$box07,$box08));
shuffle ($shuffled_lines);
foreach ($shuffled_lines as $shuffled_line) {
echo $shuffled_line;
}
echo "<div style=\"clear: both;\"></div>\n";

  if ((!empty(trim($subject))) || (!empty(trim($auxiliary_vb))) || (!empty(trim($lexical_vb))) || (!empty(trim($past_participle))) || (!empty(trim($object))) || (!empty(trim($preposition))) || (!empty(trim($object2))) || (!empty(trim($hint))) || (!empty(trim($answer)))) {

echo "<script>\n";
echo "dragElement(document.getElementById(('div2mov_cards_box01_".$uniq_div_from_activity_title.$txt_id.$subject_wo_spaces ."')));";
include ('js/div2mov_cards.js');
echo "</script>\n";

// touch individual items of subjects
echo "<style>\n";
echo "#div2mov_cards_box01_".$uniq_div_from_activity_title.$txt_id.$subject_wo_spaces." {\n";
echo "z-index: 9;\n";
echo "position: absolute;\n";
echo "display: inline;\n";
echo "text-align: center;\n";
echo "cursor: pointer;\n";
//echo "color: #efefef;\n";
echo "color: black;\n";
echo "font-size: 120%;\n";
echo "padding: 0.1em;\n";
echo "border: 1px dotted grey;\n";
echo "mini-width: 10%;\n";
echo "float: left;\n";
//echo "background-color: #dbd039;\n";
echo "background-color: #ccc;\n";
echo "box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);\n";
echo "}\n";
echo "</style>\n";

echo "<script>\n";
echo "dragElement(document.getElementById(('div2mov_cards_box02_".$uniq_div_from_activity_title.$txt_id.$auxiliary_vb_wo_spaces ."')));";
include ('js/div2mov_cards.js');
echo "</script>\n";

// touch individual items of auxiliary_vbs
echo "<style>\n";
echo "#div2mov_cards_box02_".$uniq_div_from_activity_title.$txt_id.$auxiliary_vb_wo_spaces." {\n";
echo "z-index: 9;\n";
echo "position: absolute;\n";
echo "display: inline;\n";
echo "text-align: center;\n";
echo "cursor: pointer;\n";
//echo "color: #efefef;\n";
echo "color: black;\n";
echo "font-size: 120%;\n";
echo "padding: 0.1em;\n";
echo "border: 1px dotted grey;\n";
echo "mini-width: 10%;\n";
echo "float: left;\n";
//echo "background-color: #67e328;\n";
//echo "background-color: lime;\n";
//echo "background-color: #94fc07;\n";
echo "background-color: #ccc;\n";
echo "box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);\n";
echo "}\n";
echo "</style>\n";


echo "<script>\n";
echo "dragElement(document.getElementById(('div2mov_cards_box03_".$uniq_div_from_activity_title.$txt_id.$lexical_vb_wo_spaces ."')));";
include ('js/div2mov_cards.js');
echo "</script>\n";

// touch individual items of lexical_vbs
echo "<style>\n";
echo "#div2mov_cards_box03_".$uniq_div_from_activity_title.$txt_id.$lexical_vb_wo_spaces." {\n";
echo "z-index: 9;\n";
echo "position: absolute;\n";
echo "display: inline;\n";
echo "text-align: center;\n";
echo "cursor: pointer;\n";
//echo "color: #efefef;\n";
echo "color: black;\n";
echo "font-size: 120%;\n";
echo "padding: 0.1em;\n";
echo "border: 1px dotted grey;\n";
echo "mini-width: 10%;\n";
echo "float: left;\n";
//echo "background-color: #4bb217;\n";
echo "background-color: #ccc;\n";
echo "box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);\n";
echo "}\n";
echo "</style>\n";


echo "<script>\n";
echo "dragElement(document.getElementById(('div2mov_cards_box04_".$uniq_div_from_activity_title.$txt_id.$past_participle_wo_spaces ."')));";
include ('js/div2mov_cards.js');
echo "</script>\n";

// touch individual items of past_participles
echo "<style>\n";
echo "#div2mov_cards_box04_".$uniq_div_from_activity_title.$txt_id.$past_participle_wo_spaces." {\n";
echo "z-index: 9;\n";
echo "position: absolute;\n";
echo "display: inline;\n";
echo "text-align: center;\n";
echo "cursor: pointer;\n";
//echo "color: #efefef;\n";
echo "color: black;\n";
echo "font-size: 120%;\n";
echo "padding: 0.1em;\n";
echo "border: 1px dotted grey;\n";
echo "mini-width: 10%;\n";
echo "float: left;\n";
//echo "background-color: #0c8f23;\n";
echo "background-color: #ccc;\n";
echo "box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);\n";
echo "}\n";
echo "</style>\n";


echo "<script>\n";
echo "dragElement(document.getElementById(('div2mov_cards_box05_".$uniq_div_from_activity_title.$txt_id.$object_wo_spaces ."')));";
include ('js/div2mov_cards.js');
echo "</script>\n";

// touch individual items of objects
echo "<style>\n";
echo "#div2mov_cards_box05_".$uniq_div_from_activity_title.$txt_id.$object_wo_spaces." {\n";
echo "z-index: 9;\n";
echo "position: absolute;\n";
echo "display: inline;\n";
echo "text-align: center;\n";
echo "cursor: pointer;\n";
//echo "color: #efefef;\n";
echo "color: black;\n";
echo "font-size: 120%;\n";
echo "padding: 0.1em;\n";
echo "border: 1px dotted grey;\n";
echo "mini-width: 10%;\n";
echo "float: left;\n";
//echo "background-color: #4e55b6;\n";
echo "background-color: #ccc;\n";
echo "box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);\n";
echo "}\n";
echo "</style>\n";


echo "<script>\n";
echo "dragElement(document.getElementById(('div2mov_cards_box06_".$uniq_div_from_activity_title.$txt_id.$preposition_wo_spaces ."')));";
include ('js/div2mov_cards.js');
echo "</script>\n";

// touch individual items of prepositions
echo "<style>\n";
echo "#div2mov_cards_box06_".$uniq_div_from_activity_title.$txt_id.$preposition_wo_spaces." {\n";
echo "z-index: 9;\n";
echo "position: absolute;\n";
echo "display: inline;\n";
echo "text-align: center;\n";
echo "cursor: pointer;\n";
//echo "color: #efefef;\n";
echo "color: black;\n";
echo "font-size: 120%;\n";
echo "padding: 0.1em;\n";
echo "border: 1px dotted grey;\n";
echo "mini-width: 10%;\n";
echo "float: left;\n";
//echo "background-color: #b6ac4e;\n";
echo "background-color: #ccc;\n";
echo "box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);\n";
echo "}\n";
echo "</style>\n";


echo "<script>\n";
echo "dragElement(document.getElementById(('div2mov_cards_box07_".$uniq_div_from_activity_title.$txt_id.$object2_wo_spaces ."')));";
include ('js/div2mov_cards.js');
echo "</script>\n";

// touch individual items of object2s
echo "<style>\n";
echo "#div2mov_cards_box07_".$uniq_div_from_activity_title.$txt_id.$object2_wo_spaces." {\n";
echo "z-index: 9;\n";
echo "position: absolute;\n";
echo "display: inline;\n";
echo "text-align: center;\n";
echo "cursor: pointer;\n";
//echo "color: #efefef;\n";
echo "color: black;\n";
echo "font-size: 120%;\n";
echo "padding: 0.1em;\n";
echo "border: 1px dotted grey;\n";
echo "mini-width: 10%;\n";
echo "float: left;\n";
//echo "background-color: #6f4eb6;\n";
echo "background-color: #ccc;\n";
echo "box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);\n";
echo "}\n";
echo "</style>\n";


echo "<script>\n";
echo "dragElement(document.getElementById(('div2mov_cards_box08_".$uniq_div_from_activity_title.$txt_id.$hint_wo_spaces ."')));";
include ('js/div2mov_cards.js');
echo "</script>\n";

echo "<style>\n";
echo "#div2mov_cards_box08_".$uniq_div_from_activity_title.$txt_id.$hint_wo_spaces." {\n";
echo "z-index: 9;\n";
echo "position: absolute;\n";
echo "display: inline;\n";
echo "text-align: center;\n";
echo "cursor: pointer;\n";
//echo "color: #efefef;\n";
echo "color: black;\n";
echo "font-size: 120%;\n";
echo "padding: 0.1em;\n";
echo "border: 1px dotted grey;\n";
echo "mini-width: 10%;\n";
echo "float: left;\n";
//echo "background-color: Chocolate;\n";
echo "background-color: #ccc;\n";
echo "box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);\n";
echo "}\n";
echo "</style>\n";


echo "<script>\n";
echo "dragElement(document.getElementById(('div2mov_cards_box09_".$uniq_div_from_activity_title.$txt_id.$answer_wo_spaces ."')));";
include ('js/div2mov_cards.js');
echo "</script>\n";

echo "<style>\n";
echo "#div2mov_cards_box09_".$uniq_div_from_activity_title.$txt_id.$answer_wo_spaces." {\n";
echo "z-index: 9;\n";
echo "position: absolute;\n";
echo "display: inline;\n";
echo "text-align: center;\n";
echo "cursor: pointer;\n";
//echo "color: #efefef;\n";
echo "color: black;\n";
echo "font-size: 120%;\n";
echo "padding: 0.1em;\n";
echo "border: 1px dotted grey;\n";
echo "mini-width: 10%;\n";
echo "float: left;\n";
//echo "background-color: LightSalmon;\n";
echo "background-color: #ccc;\n";
echo "box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);\n";
echo "}\n";
echo "</style>\n";
  } // if (!empty(trim($object2)))

//echo "<div style=\"float: left;\">\n";
//echo "&nbsp;<br /><br />";
//echo "</div>\n";

} //while (($line = fgets($handle, 4096)) !== false)

//echo "</div> <!-- end flex-container 2 -->\n";
    //if (!feof($handle))
    if (!feof($handle_match)) {
        echo "Error: unexpected fgets() fail\n";
    }
    //fclose($handle);
    fclose($handle_match);
} //if ($handle_match)
//echo "</div>"; // "<div style=\"background: url(".$background_image.") no-repeat right; background-size: contain;\">\n";

} // if (!empty($path_to_csv_match))

echo "</div><!-- class column test --> \n";

} // end foreach as match


foreach (${'xml'.$test}->sbook_test_lis as $sbook_test_lis) {
echo "<div class=\"column_test\">";
  
if ($sbook_test_lis->exercise_nr[0] != null) {
echo "<h3><span class=\"sbook_exercise_no\">".$sbook_test_lis->exercise_nr . "</span></h3> ";
}
$exercise_name = trim($sbook_test_lis->exercise_name);
if (!empty($exercise_name)) {
echo "<h3>".$sbook_test_lis->exercise_name."</h3><br />\n";
}
$instructions = trim($sbook_test_lis->instructions);
if (!empty($instructions)) {
echo "    <em>".$sbook_test_lis->instructions ."</em>\n";
}

$topics_for_lis = trim($sbook_test_lis->topics_for_lis);
if (!empty($topics_for_lis)) {
$topics_to_recycle = $topics_for_lis;
/*
$topics_to_recycle = preg_replace ('/^/m', '<li>', $topics_to_recycle);
$topics_to_recycle = preg_replace ('/$/m', '</li>', $topics_to_recycle);

echo "<ol class=\"zebra\"><ol type=\"a\">";
echo $topics_to_recycle;
echo "</ol></ol>";
 */
echo "<pre>".$topics_to_recycle."</pre>";
}

$key = trim($sbook_test_lis->key);
if (!empty($key)) {
//echo "<div class=\"show_key3\">".$key."</div>";
echo "<div class=\"show_key3\"><pre>".$key."</pre></div>";
}

echo "</div> <!-- end flex-container -->\n";
} // end foreach as lis



foreach (${'xml'.$test}->sbook_test_wri as $sbook_test_wri) {
echo "<div class=\"column_test\">";
  
if ($sbook_test_wri->exercise_nr[0] != null) {
echo "<h3><span class=\"sbook_exercise_no\">".$sbook_test_wri->exercise_nr . "</span></h3> ";
}
$exercise_name = trim($sbook_test_wri->exercise_name);
if (!empty($exercise_name)) {
echo "<h3>".$sbook_test_wri->exercise_name."</h3><br />\n";
}
$instructions = trim($sbook_test_wri->instructions);
if (!empty($instructions)) {
echo "    <em>".$sbook_test_wri->instructions ."</em>\n";
}

$topics_for_wri = trim($sbook_test_wri->topics_for_wri);
if (!empty($topics_for_wri)) {
$topics_to_recycle = $topics_for_wri;
$topics_to_recycle = preg_replace ('/^/m', '<li>', $topics_to_recycle);
$topics_to_recycle = preg_replace ('/$/m', '</li><br />', $topics_to_recycle);

echo "<ol class=\"zebra\" type=\"a\">";
echo $topics_to_recycle;
echo "</ol>";
}
$key = trim($sbook_test_wri->key);
if (!empty($key)) {
echo "<div class=\"show_key3_to_print_for_feedback\">".$key."</div>";
}

echo "</div> <!-- end flex-container -->\n";
} // end foreach as wri


foreach (${'xml'.$test}->sbook_test_rea_wri as $sbook_test_rea_wri) {
echo "<div class=\"column_test\">";
  
if ($sbook_test_rea_wri->exercise_nr[0] != null) {
echo "<h3><span class=\"sbook_exercise_no\">".$sbook_test_rea_wri->exercise_nr . "</span></h3> ";
}
$exercise_name = trim($sbook_test_rea_wri->exercise_name);
if (!empty($exercise_name)) {
echo "<h3>".$sbook_test_rea_wri->exercise_name."</h3><br />\n";
}
$instructions = trim($sbook_test_rea_wri->instructions);
if (!empty($instructions)) {
echo "    <em>".$sbook_test_rea_wri->instructions ."</em>\n";
}

$topics_for_wri = trim($sbook_test_rea_wri->topics_for_wri);
if (!empty($topics_for_wri)) {
$topics_to_recycle = $topics_for_wri;
//$topics_to_recycle = preg_replace ('/^/m', '<li>', $topics_to_recycle);
//$topics_to_recycle = preg_replace ('/$/m', '</li>', $topics_to_recycle);

echo "<pre style=\"white-space: pre-wrap; font-size : 1em;font-family : 'Tahoma, Helvetica, Verdana, Arial, sans-serif';\">";
echo $topics_to_recycle;
echo "</pre>";
}
$key = trim($sbook_test_rea_wri->key);
if (!empty($key)) {
echo "<div class=\"show_key3_to_print_for_feedback\">".$key."</div>";
}
echo "</div> <!-- end flex-container -->\n";
} // end foreach as rea_wri

echo "</div> <!-- end flex-container -->\n";
?>
