Esempio n. 1
0
 function buildDSRetrivalSQL($data, &$joins, &$where, $andOperation = false)
 {
     ## Check its not a regexp
     if (preg_match('/^mysql:/i', $data[0])) {
         $field_id = $this->get('id');
         $expression = str_replace(array('mysql:', 'value'), array('', " `t{$field_id}`.`value` "), $data[0]);
         $joins .= " LEFT JOIN `tbl_entries_data_{$field_id}` AS `t{$field_id}` ON (`e`.`id` = `t{$field_id}`.entry_id) ";
         $where .= " AND {$expression} ";
     } else {
         parent::buildDSRetrivalSQL($data, $joins, $where, $andOperation);
     }
     return true;
 }
Esempio n. 2
0
 function buildDSRetrivalSQL($data, &$joins, &$where, $andOperation = false)
 {
     $data[0] = self::__hashit($data[0]);
     parent::buildDSRetrivalSQL($data, $joins, $where, $andOperation);
     return true;
 }
Esempio n. 3
0
 /**
  * Build data source retrival sql.
  *
  * @param array $data
  * @param string $joins
  * @param string $where
  * @param boolean $andOperation
  */
 function buildDSRetrivalSQL($data, &$joins, &$where, $andOperation = false)
 {
     if (self::isFilterRegex($data[0])) {
         return parent::buildDSRetrivalSQL($data, $joins, $where, $andOperation);
     }
     $parsed = array();
     foreach ($data as $string) {
         $type = self::__parseFilter($string);
         if ($type == self::ERROR) {
             return false;
         }
         if (!is_array($parsed[$type])) {
             $parsed[$type] = array();
         }
         $parsed[$type][] = $string;
     }
     foreach ($parsed as $type => $value) {
         switch ($type) {
             case self::RANGE:
                 if (!empty($value)) {
                     $this->__buildRangeFilterSQL($value, $joins, $where, $andOperation);
                 }
                 break;
             case self::SIMPLE:
                 if (!empty($value)) {
                     $this->__buildSimpleFilterSQL($value, $joins, $where, $andOperation);
                 }
                 break;
         }
     }
     return true;
 }
 function buildDSRetrivalSQL($data, &$joins, &$where, $andOperation = false)
 {
     ## Check its not a regexp
     if (preg_match('/\\bto\\b/i', $data[0])) {
         $field_id = $this->get('id');
         list($from, $to) = preg_split('/\\bto\\b/i', $data[0]);
         $from = trim($from);
         $to = trim($to);
         $from_sec = self::timeStringToInt($from);
         $to_sec = self::timeStringToInt($to);
         $joins .= " LEFT JOIN `tbl_entries_data_{$field_id}` AS `t{$field_id}` ON (`e`.`id` = `t{$field_id}`.entry_id) ";
         $where .= " AND (t{$field_id}.`value` > {$from_sec} AND t{$field_id}.`value` < {$to_sec}) ";
     } else {
         $data[0] = self::timeStringToInt($data[0]);
         parent::buildDSRetrivalSQL($data, $joins, $where, $andOperation);
     }
     return true;
 }