Total Complexity | 11 |
Total Lines | 118 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | trait ExportTrait |
||
13 | { |
||
14 | public $href = ''; |
||
15 | public $misc; |
||
16 | /** |
||
17 | * prints the dataOnly option when exporting a table, view or materialized view |
||
1 ignored issue
–
show
|
|||
18 | * |
||
19 | * @param boolean $hasID Indicates if the object has has an object ID |
||
20 | * |
||
21 | * @return string html table row |
||
22 | */ |
||
23 | public function dataOnly($hasID) |
||
24 | { |
||
25 | $content = '<tr>'; |
||
26 | $content .= '<th class="data left" rowspan="' . ($hasID ? 2 : 1) . '">'; |
||
27 | $content .= '<input type="radio" id="what1" name="what" value="dataonly" checked="checked" />'; |
||
28 | $content .= sprintf('<label for="what1">%s</label></th>%s', $this->lang['strdataonly'], "\n"); |
||
29 | $content .= sprintf('<td>%s</td>%s', $this->lang['strformat'], "\n"); |
||
30 | $content .= '<td><select name="d_format">' . "\n"; |
||
31 | $content .= '<option value="copy">COPY</option>' . "\n"; |
||
32 | $content .= '<option value="sql">SQL</option>' . "\n"; |
||
33 | $content .= '<option value="csv">CSV</option>' . "\n"; |
||
34 | $content .= "<option value=\"tab\">{$this->lang['strtabbed']}</option>" . "\n"; |
||
35 | $content .= '<option value="html">XHTML</option>' . "\n"; |
||
36 | $content .= '<option value="xml">XML</option>' . "\n"; |
||
37 | $content .= sprintf('</select>%s</td>%s</tr>%s', "\n", "\n", "\n"); |
||
38 | |||
39 | if ($hasID) { |
||
40 | $content .= sprintf('<tr><td><label for="d_oids">%s</td>', $this->lang['stroids']); |
||
41 | $content .= sprintf('<td><input type="checkbox" id="d_oids" name="d_oids" /></td>%s</tr>%s', "\n", "\n"); |
||
42 | } |
||
43 | return $content; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * prints the structureAndData option when exporting a table, view or materialized view |
||
1 ignored issue
–
show
|
|||
48 | * |
||
49 | * @param boolean $hasID Indicates if the object has an object ID |
||
50 | * |
||
51 | * @return string html table row |
||
52 | */ |
||
53 | public function structureAndData($hasID) |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * prints the structureAndData option when exporting a table, view or |
||
1 ignored issue
–
show
|
|||
76 | * materialized view |
||
77 | * |
||
78 | * @param boolean $checked Tell if this option should be checked |
||
79 | * |
||
80 | * @return string html table row |
||
81 | */ |
||
82 | public function structureOnly($checked = false) |
||
83 | { |
||
84 | $content = '<tr><th class="data left">'; |
||
85 | $content .= sprintf('<input type="radio" id="what2" name="what" value="structureonly" %s />', $checked ? 'checked="checked"' : ''); |
||
86 | $content .= sprintf('<label for="what2">%s</label></th>', $this->lang['strstructureonly'], "\n"); |
||
87 | $content .= sprintf('<td><label for="s_clean">%s</label></td>', $this->lang['strdrop']); |
||
88 | $content .= sprintf('<td><input type="checkbox" id="s_clean" name="s_clean" /></td>%s</tr>%s', "\n", "\n"); |
||
89 | return $content; |
||
90 | } |
||
91 | |||
92 | public function formHeader() |
||
93 | { |
||
94 | $content = sprintf('<form action="%s" method=\"post\">%s', \SUBFOLDER . '/src/views/dataexport', "\n"); |
||
95 | $content .= "<table>\n"; |
||
96 | $content .= sprintf('<tr><th class="data">%s</th>', $this->lang['strformat']); |
||
97 | $content .= sprintf('<th class="data" colspan="2">%s</th></tr>%s', $this->lang['stroptions'], "\n"); |
||
98 | return $content; |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * prints the formFooter section when exporting a table, view or materialized view |
||
1 ignored issue
–
show
|
|||
103 | * |
||
104 | * @param string $subject either table, view or matview |
||
105 | * @param string $object name of the table, view or matview |
||
106 | * |
||
107 | * @return string html table row |
||
108 | */ |
||
109 | public function formFooter($subject, $object) |
||
110 | { |
||
111 | $content = '<p><input type="hidden" name="action" value="export" />' . "\n"; |
||
112 | $content .= $this->misc->form; |
||
113 | $content .= sprintf('<input type="hidden" name="subject" value="%s" />%s', $subject, "\n"); |
||
114 | $content .= sprintf('<input type="hidden" name="%s" value="%s" />', $subject, htmlspecialchars($object), "\n"); |
||
115 | $content .= sprintf('<input type="submit" value="%s" /></p>%s', $this->lang['strexport'], "\n"); |
||
116 | $content .= sprintf('</form>%s', "\n"); |
||
117 | |||
118 | return $content; |
||
119 | } |
||
120 | |||
121 | public function displayOrDownload() |
||
130 | } |
||
131 | } |
||
132 |