Exemplo n.º 1
0
 public function filter($c, $filters)
 {
     $group = $this->getContext()->getUser()->getAttribute('group', null, 'bo');
     if ($group != 'root') {
         $this->forward('default', 'index');
     }
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'name') {
             $column = JobI18nPeer::getTableMap()->getColumn($key);
         } else {
             $column = JobPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER) {
                 $c->add($name, $value);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR) {
                     if ($key == 'name') {
                         $c->addJoin(JobI18nPeer::ID, JobPeer::ID, Criteria::LEFT_JOIN);
                         $c->add($name, "%{$value}%", Criteria::LIKE);
                     } else {
                         $c->add($name, "%{$value}%", Criteria::LIKE);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public static function retrieveByPK($id, $culture, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(JobI18nPeer::ID, $id);
     $criteria->add(JobI18nPeer::CULTURE, $culture);
     $v = JobI18nPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
Exemplo n.º 3
0
 protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
 {
     $affectedRows = 0;
     $objects = JobPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         include_once 'lib/model/JobI18n.php';
         $c = new Criteria();
         $c->add(JobI18nPeer::ID, $obj->getId());
         $affectedRows += JobI18nPeer::doDelete($c, $con);
     }
     return $affectedRows;
 }
Exemplo n.º 4
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = JobI18nPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setName($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setCulture($arr[$keys[2]]);
     }
 }
Exemplo n.º 5
0
 public function getCurrentJobI18n()
 {
     if (!isset($this->current_i18n[$this->culture])) {
         $obj = JobI18nPeer::retrieveByPK($this->getId(), $this->culture);
         if ($obj) {
             $this->setJobI18nForCulture($obj, $this->culture);
         } else {
             $this->setJobI18nForCulture(new JobI18n(), $this->culture);
             $this->current_i18n[$this->culture]->setCulture($this->culture);
         }
     }
     return $this->current_i18n[$this->culture];
 }