- <?php
-
-
- /**
- * Class file.
- *
- * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
- * @copyright 2005, diemeisterei GmbH. All rights reserved.
- * @author $Author: schmunk $
- * @version $Revision: 233 $ $Date: 2006-05-30 17:14:13 +0200 (Di, 30 Mai 2006) $
- * @package Lithron.LContent
- * @subpackage Core
- */
-
- /**
- * builts predefined criterias for LContent
- *
- * @package Lithron.LContent
- * @subpackage Core
- */
-
- class LContentCriteria
- {
- private $_parameters;
-
- function __construct()
- {
- $this->_parameters = new TMap;
- Prado::using("LContentCore");
- }
- function setSearchString($value)
- {
- $this->_parameters['SearchString']= $value;
- }
- function getSearchString()
- {
- return $this->_parameters['SearchString'];
- }
- function setType($value)
- {
- $this->_parameters['Type']= $value;
- }
- function getType()
- {
- return $this->_parameters['Type'];
- }
- function setStatus($value)
- {
- $this->_parameters['Status']= $value;
- }
- function getStatus()
- {
- return $this->_parameters['Status'];
- }
-
- /**
- * returns the criteria object
- */
- function build()
- {
- $c= new Criteria;
-
- if ($param= $this->getSearchString())
- {
- $c1= $c->getNewCriterion(LContentPeer :: HEADLINE, "%{$param}%", Criteria :: LIKE);
- $c2= $c->getNewCriterion(LContentPeer :: SUBLINE, "%{$param}%", Criteria :: LIKE);
- $c3= $c->getNewCriterion(LContentPeer :: TYPE, "%{$param}%", Criteria :: LIKE);
- $c4= $c->getNewCriterion(LContentPeer :: CATEGORY, "%{$param}%", Criteria :: LIKE);
- $c1->addOr($c3);
- $c1->addOr($c2);
- $c->add($c1);
- }
- if ($param= $this->getType())
- {
- $c->add(LContentPeer :: TYPE, $param);
- }
- if ($param= $this->getStatus())
- {
- $c->addAnd(LContentPeer :: STATUS, $param);
- }
- return $c;
- }
- }
- ?>