1: <?php
2: /**
3: * This file contains the QDataGridEgacyColumn and QFilterType class.
4: *
5: * @package Controls
6: */
7:
8: /**
9: * Class QFilterType: Type of filter which can be implemented on a QDataGridLegacy's Column
10: *
11: * A constant from this class determines the type of filter which is to be applied to the UI
12: * in a QDataGridLegacy and hence determines the type of query to be sent to the database for filtering
13: * results based on input
14: */
15: abstract class QFilterType {
16: /** No filter */
17: const None = '';
18: /** Text search filter */
19: const TextFilter = 'Text';
20: /** List type filter (mostly used for Boolean fields) */
21: const ListFilter = 'List';
22: }
23:
24: /**
25: * This defines a specific column <td> for a DataGrid
26: * All the appearance properties should be self-explanatory.
27: * The SortByCommand and ReverseSortByCommand are both optional -- and are explained in more
28: * depth in DataGrid.inc
29:
30: *
31: *@package Controls
32: * @property string $BackColor Background colour of an element of this column
33: * @property string $BorderColor Border colour of an element of this column
34: * @property string $BorderStyle Border style of an element of this column (constant from QBorderStyle class)
35: * @property string $BorderWidth Border width of an element of this column
36: * @property string $CssClass CSS class of an element of this column
37: * @property boolean $FontBold Determines if the font will be bold
38: * @property boolean $FontItalic Determines if the font will be italicized
39: * @property string $FontNames Font family to be used (can use a value from QFontFamily class)
40: * @property boolean $FontOverline Determines if the font will have an overline
41: * @property string|integer $FontSize Font size of the element in this column
42: * @property boolean $FontStrikeout Determines if the font will be striked out
43: * @property boolean $FontUnderline Determines if the font will be underlined
44: * @property null|string $ForeColor Text Color of the element in this column
45: * @property string $HorizontalAlign The horizontal text alignment attribute for the element in this column
46: * @property string $VerticalAlign The vertical alignment attribute for the element in this column
47: * @property string|integer $Width Column width
48: * @property boolean $Wrap Determines if the column will have nowrap html attribute set on it or not
49: * @property mixed $OrderByClause The ordering clause associated with this column
50: * @property null|QQOrderBy $ReverseOrderByClause The REVERSED ordering clause associated with this column
51: * @property mixed $FilterByCommand
52: * @property-read array $FilterInfo
53: * @property integer $FilterBoxSize Determines the width ("size" attribute) of the input control of this column on the filter row
54: * @property string $FilterType Type of filter to be used for this column (text/list)
55: * @property mixed $FilterList
56: * @property integer $FilterColId The filter column id to be used for the column
57: * @property string $FilterPrefix
58: * @property string $FilterPostfix
59: * @property mixed $FilterConstant
60: * @property-read mixed $ActiveFilter
61: * @property-write mixed $Filter
62: * @property mixed $SortByCommand
63: * @property mixed $ReverseSortByCommand
64: * @property string $Html is the contents of the column itself -- the $this->strHtml contents can contain backticks ` to deliniate commands that are to be PHP evaled (again, see DataGrid.inc for more info)
65: * @property string $Name is the name of the column, as displayed in the DataGrid's header row for that column
66: * @property boolean $HtmlEntities Determines if the contents of this column have to be processed through HtmlEntities
67: * @property boolean $HasResetButton If the concerned row is a filter row then this variable determines if it has a Reset Button on it
68: */
69: class QDataGridLegacyColumn extends QBaseClass {
70: // APPEARANCE
71: /**
72: * @var null|string Background colour of an element of this column
73: * null = not specified in rendered HTML (browser or another CSS rule can determine value)
74: * string = applied as-is
75: */
76: protected $strBackColor = null;
77: /**
78: * @var null|string Border colour of an element of this column
79: * null = not specified in rendered HTML (browser or another CSS rule can determine value)
80: * string = applied as-is
81: */
82: protected $strBorderColor = null;
83: /** @var string Border style of an element of this column (constant from QBorderStyle class) */
84: protected $strBorderStyle = QBorderStyle::NotSet;
85: /**
86: * @var null|string Border width of an element of this column
87: * null = not specified in rendered HTML (browser or another CSS rule can determine value)
88: * string = applied as-is
89: */
90: protected $strBorderWidth = null;
91: /**
92: * @var null|string CSS class of an element of this column
93: * null = not specified in rendered HTML
94: * string = applied as-is
95: */
96: protected $strCssClass = null;
97: /** @var bool Determines if the font will be bold */
98: protected $blnFontBold = false;
99: /** @var bool Determines if the font will be italicized */
100: protected $blnFontItalic = false;
101: /** @var null|string Font family to be used (can use a value from QFontFamily class) */
102: protected $strFontNames = null;
103: /** @var bool Determines if the font will have an overline */
104: protected $blnFontOverline = false;
105: /**
106: * @var null|string|integer Font size of the element in this column
107: * null = not specified in rendered HTML (browser or another CSS rule can determine value)
108: * string = applies as-is
109: * integer = interpreted as value in pixels
110: */
111: protected $strFontSize = null;
112: /** @var bool Determines if the font will be striked out */
113: protected $blnFontStrikeout = false;
114: /** @var bool Determines if the font will be underlined */
115: protected $blnFontUnderline = false;
116: /**
117: * @var null|string Text Color of the element in this column
118: * null = not specified in rendered HTML (browser or another CSS rule can determine value)
119: * string = applied as-is
120: */
121: protected $strForeColor = null;
122: /** @var string The horizontal text alignment attribute for the element in this column */
123: protected $strHorizontalAlign = QHorizontalAlign::NotSet;
124: /** @var string The vertical alignment attribute for the element in this column */
125: protected $strVerticalAlign = QVerticalAlign::NotSet;
126: /**
127: * @var null|string|integer Column width
128: * null = not specified in rendered HTML (browser or another CSS rule can determine value)
129: * string = applies as-is
130: * integer = interpreted as value in pixels
131: */
132: protected $strWidth = null;
133: /** @var bool Determines if the column will have nowrap html attribute set on it or not */
134: protected $blnWrap = true;
135:
136: /** @var bool If the concerned row is a filter row then this variable determines if it has a Reset Button on it */
137: protected $blnHasResetButton = false;
138:
139: // BEHAVIOR
140: /**
141: * @var null|QQOrderBy The ordering clause associated with this column
142: * This clause is utilized when user clicks on the top row which can be used to order results
143: */
144: protected $objOrderByClause = null;
145: /**
146: * @var null|QQOrderBy The REVERSED ordering clause associated with this column
147: */
148: protected $objReverseOrderByClause = null;
149:
150: /** @var int Determines the width ("size" attribute) of the input control of this column on the filter row */
151: protected $intFilterBoxSize = 10;
152: /** @var string Type of filter to be used for this column (text/list) */
153: protected $strFilterType = QFilterType::None;
154: /**
155: * @var null|integer The filter column id to be used for the column
156: * It is derived from the index of the column in the datagrid
157: */
158: protected $intFilterColId = null;
159: protected $arrFilterList = array();
160:
161: //The filter this column has applied
162: protected $objActiveFilter = null;
163: //a Filter that gets applied in addition to $Filter when the user filters on this column
164: protected $objFilterConstant = null;
165:
166: protected $strFilterPrefix = '';
167: protected $strFilterPostfix = '';
168:
169: //manual filter commands
170: protected $arrFilterByCommand = null;
171:
172: // MISC
173: /** @var string Name of the column to be shown on the top row */
174: protected $strName;
175: /** @var null|string Contents of the column */
176: protected $strHtml;
177: /** @var bool Determines if the contents of this column have to be processed through HtmlEntities */
178: protected $blnHtmlEntities = true;
179:
180: /**
181: * Constructor
182: *
183: * @param string $strName Name of the column
184: * @param null|string $strHtml Text for the column (Can be processed through HtmlEntities)
185: * @param null|mixed $objOverrideParameters Parameters to be overriden (for func_get_args())
186: *
187: * @throws Exception
188: * @throws QCallerException
189: */
190: public function __construct($strName, $strHtml = null, $objOverrideParameters = null) {
191: $this->strName = $strName;
192: $this->strHtml = $strHtml;
193:
194: $objOverrideArray = func_get_args();
195: if (count($objOverrideArray) > 2)
196: try {
197: unset($objOverrideArray[0]);
198: unset($objOverrideArray[1]);
199: $this->OverrideAttributes($objOverrideArray);
200: } catch (QCallerException $objExc) {
201: $objExc->IncrementOffset();
202: throw $objExc;
203: }
204: }
205:
206: /**
207: * Returns the HTML attributes for the column
208: *
209: * @param bool $blnIncludeCustom [For future use only]
210: * @param bool $blnIncludeAction [For future use only]
211: *
212: * @return string
213: */
214: public function GetAttributes() {
215: $strToReturn = "";
216: $strStyle = "";
217:
218: if (!$this->blnWrap)
219: $strToReturn .= 'nowrap="nowrap" ';
220:
221: switch ($this->strHorizontalAlign) {
222: case QHorizontalAlign::Left:
223: $strStyle .= 'text-align:left;';
224: break;
225: case QHorizontalAlign::Right:
226: $strStyle .= 'text-align:right;';
227: break;
228: case QHorizontalAlign::Center:
229: $strStyle .= 'text-align:center;';
230: break;
231: case QHorizontalAlign::Justify:
232: $strStyle .= 'text-align:justify;';
233: break;
234: }
235:
236: switch ($this->strVerticalAlign) {
237: case QVerticalAlign::Top:
238: $strStyle .= 'vertical-align:top;';
239: break;
240: case QVerticalAlign::Middle:
241: $strStyle .= 'vertical-align:middle;';
242: break;
243: case QVerticalAlign::Bottom:
244: $strStyle .= 'vertical-align:bottom;';
245: break;
246: }
247:
248: if ($this->strCssClass)
249: $strToReturn .= sprintf('class="%s" ', $this->strCssClass);
250:
251: if ($this->strWidth) {
252: if (is_numeric($this->strWidth))
253: $strStyle .= sprintf("width:%spx;", $this->strWidth);
254: else
255: $strStyle .= sprintf("width:%s;", $this->strWidth);
256: }
257: if ($this->strForeColor)
258: $strStyle .= sprintf("color:%s;", $this->strForeColor);
259: if ($this->strBackColor)
260: $strStyle .= sprintf("background-color:%s;", $this->strBackColor);
261: if ($this->strBorderColor)
262: $strStyle .= sprintf("border-color:%s;", $this->strBorderColor);
263: if ($this->strBorderWidth) {
264: $strStyle .= sprintf("border-width:%s;", $this->strBorderWidth);
265: if ((!$this->strBorderStyle) || ($this->strBorderStyle == QBorderStyle::NotSet))
266: // For "No Border Style" -- apply a "solid" style because width is set
267: $strStyle .= "border-style:solid;";
268: }
269: if (($this->strBorderStyle) && ($this->strBorderStyle != QBorderStyle::NotSet))
270: $strStyle .= sprintf("border-style:%s;", $this->strBorderStyle);
271:
272: if ($this->strFontNames)
273: $strStyle .= sprintf("font-family:%s;", $this->strFontNames);
274: if ($this->strFontSize) {
275: if (is_numeric($this->strFontSize))
276: $strStyle .= sprintf("font-size:%spx;", $this->strFontSize);
277: else
278: $strStyle .= sprintf("font-size:%s;", $this->strFontSize);
279: }
280: if ($this->blnFontBold)
281: $strStyle .= "font-weight:bold;";
282: if ($this->blnFontItalic)
283: $strStyle .= "font-style:italic;";
284:
285: $strTextDecoration = "";
286: if ($this->blnFontUnderline)
287: $strTextDecoration .= "underline ";
288: if ($this->blnFontOverline)
289: $strTextDecoration .= "overline ";
290: if ($this->blnFontStrikeout)
291: $strTextDecoration .= "line-through ";
292:
293: if ($strTextDecoration) {
294: $strTextDecoration = trim($strTextDecoration);
295: $strStyle .= sprintf("text-decoration:%s;", $strTextDecoration);
296: }
297:
298: if ($strStyle)
299: $strToReturn .= sprintf('style="%s" ', $strStyle);
300:
301: return $strToReturn;
302: }
303:
304: /**
305: * Creates a list for a column's filter
306: * Two ways of calling the fuction:
307: * 1. specify only one paramter and it should be an advanced list item
308: * 2. the other way is to call it using 2 parameters with first one being a name and other a value
309: *
310: * @param null|string $arg1
311: * @param null|QQCondition $arg2
312: *
313: * @throws Exception
314: */
315: public function FilterAddListItem($arg1=null, $arg2=null) {
316: if($this->arrFilterList === null) {
317: $this->arrFilterList = array();
318: }
319: if($arg1 !== null && $arg2 instanceof QQCondition) {
320: //they passed in a name, condition pair
321: $this->arrFilterList[$arg1] = $arg2;
322: $this->strFilterType = QFilterType::ListFilter;
323: } elseif ($arg1 !== null) {
324: //else we are trying to make a simple list but make sure the name is supplied
325: $this->arrFilterList[$arg1] = $arg2;
326: $this->strFilterType = QFilterType::ListFilter;
327: } else {
328: //else fail the function and let the user know about correct use of parameters
329: throw new Exception("Please specify a name and QQCondition pair OR a name and value pair as parameters.");
330: }
331: }
332:
333: /**
334: * Tells whether or not the column has a filter
335: * @return bool Does the column have a filter?
336: */
337: public function HasFilter() {
338: return $this->ActiveFilter !== null || $this->FilterByCommand !== null || $this->FilterType != QFilterType::None;
339: }
340:
341: /**
342: * @param mixed $mixFilterValue for the custom filters, $mixFilterValue will be set as FilterByCommand['value'].
343: * Otherwise, if $mixFilterValue is a QQ condition, it's set as the active filter.
344: * If $mixFilterValue is not a QQ condition, then it's either the value of the
345: * filter for text box filters, or it's the index into the filter list for the list
346: * box filters.
347: *
348: * @return void
349: */
350: public function SetActiveFilterState($mixFilterValue) {
351: //deal with any manual filters
352: if ($this->FilterByCommand !== null) {
353: //update the column's filterByCommand with the user-entered value
354: $filter = $this->FilterByCommand;
355:
356: if($mixFilterValue !== null)
357: $filter['value'] = $mixFilterValue;
358: else if(isset($filter['value']))
359: unset($filter['value']);
360:
361: $this->FilterByCommand = $filter;
362: } elseif ($mixFilterValue !== null) { //Handle the other methods differently
363: switch ($this->FilterType) {
364: case QFilterType::ListFilter:
365: $this->objActiveFilter = $this->arrFilterList[$mixFilterValue];
366: break;
367: default:
368: case QFilterType::TextFilter;
369: $this->objActiveFilter = $this->arrFilterList[0];
370: $this->FilterSetOperand($mixFilterValue);
371: }
372: } else {
373: $this->ClearFilter();
374: }
375: }
376:
377: public function GetActiveFilterState() {
378: return $this->GetActiveFilterValue();
379: }
380:
381: public function GetActiveFilterValue() {
382: $value = null;
383: //for manual queries
384: if (isset($this->FilterByCommand['value']))
385: $value = $this->FilterByCommand['value'];
386: //for lists
387: elseif (null !== $this->ActiveFilter && $this->FilterType == QFilterType::ListFilter)
388: $value = array_search($this->ActiveFilter, $this->FilterList);
389: //or for text
390: elseif (null !== $this->FilterList && count($this->FilterList) > 0 && $this->FilterType == QFilterType::TextFilter) {
391: $value = $this->FilterList[0]->mixOperand;
392: if (null !== $value) {
393: //Strip prefix and postfix
394: if (null !== $this->FilterPrefix) {
395: $prefixLength = strlen($this->FilterPrefix);
396: if(substr($value, 0, $prefixLength) == $this->FilterPrefix)
397: $value = substr($value, $prefixLength);
398: }
399: if (null !== $this->FilterPostfix) {
400: $postfixLength = strlen($this->FilterPostfix);
401: if(substr($value, strlen($value) - $postfixLength) == $this->FilterPostfix)
402: $value = substr($value, 0, strlen($value) - $postfixLength);
403: }
404: }
405: }
406: return $value;
407: }
408:
409: private function FilterSetOperand($mixOperand) {
410: try {
411: if(null === $this->objActiveFilter) {
412: return;
413: } elseif($this->objActiveFilter instanceof QQConditionComparison) {
414: if ($mixOperand instanceof QQNamedValue) {
415: $this->objActiveFilter->mixOperand = $mixOperand;
416: } else if ($mixOperand instanceof QQAssociationNode) {
417: throw new QInvalidCastException('Comparison operand cannot be an Association-based QQNode', 3);
418: } else if ($mixOperand instanceof QQCondition) {
419: throw new QInvalidCastException('Comparison operand cannot be a QQCondition', 3);
420: } else if ($mixOperand instanceof QQClause) {
421: throw new QInvalidCastException('Comparison operand cannot be a QQClause', 3);
422: } else if ($mixOperand instanceof QQNode) {
423: if (!$mixOperand->_ParentNode)
424: throw new QInvalidCastException('Unable to cast "' . $mixOperand->_Name . '" table to Column-based QQNode', 3);
425: $this->objActiveFilter->mixOperand = $mixOperand;
426: } else {
427: //must be a string, apply the pre and postfix (This also handles custom filters)
428: $mixOperand = $this->strFilterPrefix . $mixOperand . $this->strFilterPostfix;
429: $this->objActiveFilter->mixOperand = $mixOperand;
430: }
431: } else {
432: throw new Exception('Trying to set Operand on a filter that does not take operands');
433: }
434: } catch (QInvalidCastException $objExc) {
435: $objExc->IncrementOffset();
436: throw $objExc;
437: }
438: }
439:
440: public function ClearFilter() {
441: $this->objActiveFilter = null;
442: if($this->arrFilterByCommand !== null)
443: $this->arrFilterByCommand['value'] = null;
444: }
445:
446:
447: /////////////////////////
448: // Public Properties: GET
449: /////////////////////////
450: /**
451: * PHP magic method
452: * @param string $strName
453: *
454: * @return mixed
455: * @throws Exception|QCallerException
456: */
457: public function __get($strName) {
458: switch ($strName) {
459: // APPEARANCE
460: case "BackColor": return $this->strBackColor;
461: case "BorderColor": return $this->strBorderColor;
462: case "BorderStyle": return $this->strBorderStyle;
463: case "BorderWidth": return $this->strBorderWidth;
464: case "CssClass": return $this->strCssClass;
465: case "FontBold": return $this->blnFontBold;
466: case "FontItalic": return $this->blnFontItalic;
467: case "FontNames": return $this->strFontNames;
468: case "FontOverline": return $this->blnFontOverline;
469: case "FontSize": return $this->strFontSize;
470: case "FontStrikeout": return $this->blnFontStrikeout;
471: case "FontUnderline": return $this->blnFontUnderline;
472: case "ForeColor": return $this->strForeColor;
473: case "HorizontalAlign": return $this->strHorizontalAlign;
474: case "VerticalAlign": return $this->strVerticalAlign;
475: case "Width": return $this->strWidth;
476: case "Wrap": return $this->blnWrap;
477:
478: // BEHAVIOR
479: case "OrderByClause": return $this->objOrderByClause;
480: case "ReverseOrderByClause": return $this->objReverseOrderByClause;
481:
482: case "FilterByCommand": return $this->arrFilterByCommand;
483: case "FilterBoxSize": return $this->intFilterBoxSize;
484: case "FilterInfo": {
485: if (!isset($this->FilterByCommand['value'])) {
486: return null;
487: }
488: $filterCommand = $this->FilterByCommand;
489: $filterCommand['clause_operator'] = 'AND';
490: //apply the pre and postfix
491: $filterCommand['value'] = $filterCommand['prefix'] . $filterCommand['value'] . $filterCommand['postfix'];
492: return $filterCommand;
493: }
494: case "FilterType": return $this->strFilterType;
495: case "FilterList": return $this->arrFilterList;
496: case "FilterColId": return $this->intFilterColId;
497:
498: case "FilterPrefix": return $this->strFilterPrefix;
499: case "FilterPostfix": return $this->strFilterPostfix;
500:
501: case "FilterConstant": return $this->objFilterConstant;
502: case "ActiveFilter": return $this->objActiveFilter;
503:
504: // MANUAL QUERY BEHAVIORS
505: case "SortByCommand": return $this->objOrderByClause;
506: case "ReverseSortByCommand": return $this->objReverseOrderByClause;
507:
508: // MISC
509: case "Html": return $this->strHtml;
510: case "Name": return $this->strName;
511: case "HtmlEntities": return $this->blnHtmlEntities;
512: case "HasResetButton": return $this->blnHasResetButton;
513:
514: default:
515: try {
516: return parent::__get($strName);
517: } catch (QCallerException $objExc) {
518: $objExc->IncrementOffset();
519: throw $objExc;
520: }
521: }
522: }
523:
524: /////////////////////////
525: // Public Properties: SET
526: /////////////////////////
527: /**
528: * PHP magic method
529: *
530: * @param string $strName
531: * @param string $mixValue
532: *
533: * @return mixed
534: *
535: * @throws Exception|QCallerException|QInvalidCastException
536: */
537: public function __set($strName, $mixValue) {
538: switch ($strName) {
539: // APPEARANCE
540: case "BackColor":
541: try {
542: $this->strBackColor = QType::Cast($mixValue, QType::String);
543: break;
544: } catch (QInvalidCastException $objExc) {
545: $objExc->IncrementOffset();
546: throw $objExc;
547: }
548: case "BorderColor":
549: try {
550: $this->strBorderColor = QType::Cast($mixValue, QType::String);
551: break;
552: } catch (QInvalidCastException $objExc) {
553: $objExc->IncrementOffset();
554: throw $objExc;
555: }
556: case "BorderStyle":
557: try {
558: $this->strBorderStyle = QType::Cast($mixValue, QType::String);
559: break;
560: } catch (QInvalidCastException $objExc) {
561: $objExc->IncrementOffset();
562: throw $objExc;
563: }
564: case "BorderWidth":
565: try {
566: $this->strBorderWidth = QType::Cast($mixValue, QType::String);
567: break;
568: } catch (QInvalidCastException $objExc) {
569: $objExc->IncrementOffset();
570: throw $objExc;
571: }
572: case "CssClass":
573: try {
574: $this->strCssClass = QType::Cast($mixValue, QType::String);
575: break;
576: } catch (QInvalidCastException $objExc) {
577: $objExc->IncrementOffset();
578: throw $objExc;
579: }
580: case "FontBold":
581: try {
582: $this->blnFontBold = QType::Cast($mixValue, QType::Boolean);
583: break;
584: } catch (QInvalidCastException $objExc) {
585: $objExc->IncrementOffset();
586: throw $objExc;
587: }
588: case "FontItalic":
589: try {
590: $this->blnFontItalic = QType::Cast($mixValue, QType::Boolean);
591: break;
592: } catch (QInvalidCastException $objExc) {
593: $objExc->IncrementOffset();
594: throw $objExc;
595: }
596: case "FontNames":
597: try {
598: $this->strFontNames = QType::Cast($mixValue, QType::String);
599: break;
600: } catch (QInvalidCastException $objExc) {
601: $objExc->IncrementOffset();
602: throw $objExc;
603: }
604: case "FontOverline":
605: try {
606: $this->blnFontOverline = QType::Cast($mixValue, QType::Boolean);
607: break;
608: } catch (QInvalidCastException $objExc) {
609: $objExc->IncrementOffset();
610: throw $objExc;
611: }
612: case "FontSize":
613: try {
614: $this->strFontSize = QType::Cast($mixValue, QType::String);
615: break;
616: } catch (QInvalidCastException $objExc) {
617: $objExc->IncrementOffset();
618: throw $objExc;
619: }
620: case "FontStrikeout":
621: try {
622: $this->blnFontStrikeout = QType::Cast($mixValue, QType::Boolean);
623: break;
624: } catch (QInvalidCastException $objExc) {
625: $objExc->IncrementOffset();
626: throw $objExc;
627: }
628: case "FontUnderline":
629: try {
630: $this->blnFontUnderline = QType::Cast($mixValue, QType::Boolean);
631: break;
632: } catch (QInvalidCastException $objExc) {
633: $objExc->IncrementOffset();
634: throw $objExc;
635: }
636: case "ForeColor":
637: try {
638: $this->strForeColor = QType::Cast($mixValue, QType::String);
639: break;
640: } catch (QInvalidCastException $objExc) {
641: $objExc->IncrementOffset();
642: throw $objExc;
643: }
644: case "HorizontalAlign":
645: try {
646: $this->strHorizontalAlign = QType::Cast($mixValue, QType::String);
647: break;
648: } catch (QInvalidCastException $objExc) {
649: $objExc->IncrementOffset();
650: throw $objExc;
651: }
652: case "VerticalAlign":
653: try {
654: $this->strVerticalAlign = QType::Cast($mixValue, QType::String);
655: break;
656: } catch (QInvalidCastException $objExc) {
657: $objExc->IncrementOffset();
658: throw $objExc;
659: }
660: case "Width":
661: try {
662: $this->strWidth = QType::Cast($mixValue, QType::String);
663: break;
664: } catch (QInvalidCastException $objExc) {
665: $objExc->IncrementOffset();
666: throw $objExc;
667: }
668: case "Wrap":
669: try {
670: $this->blnWrap = QType::Cast($mixValue, QType::Boolean);
671: break;
672: } catch (QInvalidCastException $objExc) {
673: $objExc->IncrementOffset();
674: throw $objExc;
675: }
676:
677:
678: // BEHAVIOR
679: case "OrderByClause":
680: try {
681: $this->objOrderByClause = QType::Cast($mixValue, 'QQOrderBy');
682: break;
683: } catch (QInvalidCastException $objExc) {
684: $objExc->IncrementOffset();
685: throw $objExc;
686: }
687: case "ReverseOrderByClause":
688: try {
689: $this->objReverseOrderByClause = QType::Cast($mixValue, 'QQOrderBy');
690: break;
691: } catch (QInvalidCastException $objExc) {
692: $objExc->IncrementOffset();
693: throw $objExc;
694: }
695: case "FilterConstant":
696: try {
697: $this->objFilterConstant = $mixValue;
698: break;
699: } catch(QInvalidCastException $objExc) {
700: $objExc->IncrementOffset();
701: throw $objExc;
702: }
703:
704:
705: case "FilterPrefix":
706: try {
707: $this->strFilterPrefix = QType::Cast($mixValue, QType::String);
708: break;
709: } catch (QInvalidCastException $objExc) {
710: $objExc->IncrementOffset();
711: throw $objExc;
712: }
713: case "FilterPostfix":
714: try {
715: $this->strFilterPostfix = QType::Cast($mixValue, QType::String);
716: break;
717: } catch (QInvalidCastException $objExc) {
718: $objExc->IncrementOffset();
719: throw $objExc;
720: }
721:
722: case "FilterType":
723: try {
724: $this->strFilterType= QType::Cast($mixValue, QType::String);
725: if($this->strFilterType == QFilterType::None)
726: {
727: $this->objActiveFilter = null;
728: $this->FilterByCommand = null;
729: }
730: break;
731: } catch (QInvalidCastException $objExc) {
732: $objExc->IncrementOffset();
733: throw $objExc;
734: }
735:
736: case "FilterColId":
737: try {
738: $this->intFilterColId = QType::Cast($mixValue, QType::Integer);
739: break;
740: } catch (QInvalidCastException $objExc) {
741: $objExc->IncrementOffset();
742: throw $objExc;
743: }
744:
745: case "Filter":
746: try {
747: if(null === $mixValue)
748: $this->arrFilterList = null;
749: else
750: $this->arrFilterList = array($mixValue);
751: break;
752: } catch(QInvalidCastException $objExc) {
753: $objExc->IncrementOffset();
754: throw $objExc;
755: }
756:
757: case "FilterBoxSize":
758: try {
759: $this->intFilterBoxSize = QType::Cast($mixValue, QType::Integer);
760: $this->FilterType = 'Text';
761: break;
762: } catch (QInvalidCastException $objExc) {
763: $objExc->IncrementOffset();
764: throw $objExc;
765: }
766:
767: case "FilterList":
768: try {
769: $this->arrFilterList = QType::Cast($mixValue, QType::ArrayType);
770: $this->strFilterType = QFilterType::ListFilter;
771: break;
772: } catch (QInvalidCastException $objExc) {
773: $objExc->IncrementOffset();
774: throw $objExc;
775: }
776:
777: // MANUAL QUERY BEHAVIOR
778: case "FilterByCommand":
779: try {
780: if(null === $mixValue) {
781: $this->arrFilterByCommand = null;
782: break;
783: }
784:
785: $arr = QType::Cast($mixValue, QType::ArrayType);
786: //ensure pre and postfix exist
787: if(!isset($arr['prefix']))
788: $arr['prefix'] = '';
789: if(!isset($arr['postfix']))
790: $arr['postfix'] = '';
791: $this->arrFilterByCommand = $arr;
792: break;
793: } catch (QInvalidCastException $objExc) {
794: $objExc->IncrementOffset();
795: throw $objExc;
796: }
797:
798: case "SortByCommand":
799: try {
800: $this->objOrderByClause = QType::Cast($mixValue, QType::String);
801: break;
802: } catch (QInvalidCastException $objExc) {
803: $objExc->IncrementOffset();
804: throw $objExc;
805: }
806: case "ReverseSortByCommand":
807: try {
808: $this->objReverseOrderByClause = QType::Cast($mixValue, QType::String);
809: break;
810: } catch (QInvalidCastException $objExc) {
811: $objExc->IncrementOffset();
812: throw $objExc;
813: }
814:
815:
816: // MISC
817: case "Html":
818: try {
819: $this->strHtml = QType::Cast($mixValue, QType::String);
820: break;
821: } catch (QInvalidCastException $objExc) {
822: $objExc->IncrementOffset();
823: throw $objExc;
824: }
825: case "Name":
826: try {
827: $this->strName = QType::Cast($mixValue, QType::String);
828: break;
829: } catch (QInvalidCastException $objExc) {
830: $objExc->IncrementOffset();
831: throw $objExc;
832: }
833: case "HtmlEntities":
834: try {
835: $this->blnHtmlEntities = QType::Cast($mixValue, QType::Boolean);
836: break;
837: } catch (QInvalidCastException $objExc) {
838: $objExc->IncrementOffset();
839: throw $objExc;
840: }
841:
842: case "HasResetButton":
843: try {
844: $this->blnHasResetButton = QType::Cast($mixValue, QType::Boolean);
845: break;
846: } catch (QInvalidCastException $objExc) {
847: $objExc->IncrementOffset();
848: throw $objExc;
849: }
850:
851:
852: default:
853: try {
854: parent::__set($strName, $mixValue);
855: break;
856: } catch (QCallerException $objExc) {
857: $objExc->IncrementOffset();
858: throw $objExc;
859: }
860: }
861: }
862: }
863: