/**
  * deletes a record
  */
 public function del()
 {
     $dh = $GLOBALS['dh'];
     $question =& $this->_r;
     $nodo = new Node($this->test['id_nodo_riferimento']);
     if (!AMATestDataHandler::isError($nodo)) {
         $path = $nodo->findPathFN();
     }
     if (isset($_POST['delete'])) {
         if ($_POST['delete'] == 1) {
             if (AMATestDataHandler::isError($dh->test_deleteNodeTest($this->id))) {
                 $html = sprintf(translateFN('Errore durante la cancellazione della %s'), $this->what);
             } else {
                 $get_topic = isset($_GET['topic']) ? '&topic=' . $_GET['topic'] : '';
                 redirect(MODULES_TEST_HTTP . '/index.php?id_test=' . $question['id_nodo_radice'] . $get_topic);
             }
         } else {
             $get_topic = isset($_GET['topic']) ? '&topic=' . $_GET['topic'] : '';
             redirect(MODULES_TEST_HTTP . '/index.php?id_test=' . $question['id_nodo_radice'] . $get_topic);
         }
     } else {
         require_once MODULES_TEST_PATH . '/include/forms/deleteFormTest.inc.php';
         $titolo = $question['titolo'];
         if (empty($titolo)) {
             $titolo = $question['nome'];
         }
         $titolo = $this->what . ' "' . $titolo . '"';
         $message = sprintf(translateFN('Stai per cancellare la %s e tutti i dati contenuti. Continuare?'), $titolo);
         $form = new DeleteFormTest($message);
         $html = $form->getHtml();
     }
     return array('html' => $html, 'path' => $path);
 }
 /**
  * deletes a test / survey node
  *
  * @global db $dh
  *
  * @return array an array with 'html' and 'path' key
  */
 public function del()
 {
     $dh = $GLOBALS['dh'];
     $test =& $this->_r;
     $nodo = new Node($test['id_nodo_riferimento']);
     if (!AMATestDataHandler::isError($nodo)) {
         $path = $nodo->findPathFN();
     }
     if (isset($_POST['delete'])) {
         if ($_POST['delete'] == 1) {
             if ($this->mode == ADA_TYPE_SURVEY) {
                 $courseId = explode('_', $nodo->id);
                 $courseId = $courseId[0];
                 $res = $dh->test_removeCourseTest($courseId, $this->id);
             }
             if (AMATestDataHandler::isError($dh->test_deleteNodeTest($this->id))) {
                 $html = sprintf(translateFN('Errore durante la cancellazione del %s'), $this->what);
             } else {
                 redirect(HTTP_ROOT_DIR . '/browsing/view.php?id_node=' . $nodo->parent_id);
             }
         } else {
             redirect(MODULES_TEST_HTTP . '/index.php?id_test=' . $this->id);
         }
     } else {
         require_once MODULES_TEST_PATH . '/include/forms/deleteFormTest.inc.php';
         $titolo = $test['titolo'];
         if (empty($titolo)) {
             $titolo = $test['nome'];
         }
         $titolo = $this->what . ' "' . $titolo . '"';
         $message = sprintf(translateFN('Stai per cancellare il %s e tutti i dati contenuti. Continuare?'), $titolo);
         $form = new DeleteFormTest($message);
         $html = $form->getHtml();
     }
     return array('html' => $html, 'path' => $path);
 }