/**
  * builds drag'n'drop exercise html
  *
  * @param CBase $html CBase element reference
  * @param string $preparedText cloze prepared text
  * @param boolean $showAnswers call showAnswers javascript function on elements' click
  *
  * @return CBase reference
  * @see getPreparedText
  */
 public function buildDragDropElements(CBase $html, $preparedText, $showAnswers = false, $edit = false)
 {
     $text = CDOMElement::create('div');
     $text->addChild(new CText($preparedText));
     $box = $this->createTable($edit);
     //switch per gestire la stampa del box delle risposte
     $boxClass = 'multipleClozeDiv ';
     $textClass = 'textDragDrop';
     switch ($this->boxPosition) {
         case ADA_TOP_TEST_DRAGDROP:
             $html->addChild($box);
             $html->addChild($text);
             $boxClass .= 'top';
             break;
         case ADA_RIGHT_TEST_DRAGDROP:
             $html->addChild($box);
             $html->addChild($text);
             $boxClass .= 'right';
             $textClass .= 'Left';
             break;
         case ADA_BOTTOM_TEST_DRAGDROP:
             $html->addChild($text);
             $html->addChild($box);
             $boxClass .= 'bottom';
             break;
         case ADA_LEFT_TEST_DRAGDROP:
             $html->addChild($box);
             $html->addChild($text);
             $boxClass .= 'left';
             $textClass .= 'Right';
             break;
     }
     $divclear = CDOMElement::create('div', 'class:clear');
     $html->addChild($divclear);
     $box->setAttribute('class', $boxClass);
     $text->setAttribute('class', $textClass);
     return $html;
 }
 /**
  * builds drag'n'drop exercise html
  *
  * @param CBase $html CBase element reference
  * @param string $preparedText cloze prepared text
  * @param boolean $showAnswers call showAnswers javascript function on elements' click
  *
  * @return CBase reference
  * @see getPreparedText
  */
 public function buildDragDropElements(CBase $html, $preparedText, $showAnswers = false)
 {
     $ulBox = CDOMElement::create('ul');
     $ulBox->setAttribute('id', 'ulBox' . $this->id_nodo);
     $ulBox->setAttribute('class', 'dragdropBox sortable drop' . $this->id_nodo);
     $box = CDOMElement::create('div');
     if (!empty($this->titolo_dragdrop)) {
         $span = CDOMElement::create('span', 'class:title_dragdrop');
         $span->addChild(new CText($this->titolo_dragdrop));
         $box->addChild($span);
     }
     $box->addChild($ulBox);
     $children = $this->_children;
     if (!empty($children)) {
         shuffle($children);
         foreach ($children as $c) {
             $item = CDOMElement::create('li');
             $item->setAttribute('class', 'draggable drag' . $this->id_nodo);
             $item->setAttribute('id', 'answer' . $c->id_nodo);
             if ($showAnswers) {
                 $item->setAttribute('onclick', "showAnswers('ordine" . $c->ordine . "');");
             }
             $item->addChild(new CText($c->testo));
             $ulBox->addChild($item);
         }
     }
     $text = CDOMElement::create('div');
     $text->addChild(new CText($preparedText));
     //switch per gestire la stampa del box delle risposte
     $boxClass = 'divDragDropBox ';
     $textClass = 'textDragDrop';
     switch ($this->boxPosition) {
         case ADA_TOP_TEST_DRAGDROP:
             $html->addChild($box);
             $html->addChild($text);
             $boxClass .= 'top';
             break;
         case ADA_RIGHT_TEST_DRAGDROP:
             $html->addChild($box);
             $html->addChild($text);
             $boxClass .= 'right';
             $textClass .= 'Left';
             break;
         case ADA_BOTTOM_TEST_DRAGDROP:
             $html->addChild($text);
             $html->addChild($box);
             $boxClass .= 'bottom';
             break;
         case ADA_LEFT_TEST_DRAGDROP:
             $html->addChild($box);
             $html->addChild($text);
             $boxClass .= 'left';
             $textClass .= 'Right';
             break;
     }
     $divclear = CDOMElement::create('div', 'class:clear');
     $html->addChild($divclear);
     $box->setAttribute('class', $boxClass);
     $text->setAttribute('class', $textClass);
     return $html;
 }