/** * Create a copy of an answer set. * * @param int $p_fk_poll_nr * @param int $p_parent_nr * @param array $p_answers * @return Article */ function CreateCopySet($p_poll_nr, $p_language_id, $p_parent_nr) { $ParentPoll = new Poll($p_language_id, $p_parent_nr); $parentAnswers = $ParentPoll->getAnswers(); foreach ($parentAnswers as $ParentPollAnswer) { $TargetPollAnswer = new PollAnswer($p_language_id, $p_poll_nr, $ParentPollAnswer->getNumber()); if ($TargetPollAnswer->exists()) { $parentPollAnswerAttachments = $ParentPollAnswer->getPollAnswerAttachments(); foreach ($parentPollAnswerAttachments as $ParentPollAnswerAttachment) { $TargetPollAnswerAttachment = new PollAnswerAttachment($p_poll_nr, $ParentPollAnswerAttachment->getProperty('fk_pollanswer_nr'), $ParentPollAnswerAttachment->getProperty('fk_attachment_id')); $TargetPollAnswerAttachment->create(); } } } }
$attributes['fk_description_id'] = $description->getPhraseId(); $attributes['fk_user_id'] = $g_user->getUserId(); if ($f_language_specific == "yes") { $attributes['fk_language_id'] = $f_language_id; } if ($f_content_disposition == "attachment") { $attributes['content_disposition'] = "attachment"; } if (!empty($_FILES['f_file'])) { $file = Attachment::OnFileUpload($_FILES['f_file'], $attributes); } else { camp_html_goto_page(camp_html_article_url($articleObj, $f_language_id, 'files/popup.php')); } // Check if image was added successfully if (PEAR::isError($file)) { camp_html_add_msg($file->getMessage()); camp_html_goto_page($BackLink); } $PollAnswerAttachment = new PollAnswerAttachment($f_poll_nr, $f_pollanswer_nr, $file->getAttachmentId()); $PollAnswerAttachment->create(); // Go back to upload screen. camp_html_add_msg(getGS("File '$1' added.", $file->getFileName()), "ok"); ?> <script> location.href="popup.php?f_poll_nr=<?php p($f_poll_nr) ?>&f_pollanswer_nr=<?php p($f_pollanswer_nr) ?>&f_fk_language_id=<?php p($f_fk_language_id) ?>"; </script>