* test_course_survey.id_test and test_nodes.id_nodo !!! */ // get tests $testsArr = $dh_test->test_getNodes(array('id_corso' => $course_id, 'id_nodo_parent' => null, 'id_nodo_radice' => null, 'id_nodo_riferimento' => $exportHelper->exportedNONTestNodeArray, 'id_istanza' => 0)); if (!empty($testsArr) && !AMA_DB::isError($testsArr)) { // $XMLAllTests =& $domtree->createElement('tests'); $exportHelper->testNodeXMLElement = $domtree->createElement('tests'); foreach ($testsArr as &$testElement) { // if this node is in the array of root nodes that MUST // be exported, I can safely remove it from the array itself. $array_key = array_search($testElement['id_nodo'], $surveyRootNodes); if ($array_key !== false) { unset($surveyRootNodes[$array_key]); } // export the node and all of its kids recursively $exportHelper->exportTestNodeChildren($course_id, $testElement['id_nodo'], $domtree, $dh_test); // $XMLAllTests); } } // end get tests // if there is still some value in the root nodes that MUST // be exported, do it NOW! if (!empty($surveyRootNodes)) { if (!isset($XMLAllTests)) { $XMLAllTests = $domtree->createElement('tests'); } if (!isset($exportHelper->testNodeXMLElement) || is_null($exportHelper->testNodeXMLElement)) { $exportHelper->testNodeXMLElement = $domtree->createElement('tests'); } foreach ($surveyRootNodes as &$rootNode) { // export the node and all of its kids recursively