1 | <?php |
||
32 | class WorkflowDefinitionExporter |
||
33 | { |
||
34 | use Configurable; |
||
35 | |||
36 | /** |
||
37 | * The base filename of the file to the exported |
||
38 | * |
||
39 | * @config |
||
40 | * @var string |
||
41 | */ |
||
42 | private static $export_filename_prefix = 'workflow-definition-export'; |
||
43 | /** |
||
44 | * |
||
45 | * @var Member |
||
46 | */ |
||
47 | protected $member; |
||
48 | /** |
||
49 | * |
||
50 | * @var WorkflowDefinition |
||
51 | */ |
||
52 | protected $workflowDefinition; |
||
53 | |||
54 | /** |
||
55 | * |
||
56 | * @param number $definitionID |
||
57 | * @return void |
||
|
|||
58 | */ |
||
59 | public function __construct($definitionID) |
||
64 | |||
65 | /** |
||
66 | * |
||
67 | * @param Member $member |
||
68 | */ |
||
69 | public function setMember($member) |
||
73 | |||
74 | /** |
||
75 | * @return WorkflowDefinition |
||
76 | */ |
||
77 | public function getDefinition() |
||
81 | |||
82 | /** |
||
83 | * Runs the export |
||
84 | * |
||
85 | * @return string $template |
||
86 | * @throws Exception if the current user doesn't have permission to access export functionality |
||
87 | */ |
||
88 | public function export() |
||
103 | |||
104 | /** |
||
105 | * Format the exported data as YAML. |
||
106 | * |
||
107 | * @param ArrayData $templateData |
||
108 | * @return void |
||
109 | */ |
||
110 | public function format($templateData) |
||
118 | |||
119 | /** |
||
120 | * Returns the size of the current export in bytes. |
||
121 | * Used for pushing data to the browser to prompt for download |
||
122 | * |
||
123 | * @param string $str |
||
124 | * @return number $bytes |
||
125 | */ |
||
126 | public function getExportSize($str) |
||
130 | |||
131 | /** |
||
132 | * Generate template vars for metadata |
||
133 | * |
||
134 | * @return ArrayData |
||
135 | */ |
||
136 | public function ExportMetaData() |
||
149 | |||
150 | /** |
||
151 | * Try different ways of obtaining the current SilverStripe version for YAML output. |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | private function ssVersion() |
||
165 | |||
166 | private function processTitle($title) |
||
172 | |||
173 | /** |
||
174 | * Prompt the client for file download. |
||
175 | * We're "overriding" SS_HTTPRequest::send_file() for more robust cross-browser support |
||
176 | * |
||
177 | * @param array $filedata |
||
178 | * @return HTTPResponse $response |
||
179 | */ |
||
180 | public function sendFile($filedata) |
||
201 | } |
||
202 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.