@@ -22,14 +22,14 @@ |
||
22 | 22 | class ProcessAction extends Enumeration |
23 | 23 | { |
24 | 24 | |
25 | - const REMOVE = 'remove'; |
|
25 | + const REMOVE = 'remove'; |
|
26 | 26 | |
27 | - const UPDATE = 'update'; |
|
27 | + const UPDATE = 'update'; |
|
28 | 28 | |
29 | - const COPY = 'copy'; |
|
29 | + const COPY = 'copy'; |
|
30 | 30 | |
31 | - const MOVE = 'move'; |
|
31 | + const MOVE = 'move'; |
|
32 | 32 | |
33 | - const LOCALIZE = 'localize'; |
|
33 | + const LOCALIZE = 'localize'; |
|
34 | 34 | |
35 | 35 | } |
@@ -22,54 +22,54 @@ |
||
22 | 22 | interface DataHandlerInterface |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * Process Content with action "update". |
|
27 | - * |
|
28 | - * @param Content $content |
|
29 | - * @return bool |
|
30 | - */ |
|
31 | - public function processUpdate(Content $content); |
|
25 | + /** |
|
26 | + * Process Content with action "update". |
|
27 | + * |
|
28 | + * @param Content $content |
|
29 | + * @return bool |
|
30 | + */ |
|
31 | + public function processUpdate(Content $content); |
|
32 | 32 | |
33 | - /** |
|
34 | - * Process Content with action "remove". |
|
35 | - * |
|
36 | - * @param Content $content |
|
37 | - * @return bool |
|
38 | - */ |
|
39 | - public function processRemove(Content $content); |
|
33 | + /** |
|
34 | + * Process Content with action "remove". |
|
35 | + * |
|
36 | + * @param Content $content |
|
37 | + * @return bool |
|
38 | + */ |
|
39 | + public function processRemove(Content $content); |
|
40 | 40 | |
41 | - /** |
|
42 | - * Process Content with action "copy". |
|
43 | - * |
|
44 | - * @param Content $content |
|
45 | - * @param string $target |
|
46 | - * @return bool |
|
47 | - */ |
|
48 | - public function processCopy(Content $content, $target); |
|
41 | + /** |
|
42 | + * Process Content with action "copy". |
|
43 | + * |
|
44 | + * @param Content $content |
|
45 | + * @param string $target |
|
46 | + * @return bool |
|
47 | + */ |
|
48 | + public function processCopy(Content $content, $target); |
|
49 | 49 | |
50 | - /** |
|
51 | - * Process Content with action "move". |
|
52 | - * |
|
53 | - * @param Content $content |
|
54 | - * @param mixed $target |
|
55 | - * @return bool |
|
56 | - */ |
|
57 | - public function processMove(Content $content, $target); |
|
50 | + /** |
|
51 | + * Process Content with action "move". |
|
52 | + * |
|
53 | + * @param Content $content |
|
54 | + * @param mixed $target |
|
55 | + * @return bool |
|
56 | + */ |
|
57 | + public function processMove(Content $content, $target); |
|
58 | 58 | |
59 | - /** |
|
60 | - * Process Content with action "localize". |
|
61 | - * |
|
62 | - * @param Content $content |
|
63 | - * @param int $language |
|
64 | - * @return bool |
|
65 | - */ |
|
66 | - public function processLocalize(Content $content, $language); |
|
59 | + /** |
|
60 | + * Process Content with action "localize". |
|
61 | + * |
|
62 | + * @param Content $content |
|
63 | + * @param int $language |
|
64 | + * @return bool |
|
65 | + */ |
|
66 | + public function processLocalize(Content $content, $language); |
|
67 | 67 | |
68 | - /** |
|
69 | - * Return error that have occurred while processing the data. |
|
70 | - * |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - public function getErrorMessages(); |
|
68 | + /** |
|
69 | + * Return error that have occurred while processing the data. |
|
70 | + * |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + public function getErrorMessages(); |
|
74 | 74 | |
75 | 75 | } |
@@ -23,70 +23,70 @@ |
||
23 | 23 | class DataHandlerFactory implements SingletonInterface |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - protected $actionName = ''; |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + protected $actionName = ''; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @var string |
|
33 | - */ |
|
34 | - protected $dataType = ''; |
|
31 | + /** |
|
32 | + * @var string |
|
33 | + */ |
|
34 | + protected $dataType = ''; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Default is CoreDataHandler which wraps the Core DataHandler. |
|
38 | - * |
|
39 | - * @var string |
|
40 | - */ |
|
41 | - protected $defaultDataHandler = 'Fab\Vidi\DataHandler\CoreDataHandler'; |
|
36 | + /** |
|
37 | + * Default is CoreDataHandler which wraps the Core DataHandler. |
|
38 | + * |
|
39 | + * @var string |
|
40 | + */ |
|
41 | + protected $defaultDataHandler = 'Fab\Vidi\DataHandler\CoreDataHandler'; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param string $actionName |
|
45 | - * @return $this |
|
46 | - */ |
|
47 | - public function action($actionName) |
|
48 | - { |
|
49 | - $this->actionName = $actionName; |
|
50 | - return $this; |
|
51 | - } |
|
43 | + /** |
|
44 | + * @param string $actionName |
|
45 | + * @return $this |
|
46 | + */ |
|
47 | + public function action($actionName) |
|
48 | + { |
|
49 | + $this->actionName = $actionName; |
|
50 | + return $this; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @param string $dataType |
|
55 | - * @return $this |
|
56 | - */ |
|
57 | - public function forType($dataType) |
|
58 | - { |
|
59 | - $this->dataType = $dataType; |
|
60 | - return $this; |
|
61 | - } |
|
53 | + /** |
|
54 | + * @param string $dataType |
|
55 | + * @return $this |
|
56 | + */ |
|
57 | + public function forType($dataType) |
|
58 | + { |
|
59 | + $this->dataType = $dataType; |
|
60 | + return $this; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Returns a Data Handler instance. |
|
65 | - * |
|
66 | - * @throws \Exception |
|
67 | - * @return DataHandlerInterface |
|
68 | - */ |
|
69 | - public function getDataHandler() |
|
70 | - { |
|
63 | + /** |
|
64 | + * Returns a Data Handler instance. |
|
65 | + * |
|
66 | + * @throws \Exception |
|
67 | + * @return DataHandlerInterface |
|
68 | + */ |
|
69 | + public function getDataHandler() |
|
70 | + { |
|
71 | 71 | |
72 | - if (empty($this->dataType)) { |
|
73 | - throw new \Exception('Attribute $this->dataType can not be empty', 1410001035); |
|
74 | - } |
|
72 | + if (empty($this->dataType)) { |
|
73 | + throw new \Exception('Attribute $this->dataType can not be empty', 1410001035); |
|
74 | + } |
|
75 | 75 | |
76 | - if (empty($this->actionName)) { |
|
77 | - throw new \Exception('Attribute $this->actionName can not be empty', 1410001036); |
|
78 | - } |
|
76 | + if (empty($this->actionName)) { |
|
77 | + throw new \Exception('Attribute $this->actionName can not be empty', 1410001036); |
|
78 | + } |
|
79 | 79 | |
80 | - if (isset($GLOBALS['TCA'][$this->dataType]['vidi']['data_handler'][$this->actionName])) { |
|
81 | - $className = $GLOBALS['TCA'][$this->dataType]['vidi']['data_handler'][$this->actionName]; |
|
82 | - } elseif (isset($GLOBALS['TCA'][$this->dataType]['vidi']['data_handler']['*'])) { |
|
83 | - $className = $GLOBALS['TCA'][$this->dataType]['vidi']['data_handler']['*']; |
|
84 | - } else { |
|
85 | - $className = $this->defaultDataHandler; |
|
86 | - } |
|
80 | + if (isset($GLOBALS['TCA'][$this->dataType]['vidi']['data_handler'][$this->actionName])) { |
|
81 | + $className = $GLOBALS['TCA'][$this->dataType]['vidi']['data_handler'][$this->actionName]; |
|
82 | + } elseif (isset($GLOBALS['TCA'][$this->dataType]['vidi']['data_handler']['*'])) { |
|
83 | + $className = $GLOBALS['TCA'][$this->dataType]['vidi']['data_handler']['*']; |
|
84 | + } else { |
|
85 | + $className = $this->defaultDataHandler; |
|
86 | + } |
|
87 | 87 | |
88 | - $dataHandler = GeneralUtility::makeInstance($className); |
|
89 | - return $dataHandler; |
|
90 | - } |
|
88 | + $dataHandler = GeneralUtility::makeInstance($className); |
|
89 | + return $dataHandler; |
|
90 | + } |
|
91 | 91 | |
92 | 92 | } |
@@ -27,147 +27,147 @@ |
||
27 | 27 | class SpreadSheetService |
28 | 28 | { |
29 | 29 | |
30 | - const XmlHeader = "<?xml version=\"1.0\" encoding=\"%s\"?\>\n<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:html=\"http://www.w3.org/TR/REC-html40\">"; |
|
31 | - const XmlFooter = "</Workbook>"; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - protected $encoding = 'UTF-8'; // encoding type to specify in file. |
|
37 | - // Note that you're on your own for making sure your data is actually encoded to this encoding |
|
38 | - |
|
39 | - /** |
|
40 | - * @var string |
|
41 | - */ |
|
42 | - protected $title = 'Sheet1'; // title for Worksheet |
|
43 | - |
|
44 | - /** |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - protected $buffer = ''; |
|
48 | - |
|
49 | - |
|
50 | - /** |
|
51 | - * Constructor |
|
52 | - */ |
|
53 | - public function __construct() |
|
54 | - { |
|
55 | - $this->addToBuffer($this->generateHeader()); |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * @param array $row |
|
60 | - */ |
|
61 | - public function addRow($row) |
|
62 | - { |
|
63 | - $this->addToBuffer($this->generateRow($row)); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * @return mixed |
|
68 | - */ |
|
69 | - public function toString() |
|
70 | - { |
|
71 | - $this->addToBuffer($this->generateFooter()); |
|
72 | - return $this->buffer; |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * @param $data |
|
77 | - */ |
|
78 | - protected function addToBuffer($data) |
|
79 | - { |
|
80 | - $this->buffer .= $data; |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * @return string |
|
85 | - */ |
|
86 | - protected function generateHeader() |
|
87 | - { |
|
88 | - |
|
89 | - // workbook header |
|
90 | - $output = stripslashes(sprintf(self::XmlHeader, $this->encoding)) . "\n"; |
|
91 | - |
|
92 | - // Set up styles |
|
93 | - $output .= "<Styles>\n"; |
|
94 | - $output .= "<Style ss:ID=\"sDT\"><NumberFormat ss:Format=\"Short Date\"/></Style>\n"; |
|
95 | - $output .= "</Styles>\n"; |
|
96 | - |
|
97 | - // worksheet header |
|
98 | - $output .= sprintf("<Worksheet ss:Name=\"%s\">\n <Table>\n", htmlentities($this->title)); |
|
99 | - |
|
100 | - return $output; |
|
101 | - } |
|
102 | - |
|
103 | - protected function generateFooter() |
|
104 | - { |
|
105 | - $output = ''; |
|
106 | - |
|
107 | - // worksheet footer |
|
108 | - $output .= " </Table>\n</Worksheet>\n"; |
|
109 | - |
|
110 | - // workbook footer |
|
111 | - $output .= self::XmlFooter; |
|
112 | - |
|
113 | - return $output; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @param $row |
|
118 | - * @return string |
|
119 | - */ |
|
120 | - protected function generateRow($row) |
|
121 | - { |
|
122 | - $output = ''; |
|
123 | - $output .= " <Row>\n"; |
|
124 | - foreach ($row as $v) { |
|
125 | - $output .= $this->generateCell($v); |
|
126 | - } |
|
127 | - $output .= " </Row>\n"; |
|
128 | - return $output; |
|
129 | - } |
|
130 | - |
|
131 | - /** |
|
132 | - * @param $item |
|
133 | - * @return string |
|
134 | - */ |
|
135 | - protected function generateCell($item) |
|
136 | - { |
|
137 | - $output = ''; |
|
138 | - $style = ''; |
|
139 | - |
|
140 | - // Tell Excel to treat as a number. Note that Excel only stores roughly 15 digits, so keep |
|
141 | - // as text if number is longer than that. |
|
142 | - if (preg_match("/^-?\d+(?:[.,]\d+)?$/", $item) && (strlen($item) < 15)) { |
|
143 | - $type = 'Number'; |
|
144 | - } |
|
145 | - // Sniff for valid dates; should look something like 2010-07-14 or 7/14/2010 etc. Can |
|
146 | - // also have an optional time after the date. |
|
147 | - // |
|
148 | - // Note we want to be very strict in what we consider a date. There is the possibility |
|
149 | - // of really screwing up the data if we try to reformat a string that was not actually |
|
150 | - // intended to represent a date. |
|
151 | - elseif (preg_match("/^(\d{1,2}|\d{4})[\/\-]\d{1,2}[\/\-](\d{1,2}|\d{4})([^\d].+)?$/", $item) && |
|
152 | - ($timestamp = strtotime($item)) && |
|
153 | - ($timestamp > 0) && |
|
154 | - ($timestamp < strtotime('+500 years')) |
|
155 | - ) { |
|
156 | - $type = 'DateTime'; |
|
157 | - $item = strftime("%Y-%m-%dT%H:%M:%S", $timestamp); |
|
158 | - $style = 'sDT'; // defined in header; tells excel to format date for display |
|
159 | - } else { |
|
160 | - $type = 'String'; |
|
161 | - } |
|
162 | - |
|
163 | - $item = str_replace(''', ''', htmlspecialchars($item, ENT_QUOTES)); |
|
164 | - $item = str_replace("\n", ' ', $item); |
|
165 | - $output .= " "; |
|
166 | - $output .= $style ? "<Cell ss:StyleID=\"$style\">" : "<Cell>"; |
|
167 | - $output .= sprintf("<Data ss:Type=\"%s\">%s</Data>", $type, $item); |
|
168 | - $output .= "</Cell>\n"; |
|
169 | - |
|
170 | - return $output; |
|
171 | - } |
|
30 | + const XmlHeader = "<?xml version=\"1.0\" encoding=\"%s\"?\>\n<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:html=\"http://www.w3.org/TR/REC-html40\">"; |
|
31 | + const XmlFooter = "</Workbook>"; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + protected $encoding = 'UTF-8'; // encoding type to specify in file. |
|
37 | + // Note that you're on your own for making sure your data is actually encoded to this encoding |
|
38 | + |
|
39 | + /** |
|
40 | + * @var string |
|
41 | + */ |
|
42 | + protected $title = 'Sheet1'; // title for Worksheet |
|
43 | + |
|
44 | + /** |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + protected $buffer = ''; |
|
48 | + |
|
49 | + |
|
50 | + /** |
|
51 | + * Constructor |
|
52 | + */ |
|
53 | + public function __construct() |
|
54 | + { |
|
55 | + $this->addToBuffer($this->generateHeader()); |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * @param array $row |
|
60 | + */ |
|
61 | + public function addRow($row) |
|
62 | + { |
|
63 | + $this->addToBuffer($this->generateRow($row)); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * @return mixed |
|
68 | + */ |
|
69 | + public function toString() |
|
70 | + { |
|
71 | + $this->addToBuffer($this->generateFooter()); |
|
72 | + return $this->buffer; |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * @param $data |
|
77 | + */ |
|
78 | + protected function addToBuffer($data) |
|
79 | + { |
|
80 | + $this->buffer .= $data; |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * @return string |
|
85 | + */ |
|
86 | + protected function generateHeader() |
|
87 | + { |
|
88 | + |
|
89 | + // workbook header |
|
90 | + $output = stripslashes(sprintf(self::XmlHeader, $this->encoding)) . "\n"; |
|
91 | + |
|
92 | + // Set up styles |
|
93 | + $output .= "<Styles>\n"; |
|
94 | + $output .= "<Style ss:ID=\"sDT\"><NumberFormat ss:Format=\"Short Date\"/></Style>\n"; |
|
95 | + $output .= "</Styles>\n"; |
|
96 | + |
|
97 | + // worksheet header |
|
98 | + $output .= sprintf("<Worksheet ss:Name=\"%s\">\n <Table>\n", htmlentities($this->title)); |
|
99 | + |
|
100 | + return $output; |
|
101 | + } |
|
102 | + |
|
103 | + protected function generateFooter() |
|
104 | + { |
|
105 | + $output = ''; |
|
106 | + |
|
107 | + // worksheet footer |
|
108 | + $output .= " </Table>\n</Worksheet>\n"; |
|
109 | + |
|
110 | + // workbook footer |
|
111 | + $output .= self::XmlFooter; |
|
112 | + |
|
113 | + return $output; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @param $row |
|
118 | + * @return string |
|
119 | + */ |
|
120 | + protected function generateRow($row) |
|
121 | + { |
|
122 | + $output = ''; |
|
123 | + $output .= " <Row>\n"; |
|
124 | + foreach ($row as $v) { |
|
125 | + $output .= $this->generateCell($v); |
|
126 | + } |
|
127 | + $output .= " </Row>\n"; |
|
128 | + return $output; |
|
129 | + } |
|
130 | + |
|
131 | + /** |
|
132 | + * @param $item |
|
133 | + * @return string |
|
134 | + */ |
|
135 | + protected function generateCell($item) |
|
136 | + { |
|
137 | + $output = ''; |
|
138 | + $style = ''; |
|
139 | + |
|
140 | + // Tell Excel to treat as a number. Note that Excel only stores roughly 15 digits, so keep |
|
141 | + // as text if number is longer than that. |
|
142 | + if (preg_match("/^-?\d+(?:[.,]\d+)?$/", $item) && (strlen($item) < 15)) { |
|
143 | + $type = 'Number'; |
|
144 | + } |
|
145 | + // Sniff for valid dates; should look something like 2010-07-14 or 7/14/2010 etc. Can |
|
146 | + // also have an optional time after the date. |
|
147 | + // |
|
148 | + // Note we want to be very strict in what we consider a date. There is the possibility |
|
149 | + // of really screwing up the data if we try to reformat a string that was not actually |
|
150 | + // intended to represent a date. |
|
151 | + elseif (preg_match("/^(\d{1,2}|\d{4})[\/\-]\d{1,2}[\/\-](\d{1,2}|\d{4})([^\d].+)?$/", $item) && |
|
152 | + ($timestamp = strtotime($item)) && |
|
153 | + ($timestamp > 0) && |
|
154 | + ($timestamp < strtotime('+500 years')) |
|
155 | + ) { |
|
156 | + $type = 'DateTime'; |
|
157 | + $item = strftime("%Y-%m-%dT%H:%M:%S", $timestamp); |
|
158 | + $style = 'sDT'; // defined in header; tells excel to format date for display |
|
159 | + } else { |
|
160 | + $type = 'String'; |
|
161 | + } |
|
162 | + |
|
163 | + $item = str_replace(''', ''', htmlspecialchars($item, ENT_QUOTES)); |
|
164 | + $item = str_replace("\n", ' ', $item); |
|
165 | + $output .= " "; |
|
166 | + $output .= $style ? "<Cell ss:StyleID=\"$style\">" : "<Cell>"; |
|
167 | + $output .= sprintf("<Data ss:Type=\"%s\">%s</Data>", $type, $item); |
|
168 | + $output .= "</Cell>\n"; |
|
169 | + |
|
170 | + return $output; |
|
171 | + } |
|
172 | 172 | |
173 | 173 | } |
174 | 174 | \ No newline at end of file |
@@ -87,7 +87,7 @@ |
||
87 | 87 | { |
88 | 88 | |
89 | 89 | // workbook header |
90 | - $output = stripslashes(sprintf(self::XmlHeader, $this->encoding)) . "\n"; |
|
90 | + $output = stripslashes(sprintf(self::XmlHeader, $this->encoding))."\n"; |
|
91 | 91 | |
92 | 92 | // Set up styles |
93 | 93 | $output .= "<Styles>\n"; |
@@ -22,146 +22,146 @@ |
||
22 | 22 | class Selection extends AbstractEntity |
23 | 23 | { |
24 | 24 | |
25 | - const VISIBILITY_EVERYONE = 0; |
|
26 | - const VISIBILITY_PRIVATE = 1; |
|
27 | - const VISIBILITY_ADMIN_ONLY = 2; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var int |
|
31 | - */ |
|
32 | - protected $visibility; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var string |
|
36 | - */ |
|
37 | - protected $name; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var string |
|
41 | - */ |
|
42 | - protected $dataType; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - protected $query; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var string |
|
51 | - */ |
|
52 | - protected $speakingQuery; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var int |
|
56 | - */ |
|
57 | - protected $owner; |
|
58 | - |
|
59 | - /** |
|
60 | - * @param string $dataType |
|
61 | - * @return $this |
|
62 | - */ |
|
63 | - public function setDataType($dataType) |
|
64 | - { |
|
65 | - $this->dataType = $dataType; |
|
66 | - return $this; |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * @return string |
|
71 | - */ |
|
72 | - public function getDataType() |
|
73 | - { |
|
74 | - return $this->dataType; |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * @param string $query |
|
79 | - * @return $this |
|
80 | - */ |
|
81 | - public function setQuery($query) |
|
82 | - { |
|
83 | - $this->query = $query; |
|
84 | - return $this; |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * @return string |
|
89 | - */ |
|
90 | - public function getQuery() |
|
91 | - { |
|
92 | - return $this->query; |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * @return string |
|
97 | - */ |
|
98 | - public function getSpeakingQuery() |
|
99 | - { |
|
100 | - return $this->speakingQuery; |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * @param string $speakingQuery |
|
105 | - * @return $this |
|
106 | - */ |
|
107 | - public function setSpeakingQuery($speakingQuery) |
|
108 | - { |
|
109 | - $this->speakingQuery = $speakingQuery; |
|
110 | - return $this; |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * @param string $name |
|
115 | - * @return $this |
|
116 | - */ |
|
117 | - public function setName($name) |
|
118 | - { |
|
119 | - $this->name = $name; |
|
120 | - return $this; |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * @return string |
|
125 | - */ |
|
126 | - public function getName() |
|
127 | - { |
|
128 | - return $this->name; |
|
129 | - } |
|
130 | - |
|
131 | - /** |
|
132 | - * @param int $visibility |
|
133 | - * @return $this |
|
134 | - */ |
|
135 | - public function setVisibility($visibility) |
|
136 | - { |
|
137 | - $this->visibility = $visibility; |
|
138 | - return $this; |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * @return int |
|
143 | - */ |
|
144 | - public function getVisibility() |
|
145 | - { |
|
146 | - return $this->visibility; |
|
147 | - } |
|
148 | - |
|
149 | - /** |
|
150 | - * @return int |
|
151 | - */ |
|
152 | - public function getOwner() |
|
153 | - { |
|
154 | - return $this->owner; |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * @param int $owner |
|
159 | - * @return $this |
|
160 | - */ |
|
161 | - public function setOwner($owner) |
|
162 | - { |
|
163 | - $this->owner = $owner; |
|
164 | - return $this; |
|
165 | - } |
|
25 | + const VISIBILITY_EVERYONE = 0; |
|
26 | + const VISIBILITY_PRIVATE = 1; |
|
27 | + const VISIBILITY_ADMIN_ONLY = 2; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var int |
|
31 | + */ |
|
32 | + protected $visibility; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var string |
|
36 | + */ |
|
37 | + protected $name; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var string |
|
41 | + */ |
|
42 | + protected $dataType; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + protected $query; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var string |
|
51 | + */ |
|
52 | + protected $speakingQuery; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var int |
|
56 | + */ |
|
57 | + protected $owner; |
|
58 | + |
|
59 | + /** |
|
60 | + * @param string $dataType |
|
61 | + * @return $this |
|
62 | + */ |
|
63 | + public function setDataType($dataType) |
|
64 | + { |
|
65 | + $this->dataType = $dataType; |
|
66 | + return $this; |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * @return string |
|
71 | + */ |
|
72 | + public function getDataType() |
|
73 | + { |
|
74 | + return $this->dataType; |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * @param string $query |
|
79 | + * @return $this |
|
80 | + */ |
|
81 | + public function setQuery($query) |
|
82 | + { |
|
83 | + $this->query = $query; |
|
84 | + return $this; |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * @return string |
|
89 | + */ |
|
90 | + public function getQuery() |
|
91 | + { |
|
92 | + return $this->query; |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * @return string |
|
97 | + */ |
|
98 | + public function getSpeakingQuery() |
|
99 | + { |
|
100 | + return $this->speakingQuery; |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * @param string $speakingQuery |
|
105 | + * @return $this |
|
106 | + */ |
|
107 | + public function setSpeakingQuery($speakingQuery) |
|
108 | + { |
|
109 | + $this->speakingQuery = $speakingQuery; |
|
110 | + return $this; |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * @param string $name |
|
115 | + * @return $this |
|
116 | + */ |
|
117 | + public function setName($name) |
|
118 | + { |
|
119 | + $this->name = $name; |
|
120 | + return $this; |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * @return string |
|
125 | + */ |
|
126 | + public function getName() |
|
127 | + { |
|
128 | + return $this->name; |
|
129 | + } |
|
130 | + |
|
131 | + /** |
|
132 | + * @param int $visibility |
|
133 | + * @return $this |
|
134 | + */ |
|
135 | + public function setVisibility($visibility) |
|
136 | + { |
|
137 | + $this->visibility = $visibility; |
|
138 | + return $this; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * @return int |
|
143 | + */ |
|
144 | + public function getVisibility() |
|
145 | + { |
|
146 | + return $this->visibility; |
|
147 | + } |
|
148 | + |
|
149 | + /** |
|
150 | + * @return int |
|
151 | + */ |
|
152 | + public function getOwner() |
|
153 | + { |
|
154 | + return $this->owner; |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * @param int $owner |
|
159 | + * @return $this |
|
160 | + */ |
|
161 | + public function setOwner($owner) |
|
162 | + { |
|
163 | + $this->owner = $owner; |
|
164 | + return $this; |
|
165 | + } |
|
166 | 166 | |
167 | 167 | } |
@@ -23,20 +23,20 @@ |
||
23 | 23 | class ContentValidator |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * Check whether $Content object is valid. |
|
28 | - * |
|
29 | - * @param Content $content |
|
30 | - * @throws \Exception |
|
31 | - * @return void |
|
32 | - */ |
|
33 | - public function validate(Content $content) |
|
34 | - { |
|
26 | + /** |
|
27 | + * Check whether $Content object is valid. |
|
28 | + * |
|
29 | + * @param Content $content |
|
30 | + * @throws \Exception |
|
31 | + * @return void |
|
32 | + */ |
|
33 | + public function validate(Content $content) |
|
34 | + { |
|
35 | 35 | |
36 | - // Security check. |
|
37 | - if ($content->getUid() <= 0) { |
|
38 | - throw new MissingIdentifierException('Missing identifier for Content Object', 1351605542); |
|
39 | - } |
|
40 | - } |
|
36 | + // Security check. |
|
37 | + if ($content->getUid() <= 0) { |
|
38 | + throw new MissingIdentifierException('Missing identifier for Content Object', 1351605542); |
|
39 | + } |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
@@ -23,19 +23,19 @@ |
||
23 | 23 | class ColumnsValidator extends AbstractValidator |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * Check if $columns is valid. If it is not valid, throw an exception. |
|
28 | - * |
|
29 | - * @param mixed $columns |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - public function isValid($columns) |
|
33 | - { |
|
34 | - foreach ($columns as $columnName) { |
|
35 | - if (!Tca::grid()->hasField($columnName)) { |
|
36 | - $message = sprintf('Column "%s" is not allowed. Actually, it was not configured to be displayed in the grid.', $columnName); |
|
37 | - $this->addError($message, 1380019720); |
|
38 | - } |
|
39 | - } |
|
40 | - } |
|
26 | + /** |
|
27 | + * Check if $columns is valid. If it is not valid, throw an exception. |
|
28 | + * |
|
29 | + * @param mixed $columns |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + public function isValid($columns) |
|
33 | + { |
|
34 | + foreach ($columns as $columnName) { |
|
35 | + if (!Tca::grid()->hasField($columnName)) { |
|
36 | + $message = sprintf('Column "%s" is not allowed. Actually, it was not configured to be displayed in the grid.', $columnName); |
|
37 | + $this->addError($message, 1380019720); |
|
38 | + } |
|
39 | + } |
|
40 | + } |
|
41 | 41 | } |
@@ -23,18 +23,18 @@ |
||
23 | 23 | class FacetValidator extends AbstractValidator |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * Check if $facet is valid. If it is not valid, throw an exception. |
|
28 | - * |
|
29 | - * @param mixed $facet |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - public function isValid($facet) |
|
33 | - { |
|
26 | + /** |
|
27 | + * Check if $facet is valid. If it is not valid, throw an exception. |
|
28 | + * |
|
29 | + * @param mixed $facet |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + public function isValid($facet) |
|
33 | + { |
|
34 | 34 | |
35 | - if (!Tca::grid()->hasFacet($facet)) { |
|
36 | - $message = sprintf('Facet "%s" is not allowed. Actually, it was not configured to be displayed in the grid.', $facet); |
|
37 | - $this->addError($message, 1380019719); |
|
38 | - } |
|
39 | - } |
|
35 | + if (!Tca::grid()->hasFacet($facet)) { |
|
36 | + $message = sprintf('Facet "%s" is not allowed. Actually, it was not configured to be displayed in the grid.', $facet); |
|
37 | + $this->addError($message, 1380019719); |
|
38 | + } |
|
39 | + } |
|
40 | 40 | } |
@@ -23,20 +23,20 @@ |
||
23 | 23 | class MatchesValidator extends AbstractValidator |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * Check if $matches is valid. If it is not valid, throw an exception. |
|
28 | - * |
|
29 | - * @param mixed $matches |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - public function isValid($matches) |
|
33 | - { |
|
26 | + /** |
|
27 | + * Check if $matches is valid. If it is not valid, throw an exception. |
|
28 | + * |
|
29 | + * @param mixed $matches |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + public function isValid($matches) |
|
33 | + { |
|
34 | 34 | |
35 | - foreach ($matches as $fieldName => $value) { |
|
36 | - if (!Tca::table()->hasField($fieldName)) { |
|
37 | - $message = sprintf('Field "%s" is not allowed. Actually, it is not configured in the TCA.', $fieldName); |
|
38 | - $this->addError($message, 1380019718); |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
35 | + foreach ($matches as $fieldName => $value) { |
|
36 | + if (!Tca::table()->hasField($fieldName)) { |
|
37 | + $message = sprintf('Field "%s" is not allowed. Actually, it is not configured in the TCA.', $fieldName); |
|
38 | + $this->addError($message, 1380019718); |
|
39 | + } |
|
40 | + } |
|
41 | + } |
|
42 | 42 | } |