1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\DataDefinition\Definition\View\Panel;
14:
15: /**
16: * Interface SortElementInformationInterface.
17: *
18: * This interface describes a sort panel element information for sorting by properties.
19: *
20: * @package DcGeneral\DataDefinition\Definition\View\Panel
21: */
22: interface SortElementInformationInterface extends ElementInformationInterface
23: {
24: /**
25: * Do not sort.
26: */
27: const SORTING_FLAG_NONE = 0;
28:
29: /**
30: * Sort by initial letter ascending.
31: */
32: const SORTING_FLAG_FIRST_LETTER_ASCENDING = 1;
33:
34: /**
35: * Sort by initial letter descending.
36: */
37: const SORTING_FLAG_FIRST_LETTER_DESCENDING = 2;
38:
39: /**
40: * Sort by initial two letters ascending.
41: */
42: const SORTING_FLAG_TWO_LETTERS_ASCENDING = 3;
43:
44: /**
45: * Sort by initial two letters descending.
46: */
47: const SORTING_FLAG_TWO_LETTERS_DESCENDING = 4;
48:
49: /**
50: * Sort by day ascending.
51: */
52: const SORTING_FLAG_DATE_DAY_ASCENDING = 5;
53:
54: /**
55: * Sort by day descending.
56: */
57: const SORTING_FLAG_DATE_DAY_DESCENDING = 6;
58:
59: /**
60: * Sort by month ascending.
61: */
62: const SORTING_FLAG_DATE_MONTH_ASCENDING = 7;
63:
64: /**
65: * Sort by month descending.
66: */
67: const SORTING_FLAG_DATE_MONTH_DESCENDING = 8;
68:
69: /**
70: * Sort by year ascending.
71: */
72: const SORTING_FLAG_DATE_YEAR_ASCENDING = 9;
73:
74: /**
75: * Sort by year descending.
76: */
77: const SORTING_FLAG_DATE_YEAR_DESCENDING = 10;
78:
79: /**
80: * Sort ascending.
81: */
82: const SORTING_FLAG_ASCENDING = 11;
83:
84: /**
85: * Sort descending.
86: */
87: const SORTING_FLAG_DESCENDING = 12;
88:
89: /**
90: * Set the default flag to use when no flag has been defined for a certain property.
91: *
92: * @param int $flag The flag to use.
93: *
94: * @return SortElementInformationInterface
95: */
96: public function setDefaultFlag($flag);
97:
98: /**
99: * Get the default flag to use when no flag has been defined for a certain property.
100: *
101: * @return int
102: */
103: public function getDefaultFlag();
104:
105: /**
106: * Add a property for sorting.
107: *
108: * @param string $propertyName The name of the property.
109: *
110: * @param int $flag If the default of 0 is passed, the default flag will get used.
111: *
112: * @return SortElementInformationInterface
113: */
114: public function addProperty($propertyName, $flag = 0);
115:
116: /**
117: * Determine if the given property has been marked for sorting in the element.
118: *
119: * @param string $propertyName The name of the property.
120: *
121: * @return SortElementInformationInterface
122: */
123: public function hasProperty($propertyName);
124:
125: /**
126: * Determine if the given property has been marked for sorting in the element.
127: *
128: * @param string $propertyName The name of the property.
129: *
130: * @return SortElementInformationInterface
131: */
132: public function removeProperty($propertyName);
133:
134: /**
135: * Retrieve the list of properties to allow search on.
136: *
137: * @return string[]
138: */
139: public function getPropertyNames();
140:
141: /**
142: * Get the flag to use for a property.
143: *
144: * When a flag has been defined for a certain property that flag is being used otherwise the the default flag will
145: * get returned.
146: *
147: * @param string $propertyName The name of the property.
148: *
149: * @return int
150: */
151: public function getPropertyFlag($propertyName);
152: }
153: