Lithron.LContent
[ class tree: Lithron.LContent ] [ index: Lithron.LContent ] [ all elements ]

Source for file LContentCriteria.php

Documentation is available at LContentCriteria.php

  1. <?php
  2.  
  3.  
  4. /**
  5. * Class file.
  6. *
  7. * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
  8. * @copyright 2005, diemeisterei GmbH. All rights reserved.
  9. * @author $Author: schmunk $
  10. * @version $Revision: 233 $ $Date: 2006-05-30 17:14:13 +0200 (Di, 30 Mai 2006) $
  11. * @package Lithron.LContent
  12. * @subpackage Core
  13. */
  14.  
  15. /**
  16. * builts predefined criterias for LContent
  17. *
  18. * @package Lithron.LContent
  19. * @subpackage Core
  20. */
  21.  
  22. class LContentCriteria
  23. {
  24. private $_parameters;
  25.  
  26. function __construct()
  27. {
  28. $this->_parameters = new TMap;
  29. Prado::using("LContentCore");
  30. }
  31. function setSearchString($value)
  32. {
  33. $this->_parameters['SearchString']= $value;
  34. }
  35. function getSearchString()
  36. {
  37. return $this->_parameters['SearchString'];
  38. }
  39. function setType($value)
  40. {
  41. $this->_parameters['Type']= $value;
  42. }
  43. function getType()
  44. {
  45. return $this->_parameters['Type'];
  46. }
  47. function setStatus($value)
  48. {
  49. $this->_parameters['Status']= $value;
  50. }
  51. function getStatus()
  52. {
  53. return $this->_parameters['Status'];
  54. }
  55.  
  56. /**
  57. * returns the criteria object
  58. */
  59. function build()
  60. {
  61. $c= new Criteria;
  62.  
  63. if ($param= $this->getSearchString())
  64. {
  65. $c1= $c->getNewCriterion(LContentPeer :: HEADLINE, "%{$param}%", Criteria :: LIKE);
  66. $c2= $c->getNewCriterion(LContentPeer :: SUBLINE, "%{$param}%", Criteria :: LIKE);
  67. $c3= $c->getNewCriterion(LContentPeer :: TYPE, "%{$param}%", Criteria :: LIKE);
  68. $c4= $c->getNewCriterion(LContentPeer :: CATEGORY, "%{$param}%", Criteria :: LIKE);
  69. $c1->addOr($c3);
  70. $c1->addOr($c2);
  71. $c->add($c1);
  72. }
  73. if ($param= $this->getType())
  74. {
  75. $c->add(LContentPeer :: TYPE, $param);
  76. }
  77. if ($param= $this->getStatus())
  78. {
  79. $c->addAnd(LContentPeer :: STATUS, $param);
  80. }
  81. return $c;
  82. }
  83. }
  84. ?>

Documentation generated on Tue, 20 Jun 2006 05:15:04 +0200 by phpDocumentor 1.3.0RC4