<?php $PollAnswerAttachments = PollAnswerAttachment::getPollAnswerAttachments($f_poll_nr, $f_pollanswer_nr); ?> <center> <TABLE width="95%" style="border: 1px solid #EEEEEE;"> <TR> <TD> <TABLE width="100%" bgcolor="#EEEEEE" cellpadding="3" cellspacing="0"> <TR> <TD align="left"> <STRONG><?php putGS("Files"); ?></STRONG> </TD> <?php if (($f_edit_mode == "edit") && $g_user->hasPermission('AddFile')) { ?> <TD align="right"> <IMG src="<?php p($Campsite["ADMIN_IMAGE_BASE_URL"]);?>/add.png" border="0"> <A href="javascript: void(0);" onclick="window.open('<?php echo camp_html_article_url($articleObj, $f_language_id, "files/popup.php"); ?>', 'attach_file', 'scrollbars=yes, resizable=yes, menubar=no, toolbar=no, width=500, height=400, top=200, left=100');"><?php putGS("Attach"); ?></A> </TD> <?php } ?> </TR> </TABLE> </TD> </TR> <?php foreach ($PollAnswerAttachments as $PollAnswerAttachment) { $file = $PollAnswerAttachment->getAttachment(); $fileEditUrl = "edit.php?f_publication_id=$f_publication_id&f_issue_number=$f_issue_number&f_section_number=$f_section_number&f_article_number=$f_article_number&f_attachment_id=".$file->getAttachmentId()."&f_language_id=$f_language_id&f_language_selected=$f_language_selected"; $deleteUrl = "do_del.php?f_poll_nr=$f_poll_nr&f_pollanswer_nr=$f_pollanswer_nr&f_fk_language_id=$f_fk_language_id&f_attachment_id=".$file->getAttachmentId().'&'.SecurityToken::URLParameter(); $downloadUrl = "/attachment/".basename($file->getStorageLocation())."?g_download=1"; if (strstr($file->getMimeType(), "image/") && (strstr($_SERVER['HTTP_ACCEPT'], $file->getMimeType()) || (strstr($_SERVER['HTTP_ACCEPT'], "*/*")))) {
/** * Delete record from database. * * @return boolean */ function delete() { // delete correspondending Attachment object if not used by other PollAnswers $PollAnswerAttachments = PollAnswerAttachment::getPollAnswerAttachments(null, null, $this->getProperty('fk_attachment_id')); if (count($PollAnswerAttachments) === 1) { $PollAnswerAttachment = current($PollAnswerAttachments); $PollAnswerAttachment->getAttachment()->delete(); } // Delete record from the database $deleted = parent::delete(); /* if ($deleted) { if (function_exists("camp_load_translation_strings")) { camp_load_translation_strings("api"); } $logtext = getGS('Article #$1: "$2" ($3) deleted.', $this->m_data['Number'], $this->m_data['Name'], $this->getLanguageName()) ." (".getGS("Publication")." ".$this->m_data['IdPublication'].", " ." ".getGS("Issue")." ".$this->m_data['NrIssue'].", " ." ".getGS("Section")." ".$this->m_data['NrSection'].")"; Log::Message($logtext, null, 32); } */ $CampCache = CampCache::singleton(); $CampCache->clear('user'); return $deleted; }
function getPollAnswerAttachments() { $PollAnswerAttachments = PollAnswerAttachment::getPollAnswerAttachments($this->getPollNumber(), $this->getNumber()); return $PollAnswerAttachments; }