'creationdate' =>
array (
'dbtype' => 'timestamp',
'phptype' => 'timestamp',
'null' => false,
'default' => 'CURRENT_TIMESTAMP',
public function getData() {
$isLimit = !empty($scriptProperties['limit']);
$start = $this->getProperty('start');
$limit = $this->getProperty('limit');
$sort = $this->getProperty('sort');
$dir = $this->getProperty('dir');
$query = $this->getProperty('query');
$isLimit = !empty($limit);
$searchitem = $this->getProperty('searchitem',false);
$searchtype = $this->getProperty('searchtype',false);
$searchdate = $this->getProperty('searchdate',false);
$data = array();
/* build query */
$c = $this->modx->newQuery('Activation');
$c ->select('Activation.*, Manufacturer.name as manufacturername, Location.region, Location.city, Location.postalcode, Location.street, Location.number');
$c ->leftJoin('Location', 'Location', array('Activation.location = Location.id'));
$c ->leftJoin('Manufacturer', 'Manufacturer', array('Activation.manufacturer = Manufacturer.id'));
if (!empty($searchitem) && !empty($searchtype)) {
switch ($searchtype) {
case "manufacturername":
$c->where(array('Activation.confirmed' => 1, 'Manufacturer.name' => $searchitem));
break;
default:
$c->where(array('Activation.confirmed' => 1, 'Activation.'.$searchtype => $searchitem));
break;
}
} else {
$c->where(array('Activation.confirmed' => 1));
}
$data['total'] = $this->modx->getCount('Activation',$c);
$c->sortby($this->getProperty('sort'),$this->getProperty('dir'));
$c->sortby('serial','DESC');
if ($isLimit) $c->limit($limit,$this->getProperty('start'));
$data['results'] = $this->modx->getIterator('Activation',$c);
return $data;
}
This question has been answered by Bruno17. See the first response.
$thisdaystart = strtotime(strftime('%Y-%m-%d',$date) );
$nextdaystart = strtotime(strftime('%Y-%m-%d',$date + 24 * 60 *60));
$c->where(array('creationdate:>='=>$thisdaystart,'creationdate:<'=>$nextdaystart));