Phundament-Packages
[ class tree: Phundament-Packages ] [ index: Phundament-Packages ] [ 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 Phundament.Packages
  12.  * @subpackage LContent
  13.  */
  14.  
  15. /**
  16.  * builts predefined criterias for LContent
  17.  *
  18.  * @package System.Data
  19.  * @subpackage Criterias
  20.  */
  21.  
  22. {
  23.     private $_parameters;
  24.  
  25.     function __construct()
  26.     {
  27.         $this->_parametersnew TMap;
  28.         Prado :: using("LContentCore");
  29.     }
  30.     function setSearchString($value)
  31.     {
  32.         $this->_parameters['SearchString']$value;
  33.     }
  34.     function getSearchString()
  35.     {
  36.         return $this->_parameters['SearchString'];
  37.     }
  38.     function setType($value)
  39.     {
  40.         $this->_parameters['Type']$value;
  41.     }
  42.     function getType()
  43.     {
  44.         return $this->_parameters['Type'];
  45.     }
  46.     function setStatus($value)
  47.     {
  48.         $this->_parameters['Status']$value;
  49.     }
  50.     function getStatus()
  51.     {
  52.         return $this->_parameters['Status'];
  53.     }
  54.  
  55.     function setId($value)
  56.     {
  57.         $this->_parameters['Id']$value;
  58.     }
  59.     function getId()
  60.     {
  61.         return $this->_parameters['Id'];
  62.     }
  63.  
  64.     function setIgnoreCulture($value)
  65.     {
  66.         $this->_parameters['IgnoreCulture']$value;
  67.     }
  68.     function getIgnoreCulture()
  69.     {
  70.         return $this->_parameters['IgnoreCulture'];
  71.     }
  72.  
  73.     function setInFuture($value)
  74.     {
  75.         $this->_parameters['InFuture']$value;
  76.     }
  77.     function getInFuture()
  78.     {
  79.         return $this->_parameters['InFuture'];
  80.     }
  81.  
  82.     /**
  83.      * returns the criteria object
  84.      */
  85.     function build()
  86.     {
  87.         $cnew Criteria;
  88.  
  89.         if ($param$this->getId())
  90.         {
  91.             $c->addAnd(LContentPeer :: ID$param);
  92.             return $c;
  93.         }
  94.  
  95.         if ($this->getIgnoreCulture(== false)
  96.         {
  97.             $c->add(LContentPeer :: CULTUREstrtoupper(Prado :: getApplication()->Globalization->Culture));
  98.         }
  99.  
  100.         if ($param$this->getSearchString())
  101.         {
  102.             $arrayLithron :: createArrayFromString($param);
  103.             foreach ($array AS $string)
  104.             {
  105.                 $c1$c->getNewCriterion(LContentPeer :: HEADLINE"%{$string}%"Criteria :: LIKE);
  106.                 $c2$c->getNewCriterion(LContentPeer :: SUBLINE"%{$string}%"Criteria :: LIKE);
  107.                 $c3$c->getNewCriterion(LContentPeer :: TYPE"%{$string}%"Criteria :: LIKE);
  108.                 $c4$c->getNewCriterion(LContentPeer :: CATEGORY"%{$string}%"Criteria :: LIKE);
  109.                 $c5$c->getNewCriterion(LContentPeer :: TEXT"%{$string}%"Criteria :: LIKE);
  110.                 $c6$c->getNewCriterion(LContentPeer :: ALIAS"%{$string}%"Criteria :: LIKE);
  111.                 $c1->addOr($c6);
  112.                 $c1->addOr($c5);
  113.                 $c1->addOr($c4);
  114.                 $c1->addOr($c3);
  115.                 $c1->addOr($c2);
  116.                 $c->add($c1);
  117.             }
  118.         }
  119.         if ($param$this->getType())
  120.         {
  121.             $c->add(LContentPeer :: TYPE$param);
  122.         }
  123.         if ($param$this->getStatus())
  124.         {
  125.             $c->addAnd(LContentPeer :: STATUS$param);
  126.         }
  127.         if ($param$this->getInFuture())
  128.         {
  129.             $c->addAnd(LContentPeer :: START_DATEdate("Y-m-d")Criteria :: GREATER_EQUAL);
  130.         }
  131.         return $c;
  132.     }
  133. }
  134. ?>

Documentation generated on Sun, 25 Feb 2007 16:10:04 +0100 by phpDocumentor 1.3.1