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
|
<?php
|
||||||
// This file generated by Propel 1.5.2 convert-conf target
|
// 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 (
|
$conf = array (
|
||||||
'datasources' =>
|
'datasources' =>
|
||||||
array (
|
array (
|
||||||
|
|
|
@ -40,7 +40,9 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
'NotEmpty',
|
'NotEmpty',
|
||||||
array('date', false, array('HH:mm', 'messages' => 'Show must be under 24 hours'))
|
array('regex', false,
|
||||||
|
array('/^\d+:[0-5][0-9]$/',
|
||||||
|
'messages' => 'enter a duration: HH:mm'))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class CcShowDaysTableMap extends TableMap {
|
||||||
$this->addColumn('FIRST_SHOW', 'DbFirstShow', 'DATE', true, null, null);
|
$this->addColumn('FIRST_SHOW', 'DbFirstShow', 'DATE', true, null, null);
|
||||||
$this->addColumn('LAST_SHOW', 'DbLastShow', 'DATE', false, null, null);
|
$this->addColumn('LAST_SHOW', 'DbLastShow', 'DATE', false, null, null);
|
||||||
$this->addColumn('START_TIME', 'DbStartTime', 'TIME', true, 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('DAY', 'DbDay', 'TINYINT', false, null, null);
|
||||||
$this->addColumn('REPEAT_TYPE', 'DbRepeatType', 'TINYINT', true, null, null);
|
$this->addColumn('REPEAT_TYPE', 'DbRepeatType', 'TINYINT', true, null, null);
|
||||||
$this->addColumn('NEXT_POP_DATE', 'DbNextPopDate', 'DATE', false, 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.
|
||||||
*
|
*
|
||||||
*
|
* @return string
|
||||||
* @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.
|
|
||||||
*/
|
*/
|
||||||
public function getDbDuration($format = '%X')
|
public function getDbDuration()
|
||||||
{
|
{
|
||||||
if ($this->duration === null) {
|
return $this->duration;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -470,50 +447,21 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
|
||||||
} // setDbStartTime()
|
} // 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
|
* @param string $v new value
|
||||||
* be treated as NULL for temporal objects.
|
|
||||||
* @return CcShowDays The current object (for fluent API support)
|
* @return CcShowDays The current object (for fluent API support)
|
||||||
*/
|
*/
|
||||||
public function setDbDuration($v)
|
public function setDbDuration($v)
|
||||||
{
|
{
|
||||||
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
|
if ($v !== null) {
|
||||||
// -- which is unexpected, to say the least.
|
$v = (string) $v;
|
||||||
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 ( $this->duration !== null || $dt !== null ) {
|
if ($this->duration !== $v) {
|
||||||
// (nested ifs are a little easier to read in this case)
|
$this->duration = $v;
|
||||||
|
|
||||||
$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;
|
$this->modifiedColumns[] = CcShowDaysPeer::DURATION;
|
||||||
}
|
}
|
||||||
} // if either are not null
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
} // setDbDuration()
|
} // setDbDuration()
|
||||||
|
|
|
@ -278,29 +278,20 @@ abstract class BaseCcShowDaysQuery extends ModelCriteria
|
||||||
/**
|
/**
|
||||||
* Filter the query on the duration column
|
* Filter the query on the duration column
|
||||||
*
|
*
|
||||||
* @param string|array $dbDuration The value to use as filter.
|
* @param string $dbDuration The value to use as filter.
|
||||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
*
|
*
|
||||||
* @return CcShowDaysQuery The current query, for fluid interface
|
* @return CcShowDaysQuery The current query, for fluid interface
|
||||||
*/
|
*/
|
||||||
public function filterByDbDuration($dbDuration = null, $comparison = null)
|
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;
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $dbDuration)) {
|
||||||
|
$dbDuration = str_replace('*', '%', $dbDuration);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->addUsingAlias(CcShowDaysPeer::DURATION, $dbDuration, $comparison);
|
return $this->addUsingAlias(CcShowDaysPeer::DURATION, $dbDuration, $comparison);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#Note: project.home is automatically generated by the propel-install script.
|
#Note: project.home is automatically generated by the propel-install script.
|
||||||
#Any manual changes to this value will be overwritten.
|
#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
|
project.build = ${project.home}/build
|
||||||
|
|
||||||
#Database driver
|
#Database driver
|
||||||
|
|
|
@ -142,7 +142,7 @@
|
||||||
<column name="first_show" phpName="DbFirstShow" type="DATE" required="true"/>
|
<column name="first_show" phpName="DbFirstShow" type="DATE" required="true"/>
|
||||||
<column name="last_show" phpName="DbLastShow" type="DATE" required="false"/>
|
<column name="last_show" phpName="DbLastShow" type="DATE" required="false"/>
|
||||||
<column name="start_time" phpName="DbStartTime" type="TIME" required="true"/>
|
<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="day" phpName="DbDay" type="TINYINT" required="false"/>
|
||||||
<column name="repeat_type" phpName="DbRepeatType" type="TINYINT" required="true"/>
|
<column name="repeat_type" phpName="DbRepeatType" type="TINYINT" required="true"/>
|
||||||
<column name="next_pop_date" phpName="DbNextPopDate" type="DATE" required="false"/>
|
<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,
|
"first_show" DATE NOT NULL,
|
||||||
"last_show" DATE,
|
"last_show" DATE,
|
||||||
"start_time" TIME NOT NULL,
|
"start_time" TIME NOT NULL,
|
||||||
"duration" TIME NOT NULL,
|
"duration" VARCHAR(255) NOT NULL,
|
||||||
"day" INT2,
|
"day" INT2,
|
||||||
"repeat_type" INT2 NOT NULL,
|
"repeat_type" INT2 NOT NULL,
|
||||||
"next_pop_date" DATE,
|
"next_pop_date" DATE,
|
||||||
|
|
Loading…
Reference in New Issue