/** * Returns a series of attachment links for the given question * * @param QuestionModel question attachments are for * @param string (optional) mode that we are rendering in * @return string */ public function attachments(QuestionModel $question, $mode = 'edit') { $output = ''; foreach ($question->getAttachments() as $id => $properties) { $attachment = array('filename' => $properties['filename'], 'elementName' => "q{$question->questionID}_file{$id}_delete", 'url' => $this->view->url(array('controller' => 'page', 'action' => 'download', 'id' => $question->questionID)) . "?fileID={$id}"); $output .= $this->view->renderPartial('attachment', $attachment, false, false, array('mode' => $mode)); } return $output; }