plugin->test_constructor_gatekeeper(); $ids = get_input('test'); if (!is_array($ids) && $ids != "") $ids = array($ids); $forward_to = "tests/view"; $input_values = get_inputs(); $_SESSION['input_values'] = $input_values; if (get_input('delete_button', false)) { if (!is_array($ids)) { $TeKe->add_system_message(_("Delete failed"), 'error'); forward($forward_to); } else { $delete_failed = false; foreach ($ids as $id) { if (!$TeKe->plugin->deleteType("test", $id)) { $delete_failed = true; } } if ($delete_failed) { $TeKe->add_system_message(_("At least one of the deletions failed."), 'error'); forward($forward_to); } } $TeKe->add_system_message(_("Deleted")); } else if (get_input('copy', false) && $ids) { if ($parent == "Library") { $forward_to = "library/view"; } $TeKe->to_clipboard($ids); $TeKe->add_system_message(_("Copy")); } else if (get_input('paste', false)) { $cb_ids = $TeKe->from_clipboard(); if (empty($parent) && empty($ids)) { $TeKe->add_system_message(_("Paste failed"), 'error'); forward(""); } else { $paste_failed = false; $psyhvel = new Psyhvel(); if ($parent == "TestFolder") { foreach ($cb_ids as $id) { $type = $psyhvel->loadType("", $id); if (!$type) { $paste_failed = true; } else { if (in_array($type->getType(), array("ChoiceTask", "TMTTask", "Questionnaire", "TextStimulus", "KSTask", "MultiPictureStimulus", "ChoiceObject", "PictureStimulus", "SoundTask", "SoundStimulus", "SoundTesting", "HedgehogTest", "FlowerTest", "DragTest", "WordStimulus"))) { $type->setFolder($parent_id); if (!$type->copy()) $paste_failed = true; } else { $paste_failed = true; } } } if ($paste_failed) { $TeKe->add_system_message(_("At least one of the copied items could not be created."), 'error'); forward($forward_to); } } else if ($parent == "Library") { $forward_to = "library/view"; foreach ($cb_ids as $id) { $type = $psyhvel->loadType("TestFolder", $id); if (!$type) { $paste_failed = true; } else { if (!$type->copy()) $paste_failed = true; } } if ($paste_failed) { $TeKe->add_system_message(_("At least one of the copied items could not be created."), 'error'); forward($forward_to); } } } $TeKe->clear_clipboard(); $TeKe->add_system_message(_("Paste")); } else { $TeKe->add_system_message(_("No action")); } forward($forward_to); ?>