diff --git a/code/formfields/SubmittedFormReportField.php b/code/formfields/SubmittedFormReportField.php index 1a41800..8686be4 100755 --- a/code/formfields/SubmittedFormReportField.php +++ b/code/formfields/SubmittedFormReportField.php @@ -27,11 +27,12 @@ class SubmittedFormReportField extends FormField { foreach($query as $r) { $totalCount = $r['CountRows']; } - + $list = new PaginatedList($submissions); $list->setCurrentPage($page); $list->setPageLength(10); $list->setTotalItems($totalCount); + return $list; } @@ -45,6 +46,18 @@ class SubmittedFormReportField extends FormField { )))->renderWith(array('SubmittedFormReportField')); } + public function getExportLink() { + return $this->Link('export?id=' . $this->RecordID()); + } + + public function getDeleteSubmissionsLink() { + return $this->Link('deletesubmissions?id=' . $this->RecordID()); + } + + public function LinkContainsParameter() { + return strpos($this->Link(), '?') !== FALSE; + } + /** * ID of this forms record * diff --git a/code/model/submissions/SubmittedForm.php b/code/model/submissions/SubmittedForm.php index daab6f4..a387d47 100755 --- a/code/model/submissions/SubmittedForm.php +++ b/code/model/submissions/SubmittedForm.php @@ -31,4 +31,9 @@ class SubmittedForm extends DataObject { parent::onBeforeDelete(); } + + // Used in the CMS to join the links properly + public function DeleteLink($controllerLink) { + return Controller::join_links($controllerLink, 'deletesubmission?id=' . $this->ID); + } } \ No newline at end of file diff --git a/templates/SubmittedFormReportField.ss b/templates/SubmittedFormReportField.ss index a1f456a..8880097 100644 --- a/templates/SubmittedFormReportField.ss +++ b/templates/SubmittedFormReportField.ss @@ -1,23 +1,22 @@
- <% if Submissions %> +
Name: $Name
<% loop Submissions %>
-
<% _t('SUBMITTED', 'Submitted at') %> {$Created.Nice} <% _t('DELETESUBMISSION', 'Delete Submission') %>
- <% loop Values %> -
- -
- $FormattedValue -
- +
<% _t('SUBMITTED', 'Submitted at') %> {$Created.Nice} <% _t('DELETESUBMISSION', 'Delete Submission') %>
+ <% loop Values %> +
+ +
+ $FormattedValue
- <% end_loop %> +
+ <% end_loop %>
<% end_loop %> @@ -30,7 +29,7 @@ $PageNum <% else %> <% if Link %> - $PageNum + $PageNum <% else %> ... <% end_if %>