can make show as many hours long in duration as wanted.
This commit is contained in:
parent
54398b8c32
commit
ddddcc9375
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
// This file generated by Propel 1.5.2 convert-conf target
|
||||
// from XML runtime conf file /home/martin/workspace/airtime/build/runtime-conf.xml
|
||||
// from XML runtime conf file /home/naomiaro/dev-campcaster/campcaster/build/runtime-conf.xml
|
||||
$conf = array (
|
||||
'datasources' =>
|
||||
array (
|
||||
|
@ -17,4 +17,4 @@ $conf = array (
|
|||
'generator_version' => '1.5.2',
|
||||
);
|
||||
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
|
||||
return $conf;
|
||||
return $conf;
|
|
@ -38,10 +38,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
'value' => '1:00',
|
||||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm', 'messages' => 'Show must be under 24 hours'))
|
||||
)
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('regex', false,
|
||||
array('/^\d+:[0-5][0-9]$/',
|
||||
'messages' => 'enter a duration: HH:mm'))
|
||||
)
|
||||
));
|
||||
|
||||
// Add repeats element
|
||||
|
|
|
@ -42,7 +42,7 @@ class CcShowDaysTableMap extends TableMap {
|
|||
$this->addColumn('FIRST_SHOW', 'DbFirstShow', 'DATE', true, null, null);
|
||||
$this->addColumn('LAST_SHOW', 'DbLastShow', 'DATE', false, null, null);
|
||||
$this->addColumn('START_TIME', 'DbStartTime', 'TIME', true, null, null);
|
||||
$this->addColumn('DURATION', 'DbDuration', 'TIME', true, null, null);
|
||||
$this->addColumn('DURATION', 'DbDuration', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('DAY', 'DbDay', 'TINYINT', false, null, null);
|
||||
$this->addColumn('REPEAT_TYPE', 'DbRepeatType', 'TINYINT', true, null, null);
|
||||
$this->addColumn('NEXT_POP_DATE', 'DbNextPopDate', 'DATE', false, null, null);
|
||||
|
|
|
@ -207,36 +207,13 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [duration] column value.
|
||||
* Get the [duration] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw DateTime object will be returned.
|
||||
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
* @return string
|
||||
*/
|
||||
public function getDbDuration($format = '%X')
|
||||
public function getDbDuration()
|
||||
{
|
||||
if ($this->duration === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->duration);
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->duration, true), $x);
|
||||
}
|
||||
|
||||
if ($format === null) {
|
||||
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
|
||||
return $dt;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $dt->format('U'));
|
||||
} else {
|
||||
return $dt->format($format);
|
||||
}
|
||||
return $this->duration;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -470,50 +447,21 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
|
|||
} // setDbStartTime()
|
||||
|
||||
/**
|
||||
* Sets the value of [duration] column to a normalized version of the date/time value specified.
|
||||
* Set the value of [duration] column.
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
|
||||
* be treated as NULL for temporal objects.
|
||||
* @param string $v new value
|
||||
* @return CcShowDays The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbDuration($v)
|
||||
{
|
||||
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
|
||||
// -- which is unexpected, to say the least.
|
||||
if ($v === null || $v === '') {
|
||||
$dt = null;
|
||||
} elseif ($v instanceof DateTime) {
|
||||
$dt = $v;
|
||||
} else {
|
||||
// some string/numeric value passed; we normalize that so that we can
|
||||
// validate it.
|
||||
try {
|
||||
if (is_numeric($v)) { // if it's a unix timestamp
|
||||
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
|
||||
// We have to explicitly specify and then change the time zone because of a
|
||||
// DateTime bug: http://bugs.php.net/bug.php?id=43003
|
||||
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
|
||||
} else {
|
||||
$dt = new DateTime($v);
|
||||
}
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
|
||||
}
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ( $this->duration !== null || $dt !== null ) {
|
||||
// (nested ifs are a little easier to read in this case)
|
||||
|
||||
$currNorm = ($this->duration !== null && $tmpDt = new DateTime($this->duration)) ? $tmpDt->format('H:i:s') : null;
|
||||
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
|
||||
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
)
|
||||
{
|
||||
$this->duration = ($dt ? $dt->format('H:i:s') : null);
|
||||
$this->modifiedColumns[] = CcShowDaysPeer::DURATION;
|
||||
}
|
||||
} // if either are not null
|
||||
if ($this->duration !== $v) {
|
||||
$this->duration = $v;
|
||||
$this->modifiedColumns[] = CcShowDaysPeer::DURATION;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbDuration()
|
||||
|
|
|
@ -278,29 +278,20 @@ abstract class BaseCcShowDaysQuery extends ModelCriteria
|
|||
/**
|
||||
* Filter the query on the duration column
|
||||
*
|
||||
* @param string|array $dbDuration The value to use as filter.
|
||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
||||
* @param string $dbDuration The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcShowDaysQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbDuration($dbDuration = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbDuration)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbDuration['min'])) {
|
||||
$this->addUsingAlias(CcShowDaysPeer::DURATION, $dbDuration['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbDuration['max'])) {
|
||||
$this->addUsingAlias(CcShowDaysPeer::DURATION, $dbDuration['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
if (null === $comparison) {
|
||||
if (is_array($dbDuration)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $dbDuration)) {
|
||||
$dbDuration = str_replace('*', '%', $dbDuration);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcShowDaysPeer::DURATION, $dbDuration, $comparison);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#Note: project.home is automatically generated by the propel-install script.
|
||||
#Any manual changes to this value will be overwritten.
|
||||
project.home = /home/naomi/dev-campcaster/campcaster
|
||||
project.home = /home/naomiaro/dev-campcaster/campcaster
|
||||
project.build = ${project.home}/build
|
||||
|
||||
#Database driver
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
<column name="first_show" phpName="DbFirstShow" type="DATE" required="true"/>
|
||||
<column name="last_show" phpName="DbLastShow" type="DATE" required="false"/>
|
||||
<column name="start_time" phpName="DbStartTime" type="TIME" required="true"/>
|
||||
<column name="duration" phpName="DbDuration" type="TIME" required="true"/>
|
||||
<column name="duration" phpName="DbDuration" type="VARCHAR" required="true"/>
|
||||
<column name="day" phpName="DbDay" type="TINYINT" required="false"/>
|
||||
<column name="repeat_type" phpName="DbRepeatType" type="TINYINT" required="true"/>
|
||||
<column name="next_pop_date" phpName="DbNextPopDate" type="DATE" required="false"/>
|
||||
|
|
|
@ -205,7 +205,7 @@ CREATE TABLE "cc_show_days"
|
|||
"first_show" DATE NOT NULL,
|
||||
"last_show" DATE,
|
||||
"start_time" TIME NOT NULL,
|
||||
"duration" TIME NOT NULL,
|
||||
"duration" VARCHAR(255) NOT NULL,
|
||||
"day" INT2,
|
||||
"repeat_type" INT2 NOT NULL,
|
||||
"next_pop_date" DATE,
|
||||
|
|
Loading…
Reference in New Issue