From f14ebce2399baed4e4ad383cb55b2e8062be8ce7 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 15 Feb 2012 18:27:59 +0100 Subject: [PATCH] CC-3174 : showbuilder adding new column last_scheduled to cc_show_instance changing column time_filled to be of type interval. --- .../controllers/ShowbuilderController.php | 53 ++++++++++- airtime_mvc/application/models/Scheduler.php | 7 +- .../airtime/map/CcShowInstancesTableMap.php | 3 +- .../airtime/om/BaseCcPlaylistcontents.php | 58 ++++++------ .../models/airtime/om/BaseCcShowInstances.php | 88 +++++++++++++++---- .../airtime/om/BaseCcShowInstancesPeer.php | 31 ++++--- .../airtime/om/BaseCcShowInstancesQuery.php | 42 +++++++-- airtime_mvc/build/schema.xml | 3 +- airtime_mvc/build/sql/schema.sql | 3 +- .../public/js/airtime/showbuilder/builder.js | 6 +- 10 files changed, 219 insertions(+), 75 deletions(-) diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 80689e4f7..ee36cb629 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -107,13 +107,13 @@ class ShowbuilderController extends Zend_Controller_Action { $request = $this->getRequest(); - $ids = $request->getParam("ids", null); + $items = $request->getParam("items", null); $json = array(); try { $scheduler = new Application_Model_Scheduler(); - $scheduler->removeItems($ids); + $scheduler->removeItems($items); $json["message"]="success... maybe"; } @@ -147,4 +147,53 @@ class ShowbuilderController extends Zend_Controller_Action $this->view->data = $json; } + + public function scheduleReorderAction() { + + $request = $this->getRequest(); + + $showInstance = $request->getParam("instanceId"); + } + + /* + * make sure any incoming requests for scheduling are ligit. + * + * @param array $items, an array containing pks of cc_schedule items. + */ + private function filterSelected($items) { + + $allowed = array(); + $user = Application_Model_User::GetCurrentUser(); + $type = $user->getType(); + + //item must be within the host's show. + if ($type === UTYPE_HOST) { + + $hosted = CcShowHostsQuery::create() + ->filterByDbHost($user->getId()) + ->find(); + + $allowed_shows = array(); + foreach ($hosted as $host) { + $allowed_shows[] = $host->getDbShow(); + } + + for ($i = 0; $i < count($items); $i++) { + + $instance = $items[$i]["instance"]; + + if (in_array($instance, $allowed_shows)) { + $allowed[] = $items[$i]; + } + } + + $this->view->shows = $res; + } + //they can schedule anything. + else if ($type === UTYPE_ADMIN || $type === UTYPE_PROGRAM_MANAGER) { + $allowed = $items; + } + + return $allowed; + } } \ No newline at end of file diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php index 2657d2645..bd06b1ff1 100644 --- a/airtime_mvc/application/models/Scheduler.php +++ b/airtime_mvc/application/models/Scheduler.php @@ -288,13 +288,18 @@ class Application_Model_Scheduler { } } - public function removeItems($scheduledIds, $adjustSched = true) { + public function removeItems($scheduledItems, $adjustSched = true) { $showInstances = array(); $this->con->beginTransaction(); try { + $scheduledIds = array(); + foreach ($scheduledItems as $item) { + $scheduledIds[] = $item["id"]; + } + $removedItems = CcScheduleQuery::create()->findPks($scheduledIds); $removedItems->delete($this->con); diff --git a/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php b/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php index 75e7da2c7..b605da53d 100644 --- a/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php @@ -46,7 +46,8 @@ class CcShowInstancesTableMap extends TableMap { $this->addColumn('REBROADCAST', 'DbRebroadcast', 'TINYINT', false, null, 0); $this->addForeignKey('INSTANCE_ID', 'DbOriginalShow', 'INTEGER', 'cc_show_instances', 'ID', false, null, null); $this->addForeignKey('FILE_ID', 'DbRecordedFile', 'INTEGER', 'cc_files', 'ID', false, null, null); - $this->addColumn('TIME_FILLED', 'DbTimeFilled', 'TIME', false, null, null); + $this->addColumn('TIME_FILLED', 'DbTimeFilled', 'VARCHAR', false, null, '00:00:00'); + $this->addColumn('LAST_SCHEDULED', 'DbLastScheduled', 'TIMESTAMP', false, null, null); $this->addColumn('MODIFIED_INSTANCE', 'DbModifiedInstance', 'BOOLEAN', true, null, false); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php index 44b6c7a6e..457a9b958 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php @@ -4,7 +4,7 @@ /** * Base class that represents a row from the 'cc_playlistcontents' table. * - * + * * * @package propel.generator.airtime.om */ @@ -137,7 +137,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Get the [id] column value. - * + * * @return int */ public function getDbId() @@ -147,7 +147,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Get the [playlist_id] column value. - * + * * @return int */ public function getDbPlaylistId() @@ -157,7 +157,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Get the [file_id] column value. - * + * * @return int */ public function getDbFileId() @@ -167,7 +167,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Get the [position] column value. - * + * * @return int */ public function getDbPosition() @@ -177,7 +177,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Get the [optionally formatted] temporal [cliplength] 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. @@ -210,7 +210,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Get the [optionally formatted] temporal [cuein] 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. @@ -243,7 +243,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Get the [optionally formatted] temporal [cueout] 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. @@ -276,7 +276,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Get the [optionally formatted] temporal [fadein] 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. @@ -289,6 +289,8 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent return null; } + + try { $dt = new DateTime($this->fadein); } catch (Exception $x) { @@ -307,7 +309,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Get the [optionally formatted] temporal [fadeout] 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. @@ -340,7 +342,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Set the value of [id] column. - * + * * @param int $v new value * @return CcPlaylistcontents The current object (for fluent API support) */ @@ -360,7 +362,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Set the value of [playlist_id] column. - * + * * @param int $v new value * @return CcPlaylistcontents The current object (for fluent API support) */ @@ -384,7 +386,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Set the value of [file_id] column. - * + * * @param int $v new value * @return CcPlaylistcontents The current object (for fluent API support) */ @@ -408,7 +410,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Set the value of [position] column. - * + * * @param int $v new value * @return CcPlaylistcontents The current object (for fluent API support) */ @@ -428,7 +430,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Sets the value of [cliplength] column to a normalized version of the date/time value specified. - * + * * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will * be treated as NULL for temporal objects. * @return CcPlaylistcontents The current object (for fluent API support) @@ -464,7 +466,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $currNorm = ($this->cliplength !== null && $tmpDt = new DateTime($this->cliplength)) ? $tmpDt->format('H:i:s') : null; $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - if ( ($currNorm !== $newNorm) // normalized values don't match + if ( ($currNorm !== $newNorm) // normalized values don't match || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default ) { @@ -478,7 +480,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Sets the value of [cuein] column to a normalized version of the date/time value specified. - * + * * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will * be treated as NULL for temporal objects. * @return CcPlaylistcontents The current object (for fluent API support) @@ -514,7 +516,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $currNorm = ($this->cuein !== null && $tmpDt = new DateTime($this->cuein)) ? $tmpDt->format('H:i:s') : null; $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - if ( ($currNorm !== $newNorm) // normalized values don't match + if ( ($currNorm !== $newNorm) // normalized values don't match || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default ) { @@ -528,7 +530,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Sets the value of [cueout] column to a normalized version of the date/time value specified. - * + * * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will * be treated as NULL for temporal objects. * @return CcPlaylistcontents The current object (for fluent API support) @@ -564,7 +566,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $currNorm = ($this->cueout !== null && $tmpDt = new DateTime($this->cueout)) ? $tmpDt->format('H:i:s') : null; $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - if ( ($currNorm !== $newNorm) // normalized values don't match + if ( ($currNorm !== $newNorm) // normalized values don't match || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default ) { @@ -578,7 +580,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Sets the value of [fadein] column to a normalized version of the date/time value specified. - * + * * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will * be treated as NULL for temporal objects. * @return CcPlaylistcontents The current object (for fluent API support) @@ -614,7 +616,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $currNorm = ($this->fadein !== null && $tmpDt = new DateTime($this->fadein)) ? $tmpDt->format('H:i:s') : null; $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - if ( ($currNorm !== $newNorm) // normalized values don't match + if ( ($currNorm !== $newNorm) // normalized values don't match || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default ) { @@ -628,7 +630,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * Sets the value of [fadeout] column to a normalized version of the date/time value specified. - * + * * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will * be treated as NULL for temporal objects. * @return CcPlaylistcontents The current object (for fluent API support) @@ -664,7 +666,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent $currNorm = ($this->fadeout !== null && $tmpDt = new DateTime($this->fadeout)) ? $tmpDt->format('H:i:s') : null; $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - if ( ($currNorm !== $newNorm) // normalized values don't match + if ( ($currNorm !== $newNorm) // normalized values don't match || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default ) { @@ -836,7 +838,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent if ($con === null) { $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } - + $con->beginTransaction(); try { $ret = $this->preDelete($con); @@ -878,7 +880,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent if ($con === null) { $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } - + $con->beginTransaction(); $isInsert = $this->isNew(); try { @@ -1131,7 +1133,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent * type constants. * * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * Defaults to BasePeer::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. @@ -1526,7 +1528,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent } // aggregate_column_relation behavior - + /** * Update the aggregate column in the related CcPlaylist object * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php index c78c34142..d5701f2be 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php @@ -76,10 +76,17 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent /** * The value for the time_filled field. + * Note: this column has a database default value of: '00:00:00' * @var string */ protected $time_filled; + /** + * The value for the last_scheduled field. + * @var string + */ + protected $last_scheduled; + /** * The value for the modified_instance field. * Note: this column has a database default value of: false @@ -136,6 +143,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent { $this->record = 0; $this->rebroadcast = 0; + $this->time_filled = '00:00:00'; $this->modified_instance = false; } @@ -276,7 +284,17 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent } /** - * Get the [optionally formatted] temporal [time_filled] column value. + * Get the [time_filled] column value. + * + * @return string + */ + public function getDbTimeFilled() + { + return $this->time_filled; + } + + /** + * Get the [optionally formatted] temporal [last_scheduled] column value. * * * @param string $format The date/time format string (either date()-style or strftime()-style). @@ -284,18 +302,18 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent * @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 getDbTimeFilled($format = '%X') + public function getDbLastScheduled($format = 'Y-m-d H:i:s') { - if ($this->time_filled === null) { + if ($this->last_scheduled === null) { return null; } try { - $dt = new DateTime($this->time_filled); + $dt = new DateTime($this->last_scheduled); } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->time_filled, true), $x); + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_scheduled, true), $x); } if ($format === null) { @@ -549,13 +567,33 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent } // setDbRecordedFile() /** - * Sets the value of [time_filled] column to a normalized version of the date/time value specified. + * Set the value of [time_filled] column. + * + * @param string $v new value + * @return CcShowInstances The current object (for fluent API support) + */ + public function setDbTimeFilled($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->time_filled !== $v || $this->isNew()) { + $this->time_filled = $v; + $this->modifiedColumns[] = CcShowInstancesPeer::TIME_FILLED; + } + + return $this; + } // setDbTimeFilled() + + /** + * Sets the value of [last_scheduled] column to a normalized version of the date/time value specified. * * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will * be treated as NULL for temporal objects. * @return CcShowInstances The current object (for fluent API support) */ - public function setDbTimeFilled($v) + public function setDbLastScheduled($v) { // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') // -- which is unexpected, to say the least. @@ -580,22 +618,22 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent } } - if ( $this->time_filled !== null || $dt !== null ) { + if ( $this->last_scheduled !== null || $dt !== null ) { // (nested ifs are a little easier to read in this case) - $currNorm = ($this->time_filled !== null && $tmpDt = new DateTime($this->time_filled)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + $currNorm = ($this->last_scheduled !== null && $tmpDt = new DateTime($this->last_scheduled)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; if ( ($currNorm !== $newNorm) // normalized values don't match ) { - $this->time_filled = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcShowInstancesPeer::TIME_FILLED; + $this->last_scheduled = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcShowInstancesPeer::LAST_SCHEDULED; } } // if either are not null return $this; - } // setDbTimeFilled() + } // setDbLastScheduled() /** * Set the value of [modified_instance] column. @@ -635,6 +673,10 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent return false; } + if ($this->time_filled !== '00:00:00') { + return false; + } + if ($this->modified_instance !== false) { return false; } @@ -670,7 +712,8 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent $this->instance_id = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; $this->file_id = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; $this->time_filled = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->modified_instance = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null; + $this->last_scheduled = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->modified_instance = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null; $this->resetModified(); $this->setNew(false); @@ -679,7 +722,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 10; // 10 = CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 11; // 11 = CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcShowInstances object", $e); @@ -1104,6 +1147,9 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent return $this->getDbTimeFilled(); break; case 9: + return $this->getDbLastScheduled(); + break; + case 10: return $this->getDbModifiedInstance(); break; default: @@ -1139,7 +1185,8 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent $keys[6] => $this->getDbOriginalShow(), $keys[7] => $this->getDbRecordedFile(), $keys[8] => $this->getDbTimeFilled(), - $keys[9] => $this->getDbModifiedInstance(), + $keys[9] => $this->getDbLastScheduled(), + $keys[10] => $this->getDbModifiedInstance(), ); if ($includeForeignObjects) { if (null !== $this->aCcShow) { @@ -1210,6 +1257,9 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent $this->setDbTimeFilled($value); break; case 9: + $this->setDbLastScheduled($value); + break; + case 10: $this->setDbModifiedInstance($value); break; } // switch() @@ -1245,7 +1295,8 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent if (array_key_exists($keys[6], $arr)) $this->setDbOriginalShow($arr[$keys[6]]); if (array_key_exists($keys[7], $arr)) $this->setDbRecordedFile($arr[$keys[7]]); if (array_key_exists($keys[8], $arr)) $this->setDbTimeFilled($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setDbModifiedInstance($arr[$keys[9]]); + if (array_key_exists($keys[9], $arr)) $this->setDbLastScheduled($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setDbModifiedInstance($arr[$keys[10]]); } /** @@ -1266,6 +1317,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent if ($this->isColumnModified(CcShowInstancesPeer::INSTANCE_ID)) $criteria->add(CcShowInstancesPeer::INSTANCE_ID, $this->instance_id); if ($this->isColumnModified(CcShowInstancesPeer::FILE_ID)) $criteria->add(CcShowInstancesPeer::FILE_ID, $this->file_id); if ($this->isColumnModified(CcShowInstancesPeer::TIME_FILLED)) $criteria->add(CcShowInstancesPeer::TIME_FILLED, $this->time_filled); + if ($this->isColumnModified(CcShowInstancesPeer::LAST_SCHEDULED)) $criteria->add(CcShowInstancesPeer::LAST_SCHEDULED, $this->last_scheduled); if ($this->isColumnModified(CcShowInstancesPeer::MODIFIED_INSTANCE)) $criteria->add(CcShowInstancesPeer::MODIFIED_INSTANCE, $this->modified_instance); return $criteria; @@ -1336,6 +1388,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent $copyObj->setDbOriginalShow($this->instance_id); $copyObj->setDbRecordedFile($this->file_id); $copyObj->setDbTimeFilled($this->time_filled); + $copyObj->setDbLastScheduled($this->last_scheduled); $copyObj->setDbModifiedInstance($this->modified_instance); if ($deepCopy) { @@ -1854,6 +1907,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent $this->instance_id = null; $this->file_id = null; $this->time_filled = null; + $this->last_scheduled = null; $this->modified_instance = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php index d30a1a8ab..6780ec14f 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php @@ -26,7 +26,7 @@ abstract class BaseCcShowInstancesPeer { const TM_CLASS = 'CcShowInstancesTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 10; + const NUM_COLUMNS = 11; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -58,6 +58,9 @@ abstract class BaseCcShowInstancesPeer { /** the column name for the TIME_FILLED field */ const TIME_FILLED = 'cc_show_instances.TIME_FILLED'; + /** the column name for the LAST_SCHEDULED field */ + const LAST_SCHEDULED = 'cc_show_instances.LAST_SCHEDULED'; + /** the column name for the MODIFIED_INSTANCE field */ const MODIFIED_INSTANCE = 'cc_show_instances.MODIFIED_INSTANCE'; @@ -77,12 +80,12 @@ abstract class BaseCcShowInstancesPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbTimeFilled', 'DbModifiedInstance', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbTimeFilled', 'dbModifiedInstance', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::SHOW_ID, self::RECORD, self::REBROADCAST, self::INSTANCE_ID, self::FILE_ID, self::TIME_FILLED, self::MODIFIED_INSTANCE, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'TIME_FILLED', 'MODIFIED_INSTANCE', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'time_filled', 'modified_instance', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbTimeFilled', 'DbLastScheduled', 'DbModifiedInstance', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbTimeFilled', 'dbLastScheduled', 'dbModifiedInstance', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::SHOW_ID, self::RECORD, self::REBROADCAST, self::INSTANCE_ID, self::FILE_ID, self::TIME_FILLED, self::LAST_SCHEDULED, self::MODIFIED_INSTANCE, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'TIME_FILLED', 'LAST_SCHEDULED', 'MODIFIED_INSTANCE', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'time_filled', 'last_scheduled', 'modified_instance', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) ); /** @@ -92,12 +95,12 @@ abstract class BaseCcShowInstancesPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbShowId' => 3, 'DbRecord' => 4, 'DbRebroadcast' => 5, 'DbOriginalShow' => 6, 'DbRecordedFile' => 7, 'DbTimeFilled' => 8, 'DbModifiedInstance' => 9, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbShowId' => 3, 'dbRecord' => 4, 'dbRebroadcast' => 5, 'dbOriginalShow' => 6, 'dbRecordedFile' => 7, 'dbTimeFilled' => 8, 'dbModifiedInstance' => 9, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::SHOW_ID => 3, self::RECORD => 4, self::REBROADCAST => 5, self::INSTANCE_ID => 6, self::FILE_ID => 7, self::TIME_FILLED => 8, self::MODIFIED_INSTANCE => 9, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'SHOW_ID' => 3, 'RECORD' => 4, 'REBROADCAST' => 5, 'INSTANCE_ID' => 6, 'FILE_ID' => 7, 'TIME_FILLED' => 8, 'MODIFIED_INSTANCE' => 9, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'show_id' => 3, 'record' => 4, 'rebroadcast' => 5, 'instance_id' => 6, 'file_id' => 7, 'time_filled' => 8, 'modified_instance' => 9, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbShowId' => 3, 'DbRecord' => 4, 'DbRebroadcast' => 5, 'DbOriginalShow' => 6, 'DbRecordedFile' => 7, 'DbTimeFilled' => 8, 'DbLastScheduled' => 9, 'DbModifiedInstance' => 10, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbShowId' => 3, 'dbRecord' => 4, 'dbRebroadcast' => 5, 'dbOriginalShow' => 6, 'dbRecordedFile' => 7, 'dbTimeFilled' => 8, 'dbLastScheduled' => 9, 'dbModifiedInstance' => 10, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::SHOW_ID => 3, self::RECORD => 4, self::REBROADCAST => 5, self::INSTANCE_ID => 6, self::FILE_ID => 7, self::TIME_FILLED => 8, self::LAST_SCHEDULED => 9, self::MODIFIED_INSTANCE => 10, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'SHOW_ID' => 3, 'RECORD' => 4, 'REBROADCAST' => 5, 'INSTANCE_ID' => 6, 'FILE_ID' => 7, 'TIME_FILLED' => 8, 'LAST_SCHEDULED' => 9, 'MODIFIED_INSTANCE' => 10, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'show_id' => 3, 'record' => 4, 'rebroadcast' => 5, 'instance_id' => 6, 'file_id' => 7, 'time_filled' => 8, 'last_scheduled' => 9, 'modified_instance' => 10, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) ); /** @@ -178,6 +181,7 @@ abstract class BaseCcShowInstancesPeer { $criteria->addSelectColumn(CcShowInstancesPeer::INSTANCE_ID); $criteria->addSelectColumn(CcShowInstancesPeer::FILE_ID); $criteria->addSelectColumn(CcShowInstancesPeer::TIME_FILLED); + $criteria->addSelectColumn(CcShowInstancesPeer::LAST_SCHEDULED); $criteria->addSelectColumn(CcShowInstancesPeer::MODIFIED_INSTANCE); } else { $criteria->addSelectColumn($alias . '.ID'); @@ -189,6 +193,7 @@ abstract class BaseCcShowInstancesPeer { $criteria->addSelectColumn($alias . '.INSTANCE_ID'); $criteria->addSelectColumn($alias . '.FILE_ID'); $criteria->addSelectColumn($alias . '.TIME_FILLED'); + $criteria->addSelectColumn($alias . '.LAST_SCHEDULED'); $criteria->addSelectColumn($alias . '.MODIFIED_INSTANCE'); } } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php index d127d88ad..ea429edab 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php @@ -15,6 +15,7 @@ * @method CcShowInstancesQuery orderByDbOriginalShow($order = Criteria::ASC) Order by the instance_id column * @method CcShowInstancesQuery orderByDbRecordedFile($order = Criteria::ASC) Order by the file_id column * @method CcShowInstancesQuery orderByDbTimeFilled($order = Criteria::ASC) Order by the time_filled column + * @method CcShowInstancesQuery orderByDbLastScheduled($order = Criteria::ASC) Order by the last_scheduled column * @method CcShowInstancesQuery orderByDbModifiedInstance($order = Criteria::ASC) Order by the modified_instance column * * @method CcShowInstancesQuery groupByDbId() Group by the id column @@ -26,6 +27,7 @@ * @method CcShowInstancesQuery groupByDbOriginalShow() Group by the instance_id column * @method CcShowInstancesQuery groupByDbRecordedFile() Group by the file_id column * @method CcShowInstancesQuery groupByDbTimeFilled() Group by the time_filled column + * @method CcShowInstancesQuery groupByDbLastScheduled() Group by the last_scheduled column * @method CcShowInstancesQuery groupByDbModifiedInstance() Group by the modified_instance column * * @method CcShowInstancesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query @@ -64,6 +66,7 @@ * @method CcShowInstances findOneByDbOriginalShow(int $instance_id) Return the first CcShowInstances filtered by the instance_id column * @method CcShowInstances findOneByDbRecordedFile(int $file_id) Return the first CcShowInstances filtered by the file_id column * @method CcShowInstances findOneByDbTimeFilled(string $time_filled) Return the first CcShowInstances filtered by the time_filled column + * @method CcShowInstances findOneByDbLastScheduled(string $last_scheduled) Return the first CcShowInstances filtered by the last_scheduled column * @method CcShowInstances findOneByDbModifiedInstance(boolean $modified_instance) Return the first CcShowInstances filtered by the modified_instance column * * @method array findByDbId(int $id) Return CcShowInstances objects filtered by the id column @@ -75,6 +78,7 @@ * @method array findByDbOriginalShow(int $instance_id) Return CcShowInstances objects filtered by the instance_id column * @method array findByDbRecordedFile(int $file_id) Return CcShowInstances objects filtered by the file_id column * @method array findByDbTimeFilled(string $time_filled) Return CcShowInstances objects filtered by the time_filled column + * @method array findByDbLastScheduled(string $last_scheduled) Return CcShowInstances objects filtered by the last_scheduled column * @method array findByDbModifiedInstance(boolean $modified_instance) Return CcShowInstances objects filtered by the modified_instance column * * @package propel.generator.airtime.om @@ -422,22 +426,44 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria /** * Filter the query on the time_filled column * - * @param string|array $dbTimeFilled The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $dbTimeFilled 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 CcShowInstancesQuery The current query, for fluid interface */ public function filterByDbTimeFilled($dbTimeFilled = null, $comparison = null) { - if (is_array($dbTimeFilled)) { + if (null === $comparison) { + if (is_array($dbTimeFilled)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbTimeFilled)) { + $dbTimeFilled = str_replace('*', '%', $dbTimeFilled); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled, $comparison); + } + + /** + * Filter the query on the last_scheduled column + * + * @param string|array $dbLastScheduled The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbLastScheduled($dbLastScheduled = null, $comparison = null) + { + if (is_array($dbLastScheduled)) { $useMinMax = false; - if (isset($dbTimeFilled['min'])) { - $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled['min'], Criteria::GREATER_EQUAL); + if (isset($dbLastScheduled['min'])) { + $this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($dbTimeFilled['max'])) { - $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled['max'], Criteria::LESS_EQUAL); + if (isset($dbLastScheduled['max'])) { + $this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -447,7 +473,7 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled, $comparison); + return $this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled, $comparison); } /** diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 89c86b891..edc6b2b86 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -156,7 +156,8 @@ - + +