1 | <?php |
||
3 | class EmailReminder_EmailRecord extends DataObject |
||
4 | { |
||
5 | private static $singular_name = "Email Reminder Record"; |
||
|
|||
6 | public function i18n_singular_name() |
||
10 | |||
11 | private static $plural_name = "Email Reminder Records"; |
||
12 | public function i18n_plural_name() |
||
16 | |||
17 | private static $db = array( |
||
18 | 'EmailTo' => 'Varchar(100)', |
||
19 | 'ExternalRecordClassName' => 'Varchar(100)', |
||
20 | 'ExternalRecordID' => 'Int', |
||
21 | 'Result' => 'Boolean', |
||
22 | 'IsTestOnly' => 'Boolean', |
||
23 | 'EmailContent' => 'HTMLText' |
||
24 | ); |
||
25 | |||
26 | private static $indexes = array( |
||
27 | 'EmailTo' => true, |
||
28 | 'ExternalRecordClassName' => true, |
||
29 | 'ExternalRecordID' => true, |
||
30 | 'Result' => true, |
||
31 | 'Created' => true |
||
32 | ); |
||
33 | |||
34 | private static $has_one = array( |
||
35 | 'EmailReminder_NotificationSchedule' => 'EmailReminder_NotificationSchedule' |
||
36 | ); |
||
37 | |||
38 | private static $summary_fields = array( |
||
39 | 'Created.Nice' => 'When', |
||
40 | 'EmailTo' => 'Sent to', |
||
41 | 'Result.Nice' => 'Sent Succesfully', |
||
42 | 'IsTestOnly.Nice' => 'Test Only' |
||
43 | ); |
||
44 | |||
45 | public static $default_sort = [ |
||
46 | 'Created' => 'DESC', |
||
47 | 'ID' => 'DESC' |
||
48 | ]; |
||
49 | |||
50 | |||
51 | public function canCreate($member = null) |
||
55 | |||
56 | public function canEdit($member = null) |
||
60 | |||
61 | public function canDelete($member = null) |
||
65 | |||
66 | /** |
||
67 | * standard SS method. |
||
68 | * |
||
69 | * @return FieldList |
||
70 | */ |
||
71 | public function getCMSFields() |
||
94 | |||
95 | /** |
||
96 | * |
||
97 | * tests to see if an email can be sent |
||
98 | * the emails can only be sent once unless previous attempts have failed |
||
99 | */ |
||
100 | public function canSendAgain() |
||
120 | |||
121 | /** |
||
122 | * |
||
123 | * PartialMatchFilter |
||
124 | */ |
||
125 | private static $searchable_fields = array( |
||
126 | 'EmailTo' => 'PartialMatchFilter', |
||
127 | 'Result' => 'ExactMatchFilter', |
||
128 | 'IsTestOnly' => 'ExactMatchFilter', |
||
129 | ); |
||
130 | |||
131 | /** |
||
132 | * e.g. |
||
133 | * $controller = singleton("MyModelAdmin"); |
||
134 | * return $controller->Link().$this->ClassName."/EditForm/field/".$this->ClassName."/item/".$this->ID."/edit"; |
||
135 | */ |
||
136 | public function CMSEditLink() |
||
139 | |||
140 | |||
141 | /** |
||
142 | * returns list of fields as they are exported |
||
143 | * @return array |
||
144 | * Field => Label |
||
145 | */ |
||
146 | public function getExportFields() |
||
149 | } |
||
150 |