/** * appends sql to given select statement * * @param Zend_Db_Select $_select * @param Tinebase_Backend_Sql_Abstract $_backend * * @todo to be removed once we split filter model / backend */ public function appendFilterSql($_select, $_backend) { $now = new Tinebase_DateTime(); $now->setHour(0)->setMinute(0)->setSecond(0); $db = Tinebase_Core::getDb(); if ($this->_value == 1) { $_select->where($db->quoteInto('(' . $db->quoteIdentifier('employment_end') . ' >= ? ', $now, 'datetime') . ' OR ' . $db->quoteIdentifier('employment_end') . ' IS NULL )'); $_select->where($db->quoteInto('( ' . $db->quoteIdentifier('employment_begin') . ' <= ? ', $now, 'datetime') . ' OR ( ' . $db->quoteIdentifier('employment_begin') . ' IS NULL ))'); } else { $_select->where($db->quoteInto($db->quoteIdentifier('employment_end') . ' < ? ', $now, 'datetime')); $_select->orWhere($db->quoteInto($db->quoteIdentifier('employment_begin') . ' > ? ', $now, 'datetime')); } }
/** * Creates XML Data for a combobox * * Hours: 0 to 24 * * @param string $default * @return string */ protected function _createTimespanDataXML($start = 0, $end = 24) { $doc = new DomDocument('1.0'); $options = $doc->createElement('options'); $doc->appendChild($options); $time = new Tinebase_DateTime('@0'); for ($i = $start; $i <= $end; $i++) { $time->setHour($i); $timeString = $time->format('H:i'); if ($i == $end && $timeString == '00:00') { $timeString = '24:00'; } $value = $doc->createElement('value'); $value->appendChild($doc->createTextNode($timeString)); $label = $doc->createElement('label'); $label->appendChild($doc->createTextNode($timeString)); // @todo l10n $option = $doc->createElement('option'); $option->appendChild($value); $option->appendChild($label); $options->appendChild($option); } return $doc->saveXML(); }