diff --git a/CREDITS b/CREDITS
index 4f377ea52..518f7366c 100644
--- a/CREDITS
+++ b/CREDITS
@@ -2,6 +2,22 @@
CREDITS
=======
+Version 2.5.0
+-------------
+
+Denise Rigato (denise.rigato@sourcefabric.org)
+ Role: Software Developer
+
+Naomi Aro (naomi.aro@sourcefabric.org)
+ Role: Software Developer
+
+Cliff Wang (cliff.wang@sourcefabric.org)
+ Role: QA
+
+Daniel James (daniel.james@sourcefabric.org)
+ Role: Documentor & QA
+
+
Version 2.4.1
-------------
diff --git a/VERSION b/VERSION
index e7467e459..5a1ef0b72 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
PRODUCT_ID=Airtime
-PRODUCT_RELEASE=2.4.1
+PRODUCT_RELEASE=2.5.0
diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index 0f200f3b6..02adbdc5e 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -43,14 +43,14 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view = $this->getResource('view');
$view->doctype('XHTML1_STRICT');
}
-
+
protected function _initGlobals()
{
$view = $this->getResource('view');
$baseUrl = Application_Common_OsPath::getBaseDir();
-
+
$view->headScript()->appendScript("var baseUrl = '$baseUrl'");
-
+
$user = Application_Model_User::GetCurrentUser();
if (!is_null($user)){
$userType = $user->getType();
@@ -58,7 +58,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$userType = "";
}
$view->headScript()->appendScript("var userType = '$userType';");
-
+
}
protected function _initHeadLink()
@@ -68,13 +68,13 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view = $this->getResource('view');
$baseUrl = Application_Common_OsPath::getBaseDir();
-
+
+ $view->headLink()->appendStylesheet($baseUrl.'css/bootstrap.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/redmond/jquery-ui-1.8.8.custom.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/pro_dropdown_3.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/qtip/jquery.qtip.min.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/styles.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/masterpanel.css?'.$CC_CONFIG['airtime_version']);
- $view->headLink()->appendStylesheet($baseUrl.'css/bootstrap.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/tipsy/jquery.tipsy.css?'.$CC_CONFIG['airtime_version']);
}
@@ -83,23 +83,26 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$CC_CONFIG = Config::getConfig();
$view = $this->getResource('view');
-
+
$baseUrl = Application_Common_OsPath::getBaseDir();
-
- $view->headScript()->appendFile($baseUrl.'js/libs/jquery-1.7.2.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
- $view->headScript()->appendFile($baseUrl.'js/libs/jquery-ui-1.8.18.custom.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+
+ $view->headScript()->appendFile($baseUrl.'js/libs/jquery-1.8.3.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'js/libs/jquery-ui-1.8.24.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+
+ $view->headScript()->appendFile($baseUrl.'js/libs/underscore-min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+
$view->headScript()->appendFile($baseUrl.'js/libs/jquery.stickyPanel.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/qtip/jquery.qtip.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
- $view->headScript()->appendFile($baseUrl.'js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/cookie/jquery.cookie.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/i18n/jquery.i18n.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'locale/general-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'locale/datatables-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendScript("$.i18n.setDictionary(general_dict)");
$view->headScript()->appendScript("var baseUrl='$baseUrl'");
-
+
//scripts for now playing bar
$view->headScript()->appendFile($baseUrl.'js/airtime/airtime_bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/airtime/dashboard/helperfunctions.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php
index a23846a99..83cba4b08 100644
--- a/airtime_mvc/application/configs/ACL.php
+++ b/airtime_mvc/application/configs/ACL.php
@@ -23,6 +23,7 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
->add(new Zend_Acl_Resource('preference'))
->add(new Zend_Acl_Resource('showbuilder'))
->add(new Zend_Acl_Resource('playouthistory'))
+ ->add(new Zend_Acl_Resource('playouthistorytemplate'))
->add(new Zend_Acl_Resource('listenerstat'))
->add(new Zend_Acl_Resource('usersettings'))
->add(new Zend_Acl_Resource('audiopreview'))
@@ -46,7 +47,8 @@ $ccAcl->allow('G', 'index')
->allow('H', 'plupload')
->allow('H', 'library')
->allow('H', 'playlist')
- ->allow('A', 'playouthistory')
+ ->allow('H', 'playouthistory')
+ ->allow('A', 'playouthistorytemplate')
->allow('A', 'listenerstat')
->allow('A', 'user')
->allow('A', 'systemstatus')
diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php
index 9311a8ff0..fb4284681 100644
--- a/airtime_mvc/application/configs/classmap-airtime-conf.php
+++ b/airtime_mvc/application/configs/classmap-airtime-conf.php
@@ -211,4 +211,32 @@ return array (
'BaseCcLocalePeer' => 'airtime/om/BaseCcLocalePeer.php',
'BaseCcLocale' => 'airtime/om/BaseCcLocale.php',
'BaseCcLocaleQuery' => 'airtime/om/BaseCcLocaleQuery.php',
+ 'CcPlayoutHistoryTableMap' => 'airtime/map/CcPlayoutHistoryTableMap.php',
+ 'CcPlayoutHistoryPeer' => 'airtime/CcPlayoutHistoryPeer.php',
+ 'CcPlayoutHistory' => 'airtime/CcPlayoutHistory.php',
+ 'CcPlayoutHistoryQuery' => 'airtime/CcPlayoutHistoryQuery.php',
+ 'BaseCcPlayoutHistoryPeer' => 'airtime/om/BaseCcPlayoutHistoryPeer.php',
+ 'BaseCcPlayoutHistory' => 'airtime/om/BaseCcPlayoutHistory.php',
+ 'BaseCcPlayoutHistoryQuery' => 'airtime/om/BaseCcPlayoutHistoryQuery.php',
+ 'CcPlayoutHistoryMetaDataTableMap' => 'airtime/map/CcPlayoutHistoryMetaDataTableMap.php',
+ 'CcPlayoutHistoryMetaDataPeer' => 'airtime/CcPlayoutHistoryMetaDataPeer.php',
+ 'CcPlayoutHistoryMetaData' => 'airtime/CcPlayoutHistoryMetaData.php',
+ 'CcPlayoutHistoryMetaDataQuery' => 'airtime/CcPlayoutHistoryMetaDataQuery.php',
+ 'BaseCcPlayoutHistoryMetaDataPeer' => 'airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php',
+ 'BaseCcPlayoutHistoryMetaData' => 'airtime/om/BaseCcPlayoutHistoryMetaData.php',
+ 'BaseCcPlayoutHistoryMetaDataQuery' => 'airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php',
+ 'CcPlayoutHistoryTemplateTableMap' => 'airtime/map/CcPlayoutHistoryTemplateTableMap.php',
+ 'CcPlayoutHistoryTemplatePeer' => 'airtime/CcPlayoutHistoryTemplatePeer.php',
+ 'CcPlayoutHistoryTemplate' => 'airtime/CcPlayoutHistoryTemplate.php',
+ 'CcPlayoutHistoryTemplateQuery' => 'airtime/CcPlayoutHistoryTemplateQuery.php',
+ 'BaseCcPlayoutHistoryTemplatePeer' => 'airtime/om/BaseCcPlayoutHistoryTemplatePeer.php',
+ 'BaseCcPlayoutHistoryTemplate' => 'airtime/om/BaseCcPlayoutHistoryTemplate.php',
+ 'BaseCcPlayoutHistoryTemplateQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateQuery.php',
+ 'CcPlayoutHistoryTemplateFieldTableMap' => 'airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php',
+ 'CcPlayoutHistoryTemplateFieldPeer' => 'airtime/CcPlayoutHistoryTemplateFieldPeer.php',
+ 'CcPlayoutHistoryTemplateField' => 'airtime/CcPlayoutHistoryTemplateField.php',
+ 'CcPlayoutHistoryTemplateFieldQuery' => 'airtime/CcPlayoutHistoryTemplateFieldQuery.php',
+ 'BaseCcPlayoutHistoryTemplateFieldPeer' => 'airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php',
+ 'BaseCcPlayoutHistoryTemplateField' => 'airtime/om/BaseCcPlayoutHistoryTemplateField.php',
+ 'BaseCcPlayoutHistoryTemplateFieldQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php',
);
\ No newline at end of file
diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php
index 4a1f3e55a..34f8cab41 100644
--- a/airtime_mvc/application/configs/constants.php
+++ b/airtime_mvc/application/configs/constants.php
@@ -38,6 +38,21 @@ define('MDATA_KEY_CUE_OUT' , 'cueout');
define('UI_MDATA_VALUE_FORMAT_FILE' , 'File');
define('UI_MDATA_VALUE_FORMAT_STREAM' , 'live stream');
+//User types
+define('UTYPE_HOST' , 'H');
+define('UTYPE_ADMIN' , 'A');
+define('UTYPE_GUEST' , 'G');
+define('UTYPE_PROGRAM_MANAGER' , 'P');
+
+//Constants for playout history template fields
+define('TEMPLATE_DATE', 'date');
+define('TEMPLATE_TIME', 'time');
+define('TEMPLATE_DATETIME', 'datetime');
+define('TEMPLATE_STRING', 'string');
+define('TEMPLATE_BOOLEAN', 'boolean');
+define('TEMPLATE_INT', 'integer');
+define('TEMPLATE_FLOAT', 'float');
+
// Session Keys
define('UI_PLAYLISTCONTROLLER_OBJ_SESSNAME', 'PLAYLISTCONTROLLER_OBJ');
/*define('UI_PLAYLIST_SESSNAME', 'PLAYLIST');
diff --git a/airtime_mvc/application/configs/navigation.php b/airtime_mvc/application/configs/navigation.php
index 32b4af39d..f3149f146 100644
--- a/airtime_mvc/application/configs/navigation.php
+++ b/airtime_mvc/application/configs/navigation.php
@@ -20,7 +20,7 @@ $pages = array(
'module' => 'default',
'controller' => 'Plupload',
'action' => 'index',
- 'resource' => 'plupload'
+ 'resource' => 'plupload'
),
array(
'label' => _('Library'),
@@ -79,13 +79,6 @@ $pages = array(
'action' => 'index',
'resource' => 'systemstatus'
),
- array(
- 'label' => _('Playout History'),
- 'module' => 'default',
- 'controller' => 'playouthistory',
- 'action' => 'index',
- 'resource' => 'playouthistory'
- ),
array(
'label' => _('Listener Stats'),
'module' => 'default',
@@ -95,6 +88,27 @@ $pages = array(
)
)
),
+ array(
+ 'label' => _('History'),
+ 'uri' => '#',
+ 'resource' => 'playouthistory',
+ 'pages' => array(
+ array(
+ 'label' => _('Playout History'),
+ 'module' => 'default',
+ 'controller' => 'playouthistory',
+ 'action' => 'index',
+ 'resource' => 'playouthistory'
+ ),
+ array(
+ 'label' => _('History Templates'),
+ 'module' => 'default',
+ 'controller' => 'playouthistorytemplate',
+ 'action' => 'index',
+ 'resource' => 'playouthistorytemplate'
+ ),
+ )
+ ),
array(
'label' => _('Help'),
'uri' => '#',
diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php
index 1927460ea..3a956306d 100644
--- a/airtime_mvc/application/controllers/ApiController.php
+++ b/airtime_mvc/application/controllers/ApiController.php
@@ -400,6 +400,9 @@ class ApiController extends Zend_Controller_Action
$media_id = $this->_getParam("media_id");
Logging::debug("Received notification of new media item start: $media_id");
Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
+
+ $historyService = new Application_Service_HistoryService();
+ $historyService->insertPlayedItem($media_id);
//set a 'last played' timestamp for media item
//needed for smart blocks
diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php
index 780348372..2102a662e 100644
--- a/airtime_mvc/application/controllers/LibraryController.php
+++ b/airtime_mvc/application/controllers/LibraryController.php
@@ -53,7 +53,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
-
+
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/observer/observer.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/config.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/curves.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
@@ -68,9 +68,9 @@ class LibraryController extends Zend_Controller_Action
//arbitrary attributes need to be allowed to set an id for the templates.
$this->view->headScript()->setAllowArbitraryAttributes(true);
- //$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'),
+ //$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'),
// 'text/template', array('id' => 'tpl_playlist_cues', 'noescape' => true));
-
+
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
try {
@@ -179,9 +179,7 @@ class LibraryController extends Zend_Controller_Action
$type = $this->_getParam('type');
//playlist||timeline
$screen = $this->_getParam('screen');
-
- $baseUrl = Application_Common_OsPath::getBaseDir();
-
+
$menu = array();
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
@@ -250,7 +248,7 @@ class LibraryController extends Zend_Controller_Action
} elseif ($type == "stream") {
$webstream = CcWebstreamQuery::create()->findPK($id);
$obj = new Application_Model_Webstream($webstream);
-
+
$menu["play"]["mime"] = $webstream->getDbMime();
if (isset($obj_sess->id) && $screen == "playlist") {
@@ -373,15 +371,15 @@ class LibraryController extends Zend_Controller_Action
$this->view->message = $message;
}
}
-
+
// duplicate playlist
public function duplicateAction(){
$params = $this->getRequest()->getParams();
$id = $params['id'];
-
+
$originalPl = new Application_Model_Playlist($id);
$newPl = new Application_Model_Playlist();
-
+
$contents = $originalPl->getContents();
foreach ($contents as &$c) {
if ($c['type'] == '0') {
@@ -393,15 +391,15 @@ class LibraryController extends Zend_Controller_Action
}
$c[0] = $c['item_id'];
}
-
+
$newPl->addAudioClips($contents, null, 'before');
-
+
$newPl->setCreator(Application_Model_User::getCurrentUser()->getId());
$newPl->setDescription($originalPl->getDescription());
-
+
list($plFadeIn, ) = $originalPl->getFadeInfo(0);
list(, $plFadeOut) = $originalPl->getFadeInfo($originalPl->getSize()-1);
-
+
$newPl->setfades($plFadeIn, $plFadeOut);
$newPl->setName(sprintf(_("Copy of %s"), $originalPl->getName()));
}
@@ -549,7 +547,7 @@ class LibraryController extends Zend_Controller_Action
$id = $this->_getParam('id');
Application_Model_Soundcloud::uploadSoundcloud($id);
// we should die with ui info
- $this->_helper->json->sendJson(null);
+ $this->_helper->json->sendJson(null);
}
public function getUploadToSoundcloudStatusAction()
diff --git a/airtime_mvc/application/controllers/PlayouthistoryController.php b/airtime_mvc/application/controllers/PlayouthistoryController.php
index 3269fcd46..d28c96412 100644
--- a/airtime_mvc/application/controllers/PlayouthistoryController.php
+++ b/airtime_mvc/application/controllers/PlayouthistoryController.php
@@ -6,7 +6,16 @@ class PlayouthistoryController extends Zend_Controller_Action
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext
- ->addActionContext('playout-history-feed', 'json')
+ ->addActionContext('file-history-feed', 'json')
+ ->addActionContext('item-history-feed', 'json')
+ ->addActionContext('show-history-feed', 'json')
+ ->addActionContext('edit-file-item', 'json')
+ ->addActionContext('create-list-item', 'json')
+ ->addActionContext('edit-list-item', 'json')
+ ->addActionContext('delete-list-item', 'json')
+ ->addActionContext('delete-list-items', 'json')
+ ->addActionContext('update-list-item', 'json')
+ ->addActionContext('update-file-item', 'json')
->initContext();
}
@@ -42,45 +51,219 @@ class PlayouthistoryController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$offset = date("Z") * -1;
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'js/bootstrap-datetime/bootstrap-datetimepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/historytable.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
- $this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/bootstrap-datetimepicker.min.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools-2.1.5/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/playouthistory.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
+
+ //set datatables columns for display of data.
+ $historyService = new Application_Service_HistoryService();
+ $columns = json_encode($historyService->getDatatablesLogSheetColumns());
+ $script = "localStorage.setItem( 'datatables-historyitem-aoColumns', JSON.stringify($columns) ); ";
+
+ $columns = json_encode($historyService->getDatatablesFileSummaryColumns());
+ $script.= "localStorage.setItem( 'datatables-historyfile-aoColumns', JSON.stringify($columns) );";
+ $this->view->headScript()->appendScript($script);
+
+ $user = Application_Model_User::getCurrentUser();
+ $this->view->userType = $user->getType();
}
- public function playoutHistoryFeedAction()
+ public function fileHistoryFeedAction()
+ {
+ try {
+ $request = $this->getRequest();
+ $current_time = time();
+
+ $params = $request->getParams();
+
+ $starts_epoch = $request->getParam("start", $current_time - (60*60*24));
+ $ends_epoch = $request->getParam("end", $current_time);
+
+ $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
+ $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
+
+ $historyService = new Application_Service_HistoryService();
+ $r = $historyService->getFileSummaryData($startsDT, $endsDT, $params);
+
+ $this->view->sEcho = $r["sEcho"];
+ $this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
+ $this->view->iTotalRecords = $r["iTotalRecords"];
+ $this->view->history = $r["history"];
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ Logging::info($e->getMessage());
+ }
+ }
+
+ public function itemHistoryFeedAction()
+ {
+ try {
+ $request = $this->getRequest();
+ $current_time = time();
+
+ $params = $request->getParams();
+
+ $starts_epoch = $request->getParam("start", $current_time - (60*60*24));
+ $ends_epoch = $request->getParam("end", $current_time);
+ $instance = $request->getParam("instance_id", null);
+
+ $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
+ $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
+
+ $historyService = new Application_Service_HistoryService();
+ $r = $historyService->getPlayedItemData($startsDT, $endsDT, $params, $instance);
+
+ $this->view->sEcho = $r["sEcho"];
+ $this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
+ $this->view->iTotalRecords = $r["iTotalRecords"];
+ $this->view->history = $r["history"];
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ Logging::info($e->getMessage());
+ }
+ }
+
+ public function showHistoryFeedAction()
+ {
+ try {
+ $request = $this->getRequest();
+ $current_time = time();
+ $starts_epoch = $request->getParam("start", $current_time - (60*60*24));
+ $ends_epoch = $request->getParam("end", $current_time);
+
+ $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
+ $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
+
+ $historyService = new Application_Service_HistoryService();
+ $shows = $historyService->getShowList($startsDT, $endsDT);
+
+ $this->_helper->json->sendJson($shows);
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ Logging::info($e->getMessage());
+ }
+ }
+
+ public function editFileItemAction()
+ {
+ $file_id = $this->_getParam('id');
+
+ $historyService = new Application_Service_HistoryService();
+ $form = $historyService->makeHistoryFileForm($file_id);
+
+ $this->view->form = $form;
+ $this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
+
+ unset($this->view->form);
+ }
+
+ public function createListItemAction()
+ {
+ try {
+ $request = $this->getRequest();
+ $params = $request->getPost();
+ Logging::info($params);
+
+ $historyService = new Application_Service_HistoryService();
+ $json = $historyService->createPlayedItem($params);
+
+ if (isset($json["form"])) {
+ $this->view->form = $json["form"];
+ $json["form"] = $this->view->render('playouthistory/dialog.phtml');
+
+ unset($this->view->form);
+ }
+
+ $this->_helper->json->sendJson($json);
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ Logging::info($e->getMessage());
+ }
+ }
+
+ public function editListItemAction()
+ {
+ $id = $this->_getParam('id', null);
+
+ $populate = isset($id) ? true : false;
+
+ $historyService = new Application_Service_HistoryService();
+ $form = $historyService->makeHistoryItemForm($id, $populate);
+
+ $this->view->form = $form;
+ $this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
+
+ unset($this->view->form);
+ }
+
+ public function deleteListItemAction()
+ {
+ $history_id = $this->_getParam('id');
+
+ $historyService = new Application_Service_HistoryService();
+ $historyService->deletePlayedItem($history_id);
+ }
+
+ public function deleteListItemsAction()
+ {
+ $history_ids = $this->_getParam('ids');
+
+ $historyService = new Application_Service_HistoryService();
+ $historyService->deletePlayedItems($history_ids);
+ }
+
+ public function updateListItemAction()
+ {
+ try {
+ $request = $this->getRequest();
+ $params = $request->getPost();
+ Logging::info($params);
+
+ $historyService = new Application_Service_HistoryService();
+ $json = $historyService->editPlayedItem($params);
+
+ if (isset($json["form"])) {
+ $this->view->form = $json["form"];
+ $json["form"] = $this->view->render('playouthistory/dialog.phtml');
+
+ unset($this->view->form);
+ }
+
+ $this->_helper->json->sendJson($json);
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ Logging::info($e->getMessage());
+ }
+ }
+
+ public function updateFileItemAction()
{
$request = $this->getRequest();
- $current_time = time();
+ $params = $request->getPost();
+ Logging::info($params);
- $params = $request->getParams();
+ $historyService = new Application_Service_HistoryService();
+ $json = $historyService->editPlayedFile($params);
- $starts_epoch = $request->getParam("start", $current_time - (60*60*24));
- $ends_epoch = $request->getParam("end", $current_time);
-
- $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
- $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
-
- Logging::info("history starts {$startsDT->format("Y-m-d H:i:s")}");
- Logging::info("history ends {$endsDT->format("Y-m-d H:i:s")}");
-
- $history = new Application_Model_PlayoutHistory($startsDT, $endsDT, $params);
-
- $r = $history->getItems();
-
- $this->view->sEcho = $r["sEcho"];
- $this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
- $this->view->iTotalRecords = $r["iTotalRecords"];
- $this->view->history = $r["history"];
+ $this->_helper->json->sendJson($json);
}
-
}
diff --git a/airtime_mvc/application/controllers/PlayouthistorytemplateController.php b/airtime_mvc/application/controllers/PlayouthistorytemplateController.php
new file mode 100644
index 000000000..c6651d8eb
--- /dev/null
+++ b/airtime_mvc/application/controllers/PlayouthistorytemplateController.php
@@ -0,0 +1,143 @@
+_helper->getHelper('AjaxContext');
+ $ajaxContext
+ ->addActionContext('create-template', 'json')
+ ->addActionContext('update-template', 'json')
+ ->addActionContext('delete-template', 'json')
+ ->addActionContext('set-template-default', 'json')
+ ->initContext();
+ }
+
+ public function indexAction()
+ {
+ $CC_CONFIG = Config::getConfig();
+ $baseUrl = Application_Common_OsPath::getBaseDir();
+
+ $this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/template.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
+
+ $historyService = new Application_Service_HistoryService();
+ $this->view->template_list = $historyService->getListItemTemplates();
+ $this->view->template_file = $historyService->getFileTemplates();
+ $this->view->configured = $historyService->getConfiguredTemplateIds();
+ }
+
+ public function configureTemplateAction() {
+
+ $CC_CONFIG = Config::getConfig();
+ $baseUrl = Application_Common_OsPath::getBaseDir();
+
+ $this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/configuretemplate.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
+
+ try {
+
+ $templateId = $this->_getParam('id');
+
+ $historyService = new Application_Service_HistoryService();
+ $template = $historyService->loadTemplate($templateId);
+
+ $templateType = $template["type"];
+ $supportedTypes = $historyService->getSupportedTemplateTypes();
+
+ if (!in_array($templateType, $supportedTypes)) {
+ throw new Exception("Error: $templateType is not supported.");
+ }
+
+ $getMandatoryFields = "mandatory".ucfirst($templateType)."Fields";
+ $mandatoryFields = $historyService->$getMandatoryFields();
+
+ $this->view->template_id = $templateId;
+ $this->view->template_name = $template["name"];
+ $this->view->template_fields = $template["fields"];
+ $this->view->template_type = $templateType;
+ $this->view->fileMD = $historyService->getFileMetadataTypes();
+ $this->view->fields = $historyService->getFieldTypes();
+ $this->view->required_fields = $mandatoryFields;
+ $this->view->configured = $historyService->getConfiguredTemplateIds();
+ }
+ catch (Exception $e) {
+ Logging::info("Error?");
+ Logging::info($e);
+ Logging::info($e->getMessage());
+
+ $this->_forward('index', 'playouthistorytemplate');
+ }
+ }
+
+ public function createTemplateAction()
+ {
+ $templateType = $this->_getParam('type', null);
+
+ $request = $this->getRequest();
+ $params = $request->getPost();
+
+ try {
+ $historyService = new Application_Service_HistoryService();
+ $supportedTypes = $historyService->getSupportedTemplateTypes();
+
+ if (!in_array($templateType, $supportedTypes)) {
+ throw new Exception("Error: $templateType is not supported.");
+ }
+
+ $id = $historyService->createTemplate($params);
+
+ $this->view->url = $this->view->baseUrl("Playouthistorytemplate/configure-template/id/{$id}");
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ Logging::info($e->getMessage());
+
+ $this->view->error = $e->getMessage();
+ }
+ }
+
+ public function setTemplateDefaultAction()
+ {
+ $templateId = $this->_getParam('id', null);
+
+ try {
+ $historyService = new Application_Service_HistoryService();
+ $historyService->setConfiguredTemplate($templateId);
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ Logging::info($e->getMessage());
+ }
+ }
+
+ public function updateTemplateAction()
+ {
+ $templateId = $this->_getParam('id', null);
+ $name = $this->_getParam('name', null);
+ $fields = $this->_getParam('fields', array());
+
+ try {
+ $historyService = new Application_Service_HistoryService();
+ $historyService->updateItemTemplate($templateId, $name, $fields);
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ Logging::info($e->getMessage());
+ }
+ }
+
+ public function deleteTemplateAction()
+ {
+ $templateId = $this->_getParam('id');
+
+ try {
+ $historyService = new Application_Service_HistoryService();
+ $historyService->deleteTemplate($templateId);
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ Logging::info($e->getMessage());
+ }
+ }
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php
index aa6adbbac..ced193bec 100644
--- a/airtime_mvc/application/controllers/ScheduleController.php
+++ b/airtime_mvc/application/controllers/ScheduleController.php
@@ -85,7 +85,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@@ -97,7 +96,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
- $this->view->headLink()->appendStylesheet($baseUrl.'css/TableTools.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
//End Show builder JS/CSS requirements
diff --git a/airtime_mvc/application/forms/EditHistory.php b/airtime_mvc/application/forms/EditHistory.php
new file mode 100644
index 000000000..ad7ae7a05
--- /dev/null
+++ b/airtime_mvc/application/forms/EditHistory.php
@@ -0,0 +1,211 @@
+ array(
+ "class" => "Zend_Form_Element_Text",
+ "attrs" => array(
+ "class" => self::TEXT_INPUT_CLASS
+ ),
+ "validators" => array(
+ array(
+ "class" => "Zend_Validate_Date",
+ "params" => array(
+ "format" => self::VALIDATE_DATE_FORMAT
+ )
+ )
+ ),
+ "filters" => array(
+ "StringTrim"
+ )
+ ),
+ TEMPLATE_TIME => array(
+ "class" => "Zend_Form_Element_Text",
+ "attrs" => array(
+ "class" => self::TEXT_INPUT_CLASS
+ ),
+ "validators" => array(
+ array(
+ "class" => "Zend_Validate_Date",
+ "params" => array(
+ "format" => self::VALIDATE_TIME_FORMAT
+ )
+ )
+ ),
+ "filters" => array(
+ "StringTrim"
+ )
+ ),
+ TEMPLATE_DATETIME => array(
+ "class" => "Zend_Form_Element_Text",
+ "attrs" => array(
+ "class" => self::TEXT_INPUT_CLASS
+ ),
+ "validators" => array(
+ array(
+ "class" => "Zend_Validate_Date",
+ "params" => array(
+ "format" => self::VALIDATE_DATETIME_FORMAT
+ )
+ )
+ ),
+ "filters" => array(
+ "StringTrim"
+ )
+ ),
+ TEMPLATE_STRING => array(
+ "class" => "Zend_Form_Element_Text",
+ "attrs" => array(
+ "class" => self::TEXT_INPUT_CLASS
+ ),
+ "filters" => array(
+ "StringTrim"
+ )
+ ),
+ TEMPLATE_BOOLEAN => array(
+ "class" => "Zend_Form_Element_Checkbox",
+ "validators" => array(
+ array(
+ "class" => "Zend_Validate_InArray",
+ "options" => array(
+ "haystack" => array(0,1)
+ )
+ )
+ )
+ ),
+ TEMPLATE_INT => array(
+ "class" => "Zend_Form_Element_Text",
+ "validators" => array(
+ array(
+ "class" => "Zend_Validate_Int",
+ )
+ ),
+ "attrs" => array(
+ "class" => self::TEXT_INPUT_CLASS
+ )
+ ),
+ TEMPLATE_FLOAT => array(
+ "class" => "Zend_Form_Element_Text",
+ "attrs" => array(
+ "class" => self::TEXT_INPUT_CLASS
+ ),
+ "validators" => array(
+ array(
+ "class" => "Zend_Validate_Float",
+ )
+ )
+ ),
+ );
+
+ public function init() {
+
+ $history_id = new Zend_Form_Element_Hidden($this::ID_PREFIX.'id');
+ $history_id->setValidators(array(
+ new Zend_Validate_Int()
+ ));
+ $history_id->setDecorators(array('ViewHelper'));
+ $this->addElement($history_id);
+
+ $dynamic_attrs = new Zend_Form_SubForm();
+ $this->addSubForm($dynamic_attrs, $this::ID_PREFIX.'template');
+
+ // Add the submit button
+ $this->addElement('button', $this::ID_PREFIX.'save', array(
+ 'ignore' => true,
+ 'class' => 'btn '.$this::ID_PREFIX.'save',
+ 'label' => _('Save'),
+ 'decorators' => array(
+ 'ViewHelper'
+ )
+ ));
+
+ // Add the cancel button
+ $this->addElement('button', $this::ID_PREFIX.'cancel', array(
+ 'ignore' => true,
+ 'class' => 'btn '.$this::ID_PREFIX.'cancel',
+ 'label' => _('Cancel'),
+ 'decorators' => array(
+ 'ViewHelper'
+ )
+ ));
+ }
+
+ public function createFromTemplate($template, $required) {
+
+ $templateSubForm = $this->getSubForm($this::ID_PREFIX.'template');
+
+ for ($i = 0, $len = count($template); $i < $len; $i++) {
+
+ $item = $template[$i];
+ //don't dynamically add this as it should be included in the
+ //init() function already if it should show up in the UI..
+ if (in_array($item["name"], $required)) {
+ continue;
+ }
+
+ $formElType = $this->formElTypes[$item[self::ITEM_TYPE]];
+
+ $label = $item[self::ITEM_ID_SUFFIX];
+ $id = $this::ID_PREFIX.$label;
+ $el = new $formElType[self::ITEM_CLASS]($id);
+ $el->setLabel($item["label"]);
+
+ if (isset($formElType["attrs"])) {
+
+ $attrs = $formElType["attrs"];
+
+ foreach ($attrs as $key => $value) {
+ $el->setAttrib($key, $value);
+ }
+ }
+
+ if (isset($formElType["filters"])) {
+
+ $filters = $formElType["filters"];
+
+ foreach ($filters as $filter) {
+ $el->addFilter($filter);
+ }
+ }
+
+ if (isset($formElType["validators"])) {
+
+ $validators = $formElType["validators"];
+
+ foreach ($validators as $index => $arr) {
+ $options = isset($arr[self::ITEM_OPTIONS]) ? $arr[self::ITEM_OPTIONS] : null;
+ $validator = new $arr[self::ITEM_CLASS]($options);
+
+ //extra validator info
+ if (isset($arr["params"])) {
+
+ foreach ($arr["params"] as $key => $value) {
+ $method = "set".ucfirst($key);
+ $validator->$method($value);
+ }
+ }
+
+ $el->addValidator($validator);
+ }
+ }
+
+ $el->setDecorators(array('ViewHelper'));
+ $templateSubForm->addElement($el);
+ }
+ }
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/forms/EditHistoryFile.php b/airtime_mvc/application/forms/EditHistoryFile.php
new file mode 100644
index 000000000..b58db19a1
--- /dev/null
+++ b/airtime_mvc/application/forms/EditHistoryFile.php
@@ -0,0 +1,22 @@
+setDecorators(
+ array(
+ array('ViewScript', array('viewScript' => 'form/edit-history-file.phtml'))
+ )
+ );
+ }
+
+ public function createFromTemplate($template, $required) {
+
+ parent::createFromTemplate($template, $required);
+ }
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/forms/EditHistoryItem.php b/airtime_mvc/application/forms/EditHistoryItem.php
new file mode 100644
index 000000000..16ba5ded5
--- /dev/null
+++ b/airtime_mvc/application/forms/EditHistoryItem.php
@@ -0,0 +1,66 @@
+setDecorators(array(
+ 'PrepareElements',
+ array('ViewScript', array('viewScript' => 'form/edit-history-item.phtml'))
+ ));
+
+ /*
+ $instance = new Zend_Form_Element_Select("instance_id");
+ $instance->setLabel(_("Choose Show Instance"));
+ $instance->setMultiOptions(array("0" => "-----------"));
+ $instance->setValue(0);
+ $instance->setDecorators(array('ViewHelper'));
+ $this->addElement($instance);
+ */
+
+ $starts = new Zend_Form_Element_Text(self::ID_PREFIX.'starts');
+ $starts->setValidators(array(
+ new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT)
+ ));
+ $starts->setAttrib('class', self::TEXT_INPUT_CLASS." datepicker");
+ $starts->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT);
+ $starts->addFilter('StringTrim');
+ $starts->setLabel(_('Start Time'));
+ $starts->setDecorators(array('ViewHelper'));
+ $starts->setRequired(true);
+ $this->addElement($starts);
+
+ $ends = new Zend_Form_Element_Text(self::ID_PREFIX.'ends');
+ $ends->setValidators(array(
+ new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT)
+ ));
+ $ends->setAttrib('class', self::TEXT_INPUT_CLASS." datepicker");
+ $ends->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT);
+ $ends->addFilter('StringTrim');
+ $ends->setLabel(_('End Time'));
+ $ends->setDecorators(array('ViewHelper'));
+ $ends->setRequired(true);
+ $this->addElement($ends);
+ }
+
+ public function createFromTemplate($template, $required) {
+
+ parent::createFromTemplate($template, $required);
+ }
+
+ public function populateShowInstances($possibleInstances, $default) {
+
+ $possibleInstances["0"] = _("No Show");
+
+ $instance = new Zend_Form_Element_Select("his_instance_select");
+ //$instance->setLabel(_("Choose Show Instance"));
+ $instance->setMultiOptions($possibleInstances);
+ $instance->setValue($default);
+ $instance->setDecorators(array('ViewHelper'));
+ $this->addElement($instance);
+ }
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/models/Datatables.php b/airtime_mvc/application/models/Datatables.php
index b3b370352..d39a939fa 100644
--- a/airtime_mvc/application/models/Datatables.php
+++ b/airtime_mvc/application/models/Datatables.php
@@ -58,43 +58,6 @@ class Application_Model_Datatables
public static function findEntries($con, $displayColumns, $fromTable,
$data, $dataProp = "aaData")
{
- $librarySetting =
- Application_Model_Preference::getCurrentLibraryTableColumnMap();
- //$displayColumns[] = 'owner';
-
- // map that maps original column position to db name
- $current2dbname = array();
- // array of search terms
- $orig2searchTerm = array();
- foreach ($data as $key => $d) {
- if (strstr($key, "mDataProp_")) {
- list($dump, $index) = explode("_", $key);
- $current2dbname[$index] = $d;
- } elseif (strstr($key, "sSearch_")) {
- list($dump, $index) = explode("_", $key);
- $orig2searchTerm[$index] = $d;
- }
- }
-
- // map that maps dbname to searchTerm
- $dbname2searchTerm = array();
- foreach ($current2dbname as $currentPos => $dbname) {
- $new_index = $librarySetting($currentPos);
- // TODO : Fix this retarded hack later. Just a band aid for
- // now at least we print some warnings so that we don't
- // forget about this -- cc-4462
- if ( array_key_exists($new_index, $orig2searchTerm) ) {
- $dbname2searchTerm[$dbname] = $orig2searchTerm[$new_index];
- } else {
- Logging::warn("Trying to reorder to unknown index
- printing as much debugging as possible...");
- $debug = array(
- '$new_index' => $new_index,
- '$currentPos' => $currentPos,
- '$orig2searchTerm' => $orig2searchTerm);
- Logging::warn($debug);
- }
- }
$where = array();
/* Holds the parameters for binding after the statement has been
@@ -102,6 +65,45 @@ class Application_Model_Datatables
$params = array();
if (isset($data['advSearch']) && $data['advSearch'] === 'true') {
+
+ $librarySetting =
+ Application_Model_Preference::getCurrentLibraryTableColumnMap();
+ //$displayColumns[] = 'owner';
+
+ // map that maps original column position to db name
+ $current2dbname = array();
+ // array of search terms
+ $orig2searchTerm = array();
+ foreach ($data as $key => $d) {
+ if (strstr($key, "mDataProp_")) {
+ list($dump, $index) = explode("_", $key);
+ $current2dbname[$index] = $d;
+ } elseif (strstr($key, "sSearch_")) {
+ list($dump, $index) = explode("_", $key);
+ $orig2searchTerm[$index] = $d;
+ }
+ }
+
+ // map that maps dbname to searchTerm
+ $dbname2searchTerm = array();
+ foreach ($current2dbname as $currentPos => $dbname) {
+ $new_index = $librarySetting($currentPos);
+ // TODO : Fix this retarded hack later. Just a band aid for
+ // now at least we print some warnings so that we don't
+ // forget about this -- cc-4462
+ if ( array_key_exists($new_index, $orig2searchTerm) ) {
+ $dbname2searchTerm[$dbname] = $orig2searchTerm[$new_index];
+ } else {
+ Logging::warn("Trying to reorder to unknown index
+ printing as much debugging as possible...");
+ $debug = array(
+ '$new_index' => $new_index,
+ '$currentPos' => $currentPos,
+ '$orig2searchTerm' => $orig2searchTerm);
+ Logging::warn($debug);
+ }
+ }
+
$advancedWhere = self::buildWhereClauseForAdvancedSearch($dbname2searchTerm);
if (!empty($advancedWhere['clause'])) {
$where[] = join(" AND ", $advancedWhere['clause']);
@@ -119,7 +121,6 @@ class Application_Model_Datatables
$sql = $selectorCount." FROM ".$fromTable;
$sqlTotalRows = $sql;
-
if (isset($searchTerms)) {
$searchCols = array();
for ($i = 0; $i < $data["iColumns"]; $i++) {
@@ -164,57 +165,47 @@ class Application_Model_Datatables
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby;
- //limit the results returned.
- if ($displayLength !== -1) {
- $sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
- }
- } else {
- $sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
-
- //limit the results returned.
- if ($displayLength !== -1) {
- $sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
- }
}
+ else {
+ $sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
+ }
+
+ //limit the results returned.
+ if ($displayLength !== -1) {
+ $sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
+ }
+
try {
-
+
+ //Logging::info($sqlTotalRows);
+
$r = $con->query($sqlTotalRows);
$totalRows = $r->fetchColumn(0);
if (isset($sqlTotalDisplayRows)) {
+ //Logging::info("sql is set");
+ //Logging::info($sqlTotalDisplayRows);
$totalDisplayRows = Application_Common_Database::prepareAndExecute($sqlTotalDisplayRows, $params, 'column');
- } else {
+ }
+ else {
+ //Logging::info("sql is not set.");
$totalDisplayRows = $totalRows;
}
//TODO
if ($needToBind) {
$results = Application_Common_Database::prepareAndExecute($sql, $params);
- } else {
+ }
+ else {
$stmt = $con->query($sql);
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$results = $stmt->fetchAll();
}
-
- // we need to go over all items and fix length for playlist
- // in case the playlist contains dynamic block
- foreach ($results as &$r) {
- //this function is also called for Manage Users so in
- //this case there will be no 'ftype'
- if (isset($r['ftype'])) {
- if ($r['ftype'] == 'playlist') {
- $pl = new Application_Model_Playlist($r['id']);
- $r['length'] = $pl->getLength();
- } elseif ($r['ftype'] == "block") {
- $bl = new Application_Model_Block($r['id']);
- $r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic';
- $r['length'] = $bl->getLength();
- }
- }
- }
- } catch (Exception $e) {
- Logging::debug($e->getMessage());
}
+ catch (Exception $e) {
+ Logging::info($e->getMessage());
+ }
+
return array(
"sEcho" => intval($data["sEcho"]),
"iTotalDisplayRecords" => intval($totalDisplayRows),
diff --git a/airtime_mvc/application/models/PlayoutHistory.php b/airtime_mvc/application/models/PlayoutHistory.php
deleted file mode 100644
index 7da1ff2c2..000000000
--- a/airtime_mvc/application/models/PlayoutHistory.php
+++ /dev/null
@@ -1,83 +0,0 @@
- "artist_name",
- "title" => "track_title",
- "played" => "played",
- "length" => "length",
- "composer" => "composer",
- "copyright" => "copyright",
- );
-
- public function __construct($p_startDT, $p_endDT, $p_opts)
- {
- $this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
- $this->startDT = $p_startDT;
- $this->endDT = $p_endDT;
- $this->timezone = date_default_timezone_get();
- $this->epoch_now = time();
- $this->opts = $p_opts;
- }
-
- /*
- * map front end mDataProp labels to proper column names for searching etc.
- */
- private function translateColumns()
- {
- for ($i = 0; $i < $this->opts["iColumns"]; $i++) {
-
- $this->opts["mDataProp_{$i}"] = $this->mDataPropMap[$this->opts["mDataProp_{$i}"]];
- }
- }
-
- public function getItems()
- {
- $this->translateColumns();
-
- $select = array(
- "file.track_title as title",
- "file.artist_name as artist",
- "playout.played",
- "playout.file_id",
- "file.composer",
- "file.copyright",
- "file.length"
- );
-
- $start = $this->startDT->format("Y-m-d H:i:s");
- $end = $this->endDT->format("Y-m-d H:i:s");
-
- $historyTable = "(
- select count(schedule.file_id) as played, schedule.file_id as file_id
- from cc_schedule as schedule
- where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
- and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
- group by schedule.file_id
- )
- AS playout left join cc_files as file on (file.id = playout.file_id)";
-
- $results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $this->opts, "history");
-
- foreach ($results["history"] as &$row) {
- $formatter = new LengthFormatter($row['length']);
- $row['length'] = $formatter->format();
- }
-
- return $results;
- }
-}
diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php
index d1e608e3c..7f4ea8602 100644
--- a/airtime_mvc/application/models/Preference.php
+++ b/airtime_mvc/application/models/Preference.php
@@ -1363,4 +1363,20 @@ class Application_Model_Preference
{
self::setValue("replay_gain_modifier", $rg_modifier, true);
}
+
+ public static function SetHistoryItemTemplate($value) {
+ self::setValue("history_item_template", $value);
+ }
+
+ public static function GetHistoryItemTemplate() {
+ return self::getValue("history_item_template");
+ }
+
+ public static function SetHistoryFileTemplate($value) {
+ self::setValue("history_file_template", $value);
+ }
+
+ public static function GetHistoryFileTemplate() {
+ return self::getValue("history_file_template");
+ }
}
diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php
index 2930a7ff3..f5cac2aa0 100644
--- a/airtime_mvc/application/models/Show.php
+++ b/airtime_mvc/application/models/Show.php
@@ -949,6 +949,7 @@ SQL;
AND ((si1.starts >= :start1::TIMESTAMP AND si1.starts < :end1::TIMESTAMP)
OR (si1.ends > :start2::TIMESTAMP AND si1.ends <= :end2::TIMESTAMP)
OR (si1.starts <= :start3::TIMESTAMP AND si1.ends >= :end3::TIMESTAMP))
+ORDER BY si1.starts
SQL;
return Application_Common_Database::prepareAndExecute( $sql,
array(
diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php
index 9640c36bc..6f0a98cce 100644
--- a/airtime_mvc/application/models/StoredFile.php
+++ b/airtime_mvc/application/models/StoredFile.php
@@ -778,6 +778,18 @@ SQL;
foreach ($results['aaData'] as &$row) {
$row['id'] = intval($row['id']);
+ //taken from Datatables.php, needs to be cleaned up there.
+ if (isset($r['ftype'])) {
+ if ($r['ftype'] == 'playlist') {
+ $pl = new Application_Model_Playlist($r['id']);
+ $r['length'] = $pl->getLength();
+ } elseif ($r['ftype'] == "block") {
+ $bl = new Application_Model_Block($r['id']);
+ $r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic';
+ $r['length'] = $bl->getLength();
+ }
+ }
+
if ($row['ftype'] === "audioclip") {
$cuein_formatter = new LengthFormatter($row["cuein"]);
diff --git a/airtime_mvc/application/models/User.php b/airtime_mvc/application/models/User.php
index 295ac83c6..2fc763e06 100644
--- a/airtime_mvc/application/models/User.php
+++ b/airtime_mvc/application/models/User.php
@@ -1,10 +1,5 @@
filterByDbHost($this->getDbId())
->count() > 0;
}
+
+ public function isHostOfShowInstance($instanceId)
+ {
+ $showInstance = CcShowInstancesQuery::create()
+ ->findPk($instanceId);
+
+ return CcShowHostsQuery::create()
+ ->filterByDbShow($showInstance->getDbShowId())
+ ->filterByDbHost($this->getDbId())
+ ->count() > 0;
+ }
} // CcSubjs
diff --git a/airtime_mvc/application/models/airtime/CcTag.php b/airtime_mvc/application/models/airtime/CcTag.php
new file mode 100644
index 000000000..2b02b8368
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/CcTag.php
@@ -0,0 +1,18 @@
+setName('cc_file_tag');
+ $this->setPhpName('CcFileTag');
+ $this->setClassname('CcFileTag');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_file_tag_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', true, null, null);
+ $this->addForeignKey('TAG_ID', 'DbTagId', 'INTEGER', 'cc_tag', 'ID', true, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('CcTag', 'CcTag', RelationMap::MANY_TO_ONE, array('tag_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CcFileTagTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
index 56e7a5fff..6f9f414dd 100644
--- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
@@ -123,6 +123,7 @@ class CcFilesTableMap extends TableMap {
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
+ $this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
} // buildRelations()
} // CcFilesTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryMetaDataTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryMetaDataTableMap.php
new file mode 100644
index 000000000..8e937f6e5
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryMetaDataTableMap.php
@@ -0,0 +1,56 @@
+setName('cc_playout_history_metadata');
+ $this->setPhpName('CcPlayoutHistoryMetaData');
+ $this->setClassname('CcPlayoutHistoryMetaData');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_playout_history_metadata_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('HISTORY_ID', 'DbHistoryId', 'INTEGER', 'cc_playout_history', 'ID', true, null, null);
+ $this->addColumn('KEY', 'DbKey', 'VARCHAR', true, 128, null);
+ $this->addColumn('VALUE', 'DbValue', 'VARCHAR', true, 128, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::MANY_TO_ONE, array('history_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CcPlayoutHistoryMetaDataTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTableMap.php
new file mode 100644
index 000000000..6c365d7bb
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTableMap.php
@@ -0,0 +1,59 @@
+setName('cc_playout_history');
+ $this->setPhpName('CcPlayoutHistory');
+ $this->setClassname('CcPlayoutHistory');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_playout_history_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
+ $this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
+ $this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
+ $this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'SET NULL', null);
+ $this->addRelation('CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaData', RelationMap::ONE_TO_MANY, array('id' => 'history_id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CcPlayoutHistoryTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php
new file mode 100644
index 000000000..f68db26a1
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php
@@ -0,0 +1,59 @@
+setName('cc_playout_history_template_field');
+ $this->setPhpName('CcPlayoutHistoryTemplateField');
+ $this->setClassname('CcPlayoutHistoryTemplateField');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_playout_history_template_field_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('TEMPLATE_ID', 'DbTemplateId', 'INTEGER', 'cc_playout_history_template', 'ID', true, null, null);
+ $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
+ $this->addColumn('LABEL', 'DbLabel', 'VARCHAR', true, 128, null);
+ $this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 128, null);
+ $this->addColumn('IS_FILE_MD', 'DbIsFileMD', 'BOOLEAN', true, null, false);
+ $this->addColumn('POSITION', 'DbPosition', 'INTEGER', true, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplate', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CcPlayoutHistoryTemplateFieldTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTableMap.php
new file mode 100644
index 000000000..e5aea573d
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTableMap.php
@@ -0,0 +1,55 @@
+setName('cc_playout_history_template');
+ $this->setPhpName('CcPlayoutHistoryTemplate');
+ $this->setClassname('CcPlayoutHistoryTemplate');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_playout_history_template_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
+ $this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 35, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcPlayoutHistoryTemplateField', 'CcPlayoutHistoryTemplateField', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CcPlayoutHistoryTemplateTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTagTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTagTableMap.php
new file mode 100644
index 000000000..9ce9ab7e1
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTagTableMap.php
@@ -0,0 +1,58 @@
+setName('cc_playout_history_template_field');
+ $this->setPhpName('CcPlayoutHistoryTemplateTag');
+ $this->setClassname('CcPlayoutHistoryTemplateTag');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_playout_history_template_field_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('TEMPLATE_ID', 'DbTemplateId', 'INTEGER', 'cc_playout_history_template', 'ID', true, null, null);
+ $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
+ $this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 128, null);
+ $this->addColumn('IS_FILE_MD', 'DbIsFileMD', 'BOOLEAN', true, null, false);
+ $this->addColumn('POSITION', 'DbTagPosition', 'INTEGER', true, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplate', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CcPlayoutHistoryTemplateTagTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php b/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php
index e6a7b87a0..c55e86080 100644
--- a/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php
@@ -63,6 +63,7 @@ class CcShowInstancesTableMap extends TableMap {
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcShowInstancesRelatedByDbId', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
+ $this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'SET NULL', null);
} // buildRelations()
} // CcShowInstancesTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcTagTableMap.php b/airtime_mvc/application/models/airtime/map/CcTagTableMap.php
new file mode 100644
index 000000000..0cfbcbb2c
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcTagTableMap.php
@@ -0,0 +1,57 @@
+setName('cc_tag');
+ $this->setPhpName('CcTag');
+ $this->setClassname('CcTag');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_tag_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('TAG_NAME', 'DbTagName', 'VARCHAR', true, 128, null);
+ $this->addColumn('TAG_TYPE', 'DbTagType', 'VARCHAR', true, 128, 'boolean');
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcFileTag', 'CcFileTag', RelationMap::ONE_TO_MANY, array('id' => 'tag_id', ), 'CASCADE', null);
+ $this->addRelation('CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaData', RelationMap::ONE_TO_MANY, array('id' => 'tag_id', ), 'CASCADE', null);
+ $this->addRelation('CcPlayoutHistoryTemplateTag', 'CcPlayoutHistoryTemplateTag', RelationMap::ONE_TO_MANY, array('id' => 'tag_id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CcTagTableMap
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFileTag.php b/airtime_mvc/application/models/airtime/om/BaseCcFileTag.php
new file mode 100644
index 000000000..eea6b63e0
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFileTag.php
@@ -0,0 +1,936 @@
+id;
+ }
+
+ /**
+ * Get the [file_id] column value.
+ *
+ * @return int
+ */
+ public function getDbFileId()
+ {
+ return $this->file_id;
+ }
+
+ /**
+ * Get the [tag_id] column value.
+ *
+ * @return int
+ */
+ public function getDbTagId()
+ {
+ return $this->tag_id;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcFileTag The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcFileTagPeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [file_id] column.
+ *
+ * @param int $v new value
+ * @return CcFileTag The current object (for fluent API support)
+ */
+ public function setDbFileId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->file_id !== $v) {
+ $this->file_id = $v;
+ $this->modifiedColumns[] = CcFileTagPeer::FILE_ID;
+ }
+
+ if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) {
+ $this->aCcFiles = null;
+ }
+
+ return $this;
+ } // setDbFileId()
+
+ /**
+ * Set the value of [tag_id] column.
+ *
+ * @param int $v new value
+ * @return CcFileTag The current object (for fluent API support)
+ */
+ public function setDbTagId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->tag_id !== $v) {
+ $this->tag_id = $v;
+ $this->modifiedColumns[] = CcFileTagPeer::TAG_ID;
+ }
+
+ if ($this->aCcTag !== null && $this->aCcTag->getDbId() !== $v) {
+ $this->aCcTag = null;
+ }
+
+ return $this;
+ } // setDbTagId()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->file_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->tag_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 3; // 3 = CcFileTagPeer::NUM_COLUMNS - CcFileTagPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcFileTag object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) {
+ $this->aCcFiles = null;
+ }
+ if ($this->aCcTag !== null && $this->tag_id !== $this->aCcTag->getDbId()) {
+ $this->aCcTag = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcFileTagPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCcFiles = null;
+ $this->aCcTag = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcFileTagQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CcFileTagPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcFiles !== null) {
+ if ($this->aCcFiles->isModified() || $this->aCcFiles->isNew()) {
+ $affectedRows += $this->aCcFiles->save($con);
+ }
+ $this->setCcFiles($this->aCcFiles);
+ }
+
+ if ($this->aCcTag !== null) {
+ if ($this->aCcTag->isModified() || $this->aCcTag->isNew()) {
+ $affectedRows += $this->aCcTag->save($con);
+ }
+ $this->setCcTag($this->aCcTag);
+ }
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcFileTagPeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcFileTagPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcFileTagPeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows += 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows += CcFileTagPeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcFiles !== null) {
+ if (!$this->aCcFiles->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcFiles->getValidationFailures());
+ }
+ }
+
+ if ($this->aCcTag !== null) {
+ if (!$this->aCcTag->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcTag->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcFileTagPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcFileTagPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbFileId();
+ break;
+ case 2:
+ return $this->getDbTagId();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * 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.
+ * 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.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
+ {
+ $keys = CcFileTagPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbFileId(),
+ $keys[2] => $this->getDbTagId(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcFiles) {
+ $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ if (null !== $this->aCcTag) {
+ $result['CcTag'] = $this->aCcTag->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcFileTagPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbFileId($value);
+ break;
+ case 2:
+ $this->setDbTagId($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcFileTagPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbFileId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbTagId($arr[$keys[2]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcFileTagPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcFileTagPeer::ID)) $criteria->add(CcFileTagPeer::ID, $this->id);
+ if ($this->isColumnModified(CcFileTagPeer::FILE_ID)) $criteria->add(CcFileTagPeer::FILE_ID, $this->file_id);
+ if ($this->isColumnModified(CcFileTagPeer::TAG_ID)) $criteria->add(CcFileTagPeer::TAG_ID, $this->tag_id);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcFileTagPeer::DATABASE_NAME);
+ $criteria->add(CcFileTagPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcFileTag (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbFileId($this->file_id);
+ $copyObj->setDbTagId($this->tag_id);
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcFileTag Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcFileTagPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcFileTagPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcFiles object.
+ *
+ * @param CcFiles $v
+ * @return CcFileTag The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcFiles(CcFiles $v = null)
+ {
+ if ($v === null) {
+ $this->setDbFileId(NULL);
+ } else {
+ $this->setDbFileId($v->getDbId());
+ }
+
+ $this->aCcFiles = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcFiles object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcFileTag($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcFiles object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcFiles The associated CcFiles object.
+ * @throws PropelException
+ */
+ public function getCcFiles(PropelPDO $con = null)
+ {
+ if ($this->aCcFiles === null && ($this->file_id !== null)) {
+ $this->aCcFiles = CcFilesQuery::create()->findPk($this->file_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcFiles->addCcFileTags($this);
+ */
+ }
+ return $this->aCcFiles;
+ }
+
+ /**
+ * Declares an association between this object and a CcTag object.
+ *
+ * @param CcTag $v
+ * @return CcFileTag The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcTag(CcTag $v = null)
+ {
+ if ($v === null) {
+ $this->setDbTagId(NULL);
+ } else {
+ $this->setDbTagId($v->getDbId());
+ }
+
+ $this->aCcTag = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcTag object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcFileTag($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcTag object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcTag The associated CcTag object.
+ * @throws PropelException
+ */
+ public function getCcTag(PropelPDO $con = null)
+ {
+ if ($this->aCcTag === null && ($this->tag_id !== null)) {
+ $this->aCcTag = CcTagQuery::create()->findPk($this->tag_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcTag->addCcFileTags($this);
+ */
+ }
+ return $this->aCcTag;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->file_id = null;
+ $this->tag_id = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aCcFiles = null;
+ $this->aCcTag = null;
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcFileTag
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFileTagPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcFileTagPeer.php
new file mode 100644
index 000000000..e4454a44f
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFileTagPeer.php
@@ -0,0 +1,1365 @@
+ array ('DbId', 'DbFileId', 'DbTagId', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbTagId', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::FILE_ID, self::TAG_ID, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'TAG_ID', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'tag_id', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFileId' => 1, 'DbTagId' => 2, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbTagId' => 2, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::FILE_ID => 1, self::TAG_ID => 2, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'TAG_ID' => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'tag_id' => 2, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcFileTagPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcFileTagPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcFileTagPeer::ID);
+ $criteria->addSelectColumn(CcFileTagPeer::FILE_ID);
+ $criteria->addSelectColumn(CcFileTagPeer::TAG_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.FILE_ID');
+ $criteria->addSelectColumn($alias . '.TAG_ID');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcFileTagPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcFileTagPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcFileTag
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcFileTagPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcFileTagPeer::populateObjects(CcFileTagPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcFileTagPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcFileTag $value A CcFileTag object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcFileTag $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcFileTag object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcFileTag) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcFileTag object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcFileTag Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_file_tag
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcFileTagPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcFileTagPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcFileTagPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcFileTagPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcFileTag object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcFileTagPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcFileTagPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcFileTagPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcFileTagPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcFileTagPeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcFiles table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcFileTagPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcFileTagPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcFileTagPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcTag table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcTag(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcFileTagPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcFileTagPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcFileTagPeer::TAG_ID, CcTagPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcFileTag objects pre-filled with their CcFiles objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcFileTag objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcFileTagPeer::addSelectColumns($criteria);
+ $startcol = (CcFileTagPeer::NUM_COLUMNS - CcFileTagPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcFilesPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcFileTagPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcFileTagPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcFileTagPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcFileTagPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcFileTagPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcFileTag) to $obj2 (CcFiles)
+ $obj2->addCcFileTag($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcFileTag objects pre-filled with their CcTag objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcFileTag objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcTag(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcFileTagPeer::addSelectColumns($criteria);
+ $startcol = (CcFileTagPeer::NUM_COLUMNS - CcFileTagPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcTagPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcFileTagPeer::TAG_ID, CcTagPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcFileTagPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcFileTagPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcFileTagPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcFileTagPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcTagPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcTagPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcTagPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcTagPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcFileTag) to $obj2 (CcTag)
+ $obj2->addCcFileTag($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcFileTagPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcFileTagPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcFileTagPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcFileTagPeer::TAG_ID, CcTagPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CcFileTag objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcFileTag objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcFileTagPeer::addSelectColumns($criteria);
+ $startcol2 = (CcFileTagPeer::NUM_COLUMNS - CcFileTagPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcTagPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + (CcTagPeer::NUM_COLUMNS - CcTagPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcFileTagPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcFileTagPeer::TAG_ID, CcTagPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcFileTagPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcFileTagPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcFileTagPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcFileTagPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcFiles rows
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcFileTag) to the collection in $obj2 (CcFiles)
+ $obj2->addCcFileTag($obj1);
+ } // if joined row not null
+
+ // Add objects for joined CcTag rows
+
+ $key3 = CcTagPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcTagPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcTagPeer::getOMClass(false);
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcTagPeer::addInstanceToPool($obj3, $key3);
+ } // if obj3 loaded
+
+ // Add the $obj1 (CcFileTag) to the collection in $obj3 (CcTag)
+ $obj3->addCcFileTag($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcFiles table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAllExceptCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcFileTagPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcFileTagPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcFileTagPeer::TAG_ID, CcTagPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcTag table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAllExceptCcTag(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcFileTagPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcFileTagPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcFileTagPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcFileTag objects pre-filled with all related objects except CcFiles.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcFileTag objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAllExceptCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ // $criteria->getDbName() will return the same object if not set to another value
+ // so == check is okay and faster
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcFileTagPeer::addSelectColumns($criteria);
+ $startcol2 = (CcFileTagPeer::NUM_COLUMNS - CcFileTagPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcTagPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcTagPeer::NUM_COLUMNS - CcTagPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcFileTagPeer::TAG_ID, CcTagPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcFileTagPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcFileTagPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcFileTagPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcFileTagPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcTag rows
+
+ $key2 = CcTagPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcTagPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcTagPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcTagPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcFileTag) to the collection in $obj2 (CcTag)
+ $obj2->addCcFileTag($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcFileTag objects pre-filled with all related objects except CcTag.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcFileTag objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAllExceptCcTag(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ // $criteria->getDbName() will return the same object if not set to another value
+ // so == check is okay and faster
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcFileTagPeer::addSelectColumns($criteria);
+ $startcol2 = (CcFileTagPeer::NUM_COLUMNS - CcFileTagPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcFileTagPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcFileTagPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcFileTagPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcFileTagPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcFileTagPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcFiles rows
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcFileTag) to the collection in $obj2 (CcFiles)
+ $obj2->addCcFileTag($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcFileTagPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcFileTagPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcFileTagTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcFileTagPeer::CLASS_DEFAULT : CcFileTagPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcFileTag or Criteria object.
+ *
+ * @param mixed $values Criteria or CcFileTag object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcFileTag object
+ }
+
+ if ($criteria->containsKey(CcFileTagPeer::ID) && $criteria->keyContainsValue(CcFileTagPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcFileTagPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcFileTag or Criteria object.
+ *
+ * @param mixed $values Criteria or CcFileTag object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcFileTagPeer::ID);
+ $value = $criteria->remove(CcFileTagPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcFileTagPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcFileTagPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcFileTag object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_file_tag table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcFileTagPeer::TABLE_NAME, $con, CcFileTagPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcFileTagPeer::clearInstancePool();
+ CcFileTagPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcFileTag or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcFileTag object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcFileTagPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcFileTag) { // it's a model object
+ // invalidate the cache for this single object
+ CcFileTagPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcFileTagPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcFileTagPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcFileTagPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcFileTag object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcFileTag $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcFileTag $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcFileTagPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcFileTagPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcFileTagPeer::DATABASE_NAME, CcFileTagPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcFileTag
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcFileTagPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcFileTagPeer::DATABASE_NAME);
+ $criteria->add(CcFileTagPeer::ID, $pk);
+
+ $v = CcFileTagPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcFileTagPeer::DATABASE_NAME);
+ $criteria->add(CcFileTagPeer::ID, $pks, Criteria::IN);
+ $objs = CcFileTagPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcFileTagPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcFileTagPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFileTagQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFileTagQuery.php
new file mode 100644
index 000000000..991c4e05a
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFileTagQuery.php
@@ -0,0 +1,371 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcFileTag|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcFileTagPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcFileTagQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcFileTagPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcFileTagQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcFileTagPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId 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 CcFileTagQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcFileTagPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the file_id column
+ *
+ * @param int|array $dbFileId 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 CcFileTagQuery The current query, for fluid interface
+ */
+ public function filterByDbFileId($dbFileId = null, $comparison = null)
+ {
+ if (is_array($dbFileId)) {
+ $useMinMax = false;
+ if (isset($dbFileId['min'])) {
+ $this->addUsingAlias(CcFileTagPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFileId['max'])) {
+ $this->addUsingAlias(CcFileTagPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcFileTagPeer::FILE_ID, $dbFileId, $comparison);
+ }
+
+ /**
+ * Filter the query on the tag_id column
+ *
+ * @param int|array $dbTagId 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 CcFileTagQuery The current query, for fluid interface
+ */
+ public function filterByDbTagId($dbTagId = null, $comparison = null)
+ {
+ if (is_array($dbTagId)) {
+ $useMinMax = false;
+ if (isset($dbTagId['min'])) {
+ $this->addUsingAlias(CcFileTagPeer::TAG_ID, $dbTagId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbTagId['max'])) {
+ $this->addUsingAlias(CcFileTagPeer::TAG_ID, $dbTagId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcFileTagPeer::TAG_ID, $dbTagId, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcFiles object
+ *
+ * @param CcFiles $ccFiles the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFileTagQuery The current query, for fluid interface
+ */
+ public function filterByCcFiles($ccFiles, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcFileTagPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcFiles relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcFileTagQuery The current query, for fluid interface
+ */
+ public function joinCcFiles($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcFiles');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcFiles');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcFiles relation CcFiles object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcFilesQuery A secondary query class using the current class as primary query
+ */
+ public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcFiles($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcTag object
+ *
+ * @param CcTag $ccTag the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFileTagQuery The current query, for fluid interface
+ */
+ public function filterByCcTag($ccTag, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcFileTagPeer::TAG_ID, $ccTag->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcTag relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcFileTagQuery The current query, for fluid interface
+ */
+ public function joinCcTag($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcTag');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcTag');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcTag relation CcTag object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcTagQuery A secondary query class using the current class as primary query
+ */
+ public function useCcTagQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcTag($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcTag', 'CcTagQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcFileTag $ccFileTag Object to remove from the list of results
+ *
+ * @return CcFileTagQuery The current query, for fluid interface
+ */
+ public function prune($ccFileTag = null)
+ {
+ if ($ccFileTag) {
+ $this->addUsingAlias(CcFileTagPeer::ID, $ccFileTag->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcFileTagQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
index 55f868769..38d147c07 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
@@ -493,6 +493,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
*/
protected $collCcSchedules;
+ /**
+ * @var array CcPlayoutHistory[] Collection to store aggregation of CcPlayoutHistory objects.
+ */
+ protected $collCcPlayoutHistorys;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -3109,6 +3114,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$this->collCcSchedules = null;
+ $this->collCcPlayoutHistorys = null;
+
} // if (deep)
}
@@ -3300,6 +3307,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
}
}
+ if ($this->collCcPlayoutHistorys !== null) {
+ foreach ($this->collCcPlayoutHistorys as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -3427,6 +3442,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
}
}
+ if ($this->collCcPlayoutHistorys !== null) {
+ foreach ($this->collCcPlayoutHistorys as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
$this->alreadyInValidation = false;
}
@@ -4351,6 +4374,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
}
}
+ foreach ($this->getCcPlayoutHistorys() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlayoutHistory($relObj->copy($deepCopy));
+ }
+ }
+
} // if ($deepCopy)
@@ -5154,6 +5183,140 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
return $this->getCcSchedules($query, $con);
}
+ /**
+ * Clears out the collCcPlayoutHistorys collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addCcPlayoutHistorys()
+ */
+ public function clearCcPlayoutHistorys()
+ {
+ $this->collCcPlayoutHistorys = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcPlayoutHistorys collection.
+ *
+ * By default this just sets the collCcPlayoutHistorys collection to an empty array (like clearcollCcPlayoutHistorys());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @return void
+ */
+ public function initCcPlayoutHistorys()
+ {
+ $this->collCcPlayoutHistorys = new PropelObjectCollection();
+ $this->collCcPlayoutHistorys->setModel('CcPlayoutHistory');
+ }
+
+ /**
+ * Gets an array of CcPlayoutHistory objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this CcFiles is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelCollection|array CcPlayoutHistory[] List of CcPlayoutHistory objects
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistorys($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
+ // return empty collection
+ $this->initCcPlayoutHistorys();
+ } else {
+ $collCcPlayoutHistorys = CcPlayoutHistoryQuery::create(null, $criteria)
+ ->filterByCcFiles($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcPlayoutHistorys;
+ }
+ $this->collCcPlayoutHistorys = $collCcPlayoutHistorys;
+ }
+ }
+ return $this->collCcPlayoutHistorys;
+ }
+
+ /**
+ * Returns the number of related CcPlayoutHistory objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlayoutHistory objects.
+ * @throws PropelException
+ */
+ public function countCcPlayoutHistorys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
+ return 0;
+ } else {
+ $query = CcPlayoutHistoryQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcFiles($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcPlayoutHistorys);
+ }
+ }
+
+ /**
+ * Method called to associate a CcPlayoutHistory object to this object
+ * through the CcPlayoutHistory foreign key attribute.
+ *
+ * @param CcPlayoutHistory $l CcPlayoutHistory
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcPlayoutHistory(CcPlayoutHistory $l)
+ {
+ if ($this->collCcPlayoutHistorys === null) {
+ $this->initCcPlayoutHistorys();
+ }
+ if (!$this->collCcPlayoutHistorys->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcPlayoutHistorys[]= $l;
+ $l->setCcFiles($this);
+ }
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcFiles is new, it will return
+ * an empty collection; or if this CcFiles has previously
+ * been saved, it will retrieve related CcPlayoutHistorys from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in CcFiles.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return PropelCollection|array CcPlayoutHistory[] List of CcPlayoutHistory objects
+ */
+ public function getCcPlayoutHistorysJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlayoutHistoryQuery::create(null, $criteria);
+ $query->joinWith('CcShowInstances', $join_behavior);
+
+ return $this->getCcPlayoutHistorys($query, $con);
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -5270,12 +5433,18 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collCcPlayoutHistorys) {
+ foreach ((array) $this->collCcPlayoutHistorys as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
$this->collCcShowInstancess = null;
$this->collCcPlaylistcontentss = null;
$this->collCcBlockcontentss = null;
$this->collCcSchedules = null;
+ $this->collCcPlayoutHistorys = null;
$this->aFkOwner = null;
$this->aCcSubjsRelatedByDbEditedby = null;
$this->aCcMusicDirs = null;
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php
index 82ebc7851..dbfbeaf06 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php
@@ -695,6 +695,9 @@ abstract class BaseCcFilesPeer {
// Invalidate objects in CcSchedulePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcSchedulePeer::clearInstancePool();
+ // Invalidate objects in CcPlayoutHistoryPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlayoutHistoryPeer::clearInstancePool();
}
/**
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
index fe42ad88c..50a21a332 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
@@ -180,6 +180,10 @@
* @method CcFilesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation
* @method CcFilesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
*
+ * @method CcFilesQuery leftJoinCcPlayoutHistory($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcFilesQuery rightJoinCcPlayoutHistory($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcFilesQuery innerJoinCcPlayoutHistory($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
+ *
* @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query
* @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found
*
@@ -2535,6 +2539,70 @@ abstract class BaseCcFilesQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
}
+ /**
+ * Filter the query by a related CcPlayoutHistory object
+ *
+ * @param CcPlayoutHistory $ccPlayoutHistory the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcFilesPeer::ID, $ccPlayoutHistory->getDbFileId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistory relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistory($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistory');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcPlayoutHistory');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistory relation CcPlayoutHistory object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistory($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
+ }
+
/**
* Exclude object from result
*
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistory.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistory.php
new file mode 100644
index 000000000..2e55a484f
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistory.php
@@ -0,0 +1,1288 @@
+id;
+ }
+
+ /**
+ * Get the [file_id] column value.
+ *
+ * @return int
+ */
+ public function getDbFileId()
+ {
+ return $this->file_id;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [starts] 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.
+ */
+ public function getDbStarts($format = 'Y-m-d H:i:s')
+ {
+ if ($this->starts === null) {
+ return null;
+ }
+
+
+
+ try {
+ $dt = new DateTime($this->starts);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->starts, 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);
+ }
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [ends] 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.
+ */
+ public function getDbEnds($format = 'Y-m-d H:i:s')
+ {
+ if ($this->ends === null) {
+ return null;
+ }
+
+
+
+ try {
+ $dt = new DateTime($this->ends);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ends, 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);
+ }
+ }
+
+ /**
+ * Get the [instance_id] column value.
+ *
+ * @return int
+ */
+ public function getDbInstanceId()
+ {
+ return $this->instance_id;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [file_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setDbFileId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->file_id !== $v) {
+ $this->file_id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::FILE_ID;
+ }
+
+ if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) {
+ $this->aCcFiles = null;
+ }
+
+ return $this;
+ } // setDbFileId()
+
+ /**
+ * Sets the value of [starts] 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 CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setDbStarts($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 ( $this->starts !== null || $dt !== null ) {
+ // (nested ifs are a little easier to read in this case)
+
+ $currNorm = ($this->starts !== null && $tmpDt = new DateTime($this->starts)) ? $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->starts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::STARTS;
+ }
+ } // if either are not null
+
+ return $this;
+ } // setDbStarts()
+
+ /**
+ * Sets the value of [ends] 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 CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setDbEnds($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 ( $this->ends !== null || $dt !== null ) {
+ // (nested ifs are a little easier to read in this case)
+
+ $currNorm = ($this->ends !== null && $tmpDt = new DateTime($this->ends)) ? $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->ends = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::ENDS;
+ }
+ } // if either are not null
+
+ return $this;
+ } // setDbEnds()
+
+ /**
+ * Set the value of [instance_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setDbInstanceId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->instance_id !== $v) {
+ $this->instance_id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::INSTANCE_ID;
+ }
+
+ if ($this->aCcShowInstances !== null && $this->aCcShowInstances->getDbId() !== $v) {
+ $this->aCcShowInstances = null;
+ }
+
+ return $this;
+ } // setDbInstanceId()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->file_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->instance_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 5; // 5 = CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcPlayoutHistory object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) {
+ $this->aCcFiles = null;
+ }
+ if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) {
+ $this->aCcShowInstances = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcPlayoutHistoryPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCcFiles = null;
+ $this->aCcShowInstances = null;
+ $this->collCcPlayoutHistoryMetaDatas = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcPlayoutHistoryQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CcPlayoutHistoryPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcFiles !== null) {
+ if ($this->aCcFiles->isModified() || $this->aCcFiles->isNew()) {
+ $affectedRows += $this->aCcFiles->save($con);
+ }
+ $this->setCcFiles($this->aCcFiles);
+ }
+
+ if ($this->aCcShowInstances !== null) {
+ if ($this->aCcShowInstances->isModified() || $this->aCcShowInstances->isNew()) {
+ $affectedRows += $this->aCcShowInstances->save($con);
+ }
+ $this->setCcShowInstances($this->aCcShowInstances);
+ }
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcPlayoutHistoryPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryPeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows += 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows += CcPlayoutHistoryPeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ if ($this->collCcPlayoutHistoryMetaDatas !== null) {
+ foreach ($this->collCcPlayoutHistoryMetaDatas as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcFiles !== null) {
+ if (!$this->aCcFiles->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcFiles->getValidationFailures());
+ }
+ }
+
+ if ($this->aCcShowInstances !== null) {
+ if (!$this->aCcShowInstances->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcShowInstances->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcPlayoutHistoryPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collCcPlayoutHistoryMetaDatas !== null) {
+ foreach ($this->collCcPlayoutHistoryMetaDatas as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbFileId();
+ break;
+ case 2:
+ return $this->getDbStarts();
+ break;
+ case 3:
+ return $this->getDbEnds();
+ break;
+ case 4:
+ return $this->getDbInstanceId();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * 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.
+ * 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.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
+ {
+ $keys = CcPlayoutHistoryPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbFileId(),
+ $keys[2] => $this->getDbStarts(),
+ $keys[3] => $this->getDbEnds(),
+ $keys[4] => $this->getDbInstanceId(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcFiles) {
+ $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ if (null !== $this->aCcShowInstances) {
+ $result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbFileId($value);
+ break;
+ case 2:
+ $this->setDbStarts($value);
+ break;
+ case 3:
+ $this->setDbEnds($value);
+ break;
+ case 4:
+ $this->setDbInstanceId($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcPlayoutHistoryPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbFileId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbStarts($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbEnds($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbInstanceId($arr[$keys[4]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::ID)) $criteria->add(CcPlayoutHistoryPeer::ID, $this->id);
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::FILE_ID)) $criteria->add(CcPlayoutHistoryPeer::FILE_ID, $this->file_id);
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::STARTS)) $criteria->add(CcPlayoutHistoryPeer::STARTS, $this->starts);
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::ENDS)) $criteria->add(CcPlayoutHistoryPeer::ENDS, $this->ends);
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::INSTANCE_ID)) $criteria->add(CcPlayoutHistoryPeer::INSTANCE_ID, $this->instance_id);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcPlayoutHistory (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbFileId($this->file_id);
+ $copyObj->setDbStarts($this->starts);
+ $copyObj->setDbEnds($this->ends);
+ $copyObj->setDbInstanceId($this->instance_id);
+
+ if ($deepCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+
+ foreach ($this->getCcPlayoutHistoryMetaDatas() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlayoutHistoryMetaData($relObj->copy($deepCopy));
+ }
+ }
+
+ } // if ($deepCopy)
+
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcPlayoutHistory Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcPlayoutHistoryPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcPlayoutHistoryPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcFiles object.
+ *
+ * @param CcFiles $v
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcFiles(CcFiles $v = null)
+ {
+ if ($v === null) {
+ $this->setDbFileId(NULL);
+ } else {
+ $this->setDbFileId($v->getDbId());
+ }
+
+ $this->aCcFiles = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcFiles object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcPlayoutHistory($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcFiles object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcFiles The associated CcFiles object.
+ * @throws PropelException
+ */
+ public function getCcFiles(PropelPDO $con = null)
+ {
+ if ($this->aCcFiles === null && ($this->file_id !== null)) {
+ $this->aCcFiles = CcFilesQuery::create()->findPk($this->file_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcFiles->addCcPlayoutHistorys($this);
+ */
+ }
+ return $this->aCcFiles;
+ }
+
+ /**
+ * Declares an association between this object and a CcShowInstances object.
+ *
+ * @param CcShowInstances $v
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcShowInstances(CcShowInstances $v = null)
+ {
+ if ($v === null) {
+ $this->setDbInstanceId(NULL);
+ } else {
+ $this->setDbInstanceId($v->getDbId());
+ }
+
+ $this->aCcShowInstances = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcShowInstances object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcPlayoutHistory($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcShowInstances object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcShowInstances The associated CcShowInstances object.
+ * @throws PropelException
+ */
+ public function getCcShowInstances(PropelPDO $con = null)
+ {
+ if ($this->aCcShowInstances === null && ($this->instance_id !== null)) {
+ $this->aCcShowInstances = CcShowInstancesQuery::create()->findPk($this->instance_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcShowInstances->addCcPlayoutHistorys($this);
+ */
+ }
+ return $this->aCcShowInstances;
+ }
+
+ /**
+ * Clears out the collCcPlayoutHistoryMetaDatas collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addCcPlayoutHistoryMetaDatas()
+ */
+ public function clearCcPlayoutHistoryMetaDatas()
+ {
+ $this->collCcPlayoutHistoryMetaDatas = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcPlayoutHistoryMetaDatas collection.
+ *
+ * By default this just sets the collCcPlayoutHistoryMetaDatas collection to an empty array (like clearcollCcPlayoutHistoryMetaDatas());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @return void
+ */
+ public function initCcPlayoutHistoryMetaDatas()
+ {
+ $this->collCcPlayoutHistoryMetaDatas = new PropelObjectCollection();
+ $this->collCcPlayoutHistoryMetaDatas->setModel('CcPlayoutHistoryMetaData');
+ }
+
+ /**
+ * Gets an array of CcPlayoutHistoryMetaData objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this CcPlayoutHistory is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelCollection|array CcPlayoutHistoryMetaData[] List of CcPlayoutHistoryMetaData objects
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistoryMetaDatas($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistoryMetaDatas || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryMetaDatas) {
+ // return empty collection
+ $this->initCcPlayoutHistoryMetaDatas();
+ } else {
+ $collCcPlayoutHistoryMetaDatas = CcPlayoutHistoryMetaDataQuery::create(null, $criteria)
+ ->filterByCcPlayoutHistory($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcPlayoutHistoryMetaDatas;
+ }
+ $this->collCcPlayoutHistoryMetaDatas = $collCcPlayoutHistoryMetaDatas;
+ }
+ }
+ return $this->collCcPlayoutHistoryMetaDatas;
+ }
+
+ /**
+ * Returns the number of related CcPlayoutHistoryMetaData objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlayoutHistoryMetaData objects.
+ * @throws PropelException
+ */
+ public function countCcPlayoutHistoryMetaDatas(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistoryMetaDatas || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryMetaDatas) {
+ return 0;
+ } else {
+ $query = CcPlayoutHistoryMetaDataQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcPlayoutHistory($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcPlayoutHistoryMetaDatas);
+ }
+ }
+
+ /**
+ * Method called to associate a CcPlayoutHistoryMetaData object to this object
+ * through the CcPlayoutHistoryMetaData foreign key attribute.
+ *
+ * @param CcPlayoutHistoryMetaData $l CcPlayoutHistoryMetaData
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcPlayoutHistoryMetaData(CcPlayoutHistoryMetaData $l)
+ {
+ if ($this->collCcPlayoutHistoryMetaDatas === null) {
+ $this->initCcPlayoutHistoryMetaDatas();
+ }
+ if (!$this->collCcPlayoutHistoryMetaDatas->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcPlayoutHistoryMetaDatas[]= $l;
+ $l->setCcPlayoutHistory($this);
+ }
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->file_id = null;
+ $this->starts = null;
+ $this->ends = null;
+ $this->instance_id = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ if ($this->collCcPlayoutHistoryMetaDatas) {
+ foreach ((array) $this->collCcPlayoutHistoryMetaDatas as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ } // if ($deep)
+
+ $this->collCcPlayoutHistoryMetaDatas = null;
+ $this->aCcFiles = null;
+ $this->aCcShowInstances = null;
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcPlayoutHistory
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaData.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaData.php
new file mode 100644
index 000000000..a0cbb9539
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaData.php
@@ -0,0 +1,905 @@
+id;
+ }
+
+ /**
+ * Get the [history_id] column value.
+ *
+ * @return int
+ */
+ public function getDbHistoryId()
+ {
+ return $this->history_id;
+ }
+
+ /**
+ * Get the [key] column value.
+ *
+ * @return string
+ */
+ public function getDbKey()
+ {
+ return $this->key;
+ }
+
+ /**
+ * Get the [value] column value.
+ *
+ * @return string
+ */
+ public function getDbValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [history_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
+ */
+ public function setDbHistoryId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->history_id !== $v) {
+ $this->history_id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::HISTORY_ID;
+ }
+
+ if ($this->aCcPlayoutHistory !== null && $this->aCcPlayoutHistory->getDbId() !== $v) {
+ $this->aCcPlayoutHistory = null;
+ }
+
+ return $this;
+ } // setDbHistoryId()
+
+ /**
+ * Set the value of [key] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
+ */
+ public function setDbKey($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->key !== $v) {
+ $this->key = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::KEY;
+ }
+
+ return $this;
+ } // setDbKey()
+
+ /**
+ * Set the value of [value] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
+ */
+ public function setDbValue($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->value !== $v) {
+ $this->value = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::VALUE;
+ }
+
+ return $this;
+ } // setDbValue()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->history_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->key = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->value = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 4; // 4 = CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcPlayoutHistoryMetaData object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCcPlayoutHistory !== null && $this->history_id !== $this->aCcPlayoutHistory->getDbId()) {
+ $this->aCcPlayoutHistory = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcPlayoutHistoryMetaDataPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCcPlayoutHistory = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcPlayoutHistoryMetaDataQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CcPlayoutHistoryMetaDataPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistory !== null) {
+ if ($this->aCcPlayoutHistory->isModified() || $this->aCcPlayoutHistory->isNew()) {
+ $affectedRows += $this->aCcPlayoutHistory->save($con);
+ }
+ $this->setCcPlayoutHistory($this->aCcPlayoutHistory);
+ }
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcPlayoutHistoryMetaDataPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryMetaDataPeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows += 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows += CcPlayoutHistoryMetaDataPeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistory !== null) {
+ if (!$this->aCcPlayoutHistory->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcPlayoutHistory->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcPlayoutHistoryMetaDataPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryMetaDataPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbHistoryId();
+ break;
+ case 2:
+ return $this->getDbKey();
+ break;
+ case 3:
+ return $this->getDbValue();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * 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.
+ * 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.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
+ {
+ $keys = CcPlayoutHistoryMetaDataPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbHistoryId(),
+ $keys[2] => $this->getDbKey(),
+ $keys[3] => $this->getDbValue(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcPlayoutHistory) {
+ $result['CcPlayoutHistory'] = $this->aCcPlayoutHistory->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryMetaDataPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbHistoryId($value);
+ break;
+ case 2:
+ $this->setDbKey($value);
+ break;
+ case 3:
+ $this->setDbValue($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcPlayoutHistoryMetaDataPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbHistoryId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbKey($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbValue($arr[$keys[3]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::ID)) $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $this->id);
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::HISTORY_ID)) $criteria->add(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $this->history_id);
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::KEY)) $criteria->add(CcPlayoutHistoryMetaDataPeer::KEY, $this->key);
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::VALUE)) $criteria->add(CcPlayoutHistoryMetaDataPeer::VALUE, $this->value);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcPlayoutHistoryMetaData (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbHistoryId($this->history_id);
+ $copyObj->setDbKey($this->key);
+ $copyObj->setDbValue($this->value);
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcPlayoutHistoryMetaData Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcPlayoutHistoryMetaDataPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcPlayoutHistoryMetaDataPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcPlayoutHistory object.
+ *
+ * @param CcPlayoutHistory $v
+ * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcPlayoutHistory(CcPlayoutHistory $v = null)
+ {
+ if ($v === null) {
+ $this->setDbHistoryId(NULL);
+ } else {
+ $this->setDbHistoryId($v->getDbId());
+ }
+
+ $this->aCcPlayoutHistory = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcPlayoutHistory object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcPlayoutHistoryMetaData($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcPlayoutHistory object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcPlayoutHistory The associated CcPlayoutHistory object.
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistory(PropelPDO $con = null)
+ {
+ if ($this->aCcPlayoutHistory === null && ($this->history_id !== null)) {
+ $this->aCcPlayoutHistory = CcPlayoutHistoryQuery::create()->findPk($this->history_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcPlayoutHistory->addCcPlayoutHistoryMetaDatas($this);
+ */
+ }
+ return $this->aCcPlayoutHistory;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->history_id = null;
+ $this->key = null;
+ $this->value = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aCcPlayoutHistory = null;
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcPlayoutHistoryMetaData
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php
new file mode 100644
index 000000000..0b980ec4e
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php
@@ -0,0 +1,983 @@
+ array ('DbId', 'DbHistoryId', 'DbKey', 'DbValue', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbHistoryId', 'dbKey', 'dbValue', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::HISTORY_ID, self::KEY, self::VALUE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'HISTORY_ID', 'KEY', 'VALUE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'history_id', 'key', 'value', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbHistoryId' => 1, 'DbKey' => 2, 'DbValue' => 3, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbHistoryId' => 1, 'dbKey' => 2, 'dbValue' => 3, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::HISTORY_ID => 1, self::KEY => 2, self::VALUE => 3, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'HISTORY_ID' => 1, 'KEY' => 2, 'VALUE' => 3, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'history_id' => 1, 'key' => 2, 'value' => 3, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcPlayoutHistoryMetaDataPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcPlayoutHistoryMetaDataPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::HISTORY_ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::KEY);
+ $criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::VALUE);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.HISTORY_ID');
+ $criteria->addSelectColumn($alias . '.KEY');
+ $criteria->addSelectColumn($alias . '.VALUE');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcPlayoutHistoryMetaData
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcPlayoutHistoryMetaDataPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcPlayoutHistoryMetaDataPeer::populateObjects(CcPlayoutHistoryMetaDataPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcPlayoutHistoryMetaData $value A CcPlayoutHistoryMetaData object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcPlayoutHistoryMetaData $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcPlayoutHistoryMetaData object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcPlayoutHistoryMetaData) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPlayoutHistoryMetaData object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcPlayoutHistoryMetaData Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_playout_history_metadata
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcPlayoutHistoryMetaData object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcPlayoutHistoryMetaDataPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcPlayoutHistory table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcPlayoutHistory(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcPlayoutHistoryMetaData objects pre-filled with their CcPlayoutHistory objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistoryMetaData objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcPlayoutHistory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ $startcol = (CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryMetaDataPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistoryMetaData) to $obj2 (CcPlayoutHistory)
+ $obj2->addCcPlayoutHistoryMetaData($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CcPlayoutHistoryMetaData objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistoryMetaData objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ $startcol2 = (CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryMetaDataPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcPlayoutHistory rows
+
+ $key2 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcPlayoutHistoryMetaData) to the collection in $obj2 (CcPlayoutHistory)
+ $obj2->addCcPlayoutHistoryMetaData($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcPlayoutHistoryMetaDataPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcPlayoutHistoryMetaDataTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcPlayoutHistoryMetaDataPeer::CLASS_DEFAULT : CcPlayoutHistoryMetaDataPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcPlayoutHistoryMetaData or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryMetaData object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryMetaData object
+ }
+
+ if ($criteria->containsKey(CcPlayoutHistoryMetaDataPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryMetaDataPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryMetaDataPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcPlayoutHistoryMetaData or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryMetaData object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcPlayoutHistoryMetaDataPeer::ID);
+ $value = $criteria->remove(CcPlayoutHistoryMetaDataPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcPlayoutHistoryMetaDataPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcPlayoutHistoryMetaData object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_playout_history_metadata table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcPlayoutHistoryMetaDataPeer::TABLE_NAME, $con, CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcPlayoutHistoryMetaDataPeer::clearInstancePool();
+ CcPlayoutHistoryMetaDataPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcPlayoutHistoryMetaData or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryMetaData object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcPlayoutHistoryMetaDataPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcPlayoutHistoryMetaData) { // it's a model object
+ // invalidate the cache for this single object
+ CcPlayoutHistoryMetaDataPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcPlayoutHistoryMetaDataPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcPlayoutHistoryMetaDataPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcPlayoutHistoryMetaData object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcPlayoutHistoryMetaData $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcPlayoutHistoryMetaData $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, CcPlayoutHistoryMetaDataPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcPlayoutHistoryMetaData
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $pk);
+
+ $v = CcPlayoutHistoryMetaDataPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $pks, Criteria::IN);
+ $objs = CcPlayoutHistoryMetaDataPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcPlayoutHistoryMetaDataPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcPlayoutHistoryMetaDataPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php
new file mode 100644
index 000000000..7a27c61af
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php
@@ -0,0 +1,320 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlayoutHistoryMetaData|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcPlayoutHistoryMetaDataPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId 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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the history_id column
+ *
+ * @param int|array $dbHistoryId 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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByDbHistoryId($dbHistoryId = null, $comparison = null)
+ {
+ if (is_array($dbHistoryId)) {
+ $useMinMax = false;
+ if (isset($dbHistoryId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbHistoryId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId, $comparison);
+ }
+
+ /**
+ * Filter the query on the key column
+ *
+ * @param string $dbKey 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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByDbKey($dbKey = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbKey)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbKey)) {
+ $dbKey = str_replace('*', '%', $dbKey);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::KEY, $dbKey, $comparison);
+ }
+
+ /**
+ * Filter the query on the value column
+ *
+ * @param string $dbValue 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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByDbValue($dbValue = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbValue)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbValue)) {
+ $dbValue = str_replace('*', '%', $dbValue);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::VALUE, $dbValue, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistory object
+ *
+ * @param CcPlayoutHistory $ccPlayoutHistory the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $ccPlayoutHistory->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistory relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistory($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistory');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcPlayoutHistory');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistory relation CcPlayoutHistory object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistory($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData Object to remove from the list of results
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function prune($ccPlayoutHistoryMetaData = null)
+ {
+ if ($ccPlayoutHistoryMetaData) {
+ $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $ccPlayoutHistoryMetaData->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcPlayoutHistoryMetaDataQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryPeer.php
new file mode 100644
index 000000000..01b944a65
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryPeer.php
@@ -0,0 +1,1378 @@
+ array ('DbId', 'DbFileId', 'DbStarts', 'DbEnds', 'DbInstanceId', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbStarts', 'dbEnds', 'dbInstanceId', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::FILE_ID, self::STARTS, self::ENDS, self::INSTANCE_ID, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'STARTS', 'ENDS', 'INSTANCE_ID', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'starts', 'ends', 'instance_id', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFileId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbInstanceId' => 4, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbInstanceId' => 4, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::FILE_ID => 1, self::STARTS => 2, self::ENDS => 3, self::INSTANCE_ID => 4, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'INSTANCE_ID' => 4, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'starts' => 2, 'ends' => 3, 'instance_id' => 4, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcPlayoutHistoryPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcPlayoutHistoryPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcPlayoutHistoryPeer::ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryPeer::FILE_ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryPeer::STARTS);
+ $criteria->addSelectColumn(CcPlayoutHistoryPeer::ENDS);
+ $criteria->addSelectColumn(CcPlayoutHistoryPeer::INSTANCE_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.FILE_ID');
+ $criteria->addSelectColumn($alias . '.STARTS');
+ $criteria->addSelectColumn($alias . '.ENDS');
+ $criteria->addSelectColumn($alias . '.INSTANCE_ID');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcPlayoutHistory
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcPlayoutHistoryPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcPlayoutHistoryPeer::populateObjects(CcPlayoutHistoryPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcPlayoutHistory $value A CcPlayoutHistory object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcPlayoutHistory $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcPlayoutHistory object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcPlayoutHistory) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPlayoutHistory object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcPlayoutHistory Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_playout_history
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in CcPlayoutHistoryMetaDataPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlayoutHistoryMetaDataPeer::clearInstancePool();
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcPlayoutHistoryPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcPlayoutHistoryPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcPlayoutHistoryPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcPlayoutHistory object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcPlayoutHistoryPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcPlayoutHistoryPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcPlayoutHistoryPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcFiles table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcShowInstances table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcShowInstances(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcPlayoutHistory objects pre-filled with their CcFiles objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistory objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcFilesPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcPlayoutHistoryPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to $obj2 (CcFiles)
+ $obj2->addCcPlayoutHistory($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcPlayoutHistory objects pre-filled with their CcShowInstances objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistory objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcShowInstances(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcShowInstancesPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcPlayoutHistoryPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcShowInstancesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to $obj2 (CcShowInstances)
+ $obj2->addCcPlayoutHistory($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CcPlayoutHistory objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistory objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol2 = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcPlayoutHistoryPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcFiles rows
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to the collection in $obj2 (CcFiles)
+ $obj2->addCcPlayoutHistory($obj1);
+ } // if joined row not null
+
+ // Add objects for joined CcShowInstances rows
+
+ $key3 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcShowInstancesPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcShowInstancesPeer::getOMClass(false);
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcShowInstancesPeer::addInstanceToPool($obj3, $key3);
+ } // if obj3 loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to the collection in $obj3 (CcShowInstances)
+ $obj3->addCcPlayoutHistory($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcFiles table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAllExceptCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcShowInstances table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAllExceptCcShowInstances(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcPlayoutHistory objects pre-filled with all related objects except CcFiles.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistory objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAllExceptCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ // $criteria->getDbName() will return the same object if not set to another value
+ // so == check is okay and faster
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol2 = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcPlayoutHistoryPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcShowInstances rows
+
+ $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcShowInstancesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to the collection in $obj2 (CcShowInstances)
+ $obj2->addCcPlayoutHistory($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcPlayoutHistory objects pre-filled with all related objects except CcShowInstances.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistory objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAllExceptCcShowInstances(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ // $criteria->getDbName() will return the same object if not set to another value
+ // so == check is okay and faster
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol2 = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcPlayoutHistoryPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcFiles rows
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to the collection in $obj2 (CcFiles)
+ $obj2->addCcPlayoutHistory($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcPlayoutHistoryPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcPlayoutHistoryPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcPlayoutHistoryTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcPlayoutHistoryPeer::CLASS_DEFAULT : CcPlayoutHistoryPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcPlayoutHistory or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistory object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistory object
+ }
+
+ if ($criteria->containsKey(CcPlayoutHistoryPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcPlayoutHistory or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistory object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcPlayoutHistoryPeer::ID);
+ $value = $criteria->remove(CcPlayoutHistoryPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcPlayoutHistoryPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcPlayoutHistory object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_playout_history table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcPlayoutHistoryPeer::TABLE_NAME, $con, CcPlayoutHistoryPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcPlayoutHistoryPeer::clearInstancePool();
+ CcPlayoutHistoryPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcPlayoutHistory or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistory object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcPlayoutHistoryPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcPlayoutHistory) { // it's a model object
+ // invalidate the cache for this single object
+ CcPlayoutHistoryPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcPlayoutHistoryPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcPlayoutHistoryPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcPlayoutHistory object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcPlayoutHistory $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcPlayoutHistory $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcPlayoutHistoryPeer::DATABASE_NAME, CcPlayoutHistoryPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcPlayoutHistory
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcPlayoutHistoryPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryPeer::ID, $pk);
+
+ $v = CcPlayoutHistoryPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryPeer::ID, $pks, Criteria::IN);
+ $objs = CcPlayoutHistoryPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcPlayoutHistoryPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcPlayoutHistoryPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryQuery.php
new file mode 100644
index 000000000..b772a0d7a
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryQuery.php
@@ -0,0 +1,509 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlayoutHistory|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcPlayoutHistoryPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId 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 CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the file_id column
+ *
+ * @param int|array $dbFileId 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 CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByDbFileId($dbFileId = null, $comparison = null)
+ {
+ if (is_array($dbFileId)) {
+ $useMinMax = false;
+ if (isset($dbFileId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFileId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $dbFileId, $comparison);
+ }
+
+ /**
+ * Filter the query on the starts column
+ *
+ * @param string|array $dbStarts 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 CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByDbStarts($dbStarts = null, $comparison = null)
+ {
+ if (is_array($dbStarts)) {
+ $useMinMax = false;
+ if (isset($dbStarts['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::STARTS, $dbStarts['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbStarts['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::STARTS, $dbStarts['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::STARTS, $dbStarts, $comparison);
+ }
+
+ /**
+ * Filter the query on the ends column
+ *
+ * @param string|array $dbEnds 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 CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByDbEnds($dbEnds = null, $comparison = null)
+ {
+ if (is_array($dbEnds)) {
+ $useMinMax = false;
+ if (isset($dbEnds['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbEnds['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds, $comparison);
+ }
+
+ /**
+ * Filter the query on the instance_id column
+ *
+ * @param int|array $dbInstanceId 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 CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByDbInstanceId($dbInstanceId = null, $comparison = null)
+ {
+ if (is_array($dbInstanceId)) {
+ $useMinMax = false;
+ if (isset($dbInstanceId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbInstanceId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcFiles object
+ *
+ * @param CcFiles $ccFiles the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByCcFiles($ccFiles, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcFiles relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcFiles');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcFiles');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcFiles relation CcFiles object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcFilesQuery A secondary query class using the current class as primary query
+ */
+ public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcFiles($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcShowInstances object
+ *
+ * @param CcShowInstances $ccShowInstances the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByCcShowInstances($ccShowInstances, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcShowInstances relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function joinCcShowInstances($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcShowInstances');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcShowInstances');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcShowInstances relation CcShowInstances object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcShowInstancesQuery A secondary query class using the current class as primary query
+ */
+ public function useCcShowInstancesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcShowInstances($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistoryMetaData object
+ *
+ * @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByCcPlayoutHistoryMetaData($ccPlayoutHistoryMetaData, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryPeer::ID, $ccPlayoutHistoryMetaData->getDbHistoryId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistoryMetaData relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistoryMetaData($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistoryMetaData');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcPlayoutHistoryMetaData');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistoryMetaData relation CcPlayoutHistoryMetaData object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryMetaDataQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryMetaDataQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistoryMetaData($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaDataQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcPlayoutHistory $ccPlayoutHistory Object to remove from the list of results
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function prune($ccPlayoutHistory = null)
+ {
+ if ($ccPlayoutHistory) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $ccPlayoutHistory->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcPlayoutHistoryQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplate.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplate.php
new file mode 100644
index 000000000..222227af6
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplate.php
@@ -0,0 +1,916 @@
+id;
+ }
+
+ /**
+ * Get the [name] column value.
+ *
+ * @return string
+ */
+ public function getDbName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Get the [type] column value.
+ *
+ * @return string
+ */
+ public function getDbType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplate The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplate The current object (for fluent API support)
+ */
+ public function setDbName($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::NAME;
+ }
+
+ return $this;
+ } // setDbName()
+
+ /**
+ * Set the value of [type] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplate The current object (for fluent API support)
+ */
+ public function setDbType($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->type !== $v) {
+ $this->type = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::TYPE;
+ }
+
+ return $this;
+ } // setDbType()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->type = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 3; // 3 = CcPlayoutHistoryTemplatePeer::NUM_COLUMNS - CcPlayoutHistoryTemplatePeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcPlayoutHistoryTemplate object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcPlayoutHistoryTemplatePeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->collCcPlayoutHistoryTemplateFields = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcPlayoutHistoryTemplateQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcPlayoutHistoryTemplatePeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplatePeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows = 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows = CcPlayoutHistoryTemplatePeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ if ($this->collCcPlayoutHistoryTemplateFields !== null) {
+ foreach ($this->collCcPlayoutHistoryTemplateFields as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = CcPlayoutHistoryTemplatePeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collCcPlayoutHistoryTemplateFields !== null) {
+ foreach ($this->collCcPlayoutHistoryTemplateFields as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryTemplatePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbName();
+ break;
+ case 2:
+ return $this->getDbType();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * 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.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
+ {
+ $keys = CcPlayoutHistoryTemplatePeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbName(),
+ $keys[2] => $this->getDbType(),
+ );
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryTemplatePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbName($value);
+ break;
+ case 2:
+ $this->setDbType($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcPlayoutHistoryTemplatePeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbType($arr[$keys[2]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::ID)) $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $this->id);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::NAME)) $criteria->add(CcPlayoutHistoryTemplatePeer::NAME, $this->name);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::TYPE)) $criteria->add(CcPlayoutHistoryTemplatePeer::TYPE, $this->type);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcPlayoutHistoryTemplate (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbName($this->name);
+ $copyObj->setDbType($this->type);
+
+ if ($deepCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+
+ foreach ($this->getCcPlayoutHistoryTemplateFields() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlayoutHistoryTemplateField($relObj->copy($deepCopy));
+ }
+ }
+
+ } // if ($deepCopy)
+
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcPlayoutHistoryTemplate Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcPlayoutHistoryTemplatePeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcPlayoutHistoryTemplatePeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Clears out the collCcPlayoutHistoryTemplateFields collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addCcPlayoutHistoryTemplateFields()
+ */
+ public function clearCcPlayoutHistoryTemplateFields()
+ {
+ $this->collCcPlayoutHistoryTemplateFields = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcPlayoutHistoryTemplateFields collection.
+ *
+ * By default this just sets the collCcPlayoutHistoryTemplateFields collection to an empty array (like clearcollCcPlayoutHistoryTemplateFields());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @return void
+ */
+ public function initCcPlayoutHistoryTemplateFields()
+ {
+ $this->collCcPlayoutHistoryTemplateFields = new PropelObjectCollection();
+ $this->collCcPlayoutHistoryTemplateFields->setModel('CcPlayoutHistoryTemplateField');
+ }
+
+ /**
+ * Gets an array of CcPlayoutHistoryTemplateField objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this CcPlayoutHistoryTemplate is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelCollection|array CcPlayoutHistoryTemplateField[] List of CcPlayoutHistoryTemplateField objects
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistoryTemplateFields($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistoryTemplateFields || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateFields) {
+ // return empty collection
+ $this->initCcPlayoutHistoryTemplateFields();
+ } else {
+ $collCcPlayoutHistoryTemplateFields = CcPlayoutHistoryTemplateFieldQuery::create(null, $criteria)
+ ->filterByCcPlayoutHistoryTemplate($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcPlayoutHistoryTemplateFields;
+ }
+ $this->collCcPlayoutHistoryTemplateFields = $collCcPlayoutHistoryTemplateFields;
+ }
+ }
+ return $this->collCcPlayoutHistoryTemplateFields;
+ }
+
+ /**
+ * Returns the number of related CcPlayoutHistoryTemplateField objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlayoutHistoryTemplateField objects.
+ * @throws PropelException
+ */
+ public function countCcPlayoutHistoryTemplateFields(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistoryTemplateFields || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateFields) {
+ return 0;
+ } else {
+ $query = CcPlayoutHistoryTemplateFieldQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcPlayoutHistoryTemplate($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcPlayoutHistoryTemplateFields);
+ }
+ }
+
+ /**
+ * Method called to associate a CcPlayoutHistoryTemplateField object to this object
+ * through the CcPlayoutHistoryTemplateField foreign key attribute.
+ *
+ * @param CcPlayoutHistoryTemplateField $l CcPlayoutHistoryTemplateField
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcPlayoutHistoryTemplateField(CcPlayoutHistoryTemplateField $l)
+ {
+ if ($this->collCcPlayoutHistoryTemplateFields === null) {
+ $this->initCcPlayoutHistoryTemplateFields();
+ }
+ if (!$this->collCcPlayoutHistoryTemplateFields->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcPlayoutHistoryTemplateFields[]= $l;
+ $l->setCcPlayoutHistoryTemplate($this);
+ }
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->name = null;
+ $this->type = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ if ($this->collCcPlayoutHistoryTemplateFields) {
+ foreach ((array) $this->collCcPlayoutHistoryTemplateFields as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ } // if ($deep)
+
+ $this->collCcPlayoutHistoryTemplateFields = null;
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcPlayoutHistoryTemplate
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateField.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateField.php
new file mode 100644
index 000000000..3476aa459
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateField.php
@@ -0,0 +1,1076 @@
+is_file_md = false;
+ }
+
+ /**
+ * Initializes internal state of BaseCcPlayoutHistoryTemplateField object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [template_id] column value.
+ *
+ * @return int
+ */
+ public function getDbTemplateId()
+ {
+ return $this->template_id;
+ }
+
+ /**
+ * Get the [name] column value.
+ *
+ * @return string
+ */
+ public function getDbName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Get the [label] column value.
+ *
+ * @return string
+ */
+ public function getDbLabel()
+ {
+ return $this->label;
+ }
+
+ /**
+ * Get the [type] column value.
+ *
+ * @return string
+ */
+ public function getDbType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * Get the [is_file_md] column value.
+ *
+ * @return boolean
+ */
+ public function getDbIsFileMD()
+ {
+ return $this->is_file_md;
+ }
+
+ /**
+ * Get the [position] column value.
+ *
+ * @return int
+ */
+ public function getDbPosition()
+ {
+ return $this->position;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [template_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbTemplateId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->template_id !== $v) {
+ $this->template_id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID;
+ }
+
+ if ($this->aCcPlayoutHistoryTemplate !== null && $this->aCcPlayoutHistoryTemplate->getDbId() !== $v) {
+ $this->aCcPlayoutHistoryTemplate = null;
+ }
+
+ return $this;
+ } // setDbTemplateId()
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbName($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::NAME;
+ }
+
+ return $this;
+ } // setDbName()
+
+ /**
+ * Set the value of [label] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbLabel($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->label !== $v) {
+ $this->label = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::LABEL;
+ }
+
+ return $this;
+ } // setDbLabel()
+
+ /**
+ * Set the value of [type] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbType($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->type !== $v) {
+ $this->type = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::TYPE;
+ }
+
+ return $this;
+ } // setDbType()
+
+ /**
+ * Set the value of [is_file_md] column.
+ *
+ * @param boolean $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbIsFileMD($v)
+ {
+ if ($v !== null) {
+ $v = (boolean) $v;
+ }
+
+ if ($this->is_file_md !== $v || $this->isNew()) {
+ $this->is_file_md = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD;
+ }
+
+ return $this;
+ } // setDbIsFileMD()
+
+ /**
+ * Set the value of [position] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbPosition($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::POSITION;
+ }
+
+ return $this;
+ } // setDbPosition()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->is_file_md !== false) {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->template_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->label = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->type = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->is_file_md = ($row[$startcol + 5] !== null) ? (boolean) $row[$startcol + 5] : null;
+ $this->position = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 7; // 7 = CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateFieldPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcPlayoutHistoryTemplateField object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCcPlayoutHistoryTemplate !== null && $this->template_id !== $this->aCcPlayoutHistoryTemplate->getDbId()) {
+ $this->aCcPlayoutHistoryTemplate = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcPlayoutHistoryTemplateFieldPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCcPlayoutHistoryTemplate = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcPlayoutHistoryTemplateFieldQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistoryTemplate !== null) {
+ if ($this->aCcPlayoutHistoryTemplate->isModified() || $this->aCcPlayoutHistoryTemplate->isNew()) {
+ $affectedRows += $this->aCcPlayoutHistoryTemplate->save($con);
+ }
+ $this->setCcPlayoutHistoryTemplate($this->aCcPlayoutHistoryTemplate);
+ }
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcPlayoutHistoryTemplateFieldPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplateFieldPeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows += 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows += CcPlayoutHistoryTemplateFieldPeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistoryTemplate !== null) {
+ if (!$this->aCcPlayoutHistoryTemplate->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcPlayoutHistoryTemplate->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcPlayoutHistoryTemplateFieldPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryTemplateFieldPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbTemplateId();
+ break;
+ case 2:
+ return $this->getDbName();
+ break;
+ case 3:
+ return $this->getDbLabel();
+ break;
+ case 4:
+ return $this->getDbType();
+ break;
+ case 5:
+ return $this->getDbIsFileMD();
+ break;
+ case 6:
+ return $this->getDbPosition();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * 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.
+ * 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.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
+ {
+ $keys = CcPlayoutHistoryTemplateFieldPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbTemplateId(),
+ $keys[2] => $this->getDbName(),
+ $keys[3] => $this->getDbLabel(),
+ $keys[4] => $this->getDbType(),
+ $keys[5] => $this->getDbIsFileMD(),
+ $keys[6] => $this->getDbPosition(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcPlayoutHistoryTemplate) {
+ $result['CcPlayoutHistoryTemplate'] = $this->aCcPlayoutHistoryTemplate->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryTemplateFieldPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbTemplateId($value);
+ break;
+ case 2:
+ $this->setDbName($value);
+ break;
+ case 3:
+ $this->setDbLabel($value);
+ break;
+ case 4:
+ $this->setDbType($value);
+ break;
+ case 5:
+ $this->setDbIsFileMD($value);
+ break;
+ case 6:
+ $this->setDbPosition($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcPlayoutHistoryTemplateFieldPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbTemplateId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbName($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbLabel($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbType($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbIsFileMD($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbPosition($arr[$keys[6]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::ID)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $this->id);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $this->template_id);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::NAME)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::NAME, $this->name);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::LABEL)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::LABEL, $this->label);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::TYPE)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::TYPE, $this->type);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD, $this->is_file_md);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::POSITION)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::POSITION, $this->position);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcPlayoutHistoryTemplateField (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbTemplateId($this->template_id);
+ $copyObj->setDbName($this->name);
+ $copyObj->setDbLabel($this->label);
+ $copyObj->setDbType($this->type);
+ $copyObj->setDbIsFileMD($this->is_file_md);
+ $copyObj->setDbPosition($this->position);
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcPlayoutHistoryTemplateField Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcPlayoutHistoryTemplateFieldPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcPlayoutHistoryTemplateFieldPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcPlayoutHistoryTemplate object.
+ *
+ * @param CcPlayoutHistoryTemplate $v
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcPlayoutHistoryTemplate(CcPlayoutHistoryTemplate $v = null)
+ {
+ if ($v === null) {
+ $this->setDbTemplateId(NULL);
+ } else {
+ $this->setDbTemplateId($v->getDbId());
+ }
+
+ $this->aCcPlayoutHistoryTemplate = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcPlayoutHistoryTemplate object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcPlayoutHistoryTemplateField($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcPlayoutHistoryTemplate object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcPlayoutHistoryTemplate The associated CcPlayoutHistoryTemplate object.
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistoryTemplate(PropelPDO $con = null)
+ {
+ if ($this->aCcPlayoutHistoryTemplate === null && ($this->template_id !== null)) {
+ $this->aCcPlayoutHistoryTemplate = CcPlayoutHistoryTemplateQuery::create()->findPk($this->template_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcPlayoutHistoryTemplate->addCcPlayoutHistoryTemplateFields($this);
+ */
+ }
+ return $this->aCcPlayoutHistoryTemplate;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->template_id = null;
+ $this->name = null;
+ $this->label = null;
+ $this->type = null;
+ $this->is_file_md = null;
+ $this->position = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aCcPlayoutHistoryTemplate = null;
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcPlayoutHistoryTemplateField
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php
new file mode 100644
index 000000000..91586fa1d
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php
@@ -0,0 +1,998 @@
+ array ('DbId', 'DbTemplateId', 'DbName', 'DbLabel', 'DbType', 'DbIsFileMD', 'DbPosition', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTemplateId', 'dbName', 'dbLabel', 'dbType', 'dbIsFileMD', 'dbPosition', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::TEMPLATE_ID, self::NAME, self::LABEL, self::TYPE, self::IS_FILE_MD, self::POSITION, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TEMPLATE_ID', 'NAME', 'LABEL', 'TYPE', 'IS_FILE_MD', 'POSITION', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'template_id', 'name', 'label', 'type', 'is_file_md', 'position', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTemplateId' => 1, 'DbName' => 2, 'DbLabel' => 3, 'DbType' => 4, 'DbIsFileMD' => 5, 'DbPosition' => 6, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTemplateId' => 1, 'dbName' => 2, 'dbLabel' => 3, 'dbType' => 4, 'dbIsFileMD' => 5, 'dbPosition' => 6, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TEMPLATE_ID => 1, self::NAME => 2, self::LABEL => 3, self::TYPE => 4, self::IS_FILE_MD => 5, self::POSITION => 6, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TEMPLATE_ID' => 1, 'NAME' => 2, 'LABEL' => 3, 'TYPE' => 4, 'IS_FILE_MD' => 5, 'POSITION' => 6, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'template_id' => 1, 'name' => 2, 'label' => 3, 'type' => 4, 'is_file_md' => 5, 'position' => 6, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcPlayoutHistoryTemplateFieldPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::NAME);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::LABEL);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::TYPE);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::POSITION);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
+ $criteria->addSelectColumn($alias . '.NAME');
+ $criteria->addSelectColumn($alias . '.LABEL');
+ $criteria->addSelectColumn($alias . '.TYPE');
+ $criteria->addSelectColumn($alias . '.IS_FILE_MD');
+ $criteria->addSelectColumn($alias . '.POSITION');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcPlayoutHistoryTemplateField
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcPlayoutHistoryTemplateFieldPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcPlayoutHistoryTemplateFieldPeer::populateObjects(CcPlayoutHistoryTemplateFieldPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcPlayoutHistoryTemplateField $value A CcPlayoutHistoryTemplateField object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcPlayoutHistoryTemplateField $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcPlayoutHistoryTemplateField object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcPlayoutHistoryTemplateField) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPlayoutHistoryTemplateField object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcPlayoutHistoryTemplateField Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_playout_history_template_field
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcPlayoutHistoryTemplateFieldPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcPlayoutHistoryTemplateField object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcPlayoutHistoryTemplateFieldPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcPlayoutHistoryTemplate table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcPlayoutHistoryTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcPlayoutHistoryTemplateField objects pre-filled with their CcPlayoutHistoryTemplate objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistoryTemplateField objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcPlayoutHistoryTemplate(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ $startcol = (CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateFieldPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryTemplateFieldPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcPlayoutHistoryTemplateFieldPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistoryTemplateField) to $obj2 (CcPlayoutHistoryTemplate)
+ $obj2->addCcPlayoutHistoryTemplateField($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CcPlayoutHistoryTemplateField objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistoryTemplateField objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ $startcol2 = (CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateFieldPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcPlayoutHistoryTemplatePeer::NUM_COLUMNS - CcPlayoutHistoryTemplatePeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryTemplateFieldPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcPlayoutHistoryTemplateFieldPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcPlayoutHistoryTemplate rows
+
+ $key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcPlayoutHistoryTemplateField) to the collection in $obj2 (CcPlayoutHistoryTemplate)
+ $obj2->addCcPlayoutHistoryTemplateField($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcPlayoutHistoryTemplateFieldPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcPlayoutHistoryTemplateFieldTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcPlayoutHistoryTemplateFieldPeer::CLASS_DEFAULT : CcPlayoutHistoryTemplateFieldPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcPlayoutHistoryTemplateField or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplateField object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryTemplateField object
+ }
+
+ if ($criteria->containsKey(CcPlayoutHistoryTemplateFieldPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryTemplateFieldPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplateFieldPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcPlayoutHistoryTemplateField or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplateField object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcPlayoutHistoryTemplateFieldPeer::ID);
+ $value = $criteria->remove(CcPlayoutHistoryTemplateFieldPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcPlayoutHistoryTemplateField object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_playout_history_template_field table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME, $con, CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcPlayoutHistoryTemplateFieldPeer::clearInstancePool();
+ CcPlayoutHistoryTemplateFieldPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcPlayoutHistoryTemplateField or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplateField object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcPlayoutHistoryTemplateFieldPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcPlayoutHistoryTemplateField) { // it's a model object
+ // invalidate the cache for this single object
+ CcPlayoutHistoryTemplateFieldPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcPlayoutHistoryTemplateFieldPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcPlayoutHistoryTemplateFieldPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcPlayoutHistoryTemplateField object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcPlayoutHistoryTemplateField $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcPlayoutHistoryTemplateField $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcPlayoutHistoryTemplateField
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $pk);
+
+ $v = CcPlayoutHistoryTemplateFieldPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $pks, Criteria::IN);
+ $objs = CcPlayoutHistoryTemplateFieldPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcPlayoutHistoryTemplateFieldPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcPlayoutHistoryTemplateFieldPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php
new file mode 100644
index 000000000..2bccd58ca
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php
@@ -0,0 +1,402 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlayoutHistoryTemplateField|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the template_id column
+ *
+ * @param int|array $dbTemplateId 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByDbTemplateId($dbTemplateId = null, $comparison = null)
+ {
+ if (is_array($dbTemplateId)) {
+ $useMinMax = false;
+ if (isset($dbTemplateId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbTemplateId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId, $comparison);
+ }
+
+ /**
+ * Filter the query on the name column
+ *
+ * @param string $dbName 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByDbName($dbName = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbName)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbName)) {
+ $dbName = str_replace('*', '%', $dbName);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::NAME, $dbName, $comparison);
+ }
+
+ /**
+ * Filter the query on the label column
+ *
+ * @param string $dbLabel 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByDbLabel($dbLabel = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLabel)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLabel)) {
+ $dbLabel = str_replace('*', '%', $dbLabel);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::LABEL, $dbLabel, $comparison);
+ }
+
+ /**
+ * Filter the query on the type column
+ *
+ * @param string $dbType 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByDbType($dbType = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbType)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbType)) {
+ $dbType = str_replace('*', '%', $dbType);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TYPE, $dbType, $comparison);
+ }
+
+ /**
+ * Filter the query on the is_file_md column
+ *
+ * @param boolean|string $dbIsFileMD The value to use as filter.
+ * Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByDbIsFileMD($dbIsFileMD = null, $comparison = null)
+ {
+ if (is_string($dbIsFileMD)) {
+ $is_file_md = in_array(strtolower($dbIsFileMD), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD, $dbIsFileMD, $comparison);
+ }
+
+ /**
+ * Filter the query on the position column
+ *
+ * @param int|array $dbPosition 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByDbPosition($dbPosition = null, $comparison = null)
+ {
+ if (is_array($dbPosition)) {
+ $useMinMax = false;
+ if (isset($dbPosition['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbPosition['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistoryTemplate object
+ *
+ * @param CcPlayoutHistoryTemplate $ccPlayoutHistoryTemplate the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByCcPlayoutHistoryTemplate($ccPlayoutHistoryTemplate, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $ccPlayoutHistoryTemplate->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistoryTemplate relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistoryTemplate($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplate');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcPlayoutHistoryTemplate');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistoryTemplate relation CcPlayoutHistoryTemplate object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryTemplateQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryTemplateQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistoryTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplateQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcPlayoutHistoryTemplateField $ccPlayoutHistoryTemplateField Object to remove from the list of results
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function prune($ccPlayoutHistoryTemplateField = null)
+ {
+ if ($ccPlayoutHistoryTemplateField) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $ccPlayoutHistoryTemplateField->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcPlayoutHistoryTemplateFieldQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplatePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplatePeer.php
new file mode 100644
index 000000000..9e1d216f1
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplatePeer.php
@@ -0,0 +1,747 @@
+ array ('DbId', 'DbName', 'DbType', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbType', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::TYPE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'TYPE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'type', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbType' => 2, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbType' => 2, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::TYPE => 2, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'TYPE' => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'type' => 2, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcPlayoutHistoryTemplatePeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcPlayoutHistoryTemplatePeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::NAME);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::TYPE);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.NAME');
+ $criteria->addSelectColumn($alias . '.TYPE');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcPlayoutHistoryTemplate
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcPlayoutHistoryTemplatePeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcPlayoutHistoryTemplatePeer::populateObjects(CcPlayoutHistoryTemplatePeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcPlayoutHistoryTemplate $value A CcPlayoutHistoryTemplate object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcPlayoutHistoryTemplate $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcPlayoutHistoryTemplate object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcPlayoutHistoryTemplate) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPlayoutHistoryTemplate object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcPlayoutHistoryTemplate Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_playout_history_template
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in CcPlayoutHistoryTemplateFieldPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlayoutHistoryTemplateFieldPeer::clearInstancePool();
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcPlayoutHistoryTemplate object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcPlayoutHistoryTemplatePeer::NUM_COLUMNS;
+ } else {
+ $cls = CcPlayoutHistoryTemplatePeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcPlayoutHistoryTemplatePeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcPlayoutHistoryTemplateTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcPlayoutHistoryTemplatePeer::CLASS_DEFAULT : CcPlayoutHistoryTemplatePeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcPlayoutHistoryTemplate or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplate object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryTemplate object
+ }
+
+ if ($criteria->containsKey(CcPlayoutHistoryTemplatePeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryTemplatePeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplatePeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcPlayoutHistoryTemplate or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplate object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcPlayoutHistoryTemplatePeer::ID);
+ $value = $criteria->remove(CcPlayoutHistoryTemplatePeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcPlayoutHistoryTemplatePeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcPlayoutHistoryTemplate object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_playout_history_template table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcPlayoutHistoryTemplatePeer::TABLE_NAME, $con, CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcPlayoutHistoryTemplatePeer::clearInstancePool();
+ CcPlayoutHistoryTemplatePeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcPlayoutHistoryTemplate or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplate object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcPlayoutHistoryTemplatePeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcPlayoutHistoryTemplate) { // it's a model object
+ // invalidate the cache for this single object
+ CcPlayoutHistoryTemplatePeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplatePeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcPlayoutHistoryTemplatePeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcPlayoutHistoryTemplatePeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcPlayoutHistoryTemplate object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcPlayoutHistoryTemplate $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcPlayoutHistoryTemplate $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, CcPlayoutHistoryTemplatePeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcPlayoutHistoryTemplate
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcPlayoutHistoryTemplatePeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $pk);
+
+ $v = CcPlayoutHistoryTemplatePeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $pks, Criteria::IN);
+ $objs = CcPlayoutHistoryTemplatePeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcPlayoutHistoryTemplatePeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcPlayoutHistoryTemplatePeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateQuery.php
new file mode 100644
index 000000000..ca2f84229
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateQuery.php
@@ -0,0 +1,285 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlayoutHistoryTemplate|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcPlayoutHistoryTemplatePeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId 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 CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the name column
+ *
+ * @param string $dbName 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 CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function filterByDbName($dbName = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbName)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbName)) {
+ $dbName = str_replace('*', '%', $dbName);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::NAME, $dbName, $comparison);
+ }
+
+ /**
+ * Filter the query on the type column
+ *
+ * @param string $dbType 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 CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function filterByDbType($dbType = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbType)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbType)) {
+ $dbType = str_replace('*', '%', $dbType);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::TYPE, $dbType, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistoryTemplateField object
+ *
+ * @param CcPlayoutHistoryTemplateField $ccPlayoutHistoryTemplateField the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function filterByCcPlayoutHistoryTemplateField($ccPlayoutHistoryTemplateField, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $ccPlayoutHistoryTemplateField->getDbTemplateId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistoryTemplateField($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplateField');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcPlayoutHistoryTemplateField');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistoryTemplateField relation CcPlayoutHistoryTemplateField object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryTemplateFieldQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistoryTemplateField($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplateField', 'CcPlayoutHistoryTemplateFieldQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcPlayoutHistoryTemplate $ccPlayoutHistoryTemplate Object to remove from the list of results
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function prune($ccPlayoutHistoryTemplate = null)
+ {
+ if ($ccPlayoutHistoryTemplate) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $ccPlayoutHistoryTemplate->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcPlayoutHistoryTemplateQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTag.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTag.php
new file mode 100644
index 000000000..bd2530992
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTag.php
@@ -0,0 +1,1028 @@
+is_file_md = false;
+ }
+
+ /**
+ * Initializes internal state of BaseCcPlayoutHistoryTemplateTag object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [template_id] column value.
+ *
+ * @return int
+ */
+ public function getDbTemplateId()
+ {
+ return $this->template_id;
+ }
+
+ /**
+ * Get the [name] column value.
+ *
+ * @return string
+ */
+ public function getDbName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Get the [type] column value.
+ *
+ * @return string
+ */
+ public function getDbType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * Get the [is_file_md] column value.
+ *
+ * @return boolean
+ */
+ public function getDbIsFileMD()
+ {
+ return $this->is_file_md;
+ }
+
+ /**
+ * Get the [position] column value.
+ *
+ * @return int
+ */
+ public function getDbTagPosition()
+ {
+ return $this->position;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplateTag The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateTagPeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [template_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplateTag The current object (for fluent API support)
+ */
+ public function setDbTemplateId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->template_id !== $v) {
+ $this->template_id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID;
+ }
+
+ if ($this->aCcPlayoutHistoryTemplate !== null && $this->aCcPlayoutHistoryTemplate->getDbId() !== $v) {
+ $this->aCcPlayoutHistoryTemplate = null;
+ }
+
+ return $this;
+ } // setDbTemplateId()
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplateTag The current object (for fluent API support)
+ */
+ public function setDbName($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateTagPeer::NAME;
+ }
+
+ return $this;
+ } // setDbName()
+
+ /**
+ * Set the value of [type] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplateTag The current object (for fluent API support)
+ */
+ public function setDbType($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->type !== $v) {
+ $this->type = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateTagPeer::TYPE;
+ }
+
+ return $this;
+ } // setDbType()
+
+ /**
+ * Set the value of [is_file_md] column.
+ *
+ * @param boolean $v new value
+ * @return CcPlayoutHistoryTemplateTag The current object (for fluent API support)
+ */
+ public function setDbIsFileMD($v)
+ {
+ if ($v !== null) {
+ $v = (boolean) $v;
+ }
+
+ if ($this->is_file_md !== $v || $this->isNew()) {
+ $this->is_file_md = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateTagPeer::IS_FILE_MD;
+ }
+
+ return $this;
+ } // setDbIsFileMD()
+
+ /**
+ * Set the value of [position] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplateTag The current object (for fluent API support)
+ */
+ public function setDbTagPosition($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateTagPeer::POSITION;
+ }
+
+ return $this;
+ } // setDbTagPosition()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->is_file_md !== false) {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->template_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->type = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->is_file_md = ($row[$startcol + 4] !== null) ? (boolean) $row[$startcol + 4] : null;
+ $this->position = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = CcPlayoutHistoryTemplateTagPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateTagPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcPlayoutHistoryTemplateTag object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCcPlayoutHistoryTemplate !== null && $this->template_id !== $this->aCcPlayoutHistoryTemplate->getDbId()) {
+ $this->aCcPlayoutHistoryTemplate = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcPlayoutHistoryTemplateTagPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCcPlayoutHistoryTemplate = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcPlayoutHistoryTemplateTagQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CcPlayoutHistoryTemplateTagPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistoryTemplate !== null) {
+ if ($this->aCcPlayoutHistoryTemplate->isModified() || $this->aCcPlayoutHistoryTemplate->isNew()) {
+ $affectedRows += $this->aCcPlayoutHistoryTemplate->save($con);
+ }
+ $this->setCcPlayoutHistoryTemplate($this->aCcPlayoutHistoryTemplate);
+ }
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateTagPeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcPlayoutHistoryTemplateTagPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplateTagPeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows += 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows += CcPlayoutHistoryTemplateTagPeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistoryTemplate !== null) {
+ if (!$this->aCcPlayoutHistoryTemplate->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcPlayoutHistoryTemplate->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcPlayoutHistoryTemplateTagPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryTemplateTagPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbTemplateId();
+ break;
+ case 2:
+ return $this->getDbName();
+ break;
+ case 3:
+ return $this->getDbType();
+ break;
+ case 4:
+ return $this->getDbIsFileMD();
+ break;
+ case 5:
+ return $this->getDbTagPosition();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * 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.
+ * 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.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
+ {
+ $keys = CcPlayoutHistoryTemplateTagPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbTemplateId(),
+ $keys[2] => $this->getDbName(),
+ $keys[3] => $this->getDbType(),
+ $keys[4] => $this->getDbIsFileMD(),
+ $keys[5] => $this->getDbTagPosition(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcPlayoutHistoryTemplate) {
+ $result['CcPlayoutHistoryTemplate'] = $this->aCcPlayoutHistoryTemplate->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryTemplateTagPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbTemplateId($value);
+ break;
+ case 2:
+ $this->setDbName($value);
+ break;
+ case 3:
+ $this->setDbType($value);
+ break;
+ case 4:
+ $this->setDbIsFileMD($value);
+ break;
+ case 5:
+ $this->setDbTagPosition($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcPlayoutHistoryTemplateTagPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbTemplateId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbName($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbType($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbIsFileMD($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbTagPosition($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateTagPeer::ID)) $criteria->add(CcPlayoutHistoryTemplateTagPeer::ID, $this->id);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID)) $criteria->add(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, $this->template_id);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateTagPeer::NAME)) $criteria->add(CcPlayoutHistoryTemplateTagPeer::NAME, $this->name);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateTagPeer::TYPE)) $criteria->add(CcPlayoutHistoryTemplateTagPeer::TYPE, $this->type);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateTagPeer::IS_FILE_MD)) $criteria->add(CcPlayoutHistoryTemplateTagPeer::IS_FILE_MD, $this->is_file_md);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateTagPeer::POSITION)) $criteria->add(CcPlayoutHistoryTemplateTagPeer::POSITION, $this->position);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateTagPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcPlayoutHistoryTemplateTag (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbTemplateId($this->template_id);
+ $copyObj->setDbName($this->name);
+ $copyObj->setDbType($this->type);
+ $copyObj->setDbIsFileMD($this->is_file_md);
+ $copyObj->setDbTagPosition($this->position);
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcPlayoutHistoryTemplateTag Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcPlayoutHistoryTemplateTagPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcPlayoutHistoryTemplateTagPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcPlayoutHistoryTemplate object.
+ *
+ * @param CcPlayoutHistoryTemplate $v
+ * @return CcPlayoutHistoryTemplateTag The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcPlayoutHistoryTemplate(CcPlayoutHistoryTemplate $v = null)
+ {
+ if ($v === null) {
+ $this->setDbTemplateId(NULL);
+ } else {
+ $this->setDbTemplateId($v->getDbId());
+ }
+
+ $this->aCcPlayoutHistoryTemplate = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcPlayoutHistoryTemplate object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcPlayoutHistoryTemplateTag($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcPlayoutHistoryTemplate object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcPlayoutHistoryTemplate The associated CcPlayoutHistoryTemplate object.
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistoryTemplate(PropelPDO $con = null)
+ {
+ if ($this->aCcPlayoutHistoryTemplate === null && ($this->template_id !== null)) {
+ $this->aCcPlayoutHistoryTemplate = CcPlayoutHistoryTemplateQuery::create()->findPk($this->template_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcPlayoutHistoryTemplate->addCcPlayoutHistoryTemplateTags($this);
+ */
+ }
+ return $this->aCcPlayoutHistoryTemplate;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->template_id = null;
+ $this->name = null;
+ $this->type = null;
+ $this->is_file_md = null;
+ $this->position = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aCcPlayoutHistoryTemplate = null;
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcPlayoutHistoryTemplateTag
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTagPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTagPeer.php
new file mode 100644
index 000000000..617bcf2dc
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTagPeer.php
@@ -0,0 +1,993 @@
+ array ('DbId', 'DbTemplateId', 'DbName', 'DbType', 'DbIsFileMD', 'DbTagPosition', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTemplateId', 'dbName', 'dbType', 'dbIsFileMD', 'dbTagPosition', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::TEMPLATE_ID, self::NAME, self::TYPE, self::IS_FILE_MD, self::POSITION, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TEMPLATE_ID', 'NAME', 'TYPE', 'IS_FILE_MD', 'POSITION', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'template_id', 'name', 'type', 'is_file_md', 'position', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTemplateId' => 1, 'DbName' => 2, 'DbType' => 3, 'DbIsFileMD' => 4, 'DbTagPosition' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTemplateId' => 1, 'dbName' => 2, 'dbType' => 3, 'dbIsFileMD' => 4, 'dbTagPosition' => 5, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TEMPLATE_ID => 1, self::NAME => 2, self::TYPE => 3, self::IS_FILE_MD => 4, self::POSITION => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TEMPLATE_ID' => 1, 'NAME' => 2, 'TYPE' => 3, 'IS_FILE_MD' => 4, 'POSITION' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'template_id' => 1, 'name' => 2, 'type' => 3, 'is_file_md' => 4, 'position' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcPlayoutHistoryTemplateTagPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::NAME);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::TYPE);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::IS_FILE_MD);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::POSITION);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
+ $criteria->addSelectColumn($alias . '.NAME');
+ $criteria->addSelectColumn($alias . '.TYPE');
+ $criteria->addSelectColumn($alias . '.IS_FILE_MD');
+ $criteria->addSelectColumn($alias . '.POSITION');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplateTagPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcPlayoutHistoryTemplateTag
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcPlayoutHistoryTemplateTagPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcPlayoutHistoryTemplateTagPeer::populateObjects(CcPlayoutHistoryTemplateTagPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcPlayoutHistoryTemplateTagPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcPlayoutHistoryTemplateTag $value A CcPlayoutHistoryTemplateTag object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcPlayoutHistoryTemplateTag $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcPlayoutHistoryTemplateTag object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcPlayoutHistoryTemplateTag) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPlayoutHistoryTemplateTag object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcPlayoutHistoryTemplateTag Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_playout_history_template_field
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcPlayoutHistoryTemplateTagPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcPlayoutHistoryTemplateTagPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcPlayoutHistoryTemplateTagPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcPlayoutHistoryTemplateTagPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcPlayoutHistoryTemplateTag object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcPlayoutHistoryTemplateTagPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcPlayoutHistoryTemplateTagPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcPlayoutHistoryTemplateTagPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcPlayoutHistoryTemplateTagPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcPlayoutHistoryTemplateTagPeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcPlayoutHistoryTemplate table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcPlayoutHistoryTemplate(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplateTagPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcPlayoutHistoryTemplateTag objects pre-filled with their CcPlayoutHistoryTemplate objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistoryTemplateTag objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcPlayoutHistoryTemplate(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryTemplateTagPeer::addSelectColumns($criteria);
+ $startcol = (CcPlayoutHistoryTemplateTagPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateTagPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryTemplateTagPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryTemplateTagPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcPlayoutHistoryTemplateTagPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryTemplateTagPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistoryTemplateTag) to $obj2 (CcPlayoutHistoryTemplate)
+ $obj2->addCcPlayoutHistoryTemplateTag($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplateTagPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CcPlayoutHistoryTemplateTag objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlayoutHistoryTemplateTag objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryTemplateTagPeer::addSelectColumns($criteria);
+ $startcol2 = (CcPlayoutHistoryTemplateTagPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateTagPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcPlayoutHistoryTemplatePeer::NUM_COLUMNS - CcPlayoutHistoryTemplatePeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryTemplateTagPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryTemplateTagPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcPlayoutHistoryTemplateTagPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryTemplateTagPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcPlayoutHistoryTemplate rows
+
+ $key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcPlayoutHistoryTemplateTag) to the collection in $obj2 (CcPlayoutHistoryTemplate)
+ $obj2->addCcPlayoutHistoryTemplateTag($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcPlayoutHistoryTemplateTagPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcPlayoutHistoryTemplateTagTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcPlayoutHistoryTemplateTagPeer::CLASS_DEFAULT : CcPlayoutHistoryTemplateTagPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcPlayoutHistoryTemplateTag or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplateTag object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryTemplateTag object
+ }
+
+ if ($criteria->containsKey(CcPlayoutHistoryTemplateTagPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryTemplateTagPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplateTagPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcPlayoutHistoryTemplateTag or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplateTag object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcPlayoutHistoryTemplateTagPeer::ID);
+ $value = $criteria->remove(CcPlayoutHistoryTemplateTagPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcPlayoutHistoryTemplateTagPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcPlayoutHistoryTemplateTag object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_playout_history_template_field table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME, $con, CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcPlayoutHistoryTemplateTagPeer::clearInstancePool();
+ CcPlayoutHistoryTemplateTagPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcPlayoutHistoryTemplateTag or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplateTag object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcPlayoutHistoryTemplateTagPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcPlayoutHistoryTemplateTag) { // it's a model object
+ // invalidate the cache for this single object
+ CcPlayoutHistoryTemplateTagPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateTagPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcPlayoutHistoryTemplateTagPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcPlayoutHistoryTemplateTagPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcPlayoutHistoryTemplateTag object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcPlayoutHistoryTemplateTag $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcPlayoutHistoryTemplateTag $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, CcPlayoutHistoryTemplateTagPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcPlayoutHistoryTemplateTag
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcPlayoutHistoryTemplateTagPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateTagPeer::ID, $pk);
+
+ $v = CcPlayoutHistoryTemplateTagPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateTagPeer::ID, $pks, Criteria::IN);
+ $objs = CcPlayoutHistoryTemplateTagPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcPlayoutHistoryTemplateTagPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcPlayoutHistoryTemplateTagPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTagQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTagQuery.php
new file mode 100644
index 000000000..62b7eff77
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTagQuery.php
@@ -0,0 +1,376 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlayoutHistoryTemplateTag|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcPlayoutHistoryTemplateTagPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId 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 CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the template_id column
+ *
+ * @param int|array $dbTemplateId 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 CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function filterByDbTemplateId($dbTemplateId = null, $comparison = null)
+ {
+ if (is_array($dbTemplateId)) {
+ $useMinMax = false;
+ if (isset($dbTemplateId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, $dbTemplateId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbTemplateId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, $dbTemplateId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, $dbTemplateId, $comparison);
+ }
+
+ /**
+ * Filter the query on the name column
+ *
+ * @param string $dbName 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 CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function filterByDbName($dbName = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbName)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbName)) {
+ $dbName = str_replace('*', '%', $dbName);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::NAME, $dbName, $comparison);
+ }
+
+ /**
+ * Filter the query on the type column
+ *
+ * @param string $dbType 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 CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function filterByDbType($dbType = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbType)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbType)) {
+ $dbType = str_replace('*', '%', $dbType);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TYPE, $dbType, $comparison);
+ }
+
+ /**
+ * Filter the query on the is_file_md column
+ *
+ * @param boolean|string $dbIsFileMD The value to use as filter.
+ * Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function filterByDbIsFileMD($dbIsFileMD = null, $comparison = null)
+ {
+ if (is_string($dbIsFileMD)) {
+ $is_file_md = in_array(strtolower($dbIsFileMD), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::IS_FILE_MD, $dbIsFileMD, $comparison);
+ }
+
+ /**
+ * Filter the query on the position column
+ *
+ * @param int|array $dbTagPosition 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 CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function filterByDbTagPosition($dbTagPosition = null, $comparison = null)
+ {
+ if (is_array($dbTagPosition)) {
+ $useMinMax = false;
+ if (isset($dbTagPosition['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::POSITION, $dbTagPosition['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbTagPosition['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::POSITION, $dbTagPosition['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::POSITION, $dbTagPosition, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistoryTemplate object
+ *
+ * @param CcPlayoutHistoryTemplate $ccPlayoutHistoryTemplate the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function filterByCcPlayoutHistoryTemplate($ccPlayoutHistoryTemplate, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, $ccPlayoutHistoryTemplate->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistoryTemplate relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistoryTemplate($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplate');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcPlayoutHistoryTemplate');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistoryTemplate relation CcPlayoutHistoryTemplate object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryTemplateQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryTemplateQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistoryTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplateQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcPlayoutHistoryTemplateTag $ccPlayoutHistoryTemplateTag Object to remove from the list of results
+ *
+ * @return CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
+ */
+ public function prune($ccPlayoutHistoryTemplateTag = null)
+ {
+ if ($ccPlayoutHistoryTemplateTag) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::ID, $ccPlayoutHistoryTemplateTag->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcPlayoutHistoryTemplateTagQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php
index 1caf7df62..a783a8e20 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php
@@ -125,6 +125,11 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
*/
protected $collCcSchedules;
+ /**
+ * @var array CcPlayoutHistory[] Collection to store aggregation of CcPlayoutHistory objects.
+ */
+ protected $collCcPlayoutHistorys;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -889,6 +894,8 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$this->collCcSchedules = null;
+ $this->collCcPlayoutHistorys = null;
+
} // if (deep)
}
@@ -1064,6 +1071,14 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
}
}
+ if ($this->collCcPlayoutHistorys !== null) {
+ foreach ($this->collCcPlayoutHistorys as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -1175,6 +1190,14 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
}
}
+ if ($this->collCcPlayoutHistorys !== null) {
+ foreach ($this->collCcPlayoutHistorys as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
$this->alreadyInValidation = false;
}
@@ -1507,6 +1530,12 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
}
}
+ foreach ($this->getCcPlayoutHistorys() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlayoutHistory($relObj->copy($deepCopy));
+ }
+ }
+
} // if ($deepCopy)
@@ -2017,6 +2046,140 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
return $this->getCcSchedules($query, $con);
}
+ /**
+ * Clears out the collCcPlayoutHistorys collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addCcPlayoutHistorys()
+ */
+ public function clearCcPlayoutHistorys()
+ {
+ $this->collCcPlayoutHistorys = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcPlayoutHistorys collection.
+ *
+ * By default this just sets the collCcPlayoutHistorys collection to an empty array (like clearcollCcPlayoutHistorys());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @return void
+ */
+ public function initCcPlayoutHistorys()
+ {
+ $this->collCcPlayoutHistorys = new PropelObjectCollection();
+ $this->collCcPlayoutHistorys->setModel('CcPlayoutHistory');
+ }
+
+ /**
+ * Gets an array of CcPlayoutHistory objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this CcShowInstances is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelCollection|array CcPlayoutHistory[] List of CcPlayoutHistory objects
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistorys($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
+ // return empty collection
+ $this->initCcPlayoutHistorys();
+ } else {
+ $collCcPlayoutHistorys = CcPlayoutHistoryQuery::create(null, $criteria)
+ ->filterByCcShowInstances($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcPlayoutHistorys;
+ }
+ $this->collCcPlayoutHistorys = $collCcPlayoutHistorys;
+ }
+ }
+ return $this->collCcPlayoutHistorys;
+ }
+
+ /**
+ * Returns the number of related CcPlayoutHistory objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlayoutHistory objects.
+ * @throws PropelException
+ */
+ public function countCcPlayoutHistorys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
+ return 0;
+ } else {
+ $query = CcPlayoutHistoryQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcShowInstances($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcPlayoutHistorys);
+ }
+ }
+
+ /**
+ * Method called to associate a CcPlayoutHistory object to this object
+ * through the CcPlayoutHistory foreign key attribute.
+ *
+ * @param CcPlayoutHistory $l CcPlayoutHistory
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcPlayoutHistory(CcPlayoutHistory $l)
+ {
+ if ($this->collCcPlayoutHistorys === null) {
+ $this->initCcPlayoutHistorys();
+ }
+ if (!$this->collCcPlayoutHistorys->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcPlayoutHistorys[]= $l;
+ $l->setCcShowInstances($this);
+ }
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcShowInstances is new, it will return
+ * an empty collection; or if this CcShowInstances has previously
+ * been saved, it will retrieve related CcPlayoutHistorys from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in CcShowInstances.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return PropelCollection|array CcPlayoutHistory[] List of CcPlayoutHistory objects
+ */
+ public function getCcPlayoutHistorysJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlayoutHistoryQuery::create(null, $criteria);
+ $query->joinWith('CcFiles', $join_behavior);
+
+ return $this->getCcPlayoutHistorys($query, $con);
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -2065,10 +2228,16 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collCcPlayoutHistorys) {
+ foreach ((array) $this->collCcPlayoutHistorys as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
$this->collCcShowInstancessRelatedByDbId = null;
$this->collCcSchedules = null;
+ $this->collCcPlayoutHistorys = null;
$this->aCcShow = null;
$this->aCcShowInstancesRelatedByDbOriginalShow = null;
$this->aCcFiles = null;
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php
index 076f2182c..ad91f182c 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php
@@ -399,6 +399,9 @@ abstract class BaseCcShowInstancesPeer {
// Invalidate objects in CcSchedulePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcSchedulePeer::clearInstancePool();
+ // Invalidate objects in CcPlayoutHistoryPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlayoutHistoryPeer::clearInstancePool();
}
/**
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php
index 08a245d2e..871b907ae 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php
@@ -56,6 +56,10 @@
* @method CcShowInstancesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation
* @method CcShowInstancesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
*
+ * @method CcShowInstancesQuery leftJoinCcPlayoutHistory($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcShowInstancesQuery rightJoinCcPlayoutHistory($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcShowInstancesQuery innerJoinCcPlayoutHistory($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
+ *
* @method CcShowInstances findOne(PropelPDO $con = null) Return the first CcShowInstances matching the query
* @method CcShowInstances findOneOrCreate(PropelPDO $con = null) Return the first CcShowInstances matching the query, or a new CcShowInstances object populated from the query conditions when no match is found
*
@@ -848,6 +852,70 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
}
+ /**
+ * Filter the query by a related CcPlayoutHistory object
+ *
+ * @param CcPlayoutHistory $ccPlayoutHistory the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcShowInstancesQuery The current query, for fluid interface
+ */
+ public function filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcShowInstancesPeer::ID, $ccPlayoutHistory->getDbInstanceId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistory relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcShowInstancesQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistory($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistory');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcPlayoutHistory');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistory relation CcPlayoutHistory object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistory($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
+ }
+
/**
* Exclude object from result
*
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcTag.php b/airtime_mvc/application/models/airtime/om/BaseCcTag.php
new file mode 100644
index 000000000..af656868b
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcTag.php
@@ -0,0 +1,1306 @@
+tag_type = 'boolean';
+ }
+
+ /**
+ * Initializes internal state of BaseCcTag object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [tag_name] column value.
+ *
+ * @return string
+ */
+ public function getDbTagName()
+ {
+ return $this->tag_name;
+ }
+
+ /**
+ * Get the [tag_type] column value.
+ *
+ * @return string
+ */
+ public function getDbTagType()
+ {
+ return $this->tag_type;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcTag The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcTagPeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [tag_name] column.
+ *
+ * @param string $v new value
+ * @return CcTag The current object (for fluent API support)
+ */
+ public function setDbTagName($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->tag_name !== $v) {
+ $this->tag_name = $v;
+ $this->modifiedColumns[] = CcTagPeer::TAG_NAME;
+ }
+
+ return $this;
+ } // setDbTagName()
+
+ /**
+ * Set the value of [tag_type] column.
+ *
+ * @param string $v new value
+ * @return CcTag The current object (for fluent API support)
+ */
+ public function setDbTagType($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->tag_type !== $v || $this->isNew()) {
+ $this->tag_type = $v;
+ $this->modifiedColumns[] = CcTagPeer::TAG_TYPE;
+ }
+
+ return $this;
+ } // setDbTagType()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->tag_type !== 'boolean') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->tag_name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->tag_type = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 3; // 3 = CcTagPeer::NUM_COLUMNS - CcTagPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcTag object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcTagPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->collCcFileTags = null;
+
+ $this->collCcPlayoutHistoryMetaDatas = null;
+
+ $this->collCcPlayoutHistoryTemplateTags = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcTagQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CcTagPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcTagPeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcTagPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcTagPeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows = 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows = CcTagPeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ if ($this->collCcFileTags !== null) {
+ foreach ($this->collCcFileTags as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collCcPlayoutHistoryMetaDatas !== null) {
+ foreach ($this->collCcPlayoutHistoryMetaDatas as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collCcPlayoutHistoryTemplateTags !== null) {
+ foreach ($this->collCcPlayoutHistoryTemplateTags as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = CcTagPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collCcFileTags !== null) {
+ foreach ($this->collCcFileTags as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collCcPlayoutHistoryMetaDatas !== null) {
+ foreach ($this->collCcPlayoutHistoryMetaDatas as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collCcPlayoutHistoryTemplateTags !== null) {
+ foreach ($this->collCcPlayoutHistoryTemplateTags as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcTagPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbTagName();
+ break;
+ case 2:
+ return $this->getDbTagType();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * 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.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
+ {
+ $keys = CcTagPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbTagName(),
+ $keys[2] => $this->getDbTagType(),
+ );
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcTagPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbTagName($value);
+ break;
+ case 2:
+ $this->setDbTagType($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcTagPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbTagName($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbTagType($arr[$keys[2]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcTagPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcTagPeer::ID)) $criteria->add(CcTagPeer::ID, $this->id);
+ if ($this->isColumnModified(CcTagPeer::TAG_NAME)) $criteria->add(CcTagPeer::TAG_NAME, $this->tag_name);
+ if ($this->isColumnModified(CcTagPeer::TAG_TYPE)) $criteria->add(CcTagPeer::TAG_TYPE, $this->tag_type);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcTagPeer::DATABASE_NAME);
+ $criteria->add(CcTagPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcTag (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbTagName($this->tag_name);
+ $copyObj->setDbTagType($this->tag_type);
+
+ if ($deepCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+
+ foreach ($this->getCcFileTags() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcFileTag($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getCcPlayoutHistoryMetaDatas() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlayoutHistoryMetaData($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getCcPlayoutHistoryTemplateTags() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlayoutHistoryTemplateTag($relObj->copy($deepCopy));
+ }
+ }
+
+ } // if ($deepCopy)
+
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcTag Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcTagPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcTagPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Clears out the collCcFileTags collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addCcFileTags()
+ */
+ public function clearCcFileTags()
+ {
+ $this->collCcFileTags = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcFileTags collection.
+ *
+ * By default this just sets the collCcFileTags collection to an empty array (like clearcollCcFileTags());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @return void
+ */
+ public function initCcFileTags()
+ {
+ $this->collCcFileTags = new PropelObjectCollection();
+ $this->collCcFileTags->setModel('CcFileTag');
+ }
+
+ /**
+ * Gets an array of CcFileTag objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this CcTag is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelCollection|array CcFileTag[] List of CcFileTag objects
+ * @throws PropelException
+ */
+ public function getCcFileTags($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcFileTags || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcFileTags) {
+ // return empty collection
+ $this->initCcFileTags();
+ } else {
+ $collCcFileTags = CcFileTagQuery::create(null, $criteria)
+ ->filterByCcTag($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcFileTags;
+ }
+ $this->collCcFileTags = $collCcFileTags;
+ }
+ }
+ return $this->collCcFileTags;
+ }
+
+ /**
+ * Returns the number of related CcFileTag objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcFileTag objects.
+ * @throws PropelException
+ */
+ public function countCcFileTags(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcFileTags || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcFileTags) {
+ return 0;
+ } else {
+ $query = CcFileTagQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcTag($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcFileTags);
+ }
+ }
+
+ /**
+ * Method called to associate a CcFileTag object to this object
+ * through the CcFileTag foreign key attribute.
+ *
+ * @param CcFileTag $l CcFileTag
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcFileTag(CcFileTag $l)
+ {
+ if ($this->collCcFileTags === null) {
+ $this->initCcFileTags();
+ }
+ if (!$this->collCcFileTags->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcFileTags[]= $l;
+ $l->setCcTag($this);
+ }
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcTag is new, it will return
+ * an empty collection; or if this CcTag has previously
+ * been saved, it will retrieve related CcFileTags from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in CcTag.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return PropelCollection|array CcFileTag[] List of CcFileTag objects
+ */
+ public function getCcFileTagsJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcFileTagQuery::create(null, $criteria);
+ $query->joinWith('CcFiles', $join_behavior);
+
+ return $this->getCcFileTags($query, $con);
+ }
+
+ /**
+ * Clears out the collCcPlayoutHistoryMetaDatas collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addCcPlayoutHistoryMetaDatas()
+ */
+ public function clearCcPlayoutHistoryMetaDatas()
+ {
+ $this->collCcPlayoutHistoryMetaDatas = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcPlayoutHistoryMetaDatas collection.
+ *
+ * By default this just sets the collCcPlayoutHistoryMetaDatas collection to an empty array (like clearcollCcPlayoutHistoryMetaDatas());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @return void
+ */
+ public function initCcPlayoutHistoryMetaDatas()
+ {
+ $this->collCcPlayoutHistoryMetaDatas = new PropelObjectCollection();
+ $this->collCcPlayoutHistoryMetaDatas->setModel('CcPlayoutHistoryMetaData');
+ }
+
+ /**
+ * Gets an array of CcPlayoutHistoryMetaData objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this CcTag is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelCollection|array CcPlayoutHistoryMetaData[] List of CcPlayoutHistoryMetaData objects
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistoryMetaDatas($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistoryMetaDatas || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryMetaDatas) {
+ // return empty collection
+ $this->initCcPlayoutHistoryMetaDatas();
+ } else {
+ $collCcPlayoutHistoryMetaDatas = CcPlayoutHistoryMetaDataQuery::create(null, $criteria)
+ ->filterByCcTag($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcPlayoutHistoryMetaDatas;
+ }
+ $this->collCcPlayoutHistoryMetaDatas = $collCcPlayoutHistoryMetaDatas;
+ }
+ }
+ return $this->collCcPlayoutHistoryMetaDatas;
+ }
+
+ /**
+ * Returns the number of related CcPlayoutHistoryMetaData objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlayoutHistoryMetaData objects.
+ * @throws PropelException
+ */
+ public function countCcPlayoutHistoryMetaDatas(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistoryMetaDatas || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryMetaDatas) {
+ return 0;
+ } else {
+ $query = CcPlayoutHistoryMetaDataQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcTag($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcPlayoutHistoryMetaDatas);
+ }
+ }
+
+ /**
+ * Method called to associate a CcPlayoutHistoryMetaData object to this object
+ * through the CcPlayoutHistoryMetaData foreign key attribute.
+ *
+ * @param CcPlayoutHistoryMetaData $l CcPlayoutHistoryMetaData
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcPlayoutHistoryMetaData(CcPlayoutHistoryMetaData $l)
+ {
+ if ($this->collCcPlayoutHistoryMetaDatas === null) {
+ $this->initCcPlayoutHistoryMetaDatas();
+ }
+ if (!$this->collCcPlayoutHistoryMetaDatas->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcPlayoutHistoryMetaDatas[]= $l;
+ $l->setCcTag($this);
+ }
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcTag is new, it will return
+ * an empty collection; or if this CcTag has previously
+ * been saved, it will retrieve related CcPlayoutHistoryMetaDatas from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in CcTag.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return PropelCollection|array CcPlayoutHistoryMetaData[] List of CcPlayoutHistoryMetaData objects
+ */
+ public function getCcPlayoutHistoryMetaDatasJoinCcPlayoutHistory($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlayoutHistoryMetaDataQuery::create(null, $criteria);
+ $query->joinWith('CcPlayoutHistory', $join_behavior);
+
+ return $this->getCcPlayoutHistoryMetaDatas($query, $con);
+ }
+
+ /**
+ * Clears out the collCcPlayoutHistoryTemplateTags collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addCcPlayoutHistoryTemplateTags()
+ */
+ public function clearCcPlayoutHistoryTemplateTags()
+ {
+ $this->collCcPlayoutHistoryTemplateTags = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcPlayoutHistoryTemplateTags collection.
+ *
+ * By default this just sets the collCcPlayoutHistoryTemplateTags collection to an empty array (like clearcollCcPlayoutHistoryTemplateTags());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @return void
+ */
+ public function initCcPlayoutHistoryTemplateTags()
+ {
+ $this->collCcPlayoutHistoryTemplateTags = new PropelObjectCollection();
+ $this->collCcPlayoutHistoryTemplateTags->setModel('CcPlayoutHistoryTemplateTag');
+ }
+
+ /**
+ * Gets an array of CcPlayoutHistoryTemplateTag objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this CcTag is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelCollection|array CcPlayoutHistoryTemplateTag[] List of CcPlayoutHistoryTemplateTag objects
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistoryTemplateTags($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistoryTemplateTags || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateTags) {
+ // return empty collection
+ $this->initCcPlayoutHistoryTemplateTags();
+ } else {
+ $collCcPlayoutHistoryTemplateTags = CcPlayoutHistoryTemplateTagQuery::create(null, $criteria)
+ ->filterByCcTag($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcPlayoutHistoryTemplateTags;
+ }
+ $this->collCcPlayoutHistoryTemplateTags = $collCcPlayoutHistoryTemplateTags;
+ }
+ }
+ return $this->collCcPlayoutHistoryTemplateTags;
+ }
+
+ /**
+ * Returns the number of related CcPlayoutHistoryTemplateTag objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlayoutHistoryTemplateTag objects.
+ * @throws PropelException
+ */
+ public function countCcPlayoutHistoryTemplateTags(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlayoutHistoryTemplateTags || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateTags) {
+ return 0;
+ } else {
+ $query = CcPlayoutHistoryTemplateTagQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcTag($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcPlayoutHistoryTemplateTags);
+ }
+ }
+
+ /**
+ * Method called to associate a CcPlayoutHistoryTemplateTag object to this object
+ * through the CcPlayoutHistoryTemplateTag foreign key attribute.
+ *
+ * @param CcPlayoutHistoryTemplateTag $l CcPlayoutHistoryTemplateTag
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcPlayoutHistoryTemplateTag(CcPlayoutHistoryTemplateTag $l)
+ {
+ if ($this->collCcPlayoutHistoryTemplateTags === null) {
+ $this->initCcPlayoutHistoryTemplateTags();
+ }
+ if (!$this->collCcPlayoutHistoryTemplateTags->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcPlayoutHistoryTemplateTags[]= $l;
+ $l->setCcTag($this);
+ }
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcTag is new, it will return
+ * an empty collection; or if this CcTag has previously
+ * been saved, it will retrieve related CcPlayoutHistoryTemplateTags from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in CcTag.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return PropelCollection|array CcPlayoutHistoryTemplateTag[] List of CcPlayoutHistoryTemplateTag objects
+ */
+ public function getCcPlayoutHistoryTemplateTagsJoinCcPlayoutHistoryTemplate($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlayoutHistoryTemplateTagQuery::create(null, $criteria);
+ $query->joinWith('CcPlayoutHistoryTemplate', $join_behavior);
+
+ return $this->getCcPlayoutHistoryTemplateTags($query, $con);
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->tag_name = null;
+ $this->tag_type = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ if ($this->collCcFileTags) {
+ foreach ((array) $this->collCcFileTags as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcPlayoutHistoryMetaDatas) {
+ foreach ((array) $this->collCcPlayoutHistoryMetaDatas as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcPlayoutHistoryTemplateTags) {
+ foreach ((array) $this->collCcPlayoutHistoryTemplateTags as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ } // if ($deep)
+
+ $this->collCcFileTags = null;
+ $this->collCcPlayoutHistoryMetaDatas = null;
+ $this->collCcPlayoutHistoryTemplateTags = null;
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcTag
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcTagPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcTagPeer.php
new file mode 100644
index 000000000..6a68b6ede
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcTagPeer.php
@@ -0,0 +1,753 @@
+ array ('DbId', 'DbTagName', 'DbTagType', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTagName', 'dbTagType', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::TAG_NAME, self::TAG_TYPE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAG_NAME', 'TAG_TYPE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'tag_name', 'tag_type', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTagName' => 1, 'DbTagType' => 2, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTagName' => 1, 'dbTagType' => 2, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TAG_NAME => 1, self::TAG_TYPE => 2, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAG_NAME' => 1, 'TAG_TYPE' => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tag_name' => 1, 'tag_type' => 2, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcTagPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcTagPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcTagPeer::ID);
+ $criteria->addSelectColumn(CcTagPeer::TAG_NAME);
+ $criteria->addSelectColumn(CcTagPeer::TAG_TYPE);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.TAG_NAME');
+ $criteria->addSelectColumn($alias . '.TAG_TYPE');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcTagPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcTagPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcTag
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcTagPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcTagPeer::populateObjects(CcTagPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcTagPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcTag $value A CcTag object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcTag $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcTag object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcTag) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcTag object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcTag Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_tag
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in CcFileTagPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcFileTagPeer::clearInstancePool();
+ // Invalidate objects in CcPlayoutHistoryMetaDataPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlayoutHistoryMetaDataPeer::clearInstancePool();
+ // Invalidate objects in CcPlayoutHistoryTemplateTagPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlayoutHistoryTemplateTagPeer::clearInstancePool();
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcTagPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcTagPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcTagPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcTagPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcTag object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcTagPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcTagPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcTagPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcTagPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcTagPeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcTagPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcTagPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcTagTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcTagPeer::CLASS_DEFAULT : CcTagPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcTag or Criteria object.
+ *
+ * @param mixed $values Criteria or CcTag object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcTag object
+ }
+
+ if ($criteria->containsKey(CcTagPeer::ID) && $criteria->keyContainsValue(CcTagPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcTagPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcTag or Criteria object.
+ *
+ * @param mixed $values Criteria or CcTag object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcTagPeer::ID);
+ $value = $criteria->remove(CcTagPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcTagPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcTagPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcTag object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_tag table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcTagPeer::TABLE_NAME, $con, CcTagPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcTagPeer::clearInstancePool();
+ CcTagPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcTag or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcTag object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcTagPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcTag) { // it's a model object
+ // invalidate the cache for this single object
+ CcTagPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcTagPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcTagPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcTagPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcTag object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcTag $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcTag $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcTagPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcTagPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcTagPeer::DATABASE_NAME, CcTagPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcTag
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcTagPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcTagPeer::DATABASE_NAME);
+ $criteria->add(CcTagPeer::ID, $pk);
+
+ $v = CcTagPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcTagPeer::DATABASE_NAME);
+ $criteria->add(CcTagPeer::ID, $pks, Criteria::IN);
+ $objs = CcTagPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcTagPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcTagPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcTagQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcTagQuery.php
new file mode 100644
index 000000000..c90d8cb09
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcTagQuery.php
@@ -0,0 +1,421 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcTag|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcTagPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcTagQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcTagPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcTagQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcTagPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId 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 CcTagQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcTagPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the tag_name column
+ *
+ * @param string $dbTagName 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 CcTagQuery The current query, for fluid interface
+ */
+ public function filterByDbTagName($dbTagName = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbTagName)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbTagName)) {
+ $dbTagName = str_replace('*', '%', $dbTagName);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcTagPeer::TAG_NAME, $dbTagName, $comparison);
+ }
+
+ /**
+ * Filter the query on the tag_type column
+ *
+ * @param string $dbTagType 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 CcTagQuery The current query, for fluid interface
+ */
+ public function filterByDbTagType($dbTagType = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbTagType)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbTagType)) {
+ $dbTagType = str_replace('*', '%', $dbTagType);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcTagPeer::TAG_TYPE, $dbTagType, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcFileTag object
+ *
+ * @param CcFileTag $ccFileTag the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcTagQuery The current query, for fluid interface
+ */
+ public function filterByCcFileTag($ccFileTag, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcTagPeer::ID, $ccFileTag->getDbTagId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcFileTag relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcTagQuery The current query, for fluid interface
+ */
+ public function joinCcFileTag($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcFileTag');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcFileTag');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcFileTag relation CcFileTag object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcFileTagQuery A secondary query class using the current class as primary query
+ */
+ public function useCcFileTagQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcFileTag($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFileTag', 'CcFileTagQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistoryMetaData object
+ *
+ * @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcTagQuery The current query, for fluid interface
+ */
+ public function filterByCcPlayoutHistoryMetaData($ccPlayoutHistoryMetaData, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcTagPeer::ID, $ccPlayoutHistoryMetaData->getDbTagId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistoryMetaData relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcTagQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistoryMetaData($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistoryMetaData');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcPlayoutHistoryMetaData');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistoryMetaData relation CcPlayoutHistoryMetaData object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryMetaDataQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryMetaDataQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistoryMetaData($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaDataQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistoryTemplateTag object
+ *
+ * @param CcPlayoutHistoryTemplateTag $ccPlayoutHistoryTemplateTag the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcTagQuery The current query, for fluid interface
+ */
+ public function filterByCcPlayoutHistoryTemplateTag($ccPlayoutHistoryTemplateTag, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcTagPeer::ID, $ccPlayoutHistoryTemplateTag->getDbTagId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistoryTemplateTag relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcTagQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistoryTemplateTag($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplateTag');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcPlayoutHistoryTemplateTag');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistoryTemplateTag relation CcPlayoutHistoryTemplateTag object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryTemplateTagQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryTemplateTagQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistoryTemplateTag($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplateTag', 'CcPlayoutHistoryTemplateTagQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcTag $ccTag Object to remove from the list of results
+ *
+ * @return CcTagQuery The current query, for fluid interface
+ */
+ public function prune($ccTag = null)
+ {
+ if ($ccTag) {
+ $this->addUsingAlias(CcTagPeer::ID, $ccTag->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcTagQuery
diff --git a/airtime_mvc/application/services/HistoryService.php b/airtime_mvc/application/services/HistoryService.php
new file mode 100644
index 000000000..10e559c3b
--- /dev/null
+++ b/airtime_mvc/application/services/HistoryService.php
@@ -0,0 +1,1465 @@
+con = isset($con) ? $con : Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME);
+ $this->timezone = Application_Model_Preference::GetTimezone();
+ }
+
+ public function getSupportedTemplateTypes()
+ {
+ return array(self::TEMPLATE_TYPE_ITEM, self::TEMPLATE_TYPE_FILE);
+ }
+
+ //opts is from datatables.
+ public function getPlayedItemData($startDT, $endDT, $opts, $instanceId=null)
+ {
+ $mainSqlQuery = "";
+ $paramMap = array();
+ $sqlTypes = $this->getSqlTypes();
+
+ $start = $startDT->format("Y-m-d H:i:s");
+ $end = $endDT->format("Y-m-d H:i:s");
+
+ $template = $this->getConfiguredItemTemplate();
+ $fields = $template["fields"];
+ $required = $this->mandatoryItemFields();
+
+ $fields_filemd = array();
+ $filemd_keys = array();
+ $fields_general = array();
+ $general_keys = array();
+
+ foreach ($fields as $index=>$field) {
+
+ if (in_array($field["name"], $required)) {
+ continue;
+ }
+
+ if ($field["isFileMd"]) {
+ $fields_filemd[] = $field;
+ $filemd_keys[] = $field["name"];
+ }
+ else {
+ $fields_general[] = $field;
+ $general_keys[] = $field["name"];
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ //Using the instance_id to filter the data.
+
+
+ $historyRange = "(".
+ "SELECT history.starts, history.ends, history.id AS history_id, history.instance_id".
+ " FROM cc_playout_history as history";
+
+ if (isset($instanceId)) {
+ $historyRange.= " WHERE history.instance_id = :instance";
+ $paramMap["instance"] = $instanceId;
+ }
+ else {
+ $historyRange.= " WHERE history.starts >= :starts and history.starts < :ends";
+ $paramMap["starts"] = $start;
+ $paramMap["ends"] = $end;
+ }
+
+ $historyRange.= ") AS history_range";
+
+ $manualMeta = "(".
+ "SELECT %KEY%.value AS %KEY%, %KEY%.history_id".
+ " FROM (".
+ " SELECT * from cc_playout_history_metadata AS phm WHERE phm.key = :meta_%KEY%".
+ " ) AS %KEY%".
+ " ) AS %KEY%_filter";
+
+ $mainSelect = array(
+ "history_range.starts",
+ "history_range.ends",
+ "history_range.history_id",
+ "history_range.instance_id"
+ );
+ $mdFilters = array();
+
+ $numFileMdFields = count($fields_filemd);
+
+ if ($numFileMdFields > 0) {
+
+ //these 3 selects are only needed if $fields_filemd has some fields.
+ $fileSelect = array("history_file.history_id");
+ $nonNullFileSelect = array("file.id as file_id");
+ $nullFileSelect = array("null_file.history_id");
+
+ $fileMdFilters = array();
+
+ //populate the different dynamic selects with file info.
+ for ($i = 0; $i < $numFileMdFields; $i++) {
+
+ $field = $fields_filemd[$i];
+ $key = $field["name"];
+ $type = $sqlTypes[$field["type"]];
+
+ $fileSelect[] = "file_md.{$key}::{$type}";
+ $nonNullFileSelect[] = "file.{$key}::{$type}";
+ $nullFileSelect[] = "{$key}_filter.{$key}::{$type}";
+ $mainSelect[] = "file_info.{$key}::{$type}";
+
+ $fileMdFilters[] = str_replace("%KEY%", $key, $manualMeta);
+ $paramMap["meta_{$key}"] = $key;
+ }
+
+ //the files associated with scheduled playback in Airtime.
+ $historyFile = "(".
+ "SELECT history.id AS history_id, history.file_id".
+ " FROM cc_playout_history AS history".
+ " WHERE history.file_id IS NOT NULL".
+ ") AS history_file";
+
+ $fileMd = "(".
+ "SELECT %NON_NULL_FILE_SELECT%".
+ " FROM cc_files AS file".
+ ") AS file_md";
+
+ $fileMd = str_replace("%NON_NULL_FILE_SELECT%", join(", ", $nonNullFileSelect), $fileMd);
+
+ //null files are from manually added data (filling in webstream info etc)
+ $nullFile = "(".
+ "SELECT history.id AS history_id".
+ " FROM cc_playout_history AS history".
+ " WHERE history.file_id IS NULL".
+ ") AS null_file";
+
+
+ //----------------------------------
+ //building the file inner query
+
+ $fileSqlQuery =
+ "SELECT ".join(", ", $fileSelect).
+ " FROM {$historyFile}".
+ " LEFT JOIN {$fileMd} USING (file_id)".
+ " UNION".
+ " SELECT ".join(", ", $nullFileSelect).
+ " FROM {$nullFile}";
+
+ foreach ($fileMdFilters as $filter) {
+
+ $fileSqlQuery.=
+ " LEFT JOIN {$filter} USING(history_id)";
+ }
+
+ }
+
+ for ($i = 0, $len = count($fields_general); $i < $len; $i++) {
+
+ $field = $fields_general[$i];
+ $key = $field["name"];
+ $type = $sqlTypes[$field["type"]];
+
+ $mdFilters[] = str_replace("%KEY%", $key, $manualMeta);
+ $paramMap["meta_{$key}"] = $key;
+ $mainSelect[] = "{$key}_filter.{$key}::{$type}";
+ }
+
+ $mainSqlQuery.=
+ "SELECT ".join(", ", $mainSelect).
+ " FROM {$historyRange}";
+
+ if (isset($fileSqlQuery)) {
+
+ $mainSqlQuery.=
+ " LEFT JOIN ( {$fileSqlQuery} ) as file_info USING(history_id)";
+ }
+
+ foreach ($mdFilters as $filter) {
+
+ $mainSqlQuery.=
+ " LEFT JOIN {$filter} USING(history_id)";
+ }
+
+ //----------------------------------------------------------------------
+ //need to count the total rows to tell Datatables.
+ $stmt = $this->con->prepare($mainSqlQuery);
+ foreach ($paramMap as $param => $v) {
+ $stmt->bindValue($param, $v);
+ }
+
+ if ($stmt->execute()) {
+ $totalRows = $stmt->rowCount();
+ }
+ else {
+ $msg = implode(',', $stmt->errorInfo());
+ throw new Exception("Error: $msg");
+ }
+
+ //------------------------------------------------------------------------
+ //Using Datatables parameters to sort the data.
+
+ $numOrderColumns = $opts["iSortingCols"];
+ $orderBys = array();
+
+ for ($i = 0; $i < $numOrderColumns; $i++) {
+
+ $colNum = $opts["iSortCol_".$i];
+ $key = $opts["mDataProp_".$colNum];
+ $sortDir = $opts["sSortDir_".$i];
+
+ if (in_array($key, $required)) {
+
+ $orderBys[] = "history_range.{$key} {$sortDir}";
+ }
+ else if (in_array($key, $filemd_keys)) {
+
+ $orderBys[] = "file_info.{$key} {$sortDir}";
+ }
+ else if (in_array($key, $general_keys)) {
+
+ $orderBys[] = "{$key}_filter.{$key} {$sortDir}";
+ }
+ else {
+ //throw new Exception("Error: $key is not part of the template.");
+ }
+ }
+
+ if (count($orderBys) > 0) {
+
+ $orders = join(", ", $orderBys);
+
+ $mainSqlQuery.=
+ " ORDER BY {$orders}";
+ }
+
+ //---------------------------------------------------------------
+ //using Datatables parameters to add limits/offsets
+
+ $displayLength = intval($opts["iDisplayLength"]);
+ //limit the results returned.
+ if ($displayLength !== -1) {
+ $mainSqlQuery.=
+ " OFFSET :offset LIMIT :limit";
+
+ $paramMap["offset"] = intval($opts["iDisplayStart"]);
+ $paramMap["limit"] = $displayLength;
+ }
+
+ $stmt = $this->con->prepare($mainSqlQuery);
+ foreach ($paramMap as $param => $v) {
+ $stmt->bindValue($param, $v);
+ }
+
+ $rows = array();
+ if ($stmt->execute()) {
+ $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ }
+ else {
+ $msg = implode(',', $stmt->errorInfo());
+ throw new Exception("Error: $msg");
+ }
+
+ //-----------------------------------------------------------------------
+ //processing results.
+
+ $timezoneUTC = new DateTimeZone("UTC");
+ $timezoneLocal = new DateTimeZone($this->timezone);
+
+ $boolCast = array();
+ foreach ($fields as $index=>$field) {
+
+ if ($field["type"] == TEMPLATE_BOOLEAN) {
+ $boolCast[] = $field["name"];
+ }
+ }
+
+ foreach ($rows as $index => &$result) {
+
+ foreach ($boolCast as $name) {
+ $result[$name] = (bool) $result[$name];
+ }
+
+ //need to display the results in the station's timezone.
+ $dateTime = new DateTime($result["starts"], $timezoneUTC);
+ $dateTime->setTimezone($timezoneLocal);
+ $result["starts"] = $dateTime->format("Y-m-d H:i:s");
+
+ $dateTime = new DateTime($result["ends"], $timezoneUTC);
+ $dateTime->setTimezone($timezoneLocal);
+ $result["ends"] = $dateTime->format("Y-m-d H:i:s");
+
+ if (isset($result[MDATA_KEY_DURATION])) {
+ $formatter = new LengthFormatter($result[MDATA_KEY_DURATION]);
+ $result[MDATA_KEY_DURATION] = $formatter->format();
+ }
+
+ //need to add a checkbox..
+ $result["checkbox"] = "";
+
+ //$unicodeChar = '\u2612';
+ //$result["new"] = json_decode('"'.$unicodeChar.'"');
+ //$result["new"] = "U+2612";
+ }
+
+ return array(
+ "sEcho" => intval($opts["sEcho"]),
+ //"iTotalDisplayRecords" => intval($totalDisplayRows),
+ "iTotalDisplayRecords" => intval($totalRows),
+ "iTotalRecords" => intval($totalRows),
+ "history" => $rows
+ );
+ }
+
+ public function getFileSummaryData($startDT, $endDT, $opts)
+ {
+ $select = array (
+ "summary.played",
+ "summary.file_id",
+ "summary.".MDATA_KEY_TITLE,
+ "summary.".MDATA_KEY_CREATOR
+ );
+
+ $mainSqlQuery = "";
+ $paramMap = array();
+ $start = $startDT->format("Y-m-d H:i:s");
+ $end = $endDT->format("Y-m-d H:i:s");
+
+ $paramMap["starts"] = $start;
+ $paramMap["ends"] = $end;
+
+ $template = $this->getConfiguredFileTemplate();
+ $fields = $template["fields"];
+ $required = $this->mandatoryFileFields();
+
+ foreach ($fields as $index=>$field) {
+
+ $key = $field["name"];
+
+ if (in_array($field["name"], $required)) {
+ continue;
+ }
+
+ $select[] = "summary.{$key}";
+ }
+
+ $fileSummaryTable = "((
+ SELECT COUNT(history.file_id) as played, history.file_id as file_id
+ FROM cc_playout_history AS history
+ WHERE history.starts >= :starts AND history.starts < :ends
+ AND history.file_id IS NOT NULL
+ GROUP BY history.file_id
+ ) AS playout
+ LEFT JOIN cc_files AS file ON (file.id = playout.file_id)) AS summary";
+
+ $mainSqlQuery.=
+ "SELECT ".join(", ", $select).
+ " FROM {$fileSummaryTable}";
+
+ //-------------------------------------------------------------------------
+ //need to count the total rows to tell Datatables.
+ $stmt = $this->con->prepare($mainSqlQuery);
+ foreach ($paramMap as $param => $v) {
+ $stmt->bindValue($param, $v);
+ }
+
+ if ($stmt->execute()) {
+ $totalRows = $stmt->rowCount();
+ }
+ else {
+ $msg = implode(',', $stmt->errorInfo());
+ throw new Exception("Error: $msg");
+ }
+
+ //------------------------------------------------------------------------
+ //Using Datatables parameters to sort the data.
+
+ $numOrderColumns = $opts["iSortingCols"];
+ $orderBys = array();
+
+ for ($i = 0; $i < $numOrderColumns; $i++) {
+
+ $colNum = $opts["iSortCol_".$i];
+ $key = $opts["mDataProp_".$colNum];
+ $sortDir = $opts["sSortDir_".$i];
+
+ $orderBys[] = "summary.{$key} {$sortDir}";
+ }
+
+ if ($numOrderColumns > 0) {
+
+ $orders = join(", ", $orderBys);
+
+ $mainSqlQuery.=
+ " ORDER BY {$orders}";
+ }
+
+ //------------------------------------------------------------
+ //using datatables params to add limits/offsets
+ $displayLength = intval($opts["iDisplayLength"]);
+ if ($displayLength !== -1) {
+ $mainSqlQuery.=
+ " OFFSET :offset LIMIT :limit";
+
+ $paramMap["offset"] = $opts["iDisplayStart"];
+ $paramMap["limit"] = $displayLength;
+ }
+
+ $stmt = $this->con->prepare($mainSqlQuery);
+ foreach ($paramMap as $param => $v) {
+ $stmt->bindValue($param, $v);
+ }
+
+ $rows = array();
+ if ($stmt->execute()) {
+ $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ }
+ else {
+ $msg = implode(',', $stmt->errorInfo());
+ throw new Exception("Error: $msg");
+ }
+
+ //-----------------------------------------------------------------
+ //processing the results
+ foreach ($rows as &$row) {
+ $formatter = new LengthFormatter($row['length']);
+ $row['length'] = $formatter->format();
+ }
+
+ return array(
+ "sEcho" => intval($opts["sEcho"]),
+ //"iTotalDisplayRecords" => intval($totalDisplayRows),
+ "iTotalDisplayRecords" => intval($totalRows),
+ "iTotalRecords" => intval($totalRows),
+ "history" => $rows
+ );
+ }
+
+ public function getShowList($startDT, $endDT)
+ {
+ $user = Application_Model_User::getCurrentUser();
+ $shows = Application_Model_Show::getShows($startDT, $endDT);
+
+ Logging::info($startDT->format("Y-m-d H:i:s"));
+ Logging::info($endDT->format("Y-m-d H:i:s"));
+
+ Logging::info($shows);
+
+ //need to filter the list to only their shows
+ if ($user->isHost()) {
+
+ $showIds = array();
+
+ foreach ($shows as $show) {
+ $showIds[] = $show["show_id"];
+ }
+
+ $showIds = array_unique($showIds);
+ Logging::info($showIds);
+
+ $hostRecords = CcShowHostsQuery::create()
+ ->filterByDbHost($user->getId())
+ ->filterByDbShow($showIds)
+ ->find($this->con);
+
+ $filteredShowIds = array();
+
+ foreach($hostRecords as $record) {
+ $filteredShowIds[] = $record->getDbShow();
+ }
+
+ Logging::info($filteredShowIds);
+
+ $filteredShows = array();
+
+ foreach($shows as $show) {
+ if (in_array($show["show_id"], $filteredShowIds)) {
+ $filteredShows[] = $show;
+ }
+ }
+ }
+ else {
+ $filteredShows = $shows;
+ }
+
+ $timezoneUTC = new DateTimeZone("UTC");
+ $timezoneLocal = new DateTimeZone($this->timezone);
+
+ foreach ($filteredShows as &$result) {
+
+ //need to display the results in the station's timezone.
+ $dateTime = new DateTime($result["starts"], $timezoneUTC);
+ $dateTime->setTimezone($timezoneLocal);
+ $result["starts"] = $dateTime->format("Y-m-d H:i:s");
+
+ $dateTime = new DateTime($result["ends"], $timezoneUTC);
+ $dateTime->setTimezone($timezoneLocal);
+ $result["ends"] = $dateTime->format("Y-m-d H:i:s");
+
+ }
+
+ return $filteredShows;
+ }
+
+ public function insertPlayedItem($schedId) {
+
+ $this->con->beginTransaction();
+
+ try {
+
+ $item = CcScheduleQuery::create()->findPK($schedId, $this->con);
+
+ //TODO figure out how to combine these all into 1 query.
+ $showInstance = $item->getCcShowInstances($this->con);
+ $show = $showInstance->getCcShow($this->con);
+
+ $fileId = $item->getDbFileId();
+
+ //don't add webstreams
+ if (isset($fileId)) {
+
+ $metadata = array();
+ $metadata["showname"] = $show->getDbName();
+
+ $instanceEnd = $showInstance->getDbEnds(null);
+ $itemEnd = $item->getDbEnds(null);
+ $recordEnd = ($instanceEnd < $itemEnd) ? $instanceEnd : $itemEnd;
+
+ $history = new CcPlayoutHistory();
+ $history->setDbFileId($fileId);
+ $history->setDbStarts($item->getDbStarts(null));
+ $history->setDbEnds($recordEnd);
+ $history->setDbInstanceId($item->getDbInstanceId());
+
+ foreach ($metadata as $key => $val) {
+ $meta = new CcPlayoutHistoryMetaData();
+ $meta->setDbKey($key);
+ $meta->setDbValue($val);
+
+ $history->addCcPlayoutHistoryMetaData($meta);
+ }
+
+ $history->save($this->con);
+ }
+
+ $this->con->commit();
+ }
+ catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+ }
+
+ /* id is an id in cc_playout_history */
+ public function makeHistoryItemForm($id, $populate=false) {
+
+ try {
+ $form = new Application_Form_EditHistoryItem();
+ $template = $this->getConfiguredItemTemplate();
+ $required = $this->mandatoryItemFields();
+ $form->createFromTemplate($template["fields"], $required);
+
+ if ($populate) {
+ $formValues = array();
+
+ $historyRecord = CcPlayoutHistoryQuery::create()->findPk($id, $this->con);
+ $file = $historyRecord->getCcFiles($this->con);
+ $instance = $historyRecord->getCcShowInstances($this->con);
+
+ if (isset($instance)) {
+ $show = $instance->getCcShow($this->con);
+ $selOpts = array();
+ $instance_id = $instance->getDbId();
+ $selOpts[$instance_id] = $show->getDbName();
+ $form->populateShowInstances($selOpts, $instance_id);
+ }
+
+ if (isset($file)) {
+ $f = Application_Model_StoredFile::createWithFile($file, $this->con);
+ $filemd = $f->getDbColMetadata();
+ }
+ $metadata = array();
+ $mds = $historyRecord->getCcPlayoutHistoryMetaDatas();
+ foreach ($mds as $md) {
+ $metadata[$md->getDbKey()] = $md->getDbValue();
+ }
+
+ $prefix = Application_Form_EditHistoryItem::ID_PREFIX;
+ $formValues["{$prefix}id"] = $id;
+
+ foreach($template["fields"] as $index => $field) {
+
+ $key = $field["name"];
+ $value = "";
+
+ if (in_array($key, $required)) {
+
+ $method = "getDb".ucfirst($key);
+ $value = $historyRecord->$method();
+ }
+ else if (isset($filemd) && $field["isFileMd"]) {
+
+ $value = $filemd[$key];
+ }
+ else if (isset($metadata[$key])) {
+ $value = $metadata[$key];
+ }
+
+ //need to convert to the station's local time first.
+ if ($field["type"] == TEMPLATE_DATETIME) {
+ $timezoneUTC = new DateTimeZone("UTC");
+ $timezoneLocal = new DateTimeZone($this->timezone);
+
+ $dateTime = new DateTime($value, $timezoneUTC);
+ $dateTime->setTimezone($timezoneLocal);
+ $value = $dateTime->format("Y-m-d H:i:s");
+ }
+
+ $formValues["$prefix{$key}"] = $value;
+ }
+
+ $form->populate($formValues);
+ }
+
+ return $form;
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ throw $e;
+ }
+ }
+
+ /* id is an id in cc_files */
+ public function makeHistoryFileForm($id) {
+
+ try {
+ $form = new Application_Form_EditHistoryFile();
+ $template = $this->getConfiguredFileTemplate();
+ $required = $this->mandatoryFileFields();
+ $form->createFromTemplate($template["fields"], $required);
+
+ $file = Application_Model_StoredFile::RecallById($id, $this->con);
+ $md = $file->getDbColMetadata();
+
+ $prefix = Application_Form_EditHistoryFile::ID_PREFIX;
+ $formValues = array();
+ $formValues["{$prefix}id"] = $id;
+
+ foreach($template["fields"] as $index => $field) {
+
+ $key = $field["name"];
+
+ if (in_array($key, $required)) {
+ continue;
+ }
+
+ $value = $md[$key];
+ $formValues["$prefix{$key}"] = $value;
+ }
+
+ $form->populate($formValues);
+
+ return $form;
+ }
+ catch (Exception $e) {
+ Logging::info($e);
+ throw $e;
+ }
+ }
+
+ public function populateTemplateFile($values, $id) {
+
+ $this->con->beginTransaction();
+
+ try {
+
+ $file = Application_Model_StoredFile::RecallById($id, $this->con);
+
+ $prefix = Application_Form_EditHistoryFile::ID_PREFIX;
+ $prefix_len = strlen($prefix);
+ $templateValues = $values[$prefix."template"];
+
+ $md = array();
+
+ foreach ($templateValues as $index => $value) {
+
+ $key = substr($index, $prefix_len);
+ $md[$key] = $value;
+ }
+
+ $file->setDbColMetadata($md);
+ $this->con->commit();
+ }
+ catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+ }
+
+ public function populateTemplateItem($values, $id=null, $instance_id=null) {
+
+ $this->con->beginTransaction();
+
+ try {
+ $template = $this->getConfiguredItemTemplate();
+ $prefix = Application_Form_EditHistoryItem::ID_PREFIX;
+
+ if (isset($id)) {
+ $historyRecord = CcPlayoutHistoryQuery::create()->findPk($id, $this->con);
+ }
+ else {
+ $historyRecord = new CcPlayoutHistory();
+ }
+
+ if (isset($instance_id)) {
+ $historyRecord->setDbInstanceId($instance_id);
+ }
+
+ $timezoneUTC = new DateTimeZone("UTC");
+ $timezoneLocal = new DateTimeZone($this->timezone);
+
+ $dateTime = new DateTime($values[$prefix."starts"], $timezoneLocal);
+ $dateTime->setTimezone($timezoneUTC);
+ $historyRecord->setDbStarts($dateTime->format("Y-m-d H:i:s"));
+
+ $dateTime = new DateTime($values[$prefix."ends"], $timezoneLocal);
+ $dateTime->setTimezone($timezoneUTC);
+ $historyRecord->setDbEnds($dateTime->format("Y-m-d H:i:s"));
+
+ $templateValues = $values[$prefix."template"];
+
+ $file = $historyRecord->getCcFiles();
+
+ $md = array();
+ $metadata = array();
+ $fields = $template["fields"];
+ $required = $this->mandatoryItemFields();
+ $phpCasts = $this->getPhpCasts();
+
+ for ($i = 0, $len = count($fields); $i < $len; $i++) {
+
+ $field = $fields[$i];
+ $key = $field["name"];
+
+ //required is delt with before this loop.
+ if (in_array($key, $required)) {
+ continue;
+ }
+
+ $isFileMd = $field["isFileMd"];
+ $entry = $phpCasts[$field["type"]]($templateValues[$prefix.$key]);
+
+ if ($isFileMd && isset($file)) {
+ Logging::info("adding metadata associated to a file for {$key} = {$entry}");
+ $md[$key] = $entry;
+ }
+ else {
+ Logging::info("adding metadata for {$key} = {$entry}");
+ $metadata[$key] = $entry;
+ }
+ }
+
+ if (count($md) > 0) {
+ $f = Application_Model_StoredFile::createWithFile($file, $this->con);
+ $f->setDbColMetadata($md);
+ }
+
+ //Use this array to update existing values.
+ $mds = $historyRecord->getCcPlayoutHistoryMetaDatas();
+ foreach ($mds as $md) {
+ $prevmd[$md->getDbKey()] = $md;
+ }
+ foreach ($metadata as $key => $val) {
+
+ if (isset($prevmd[$key])) {
+ $meta = $prevmd[$key];
+ $meta->setDbValue($val);
+ }
+ else {
+ $meta = new CcPlayoutHistoryMetaData();
+ $meta->setDbKey($key);
+ $meta->setDbValue($val);
+
+ $historyRecord->addCcPlayoutHistoryMetaData($meta);
+ }
+ }
+
+ $historyRecord->save($this->con);
+ $this->con->commit();
+ }
+ catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+ }
+
+ //start,end timestamp strings in local timezone.
+ public function populateShowInstances($start, $end) {
+ $timezoneLocal = new DateTimeZone($this->timezone);
+
+ $startDT = new DateTime($start, $timezoneLocal);
+ $endDT = new DateTime($end, $timezoneLocal);
+
+ $shows = $this->getShowList($startDT, $endDT);
+
+ $select = array();
+
+ foreach ($shows as &$show) {
+ $select[$show["instance_id"]] = $show["name"];
+ }
+
+ return $select;
+ }
+
+ private function validateHistoryItem($instanceId, $form) {
+
+ /*
+ $userService = new Application_Service_UserService();
+ $currentUser = $userService->getCurrentUser();
+
+ if (!$currentUser->isAdminOrPM()) {
+ if (empty($instance_id) ) {
+
+ }
+ }
+ */
+
+ $valid = true;
+
+ $recordStartsEl = $form->getElement("his_item_starts");
+ $recordStarts = $recordStartsEl->getValue();
+ $recordEndsEl = $form->getElement("his_item_starts");
+ $recordEnds = $recordEndsEl->getValue();
+
+ $timezoneLocal = new DateTimeZone($this->timezone);
+
+ $startDT = new DateTime($recordStarts, $timezoneLocal);
+ $endDT = new DateTime($recordEnds, $timezoneLocal);
+
+ if ($recordStarts > $recordEnds) {
+ $valid = false;
+ $recordEndsEl->addErrorMessage("End time must be after start time");
+ }
+
+ if (isset($instanceId)) {
+
+ $instance = CcShowInstancesQuery::create()->findPk($instanceId, $this->con);
+ $inStartsDT = $instance->getDbStarts(null);
+ $inEndsDT = $instance->getDbEnds(null);
+
+ if ($startDT < $inStartsDT) {
+ $valid = false;
+ $form->addErrorMessage("History item begins before show.");
+ }
+ else if ($startDT > $inEndsDT) {
+ $valid = false;
+ $form->addErrorMessage("History item begins after show.");
+ }
+ }
+
+ return $valid;
+ }
+
+ public function createPlayedItem($data) {
+
+ try {
+ $form = $this->makeHistoryItemForm(null);
+ $history_id = $form->getElement("his_item_id");
+ $instanceId = isset($data["instance_id"]) ? $data["instance_id"] : null;
+ $json = array();
+
+ if ($form->isValid($data) && $this->validateHistoryItem($instanceId, $form)) {
+
+ $history_id->setIgnore(true);
+ $values = $form->getValues();
+
+ $this->populateTemplateItem($values, null, $instanceId);
+ }
+ else {
+ $json["form"] = $form;
+ }
+
+ return $json;
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ /* id is an id in cc_playout_history */
+ public function editPlayedItem($data) {
+
+ try {
+ $id = $data["his_item_id"];
+ $instanceId = isset($data["instance_id"]) ? $data["instance_id"] : null;
+ $form = $this->makeHistoryItemForm($id);
+ $history_id = $form->getElement("his_item_id");
+ $history_id->setRequired(true);
+
+ $json = array();
+
+ if ($form->isValid($data) && $this->validateHistoryItem($instanceId, $form)) {
+
+ $history_id->setIgnore(true);
+ $values = $form->getValues();
+ $this->populateTemplateItem($values, $id, $instanceId);
+ }
+ else {
+ $json["form"] = $form;
+ }
+
+ return $json;
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ /* id is an id in cc_files */
+ public function editPlayedFile($data) {
+
+ try {
+ $id = $data["his_file_id"];
+ $form = $form = $this->makeHistoryFileForm($id);
+ $history_id = $form->getElement("his_file_id");
+ $history_id->setRequired(true);
+
+ $json = array();
+
+ if ($form->isValid($data)) {
+ $history_id->setIgnore(true);
+ $values = $form->getValues();
+
+ $this->populateTemplateFile($values, $id);
+ }
+ else {
+ $json["error"] = $msgs;
+ }
+
+ return $json;
+
+ $this->con->commit();
+ }
+ catch (Exception $e) {
+ $this->con->rollback();
+ Logging::info($e);
+ throw $e;
+ }
+
+ return $json;
+ }
+
+ /* id is an id in cc_playout_history */
+ public function deletePlayedItem($id) {
+
+ $this->con->beginTransaction();
+
+ try {
+
+ $record = CcPlayoutHistoryQuery::create()->findPk($id, $this->con);
+ $record->delete($this->con);
+
+ $this->con->commit();
+ }
+ catch (Exception $e) {
+ $this->con->rollback();
+ Logging::info($e);
+ throw $e;
+ }
+ }
+
+ /* id is an id in cc_playout_history */
+ public function deletePlayedItems($ids) {
+
+ $this->con->beginTransaction();
+
+ try {
+
+ $records = CcPlayoutHistoryQuery::create()->findPks($ids, $this->con);
+ $records->delete($this->con);
+
+ $this->con->commit();
+ }
+ catch (Exception $e) {
+ $this->con->rollback();
+ Logging::info($e);
+ throw $e;
+ }
+ }
+
+
+ //---------------- Following code is for History Templates --------------------------//
+
+ public function getFieldTypes() {
+
+ $fields = array(
+ //TEMPLATE_DATE,
+ //TEMPLATE_TIME,
+ //TEMPLATE_DATETIME,
+ TEMPLATE_STRING,
+ TEMPLATE_BOOLEAN,
+ TEMPLATE_INT,
+ TEMPLATE_FLOAT,
+ );
+
+ return $fields;
+ }
+
+ private function getPhpCasts() {
+
+ $fields = array(
+ TEMPLATE_DATE => "strval",
+ TEMPLATE_TIME => "strval",
+ TEMPLATE_DATETIME => "strval",
+ TEMPLATE_STRING => "strval",
+ TEMPLATE_BOOLEAN => "intval", //boolval only exists in php 5.5+ wtf?
+ TEMPLATE_INT => "intval",
+ TEMPLATE_FLOAT => "floatval",
+ );
+
+ return $fields;
+ }
+
+ private function getSqlTypes() {
+
+ $fields = array(
+ TEMPLATE_DATE => "date",
+ TEMPLATE_TIME => "time",
+ TEMPLATE_DATETIME => "datetime",
+ TEMPLATE_STRING => "text",
+ TEMPLATE_BOOLEAN => "boolean",
+ TEMPLATE_INT => "integer",
+ TEMPLATE_FLOAT => "float",
+ );
+
+ return $fields;
+ }
+
+ public function getFileMetadataTypes() {
+
+ $fileMD = array(
+ array("name"=> MDATA_KEY_TITLE, "label"=> _("Title"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_CREATOR, "label"=> _("Creator"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_SOURCE, "label"=> _("Album"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_DURATION, "label"=> _("Length"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_GENRE, "label"=> _("Genre"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_MOOD, "label"=> _("Mood"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_LABEL, "label"=> _("Label"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_COMPOSER, "label"=> _("Composer"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_ISRC, "label"=> _("ISRC"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_COPYRIGHT, "label"=> _("Copyright"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_YEAR, "label"=> _("Year"), "type"=> TEMPLATE_INT),
+ array("name"=> MDATA_KEY_TRACKNUMBER, "label"=> _("Track"), "type"=> TEMPLATE_INT),
+ array("name"=> MDATA_KEY_CONDUCTOR, "label"=> _("Conductor"), "type"=> TEMPLATE_STRING),
+ array("name"=> MDATA_KEY_LANGUAGE, "label"=> _("Language"), "type"=> TEMPLATE_STRING),
+ );
+
+ return $fileMD;
+ }
+
+ public function mandatoryItemFields() {
+
+ $fields = array("starts", "ends");
+
+ return $fields;
+ }
+
+ public function mandatoryFileFields() {
+
+ $fields = array("played");
+
+ return $fields;
+ }
+
+ private function defaultItemTemplate() {
+
+ $template = array();
+ $fields = array();
+
+ $fields[] = array("name" => "starts", "label"=> _("Start Time"),"type" => TEMPLATE_DATETIME, "isFileMd" => false);
+ $fields[] = array("name" => "ends", "label"=> _("End Time"), "type" => TEMPLATE_DATETIME, "isFileMd" => false);
+ $fields[] = array("name" => MDATA_KEY_TITLE, "label"=> _("Title"), "type" => TEMPLATE_STRING, "isFileMd" => true); //these fields can be populated from an associated file.
+ $fields[] = array("name" => MDATA_KEY_CREATOR, "label"=> _("Creator"), "type" => TEMPLATE_STRING, "isFileMd" => true);
+
+ $template["name"] = "Log Sheet ".date("Y-m-d H:i:s")." Template";
+ $template["fields"] = $fields;
+
+ return $template;
+ }
+
+ /*
+ * Default File Summary Template. Taken from The Czech radio requirements (customer requested this in the past).
+ */
+ private function defaultFileTemplate() {
+
+ $template = array();
+ $fields = array();
+
+ $fields[] = array("name" => MDATA_KEY_TITLE, "label"=> _("Title"), "type" => TEMPLATE_STRING, "isFileMd" => true);
+ $fields[] = array("name" => MDATA_KEY_CREATOR, "label"=> _("Creator"), "type" => TEMPLATE_STRING, "isFileMd" => true);
+ $fields[] = array("name" => "played", "label"=> _("Played"), "type" => TEMPLATE_INT, "isFileMd" => false);
+ $fields[] = array("name" => MDATA_KEY_DURATION, "label"=> _("Length"), "type" => TEMPLATE_STRING, "isFileMd" => true);
+ $fields[] = array("name" => MDATA_KEY_COMPOSER, "label"=> _("Composer"), "type" => TEMPLATE_STRING, "isFileMd" => true);
+ $fields[] = array("name" => MDATA_KEY_COPYRIGHT, "label"=> _("Copyright"), "type" => TEMPLATE_STRING, "isFileMd" => true);
+
+ $template["name"] = "File Summary ".date("Y-m-d H:i:s")." Template";
+ $template["fields"] = $fields;
+
+ return $template;
+ }
+
+ public function loadTemplate($id) {
+
+ try {
+
+ if (!is_numeric($id)) {
+ throw new Exception("Error: $id is not numeric.");
+ }
+
+ $template = CcPlayoutHistoryTemplateQuery::create()->findPk($id, $this->con);
+
+ if (empty($template)) {
+ throw new Exception("Error: Template $id does not exist.");
+ }
+
+ $c = new Criteria();
+ $c->addAscendingOrderByColumn(CcPlayoutHistoryTemplateFieldPeer::POSITION);
+ $config = $template->getCcPlayoutHistoryTemplateFields($c, $this->con);
+ $fields = array();
+
+ foreach ($config as $item) {
+
+ $fields[] = array(
+ "name" => $item->getDbName(),
+ "label" => $item->getDbLabel(),
+ "type" => $item->getDbType(),
+ "isFileMd" => $item->getDbIsFileMD(),
+ "id" => $item->getDbId()
+ );
+ }
+
+ $data = array();
+ $data["id"] = $template->getDbId();
+ $data["name"] = $template->getDbName();
+ $data["fields"] = $fields;
+ $data["type"] = $template->getDbType();
+
+ return $data;
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function getItemTemplate($id) {
+
+ if (is_numeric($id)) {
+ Logging::info("template id is: $id");
+ $template = $this->loadTemplate($id);
+ }
+ else {
+ Logging::info("Using default template");
+ $template = $this->defaultItemTemplate();
+ }
+
+ return $template;
+ }
+
+ public function getTemplates($type) {
+
+ $list = array();
+
+ try {
+
+ $query = CcPlayoutHistoryTemplateQuery::create()
+ ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND);
+
+ if (isset($type)) {
+ $templates = $query->findByDbType($type);
+ }
+ else {
+ $templates = $query->find();
+ }
+
+ foreach ($templates as $template) {
+ $list[$template->getDbId()] = $template->getDbName();
+ }
+
+ return $list;
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function getListItemTemplates() {
+ return $this->getTemplates(self::TEMPLATE_TYPE_ITEM);
+ }
+
+ public function getFileTemplates() {
+ return $this->getTemplates(self::TEMPLATE_TYPE_FILE);
+ }
+
+ private function datatablesColumns($fields) {
+
+ $columns = array();
+
+ foreach ($fields as $field) {
+
+ $label = $field["label"];
+ $key = $field["name"];
+
+ $columns[] = array(
+ "sTitle"=> $label,
+ "mDataProp"=> $key,
+ "sClass"=> "his_{$key}",
+ "sDataType"=> $field["type"]
+ );
+ }
+
+ return $columns;
+ }
+
+ public function getDatatablesLogSheetColumns() {
+
+ //need to prepend a checkbox column.
+ $checkbox = array(
+ "sTitle"=> "",
+ "mDataProp"=> "checkbox",
+ "sClass"=> "his_checkbox",
+ "bSortable"=> false
+ );
+
+ try {
+ $template = $this->getConfiguredItemTemplate();
+ $fields = $template["fields"];
+
+ $columns = $this->datatablesColumns($fields);
+ array_unshift($columns, $checkbox);
+
+ return $columns;
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function getDatatablesFileSummaryColumns() {
+
+ try {
+ $template = $this->getConfiguredFileTemplate();
+ return $this->datatablesColumns($template["fields"]);
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function getConfiguredItemTemplate() {
+
+ try {
+ $id = Application_Model_Preference::GetHistoryItemTemplate();
+
+ if (is_numeric($id)) {
+ $template = $this->loadTemplate($id);
+ }
+ else {
+ $template = $this->defaultItemTemplate();
+ }
+ return $template;
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function setConfiguredItemTemplate($id) {
+ try {
+ Application_Model_Preference::SetHistoryItemTemplate($id);
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function getConfiguredFileTemplate() {
+
+ try {
+ $id = Application_Model_Preference::GetHistoryFileTemplate();
+
+ if (is_numeric($id)) {
+ $template = $this->loadTemplate($id);
+ }
+ else {
+ $template = $this->defaultFileTemplate();
+ }
+ return $template;
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function setConfiguredFileTemplate($id) {
+ try {
+ Application_Model_Preference::SetHistoryFileTemplate($id);
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function setConfiguredTemplate($id) {
+ try {
+
+ $template = $this->loadTemplate($id);
+ $type = $template["type"];
+
+ $setTemplate = "setConfigured".ucfirst($type)."Template";
+
+ $this->$setTemplate($id);
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function getConfiguredTemplateIds() {
+
+ try {
+ $id = Application_Model_Preference::GetHistoryItemTemplate();
+ $id2 = Application_Model_Preference::GetHistoryFileTemplate();
+
+ $configured = array();
+
+ if (is_numeric($id)) {
+ $configured[] = $id;
+ }
+
+ if (is_numeric($id2)) {
+ $configured[] = $id2;
+ }
+
+ return $configured;
+ }
+ catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function createTemplate($config) {
+
+ $this->con->beginTransaction();
+
+ try {
+
+ $type = $config["type"];
+
+ $method = "default".ucfirst($type)."Template";
+ $default = $this->$method();
+
+ $name = isset($config["name"]) ? $config["name"] : $default["name"];
+ $fields = isset($config["fields"]) ? $config["fields"] : $default["fields"];
+
+ $doSetDefault = isset($config['setDefault']) ? $config['setDefault'] : false;
+
+ $template = new CcPlayoutHistoryTemplate();
+ $template->setDbName($name);
+ $template->setDbType($type);
+
+ foreach ($fields as $index=>$field) {
+
+ $isMd = ($field["isFileMd"] == 'true') ? true : false;
+
+ $templateField = new CcPlayoutHistoryTemplateField();
+ $templateField->setDbName($field["name"]);
+ $templateField->setDbLabel($field["label"]);
+ $templateField->setDbType($field["type"]);
+ $templateField->setDbIsFileMD($isMd);
+ $templateField->setDbPosition($index);
+
+ $template->addCcPlayoutHistoryTemplateField($templateField);
+ }
+
+ $template->save($this->con);
+
+ if ($doSetDefault) {
+ $this->setConfiguredItemTemplate($template->getDbid());
+ }
+
+ $this->con->commit();
+
+ return $template->getDbid();
+ }
+ catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+ }
+
+ public function updateItemTemplate($id, $name, $fields, $doSetDefault=false) {
+
+ $this->con->beginTransaction();
+
+ try {
+
+ $template = CcPlayoutHistoryTemplateQuery::create()->findPk($id, $this->con);
+ $template->setDbName($name);
+
+ if (count($fields) === 0) {
+ $t = $this->defaultItemTemplate();
+ $fields = $t["fields"];
+ }
+
+ $template->getCcPlayoutHistoryTemplateFields()->delete($this->con);
+
+ foreach ($fields as $index=>$field) {
+
+ $isMd = ($field["isFileMd"] == 'true') ? true : false;
+
+ $templateField = new CcPlayoutHistoryTemplateField();
+ $templateField->setDbName($field["name"]);
+ $templateField->setDbType($field["type"]);
+ $templateField->setDbLabel($field["label"]);
+ $templateField->setDbIsFileMD($isMd);
+ $templateField->setDbPosition($index);
+
+ $template->addCcPlayoutHistoryTemplateField($templateField);
+ }
+
+ $template->save($this->con);
+
+ if ($doSetDefault) {
+ $this->setConfiguredItemTemplate($template->getDbid());
+ }
+
+ $this->con->commit();
+ }
+ catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+ }
+
+ public function deleteTemplate($id) {
+
+ $this->con->beginTransaction();
+
+ try {
+
+ $template = CcPlayoutHistoryTemplateQuery::create()->findPk($id, $this->con);
+ $template->delete($this->con);
+
+ $this->con->commit();
+ }
+ catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+ }
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/services/UserService.php b/airtime_mvc/application/services/UserService.php
index 879ba4d48..40e077a39 100644
--- a/airtime_mvc/application/services/UserService.php
+++ b/airtime_mvc/application/services/UserService.php
@@ -1,10 +1,5 @@
+element ?>
+
+
Add more elements:
+ + + + template_type !== Application_Service_HistoryService::TEMPLATE_TYPE_FILE): ?> +"), + //set because only the checkbox row is not sortable. + "mColumns": "sortable" + } + ] + }; + + var lengthMenu = [[10, 25, 50, 100, 500, -1], [10, 25, 50, 100, 500, $.i18n._("All")]]; + + var sDom = 'l<"dt-process-rel"r><"H"T><"dataTables_scrolling"t><"F"ip>'; + + var selectedLogItems = {}; + + var dateStartId = "#his_date_start", + timeStartId = "#his_time_start", + dateEndId = "#his_date_end", + timeEndId = "#his_time_end", + + oTableAgg, + oTableItem, + oTableShow, + inShowsTab = false; + + function getSelectedLogItems() { + var items = Object.keys(selectedLogItems); + + return items; + } + + function addSelectedLogItem($el) { + var id; + + $el.addClass("his-selected"); + id = $el.data("his-id"); + selectedLogItems[id] = ""; + } + + function removeSelectedLogItem($el) { + var id; + + $el.removeClass("his-selected"); + id = $el.data("his-id"); + delete selectedLogItems[id]; + } + + function emptySelectedLogItems() { + var $inputs = $historyContentDiv.find(".his_checkbox").find("input"); + + $inputs.prop('checked', false); + $inputs.parents("tr").removeClass("his-selected"); + + selectedLogItems = {}; + } + + function selectCurrentPage(e) { + var $ctx = $(e.currentTarget).parents("div.dataTables_wrapper"), + $inputs = $ctx.find(".his_checkbox").find("input"), + $tr, + $input; + + $.each($inputs, function(index, input) { + $input = $(input); + $input.prop('checked', true); + $tr = $input.parents("tr"); + addSelectedLogItem($tr); + }); + } + + function deselectCurrentPage(e) { + var $ctx = $(e.currentTarget).parents("div.dataTables_wrapper"), + $inputs = $ctx.find(".his_checkbox").find("input"), + $tr, + $input; + + $.each($inputs, function(index, input) { + $input = $(input); + $input.prop('checked', false); + $tr = $input.parents("tr"); + removeSelectedLogItem($tr); + }); + } + + function getFileName(ext){ + var filename = $("#his_date_start").val()+"_"+$("#his_time_start").val()+"m--"+$("#his_date_end").val()+"_"+$("#his_time_end").val()+"m"; + filename = filename.replace(/:/g,"h"); + + if (ext == "pdf"){ + filename = filename+".pdf"; + } + else { + filename = filename+".csv"; + } + return filename; + } + + function setFlashFileName( nButton, oConfig, oFlash ) { + var filename = getFileName(oConfig.sExtends); + oFlash.setFileName( filename ); + + if (oConfig.sExtends == "pdf") { + this.fnSetText( oFlash, + "title:"+ this.fnGetTitle(oConfig) +"\n"+ + "message:"+ oConfig.sPdfMessage +"\n"+ + "colWidth:"+ this.fnCalcColRatios(oConfig) +"\n"+ + "orientation:"+ oConfig.sPdfOrientation +"\n"+ + "size:"+ oConfig.sPdfSize +"\n"+ + "--/TableToolsOpts--\n" + + this.fnGetTableData(oConfig)); + } + else { + this.fnSetText(oFlash, this.fnGetTableData(oConfig)); + } + } + + /* This callback can be used for all history tables */ + function fnServerData( sSource, aoData, fnCallback ) { + + if (fnServerData.hasOwnProperty("start")) { + aoData.push( { name: "start", value: fnServerData.start} ); + } + if (fnServerData.hasOwnProperty("end")) { + aoData.push( { name: "end", value: fnServerData.end} ); + } + if (fnServerData.hasOwnProperty("instance")) { + aoData.push( { name: "instance_id", value: fnServerData.instance} ); + } + + aoData.push( { name: "format", value: "json"} ); + + $.ajax( { + "dataType": 'json', + "type": "GET", + "url": sSource, + "data": aoData, + "success": fnCallback + } ); + } + + function createShowAccordSection(config) { + var template, + $el; + + template = + "
") - } - ] + "sDom": sDom, + "oTableTools": oTableTools + }); + oTable.fnSetFilteringDelay(350); + + return oTable; + } + + function itemHistoryTable(id) { + var oTable, + $historyTableDiv = $historyContentDiv.find("#"+id), + $toolbar, + columns, + fnRowCallback, + booleans = {}, + i, c; + + columns = JSON.parse(localStorage.getItem('datatables-historyitem-aoColumns')); + + for (i in columns) { + + c = columns[i]; + if (c["sDataType"] === "boolean") { + booleans[c["mDataProp"]] = c["sTitle"]; + } + } + + fnRowCallback = function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { + var editUrl = baseUrl+"playouthistory/edit-list-item/id/"+aData.history_id, + deleteUrl = baseUrl+"playouthistory/delete-list-item/id/"+aData.history_id, + emptyCheckBox = String.fromCharCode(parseInt(2610, 16)), + checkedCheckBox = String.fromCharCode(parseInt(2612, 16)), + b, + text, + $nRow = $(nRow); + + // add checkbox + $nRow.find('td.his_checkbox').html(""); + + $nRow.data('his-id', aData.history_id); + $nRow.data('url-edit', editUrl); + $nRow.data('url-delete', deleteUrl); + + for (b in booleans) { + + text = aData[b] ? checkedCheckBox : emptyCheckBox; + text = text + " " + booleans[b]; + + $nRow.find(".his_"+b).html(text); } + }; + + oTable = $historyTableDiv.dataTable( { + + "aoColumns": columns, + "bProcessing": true, + "bServerSide": true, + "sAjaxSource": baseUrl+"playouthistory/item-history-feed", + "sAjaxDataProp": "history", + "fnServerData": fnServerData, + "fnRowCallback": fnRowCallback, + "oLanguage": datatables_dict, + "aLengthMenu": lengthMenu, + "iDisplayLength": 25, + "sPaginationType": "full_numbers", + "bJQueryUI": true, + "bAutoWidth": true, + "sDom": sDom, + "oTableTools": oTableTools }); oTable.fnSetFilteringDelay(350); - historyContentDiv.find(".dataTables_scrolling").css("max-height", tableHeight); - + $toolbar = $historyTableDiv.parents(".dataTables_wrapper").find(".fg-toolbar:first"); + createToolbarButtons($toolbar); + return oTable; + } + + function showSummaryList() { + var url = baseUrl+"playouthistory/show-history-feed", + oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId), + data = { + format: "json", + start: oRange.start, + end: oRange.end + }; + + $.post(url, data, function(json) { + drawShowList(json); + }); + } + + mod.onReady = function() { + + var oBaseDatePickerSettings, + oBaseTimePickerSettings, + $hisDialogEl, + + tabsInit = [ + { + initialized: false, + initialize: function() { + oTableItem = itemHistoryTable("history_table_list"); + }, + navigate: function() { + delete fnServerData.instance; + oTableItem.fnDraw(); + }, + always: function() { + inShowsTab = false; + emptySelectedLogItems(); + } + }, + { + initialized: false, + initialize: function() { + oTableAgg = aggregateHistoryTable(); + }, + navigate: function() { + delete fnServerData.instance; + oTableAgg.fnDraw(); + }, + always: function() { + inShowsTab = false; + emptySelectedLogItems(); + } + }, + { + initialized: false, + initialize: function() { + + }, + navigate: function() { + + }, + always: function() { + inShowsTab = true; + showSummaryList(); + emptySelectedLogItems(); + } + } + ]; + + + $historyContentDiv = $("#history_content"); + + function redrawTables() { + oTableAgg && oTableAgg.fnDraw(); + oTableItem && oTableItem.fnDraw(); + oTableShow && oTableShow.fnDraw(); + } + + function removeHistoryDialog() { + $hisDialogEl.dialog("destroy"); + $hisDialogEl.remove(); + } + + function initializeDialog() { + var $startPicker = $hisDialogEl.find('#his_item_starts_datetimepicker'), + $endPicker = $hisDialogEl.find('#his_item_ends_datetimepicker'); + + $startPicker.datetimepicker(); + + $endPicker.datetimepicker({ + showTimeFirst: true + }); + + $startPicker.on('changeDate', function(e) { + $endPicker.data('datetimepicker').setLocalDate(e.localDate); + }); + } + + function processDialogHtml($el) { + + if (inShowsTab) { + $el.find("#his_choose_instance").remove(); + } + + return $el + } + + function makeHistoryDialog(html) { + $hisDialogEl = $(html); + $hisDialogEl = processDialogHtml($hisDialogEl); + + $hisDialogEl.dialog({ + title: $.i18n._("Edit History Record"), + modal: false, + open: function( event, ui ) { + initializeDialog(); + }, + close: function() { + removeHistoryDialog(); + } + }); + } + + /* + * Icon hover states for search. + */ + $historyContentDiv.on("mouseenter", ".his-timerange .ui-button", function(ev) { + $(this).addClass("ui-state-hover"); + }); + $historyContentDiv.on("mouseleave", ".his-timerange .ui-button", function(ev) { + $(this).removeClass("ui-state-hover"); + }); + + oBaseDatePickerSettings = { + dateFormat: 'yy-mm-dd', + //i18n_months, i18n_days_short are in common.js + monthNames: i18n_months, + dayNamesMin: i18n_days_short, + onSelect: function(sDate, oDatePicker) { + $(this).datepicker( "setDate", sDate ); + } + }; + + oBaseTimePickerSettings = { + showPeriodLabels: false, + showCloseButton: true, + closeButtonText: $.i18n._("Done"), + showLeadingZero: false, + defaultTime: '0:00', + hourText: $.i18n._("Hour"), + minuteText: $.i18n._("Minute") + }; + + $historyContentDiv.find(dateStartId).datepicker(oBaseDatePickerSettings); + $historyContentDiv.find(timeStartId).timepicker(oBaseTimePickerSettings); + $historyContentDiv.find(dateEndId).datepicker(oBaseDatePickerSettings); + $historyContentDiv.find(timeEndId).timepicker(oBaseTimePickerSettings); + + $historyContentDiv.on("click", "#his_create", function(e) { + var url = baseUrl+"playouthistory/edit-list-item/format/json" ; + + e.preventDefault(); + + $.get(url, function(json) { + + makeHistoryDialog(json.dialog); + + }, "json"); + }); + + $('body').on("click", ".his_file_cancel, .his_item_cancel", function(e) { + removeHistoryDialog(); + }); + + $('body').on("click", ".his_file_save", function(e) { + + e.preventDefault(); + + var $form = $(this).parents("form"); + var data = $form.serializeArray(); + + var url = baseUrl+"Playouthistory/update-file-item/format/json"; + + $.post(url, data, function(json) { + + //TODO put errors on form. + if (json.error !== undefined) { + //makeHistoryDialog(json.dialog); + } + else { + removeHistoryDialog(); + redrawTables(); + } + + }, "json"); + + }); + + $('body').on("click", ".his_item_save", function(e) { + + e.preventDefault(); + + var $form = $(this).parents("form"), + data = $form.serializeArray(), + id = data[0].value, + createUrl = baseUrl+"Playouthistory/create-list-item/format/json", + updateUrl = baseUrl+"Playouthistory/update-list-item/format/json", + url, + $select = $hisDialogEl.find("#his_instance_select"), + instance; + + url = (id === "") ? createUrl : updateUrl; + + if (fnServerData.instance !== undefined) { + data.push({ + name: "instance_id", + value: fnServerData.instance + }); + } + else if ($select.length > 0) { + instance = $select.val(); + + if (instance > 0) { + data.push({ + name: "instance_id", + value: instance + }); + } + } + + $.post(url, data, function(json) { + + if (json.form !== undefined) { + var $newForm = $(json.form); + $newForm = processDialogHtml($newForm); + $hisDialogEl.html($newForm.html()); + initializeDialog(); + } + else { + removeHistoryDialog(); + redrawTables(); + } + + }, "json"); + + }); + + + $historyContentDiv.on("click", ".his_checkbox input", function(e) { + var checked = e.currentTarget.checked, + $tr = $(e.currentTarget).parents("tr"); + + if (checked) { + addSelectedLogItem($tr); + } + else { + removeSelectedLogItem($tr); + } + }); + + $('body').on("click", "#his_instance_retrieve", function(e) { + var startPicker = $hisDialogEl.find('#his_item_starts_datetimepicker').data('datetimepicker'), + endPicker = $hisDialogEl.find('#his_item_ends_datetimepicker').data('datetimepicker'), + url = baseUrl+"playouthistory/show-history-feed", + startDate = startPicker.getLocalDate(), + endDate = endPicker.getLocalDate(), + getEpochSeconds = AIRTIME.utilities.fnGetSecondsEpoch, + data; + + data = { + start: getEpochSeconds(startDate), + end: getEpochSeconds(endDate), + format: "json" + }; + + $.get(url, data, function(json) { + var i, + $select = $('', { + id: 'his_instance_select' + }), + $option, + show; + + if (json.length > 0) { + + for (i = 0; i < json.length; i++) { + show = json[i]; + + $option = $('') + .text(show.name) + .attr('value', show.instance_id); + + $select.append($option); + } + } + + $option = $('') + .text($.i18n._("No Show")) + .attr('value', 0); + + $select.append($option); + + $hisDialogEl.find("#his_instance_select").replaceWith($select); + }); + }); + + $historyContentDiv.find("#his_submit").click(function(ev){ + var fn, + oRange; + + oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId); + + fn = fnServerData; + fn.start = oRange.start; + fn.end = oRange.end; + + if (inShowsTab) { + showSummaryList(); + } + else { + redrawTables(); + } + }); + + $historyContentDiv.on("click", ".his-select-page", selectCurrentPage); + $historyContentDiv.on("click", ".his-dselect-page", deselectCurrentPage); + $historyContentDiv.on("click", ".his-dselect-all", emptySelectedLogItems); + + $historyContentDiv.on("click", "#his_trash", function(ev){ + var items = getSelectedLogItems(), + url = baseUrl+"playouthistory/delete-list-items"; + + $.post(url, {ids: items, format: "json"}, function() { + selectedLogItems = {}; + redrawTables(); + }); + }); + + $historyContentDiv.find("#his-tabs").tabs({ + show: function( event, ui ) { + var href = $(ui.tab).attr("href"); + var index = href.split('-').pop(); + var tab = tabsInit[index-1]; + + if (!tab.initialized) { + tab.initialize(); + tab.initialized = true; + } + else { + tab.navigate(); + } + + tab.always(); + } + }); + + // begin context menu initialization. + $.contextMenu({ + selector: '#history_content td:not(.his_checkbox)', + trigger: "left", + ignoreRightClick: true, + + build: function($el, e) { + var items = {}, + callback, + $tr, + editUrl, + deleteUrl; + + $tr = $el.parents("tr"); + editUrl = $tr.data("url-edit"); + deleteUrl = $tr.data("url-delete"); + + if (editUrl !== undefined) { + + callback = function() { + $.post(editUrl, {format: "json"}, function(json) { + + makeHistoryDialog(json.dialog); + + }, "json"); + }; + + items["edit"] = { + "name": $.i18n._("Edit"), + "icon": "edit", + "callback": callback + }; + } + + if (deleteUrl !== undefined) { + + callback = function() { + var c = confirm("Delete this entry?"); + + if (c) { + $.post(deleteUrl, {format: "json"}, function(json) { + redrawTables(); + }); + } + }; + + items["del"] = { + "name": $.i18n._("Delete"), + "icon": "delete", + "callback": callback + }; + } + + return { + items: items + }; + } + }); }; return AIRTIME; }(AIRTIME || {})); -$(document).ready(function(){ - - var viewport = AIRTIME.utilities.findViewportDimensions(), - history_content = $("#history_content"), - widgetHeight = viewport.height - 185, - screenWidth = Math.floor(viewport.width - 110), - oBaseDatePickerSettings, - oBaseTimePickerSettings, - oTable, - dateStartId = "#his_date_start", - timeStartId = "#his_time_start", - dateEndId = "#his_date_end", - timeEndId = "#his_time_end"; - - /* - * Icon hover states for search. - */ - history_content.on("mouseenter", ".his-timerange .ui-button", function(ev) { - $(this).addClass("ui-state-hover"); - }); - history_content.on("mouseleave", ".his-timerange .ui-button", function(ev) { - $(this).removeClass("ui-state-hover"); - }); - - history_content - .height(widgetHeight) - .width(screenWidth); - - oBaseDatePickerSettings = { - dateFormat: 'yy-mm-dd', - //i18n_months, i18n_days_short are in common.js - monthNames: i18n_months, - dayNamesMin: i18n_days_short, - onSelect: function(sDate, oDatePicker) { - $(this).datepicker( "setDate", sDate ); - } - }; - - oBaseTimePickerSettings = { - showPeriodLabels: false, - showCloseButton: true, - closeButtonText: $.i18n._("Done"), - showLeadingZero: false, - defaultTime: '0:00', - hourText: $.i18n._("Hour"), - minuteText: $.i18n._("Minute") - }; - - oTable = AIRTIME.history.historyTable(); - - history_content.find(dateStartId).datepicker(oBaseDatePickerSettings); - history_content.find(timeStartId).timepicker(oBaseTimePickerSettings); - history_content.find(dateEndId).datepicker(oBaseDatePickerSettings); - history_content.find(timeEndId).timepicker(oBaseTimePickerSettings); - - - history_content.find("#his_submit").click(function(ev){ - var fn, - oRange; - - oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId); - - fn = oTable.fnSettings().fnServerData; - fn.start = oRange.start; - fn.end = oRange.end; - - oTable.fnDraw(); - }); - -}); +$(document).ready(AIRTIME.history.onReady); \ No newline at end of file diff --git a/airtime_mvc/public/js/airtime/playouthistory/template.js b/airtime_mvc/public/js/airtime/playouthistory/template.js new file mode 100644 index 000000000..892a9c402 --- /dev/null +++ b/airtime_mvc/public/js/airtime/playouthistory/template.js @@ -0,0 +1,102 @@ +var AIRTIME = (function(AIRTIME) { + var mod; + var $historyTemplate; + + if (AIRTIME.template === undefined) { + AIRTIME.template = {}; + } + mod = AIRTIME.template; + + function createItemLi(id, name, configured) { + + var editUrl = baseUrl+"Playouthistorytemplate/configure-template/id/"+id; + var defaultUrl = baseUrl+"Playouthistorytemplate/set-template-default/format/json/id/"+id; + var removeUrl = baseUrl+"Playouthistorytemplate/delete-template/format/json/id/"+id; + + var itemConfigured = + "
Copied '+len+' row'+plural+' to the clipboard.
', + 1500 + ); + } + } ), + + "pdf": $.extend( {}, TableTools.buttonBase, { "sAction": "flash_pdf", - "sFieldBoundary": "", - "sFieldSeperator": "\t", "sNewLine": "\n", "sFileName": "*.pdf", - "sToolTip": "", - "sTitle": "", "sButtonClass": "DTTT_button_pdf", - "sButtonClassHover": "DTTT_button_pdf_hover", "sButtonText": "PDF", - "mColumns": "all", - "bHeader": true, - "bFooter": false, - "bSelectedOnly": false, - "fnMouseover": null, - "fnMouseout": null, "sPdfOrientation": "portrait", "sPdfSize": "A4", "sPdfMessage": "", @@ -2275,167 +2221,87 @@ TableTools.BUTTONS = { "--/TableToolsOpts--\n" + this.fnGetTableData(oConfig) ); - }, - "fnSelect": null, - "fnComplete": null, - "fnInit": null, - "fnCellRender": null - }, - "print": { - "sAction": "print", + } + } ), + + "print": $.extend( {}, TableTools.buttonBase, { "sInfo": "Please use your browser's print function to "+
"print this table. Press escape when finished.",
- "sMessage": "",
+ "sMessage": null,
"bShowAll": true,
"sToolTip": "View print view",
"sButtonClass": "DTTT_button_print",
- "sButtonClassHover": "DTTT_button_print_hover",
"sButtonText": "Print",
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": null,
- "fnSelect": null,
- "fnComplete": null,
- "fnInit": null,
- "fnCellRender": null
- },
- "text": {
- "sAction": "text",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
- "sButtonText": "Text button",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "bSelectedOnly": false,
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": null,
- "fnSelect": null,
- "fnComplete": null,
- "fnInit": null,
- "fnCellRender": null
- },
- "select": {
- "sAction": "text",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
+ "fnClick": function ( nButton, oConfig ) {
+ this.fnPrint( true, oConfig );
+ }
+ } ),
+
+ "text": $.extend( {}, TableTools.buttonBase ),
+
+ "select": $.extend( {}, TableTools.buttonBase, {
"sButtonText": "Select button",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": null,
"fnSelect": function( nButton, oConfig ) {
if ( this.fnGetSelected().length !== 0 ) {
- $(nButton).removeClass('DTTT_disabled');
+ $(nButton).removeClass( this.classes.buttons.disabled );
} else {
- $(nButton).addClass('DTTT_disabled');
+ $(nButton).addClass( this.classes.buttons.disabled );
}
},
- "fnComplete": null,
"fnInit": function( nButton, oConfig ) {
- $(nButton).addClass('DTTT_disabled');
- },
- "fnCellRender": null
- },
- "select_single": {
- "sAction": "text",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
+ $(nButton).addClass( this.classes.buttons.disabled );
+ }
+ } ),
+
+ "select_single": $.extend( {}, TableTools.buttonBase, {
"sButtonText": "Select button",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": null,
"fnSelect": function( nButton, oConfig ) {
var iSelected = this.fnGetSelected().length;
if ( iSelected == 1 ) {
- $(nButton).removeClass('DTTT_disabled');
+ $(nButton).removeClass( this.classes.buttons.disabled );
} else {
- $(nButton).addClass('DTTT_disabled');
+ $(nButton).addClass( this.classes.buttons.disabled );
}
},
- "fnComplete": null,
"fnInit": function( nButton, oConfig ) {
- $(nButton).addClass('DTTT_disabled');
- },
- "fnCellRender": null
- },
- "select_all": {
- "sAction": "text",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
+ $(nButton).addClass( this.classes.buttons.disabled );
+ }
+ } ),
+
+ "select_all": $.extend( {}, TableTools.buttonBase, {
"sButtonText": "Select all",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "fnMouseover": null,
- "fnMouseout": null,
"fnClick": function( nButton, oConfig ) {
this.fnSelectAll();
},
"fnSelect": function( nButton, oConfig ) {
if ( this.fnGetSelected().length == this.s.dt.fnRecordsDisplay() ) {
- $(nButton).addClass('DTTT_disabled');
+ $(nButton).addClass( this.classes.buttons.disabled );
} else {
- $(nButton).removeClass('DTTT_disabled');
+ $(nButton).removeClass( this.classes.buttons.disabled );
}
- },
- "fnComplete": null,
- "fnInit": null,
- "fnCellRender": null
- },
- "select_none": {
- "sAction": "text",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
+ }
+ } ),
+
+ "select_none": $.extend( {}, TableTools.buttonBase, {
"sButtonText": "Deselect all",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "fnMouseover": null,
- "fnMouseout": null,
"fnClick": function( nButton, oConfig ) {
this.fnSelectNone();
},
"fnSelect": function( nButton, oConfig ) {
if ( this.fnGetSelected().length !== 0 ) {
- $(nButton).removeClass('DTTT_disabled');
+ $(nButton).removeClass( this.classes.buttons.disabled );
} else {
- $(nButton).addClass('DTTT_disabled');
+ $(nButton).addClass( this.classes.buttons.disabled );
}
},
- "fnComplete": null,
"fnInit": function( nButton, oConfig ) {
- $(nButton).addClass('DTTT_disabled');
- },
- "fnCellRender": null
- },
- "ajax": {
- "sAction": "text",
- "sFieldBoundary": "",
- "sFieldSeperator": "\t",
- "sNewLine": "\n",
+ $(nButton).addClass( this.classes.buttons.disabled );
+ }
+ } ),
+
+ "ajax": $.extend( {}, TableTools.buttonBase, {
"sAjaxUrl": "/xhr.php",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
"sButtonText": "Ajax button",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "bSelectedOnly": false,
- "fnMouseover": null,
- "fnMouseout": null,
"fnClick": function( nButton, oConfig ) {
var sData = this.fnGetTableData(oConfig);
$.ajax( {
@@ -2452,45 +2318,26 @@ TableTools.BUTTONS = {
}
} );
},
- "fnSelect": null,
- "fnComplete": null,
- "fnInit": null,
"fnAjaxComplete": function( json ) {
alert( 'Ajax complete' );
- },
- "fnCellRender": null
- },
- "div": {
+ }
+ } ),
+
+ "div": $.extend( {}, TableTools.buttonBase, {
"sAction": "div",
- "sToolTip": "",
+ "sTag": "div",
"sButtonClass": "DTTT_nonbutton",
- "sButtonClassHover": "",
- "sButtonText": "Text button",
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": null,
- "fnSelect": null,
- "fnComplete": null,
- "fnInit": null,
- "nContent": null,
- "fnCellRender": null
- },
- "collection": {
+ "sButtonText": "Text button"
+ } ),
+
+ "collection": $.extend( {}, TableTools.buttonBase, {
"sAction": "collection",
- "sToolTip": "",
"sButtonClass": "DTTT_button_collection",
- "sButtonClassHover": "DTTT_button_collection_hover",
"sButtonText": "Collection",
- "fnMouseover": null,
- "fnMouseout": null,
"fnClick": function( nButton, oConfig ) {
this._fnCollectionShow(nButton, oConfig);
- },
- "fnSelect": null,
- "fnComplete": null,
- "fnInit": null,
- "fnCellRender": null
- }
+ }
+ } )
};
/*
* on* callback parameters:
@@ -2501,17 +2348,75 @@ TableTools.BUTTONS = {
*/
+
+/**
+ * @namespace Classes used by TableTools - allows the styles to be override easily.
+ * Note that when TableTools initialises it will take a copy of the classes object
+ * and will use its internal copy for the remainder of its run time.
+ */
+TableTools.classes = {
+ "container": "DTTT_container",
+ "buttons": {
+ "normal": "DTTT_button",
+ "disabled": "DTTT_disabled"
+ },
+ "collection": {
+ "container": "DTTT_collection",
+ "background": "DTTT_collection_background",
+ "buttons": {
+ "normal": "DTTT_button",
+ "disabled": "DTTT_disabled"
+ }
+ },
+ "select": {
+ "table": "DTTT_selectable",
+ "row": "DTTT_selected"
+ },
+ "print": {
+ "body": "DTTT_Print",
+ "info": "DTTT_print_info",
+ "message": "DTTT_PrintMessage"
+ }
+};
+
+
+/**
+ * @namespace ThemeRoller classes - built in for compatibility with DataTables'
+ * bJQueryUI option.
+ */
+TableTools.classes_themeroller = {
+ "container": "DTTT_container ui-buttonset ui-buttonset-multi",
+ "buttons": {
+ "normal": "DTTT_button ui-button ui-state-default"
+ },
+ "collection": {
+ "container": "DTTT_collection ui-buttonset ui-buttonset-multi"
+ }
+};
+
+
/**
* @namespace TableTools default settings for initialisation
*/
TableTools.DEFAULTS = {
- "sSwfPath": "media/swf/copy_cvs_xls_pdf.swf",
- "sRowSelect": "none",
- "sSelectedClass": "DTTT_selected",
- "fnPreRowSelect": null,
- "fnRowSelected": null,
- "fnRowDeselected": null,
- "aButtons": [ "copy", "csv", "xls", "pdf", "print" ]
+ "sSwfPath": "media/swf/copy_csv_xls_pdf.swf",
+ "sRowSelect": "none",
+ "sSelectedClass": null,
+ "fnPreRowSelect": null,
+ "fnRowSelected": null,
+ "fnRowDeselected": null,
+ "aButtons": [ "copy", "csv", "xls", "pdf", "print" ],
+ "oTags": {
+ "container": "div",
+ "button": "a", // We really want to use buttons here, but Firefox and IE ignore the
+ // click on the Flash element in the button (but not mouse[in|out]).
+ "liner": "span",
+ "collection": {
+ "container": "div",
+ "button": "a",
+ "liner": "span"
+ }
+ }
};
@@ -2528,9 +2433,9 @@ TableTools.prototype.CLASS = "TableTools";
* TableTools version
* @constant VERSION
* @type String
- * @default 2.0.2
+ * @default See code
*/
-TableTools.VERSION = "2.0.2";
+TableTools.VERSION = "2.1.5";
TableTools.prototype.VERSION = TableTools.VERSION;
@@ -2545,7 +2450,7 @@ TableTools.prototype.VERSION = TableTools.VERSION;
*/
if ( typeof $.fn.dataTable == "function" &&
typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
- $.fn.dataTableExt.fnVersionCheck('1.8.2') )
+ $.fn.dataTableExt.fnVersionCheck('1.9.0') )
{
$.fn.dataTableExt.aoFeatures.push( {
"fnInit": function( oDTSettings ) {
@@ -2563,7 +2468,9 @@ if ( typeof $.fn.dataTable == "function" &&
}
else
{
- alert( "Warning: TableTools 2 requires DataTables 1.8.2 or newer - www.datatables.net/download");
+ alert( "Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download");
}
+$.fn.DataTable.TableTools = TableTools;
+
})(jQuery, window, document);
diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.min.js b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.min.js
new file mode 100644
index 000000000..e580c9936
--- /dev/null
+++ b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.min.js
@@ -0,0 +1,77 @@
+// Simple Set Clipboard System
+// Author: Joseph Huckaby
+var ZeroClipboard_TableTools={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(a){"string"==typeof a&&(a=document.getElementById(a));a.addClass||(a.hide=function(){this.style.display="none"},a.show=function(){this.style.display=""},a.addClass=function(a){this.removeClass(a);this.className+=" "+a},a.removeClass=function(a){this.className=this.className.replace(RegExp("\\s*"+a+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"")},a.hasClass=function(a){return!!this.className.match(RegExp("\\s*"+
+a+"\\s*"))});return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,c){(a=this.clients[a])&&a.receiveEvent(b,c)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a){var b={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};""!=a.style.width&&(b.width=a.style.width.replace("px",""));""!=a.style.height&&(b.height=a.style.height.replace("px",""));for(;a;)b.left+=a.offsetLeft,b.top+=a.offsetTop,a=a.offsetParent;return b},
+Client:function(a){this.handlers={};this.id=ZeroClipboard_TableTools.nextId++;this.movieId="ZeroClipboard_TableToolsMovie_"+this.id;ZeroClipboard_TableTools.register(this.id,this);a&&this.glue(a)}};
+ZeroClipboard_TableTools.Client.prototype={id:0,ready:!1,movie:null,clipText:"",fileName:"",action:"copy",handCursorEnabled:!0,cssEffects:!0,handlers:null,sized:!1,glue:function(a,b){this.domElement=ZeroClipboard_TableTools.$(a);var c=99;this.domElement.style.zIndex&&(c=parseInt(this.domElement.style.zIndex)+1);var d=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);this.div=document.createElement("div");var e=this.div.style;e.position="absolute";e.left="0px";e.top="0px";e.width=d.width+
+"px";e.height=d.height+"px";e.zIndex=c;"undefined"!=typeof b&&""!=b&&(this.div.title=b);0!=d.width&&0!=d.height&&(this.sized=!0);this.domElement&&(this.domElement.appendChild(this.div),this.div.innerHTML=this.getHTML(d.width,d.height))},positionElement:function(){var a=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement),b=this.div.style;b.position="absolute";b.width=a.width+"px";b.height=a.height+"px";0!=a.width&&0!=a.height&&(this.sized=!0,b=this.div.childNodes[0],b.width=a.width,b.height=
+a.height)},getHTML:function(a,b){var c="",d="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/))var e=location.href.match(/^https/i)?"https://":"http://",c=c+('');else c+='';return c},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.div=this.domElement=null}},reposition:function(a){a&&((this.domElement=ZeroClipboard_TableTools.$(a))||this.hide());if(this.domElement&&this.div){var a=ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement),
+b=this.div.style;b.left=""+a.left+"px";b.top=""+a.top+"px"}},clearText:function(){this.clipText="";this.ready&&this.movie.clearText()},appendText:function(a){this.clipText+=a;this.ready&&this.movie.appendText(a)},setText:function(a){this.clipText=a;this.ready&&this.movie.setText(a)},setCharSet:function(a){this.charSet=a;this.ready&&this.movie.setCharSet(a)},setBomInc:function(a){this.incBom=a;this.ready&&this.movie.setBomInc(a)},setFileName:function(a){this.fileName=a;this.ready&&this.movie.setFileName(a)},
+setAction:function(a){this.action=a;this.ready&&this.movie.setAction(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");this.handlers[a]||(this.handlers[a]=[]);this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a;this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");switch(a){case "load":this.movie=document.getElementById(this.movieId);
+if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=!0;return}this.ready=!0;this.movie.clearText();this.movie.appendText(this.clipText);this.movie.setFileName(this.fileName);this.movie.setAction(this.action);this.movie.setCharSet(this.charSet);this.movie.setBomInc(this.incBom);this.movie.setHandCursor(this.handCursorEnabled);
+break;case "mouseover":this.domElement&&this.cssEffects&&this.recoverActive&&this.domElement.addClass("active");break;case "mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0));break;case "mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case "mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[a])for(var d=
+0,e=this.handlers[a].length;d Copied "+a+" row"+(1==a?"":"s")+
+" to the clipboard. Please use your browser's print function to print this table. Press escape when finished.",sMessage:null,bShowAll:!0,sToolTip:"View print view",sButtonClass:"DTTT_button_print",sButtonText:"Print",fnClick:function(a,b){this.fnPrint(!0,b)}}),text:e.extend({},TableTools.buttonBase),select:e.extend({},TableTools.buttonBase,{sButtonText:"Select button",fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},
+fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),select_single:e.extend({},TableTools.buttonBase,{sButtonText:"Select button",fnSelect:function(a){1==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),select_all:e.extend({},TableTools.buttonBase,{sButtonText:"Select all",fnClick:function(){this.fnSelectAll()},fnSelect:function(a){this.fnGetSelected().length==
+this.s.dt.fnRecordsDisplay()?e(a).addClass(this.classes.buttons.disabled):e(a).removeClass(this.classes.buttons.disabled)}}),select_none:e.extend({},TableTools.buttonBase,{sButtonText:"Deselect all",fnClick:function(){this.fnSelectNone()},fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),ajax:e.extend({},TableTools.buttonBase,{sAjaxUrl:"/xhr.php",
+sButtonText:"Ajax button",fnClick:function(a,b){var c=this.fnGetTableData(b);e.ajax({url:b.sAjaxUrl,data:[{name:"tableData",value:c}],success:b.fnAjaxComplete,dataType:"json",type:"POST",cache:!1,error:function(){alert("Error detected when sending table data to server")}})},fnAjaxComplete:function(){alert("Ajax complete")}}),div:e.extend({},TableTools.buttonBase,{sAction:"div",sTag:"div",sButtonClass:"DTTT_nonbutton",sButtonText:"Text button"}),collection:e.extend({},TableTools.buttonBase,{sAction:"collection",
+sButtonClass:"DTTT_button_collection",sButtonText:"Collection",fnClick:function(a,b){this._fnCollectionShow(a,b)}})};TableTools.classes={container:"DTTT_container",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"},collection:{container:"DTTT_collection",background:"DTTT_collection_background",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"}},select:{table:"DTTT_selectable",row:"DTTT_selected"},print:{body:"DTTT_Print",info:"DTTT_print_info",message:"DTTT_PrintMessage"}};TableTools.classes_themeroller=
+{container:"DTTT_container ui-buttonset ui-buttonset-multi",buttons:{normal:"DTTT_button ui-button ui-state-default"},collection:{container:"DTTT_collection ui-buttonset ui-buttonset-multi"}};TableTools.DEFAULTS={sSwfPath:"media/swf/copy_csv_xls_pdf.swf",sRowSelect:"none",sSelectedClass:null,fnPreRowSelect:null,fnRowSelected:null,fnRowDeselected:null,aButtons:["copy","csv","xls","pdf","print"],oTags:{container:"div",button:"a",liner:"span",collection:{container:"div",button:"a",liner:"span"}}};TableTools.prototype.CLASS=
+"TableTools";TableTools.VERSION="2.1.5";TableTools.prototype.VERSION=TableTools.VERSION;"function"==typeof e.fn.dataTable&&"function"==typeof e.fn.dataTableExt.fnVersionCheck&&e.fn.dataTableExt.fnVersionCheck("1.9.0")?e.fn.dataTableExt.aoFeatures.push({fnInit:function(a){a=new TableTools(a.oInstance,"undefined"!=typeof a.oInit.oTableTools?a.oInit.oTableTools:{});TableTools._aInstances.push(a);return a.dom.container},cFeature:"T",sFeature:"TableTools"}):alert("Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download");
+e.fn.DataTable.TableTools=TableTools})(jQuery,window,document);
diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.min.js.gz b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.min.js.gz
new file mode 100644
index 000000000..01ce7c041
Binary files /dev/null and b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.min.js.gz differ
diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools/js/ZeroClipboard.js b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js
old mode 100644
new mode 100755
similarity index 86%
rename from airtime_mvc/public/js/datatables/plugin/TableTools/js/ZeroClipboard.js
rename to airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js
index 73707f024..de0f6b67b
--- a/airtime_mvc/public/js/datatables/plugin/TableTools/js/ZeroClipboard.js
+++ b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js
@@ -1,7 +1,7 @@
// Simple Set Clipboard System
// Author: Joseph Huckaby
-var ZeroClipboard = {
+var ZeroClipboard_TableTools = {
version: "1.0.4-TableTools2",
clients: {}, // registered upload clients on page, indexed by id
@@ -73,18 +73,18 @@ var ZeroClipboard = {
this.handlers = {};
// unique ID
- this.id = ZeroClipboard.nextId++;
- this.movieId = 'ZeroClipboardMovie_' + this.id;
+ this.id = ZeroClipboard_TableTools.nextId++;
+ this.movieId = 'ZeroClipboard_TableToolsMovie_' + this.id;
// register client with singleton to receive flash events
- ZeroClipboard.register(this.id, this);
+ ZeroClipboard_TableTools.register(this.id, this);
// create movie
if (elem) this.glue(elem);
}
};
-ZeroClipboard.Client.prototype = {
+ZeroClipboard_TableTools.Client.prototype = {
id: 0, // unique ID for us
ready: false, // whether movie is ready to receive events or not
@@ -100,7 +100,7 @@ ZeroClipboard.Client.prototype = {
glue: function(elem, title) {
// glue to DOM element
// elem can be ID or actual DOM element object
- this.domElement = ZeroClipboard.$(elem);
+ this.domElement = ZeroClipboard_TableTools.$(elem);
// float just above object, or zIndex 99 if dom element isn't set
var zIndex = 99;
@@ -109,19 +109,18 @@ ZeroClipboard.Client.prototype = {
}
// find X/Y position of domElement
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
+ var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
// create floating DIV above element
this.div = document.createElement('div');
var style = this.div.style;
style.position = 'absolute';
- style.left = (this.domElement.offsetLeft)+'px';
- //style.left = (this.domElement.offsetLeft+2)+'px';
- style.top = this.domElement.offsetTop+'px';
+ style.left = '0px';
+ style.top = '0px';
style.width = (box.width) + 'px';
- //style.width = (box.width-4) + 'px';
style.height = box.height + 'px';
style.zIndex = zIndex;
+
if ( typeof title != "undefined" && title != "" ) {
this.div.title = title;
}
@@ -130,18 +129,19 @@ ZeroClipboard.Client.prototype = {
}
// style.backgroundColor = '#f00'; // debug
- this.domElement.parentNode.appendChild(this.div);
-
- this.div.innerHTML = this.getHTML( box.width, box.height );
+ if ( this.domElement ) {
+ this.domElement.appendChild(this.div);
+ this.div.innerHTML = this.getHTML( box.width, box.height );
+ }
},
positionElement: function() {
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
+ var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.position = 'absolute';
- style.left = (this.domElement.offsetLeft)+'px';
- style.top = this.domElement.offsetTop+'px';
+ //style.left = (this.domElement.offsetLeft)+'px';
+ //style.top = this.domElement.offsetTop+'px';
style.width = box.width + 'px';
style.height = box.height + 'px';
@@ -166,11 +166,11 @@ ZeroClipboard.Client.prototype = {
if (navigator.userAgent.match(/MSIE/)) {
// IE gets an OBJECT tag
var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
- html += '';
+ html += '';
}
else {
// all other browsers get an EMBED tag
- html += '';
+ html += '';
}
return html;
},
@@ -205,12 +205,12 @@ ZeroClipboard.Client.prototype = {
// reposition our floating div, optionally to new container
// warning: container CANNOT change size, only position
if (elem) {
- this.domElement = ZeroClipboard.$(elem);
+ this.domElement = ZeroClipboard_TableTools.$(elem);
if (!this.domElement) this.hide();
}
if (this.domElement && this.div) {
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
+ var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';
diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/swf/copy_csv_xls.swf b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/swf/copy_csv_xls.swf
new file mode 100644
index 000000000..082c7acbf
Binary files /dev/null and b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/swf/copy_csv_xls.swf differ
diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/swf/copy_csv_xls_pdf.swf b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/swf/copy_csv_xls_pdf.swf
new file mode 100644
index 000000000..063131dfe
Binary files /dev/null and b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/swf/copy_csv_xls_pdf.swf differ
diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools/css/TableTools.css b/airtime_mvc/public/js/datatables/plugin/TableTools/css/TableTools.css
deleted file mode 100644
index 4f3dd532e..000000000
--- a/airtime_mvc/public/js/datatables/plugin/TableTools/css/TableTools.css
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * File: TableTools.css
- * Description: Styles for TableTools 2
- * Author: Allan Jardine (www.sprymedia.co.uk)
- * Language: Javascript
- * License: LGPL / 3 point BSD
- * Project: DataTables
- *
- * Copyright 2010 Allan Jardine, all rights reserved.
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * CSS name space:
- * DTTT DataTables TableTools
- *
- * Colour dictionary:
- * Button border #d0d0d0
- * Button border hover #999999
- * Hover background #f0f0f0
- * Action blue #4b66d9
- *
- * Style sheet provides:
- * CONTAINER TableTools container element and styles applying to all components
- * BUTTON_STYLES Action specific button styles
- * SELECTING Row selection styles
- * COLLECTIONS Drop down list (collection) styles
- * PRINTING Print display styles
- * MISC Minor misc styles
- */
-
-
-/*
- * CONTAINER
- * TableTools container element and styles applying to all components
- */
-div.DTTT_container {
- position: relative;
- float: right;
- margin-bottom: 1em;
-}
-
-button.DTTT_button {
- position: relative;
- float: left;
- height: 30px;
- margin-right: 3px;
- padding: 3px 5px;
- border: 1px solid #d0d0d0;
- background-color: #fff;
- cursor: pointer;
- *cursor: hand;
-}
-
-button.DTTT_button::-moz-focus-inner {
- border: none !important;
- padding: 0;
-}
-
-
-/*
- * BUTTON_STYLES
- * Action specific button styles
- */
-
-button.DTTT_button_csv {
- padding-right: 30px;
- background: #6E6E6E url(../images/csv.png) no-repeat center right !important;
-}
-
-button.DTTT_button_csv_hover {
- padding-right: 30px;
- background: #868686 url(../images/csv_hover.png) no-repeat center right !important;
-}
-
-
-button.DTTT_button_xls {
- padding-right: 30px;
- background: #6E6E6E url(../images/xls.png) no-repeat center right !important;
-}
-
-button.DTTT_button_xls_hover {
- padding-right: 30px;
- border: 1px solid #999;
- background: #868686 url(../images/xls_hover.png) no-repeat center right !important;
-}
-
-
-button.DTTT_button_copy {
- padding-right: 30px;
- background: #6E6E6E url(../images/copy.png) no-repeat center right !important;
-}
-
-button.DTTT_button_copy_hover {
- padding-right: 30px;
- border: 1px solid #999;
- background: #868686 url(../images/copy_hover.png) no-repeat center right !important;
-}
-
-
-button.DTTT_button_pdf {
- padding-right: 30px;
- background: #6E6E6E url(../images/pdf.png) no-repeat center right !important;
-}
-
-button.DTTT_button_pdf_hover {
- padding-right: 30px;
- border: 1px solid #999;
- background: #868686 url(../images/pdf_hover.png) no-repeat center right !important;
-}
-
-
-button.DTTT_button_print {
- padding-right: 30px;
- background: #6E6E6E url(../images/print.png) no-repeat center right !important;
-}
-
-button.DTTT_button_print_hover {
- padding-right: 30px;
- border: 1px solid #999;
- background: #868686 url(../images/print_hover.png) no-repeat center right !important;
-}
-
-
-button.DTTT_button_text {
-}
-
-button.DTTT_button_text_hover {
- border: 1px solid #999;
- background-color: #f0f0f0;
-}
-
-
-button.DTTT_button_collection {
- padding-right: 17px;
- background: url(../images/collection.png) no-repeat center right;
-}
-
-button.DTTT_button_collection_hover {
- padding-right: 17px;
- border: 1px solid #999;
- background: #f0f0f0 url(../images/collection_hover.png) no-repeat center right;
-}
-
-
-/*
- * SELECTING
- * Row selection styles
- */
-table.DTTT_selectable tbody tr {
- cursor: pointer;
- *cursor: hand;
-}
-
-tr.DTTT_selected.odd {
- background-color: #9FAFD1;
-}
-
-tr.DTTT_selected.odd td.sorting_1 {
- background-color: #9FAFD1;
-}
-
-tr.DTTT_selected.odd td.sorting_2 {
- background-color: #9FAFD1;
-}
-
-tr.DTTT_selected.odd td.sorting_3 {
- background-color: #9FAFD1;
-}
-
-
-tr.DTTT_selected.even {
- background-color: #B0BED9;
-}
-
-tr.DTTT_selected.even td.sorting_1 {
- background-color: #B0BED9;
-}
-
-tr.DTTT_selected.even td.sorting_2 {
- background-color: #B0BED9;
-}
-
-tr.DTTT_selected.even td.sorting_3 {
- background-color: #B0BED9;
-}
-
-
-/*
- * COLLECTIONS
- * Drop down list (collection) styles
- */
-
-div.DTTT_collection {
- width: 150px;
- padding: 3px;
- border: 1px solid #ccc;
- background-color: #f3f3f3;
- overflow: hidden;
- z-index: 2002;
-}
-
-div.DTTT_collection_background {
- background: transparent url(../images/background.png) repeat top left;
- z-index: 2001;
-}
-
-div.DTTT_collection button.DTTT_button {
- float: none;
- width: 100%;
- margin-bottom: 2px;
- background-color: white;
-}
-
-
-/*
- * PRINTING
- * Print display styles
- */
-
-.DTTT_print_info {
- position: absolute;
- top: 50%;
- left: 50%;
- width: 400px;
- height: 150px;
- margin-left: -200px;
- margin-top: -75px;
- text-align: center;
- background-color: #3f3f3f;
- color: white;
- padding: 10px 30px;
-
- opacity: 0.9;
-
- border-radius: 5px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
-
- box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
- -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
- -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
-}
-
-.DTTT_print_info h6 {
- font-weight: normal;
- font-size: 28px;
- line-height: 28px;
- margin: 1em;
-}
-
-.DTTT_print_info p {
- font-size: 14px;
- line-height: 20px;
-}
-
-
-/*
- * MISC
- * Minor misc styles
- */
-
-.DTTT_disabled {
- color: #999;
-}
diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.min.js b/airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.min.js
deleted file mode 100644
index 3455faf03..000000000
--- a/airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.min.js
+++ /dev/null
@@ -1,81 +0,0 @@
-// Simple Set Clipboard System
-// Author: Joseph Huckaby
-var ZeroClipboard={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(a){"string"==typeof a&&(a=document.getElementById(a));if(!a.addClass)a.hide=function(){this.style.display="none"},a.show=function(){this.style.display=""},a.addClass=function(a){this.removeClass(a);this.className+=" "+a},a.removeClass=function(a){this.className=this.className.replace(RegExp("\\s*"+a+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"")},a.hasClass=function(a){return!!this.className.match(RegExp("\\s*"+
-a+"\\s*"))};return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,c){(a=this.clients[a])&&a.receiveEvent(b,c)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a){var b={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};if(""!=a.style.width)b.width=a.style.width.replace("px","");if(""!=a.style.height)b.height=a.style.height.replace("px","");for(;a;)b.left+=a.offsetLeft,b.top+=a.offsetTop,a=a.offsetParent;return b},
-Client:function(a){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);a&&this.glue(a)}};
-ZeroClipboard.Client.prototype={id:0,ready:!1,movie:null,clipText:"",fileName:"",action:"copy",handCursorEnabled:!0,cssEffects:!0,handlers:null,sized:!1,glue:function(a,b){this.domElement=ZeroClipboard.$(a);var c=99;this.domElement.style.zIndex&&(c=parseInt(this.domElement.style.zIndex)+1);var d=ZeroClipboard.getDOMObjectPosition(this.domElement);this.div=document.createElement("div");var e=this.div.style;e.position="absolute";e.left=this.domElement.offsetLeft+"px";e.top=this.domElement.offsetTop+
-"px";e.width=d.width+"px";e.height=d.height+"px";e.zIndex=c;if("undefined"!=typeof b&&""!=b)this.div.title=b;if(0!=d.width&&0!=d.height)this.sized=!0;this.domElement.parentNode.appendChild(this.div);this.div.innerHTML=this.getHTML(d.width,d.height)},positionElement:function(){var a=ZeroClipboard.getDOMObjectPosition(this.domElement),b=this.div.style;b.position="absolute";b.left=this.domElement.offsetLeft+"px";b.top=this.domElement.offsetTop+"px";b.width=a.width+"px";b.height=a.height+"px";if(0!=a.width&&
-0!=a.height)this.sized=!0,b=this.div.childNodes[0],b.width=a.width,b.height=a.height},getHTML:function(a,b){var c="",d="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/))var e=location.href.match(/^https/i)?"https://":"http://",c=c+('');else c+='';return c},hide:function(){if(this.div)this.div.style.left="-2000px"},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.div=this.domElement=null}},reposition:function(a){if(a)(this.domElement=ZeroClipboard.$(a))||this.hide();if(this.domElement&&this.div){var a=ZeroClipboard.getDOMObjectPosition(this.domElement),b=
-this.div.style;b.left=""+a.left+"px";b.top=""+a.top+"px"}},clearText:function(){this.clipText="";this.ready&&this.movie.clearText()},appendText:function(a){this.clipText+=a;this.ready&&this.movie.appendText(a)},setText:function(a){this.clipText=a;this.ready&&this.movie.setText(a)},setCharSet:function(a){this.charSet=a;this.ready&&this.movie.setCharSet(a)},setBomInc:function(a){this.incBom=a;this.ready&&this.movie.setBomInc(a)},setFileName:function(a){this.fileName=a;this.ready&&this.movie.setFileName(a)},
-setAction:function(a){this.action=a;this.ready&&this.movie.setAction(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");this.handlers[a]||(this.handlers[a]=[]);this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a;this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");switch(a){case "load":this.movie=document.getElementById(this.movieId);
-if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=!0;return}this.ready=!0;this.movie.clearText();this.movie.appendText(this.clipText);this.movie.setFileName(this.fileName);this.movie.setAction(this.action);this.movie.setCharSet(this.charSet);this.movie.setBomInc(this.incBom);this.movie.setHandCursor(this.handCursorEnabled);
-break;case "mouseover":this.domElement&&this.cssEffects&&this.recoverActive&&this.domElement.addClass("active");break;case "mouseout":if(this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")))this.domElement.removeClass("active"),this.recoverActive=!0;break;case "mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case "mouseup":if(this.domElement&&this.cssEffects)this.domElement.removeClass("active"),this.recoverActive=!1}if(this.handlers[a])for(var d=
-0,e=this.handlers[a].length;d Please use your browser's print function to print this table. Press escape when finished.",
-sMessage:"",bShowAll:!0,sToolTip:"View print view",sButtonClass:"DTTT_button_print",sButtonClassHover:"DTTT_button_print_hover",sButtonText:"Print",fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null},text:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Text button",mColumns:"all",bHeader:!0,bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,
-fnComplete:null,fnInit:null,fnCellRender:null},select:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Select button",mColumns:"all",bHeader:!0,bFooter:!0,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")},fnCellRender:null},select_single:{sAction:"text",
-sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Select button",mColumns:"all",bHeader:!0,bFooter:!0,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:function(a){1==this.fnGetSelected().length?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")},fnCellRender:null},select_all:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",
-sButtonText:"Select all",mColumns:"all",bHeader:!0,bFooter:!0,fnMouseover:null,fnMouseout:null,fnClick:function(){this.fnSelectAll()},fnSelect:function(a){this.fnGetSelected().length==this.s.dt.fnRecordsDisplay()?e(a).addClass("DTTT_disabled"):e(a).removeClass("DTTT_disabled")},fnComplete:null,fnInit:null,fnCellRender:null},select_none:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Deselect all",mColumns:"all",bHeader:!0,bFooter:!0,
-fnMouseover:null,fnMouseout:null,fnClick:function(){this.fnSelectNone()},fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")},fnCellRender:null},ajax:{sAction:"text",sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"\n",sAjaxUrl:"/xhr.php",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Ajax button",mColumns:"all",bHeader:!0,
-bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:function(a,b){var c=this.fnGetTableData(b);e.ajax({url:b.sAjaxUrl,data:[{name:"tableData",value:c}],success:b.fnAjaxComplete,dataType:"json",type:"POST",cache:!1,error:function(){alert("Error detected when sending table data to server")}})},fnSelect:null,fnComplete:null,fnInit:null,fnAjaxComplete:function(){alert("Ajax complete")},fnCellRender:null},div:{sAction:"div",sToolTip:"",sButtonClass:"DTTT_nonbutton",sButtonClassHover:"",
-sButtonText:"Text button",fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,nContent:null,fnCellRender:null},collection:{sAction:"collection",sToolTip:"",sButtonClass:"DTTT_button_collection",sButtonClassHover:"DTTT_button_collection_hover",sButtonText:"Collection",fnMouseover:null,fnMouseout:null,fnClick:function(a,b){this._fnCollectionShow(a,b)},fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null}};TableTools.DEFAULTS={sSwfPath:"media/swf/copy_cvs_xls_pdf.swf",
-sRowSelect:"none",sSelectedClass:"DTTT_selected",fnPreRowSelect:null,fnRowSelected:null,fnRowDeselected:null,aButtons:["copy","csv","xls","pdf","print"]};TableTools.prototype.CLASS="TableTools";TableTools.VERSION="2.0.2";TableTools.prototype.VERSION=TableTools.VERSION;"function"==typeof e.fn.dataTable&&"function"==typeof e.fn.dataTableExt.fnVersionCheck&&e.fn.dataTableExt.fnVersionCheck("1.8.2")?e.fn.dataTableExt.aoFeatures.push({fnInit:function(a){a=new TableTools(a.oInstance,"undefined"!=typeof a.oInit.oTableTools?
-a.oInit.oTableTools:{});TableTools._aInstances.push(a);return a.dom.container},cFeature:"T",sFeature:"TableTools"}):alert("Warning: TableTools 2 requires DataTables 1.8.2 or newer - www.datatables.net/download")})(jQuery,window,document);
diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.min.js.gz b/airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.min.js.gz
deleted file mode 100644
index 6ec0fb9cb..000000000
Binary files a/airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.min.js.gz and /dev/null differ
diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools/swf/copy_cvs_xls.swf b/airtime_mvc/public/js/datatables/plugin/TableTools/swf/copy_cvs_xls.swf
deleted file mode 100644
index 4c0156d5e..000000000
Binary files a/airtime_mvc/public/js/datatables/plugin/TableTools/swf/copy_cvs_xls.swf and /dev/null differ
diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools/swf/copy_cvs_xls_pdf.swf b/airtime_mvc/public/js/datatables/plugin/TableTools/swf/copy_cvs_xls_pdf.swf
deleted file mode 100644
index 9b8aabd0b..000000000
Binary files a/airtime_mvc/public/js/datatables/plugin/TableTools/swf/copy_cvs_xls_pdf.swf and /dev/null differ
diff --git a/airtime_mvc/public/js/datatables/plugin/dataTables.TableTools.js b/airtime_mvc/public/js/datatables/plugin/dataTables.TableTools.js
deleted file mode 100644
index 3e02c2c08..000000000
--- a/airtime_mvc/public/js/datatables/plugin/dataTables.TableTools.js
+++ /dev/null
@@ -1,2569 +0,0 @@
-/*
- * File: TableTools.js
- * Version: 2.0.2
- * Description: Tools and buttons for DataTables
- * Author: Allan Jardine (www.sprymedia.co.uk)
- * Language: Javascript
- * License: GPL v2 or BSD 3 point style
- * Project: DataTables
- *
- * Copyright 2009-2012 Allan Jardine, all rights reserved.
- *
- * This source file is free software, under either the GPL v2 license or a
- * BSD style license, available at:
- * http://datatables.net/license_gpl2
- * http://datatables.net/license_bsd
- */
-
-/* Global scope for TableTools */
-var TableTools;
-
-(function($, window, document) {
-
-/**
- * TableTools provides flexible buttons and other tools for a DataTables enhanced table
- * @class TableTools
- * @constructor
- * @param {Object} oDT DataTables instance
- * @param {Object} oOpts TableTools options
- * @param {String} oOpts.sSwfPath ZeroClipboard SWF path
- * @param {String} oOpts.sRowSelect Row selection options - 'none', 'single' or 'multi'
- * @param {Function} oOpts.fnPreRowSelect Callback function just prior to row selection
- * @param {Function} oOpts.fnRowSelected Callback function just after row selection
- * @param {Function} oOpts.fnRowDeselected Callback function when row is deselected
- * @param {Array} oOpts.aButtons List of buttons to be used
- */
-TableTools = function( oDT, oOpts )
-{
- /* Santiy check that we are a new instance */
- if ( !this.CLASS || this.CLASS != "TableTools" )
- {
- alert( "Warning: TableTools must be initialised with the keyword 'new'" );
- }
-
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Public class variables
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
- /**
- * @namespace Settings object which contains customisable information for TableTools instance
- */
- this.s = {
- /**
- * Store 'this' so the instance can be retreieved from the settings object
- * @property that
- * @type object
- * @default this
- */
- "that": this,
-
- /**
- * DataTables settings objects
- * @property dt
- * @type object
- * @default null
- */
- "dt": null,
-
- /**
- * @namespace Print specific information
- */
- "print": {
- /**
- * DataTables draw 'start' point before the printing display was shown
- * @property saveStart
- * @type int
- * @default -1
- */
- "saveStart": -1,
-
- /**
- * DataTables draw 'length' point before the printing display was shown
- * @property saveLength
- * @type int
- * @default -1
- */
- "saveLength": -1,
-
- /**
- * Page scrolling point before the printing display was shown so it can be restored
- * @property saveScroll
- * @type int
- * @default -1
- */
- "saveScroll": -1,
-
- /**
- * Wrapped function to end the print display (to maintain scope)
- * @property funcEnd
- * @type Function
- * @default function () {}
- */
- "funcEnd": function () {}
- },
-
- /**
- * A unique ID is assigned to each button in each instance
- * @property buttonCounter
- * @type int
- * @default 0
- */
- "buttonCounter": 0,
-
- /**
- * @namespace Select rows specific information
- */
- "select": {
- /**
- * Select type - can be 'none', 'single' or 'multi'
- * @property type
- * @type string
- * @default ""
- */
- "type": "",
-
- /**
- * Array of nodes which are currently selected
- * @property selected
- * @type array
- * @default []
- */
- "selected": [],
-
- /**
- * Function to run before the selection can take place. Will cancel the select if the
- * function returns false
- * @property preRowSelect
- * @type Function
- * @default null
- */
- "preRowSelect": null,
-
- /**
- * Function to run when a row is selected
- * @property postSelected
- * @type Function
- * @default null
- */
- "postSelected": null,
-
- /**
- * Function to run when a row is deselected
- * @property postDeselected
- * @type Function
- * @default null
- */
- "postDeselected": null,
-
- /**
- * Indicate if all rows are selected (needed for server-side processing)
- * @property all
- * @type boolean
- * @default false
- */
- "all": false,
-
- /**
- * Class name to add to selected TR nodes
- * @property selectedClass
- * @type String
- * @default ""
- */
- "selectedClass": ""
- },
-
- /**
- * Store of the user input customisation object
- * @property custom
- * @type object
- * @default {}
- */
- "custom": {},
-
- /**
- * SWF movie path
- * @property swfPath
- * @type string
- * @default ""
- */
- "swfPath": "",
-
- /**
- * Default button set
- * @property buttonSet
- * @type array
- * @default []
- */
- "buttonSet": [],
-
- /**
- * When there is more than one TableTools instance for a DataTable, there must be a
- * master which controls events (row selection etc)
- * @property master
- * @type boolean
- * @default false
- */
- "master": false
- };
-
-
- /**
- * @namespace Common and useful DOM elements for the class instance
- */
- this.dom = {
- /**
- * DIV element that is create and all TableTools buttons (and their children) put into
- * @property container
- * @type node
- * @default null
- */
- "container": null,
-
- /**
- * The table node to which TableTools will be applied
- * @property table
- * @type node
- * @default null
- */
- "table": null,
-
- /**
- * @namespace Nodes used for the print display
- */
- "print": {
- /**
- * Nodes which have been removed from the display by setting them to display none
- * @property hidden
- * @type array
- * @default []
- */
- "hidden": [],
-
- /**
- * The information display saying tellng the user about the print display
- * @property message
- * @type node
- * @default null
- */
- "message": null
- },
-
- /**
- * @namespace Nodes used for a collection display. This contains the currently used collection
- */
- "collection": {
- /**
- * The div wrapper containing the buttons in the collection (i.e. the menu)
- * @property collection
- * @type node
- * @default null
- */
- "collection": null,
-
- /**
- * Background display to provide focus and capture events
- * @property background
- * @type node
- * @default null
- */
- "background": null
- }
- };
-
-
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Public class methods
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
- /**
- * Retreieve the settings object from an instance
- * @method fnSettings
- * @returns {object} TableTools settings object
- */
- this.fnSettings = function () {
- return this.s;
- };
-
-
- /* Constructor logic */
- if ( typeof oOpts == 'undefined' )
- {
- oOpts = {};
- }
-
- this.s.dt = oDT.fnSettings();
- this._fnConstruct( oOpts );
-
- return this;
-};
-
-
-
-TableTools.prototype = {
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Public methods
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
- /**
- * Retreieve the settings object from an instance
- * @method fnGetSelected
- * @returns {array} List of TR nodes which are currently selected
- */
- "fnGetSelected": function ()
- {
- var masterS = this._fnGetMasterSettings();
- return masterS.select.selected;
- },
-
-
- /**
- * Get the data source objects/arrays from DataTables for the selected rows (same as
- * fnGetSelected followed by fnGetData on each row from the table)
- * @method fnGetSelectedData
- * @returns {array} Data from the TR nodes which are currently selected
- */
- "fnGetSelectedData": function ()
- {
- var masterS = this._fnGetMasterSettings();
- var selected = masterS.select.selected;
- var out = [];
-
- for ( var i=0, iLen=selected.length ; i Please use your browser's print function to "+
- "print this table. Press escape when finished.",
- "sMessage": "",
- "bShowAll": true,
- "sToolTip": "View print view",
- "sButtonClass": "DTTT_button_print",
- "sButtonClassHover": "DTTT_button_print_hover",
- "sButtonText": "Print",
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": null,
- "fnSelect": null,
- "fnComplete": null,
- "fnInit": null,
- "fnCellRender": null
- },
- "text": {
- "sAction": "text",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
- "sButtonText": "Text button",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "bSelectedOnly": false,
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": null,
- "fnSelect": null,
- "fnComplete": null,
- "fnInit": null,
- "fnCellRender": null
- },
- "select": {
- "sAction": "text",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
- "sButtonText": "Select button",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": null,
- "fnSelect": function( nButton, oConfig ) {
- if ( this.fnGetSelected().length !== 0 ) {
- $(nButton).removeClass('DTTT_disabled');
- } else {
- $(nButton).addClass('DTTT_disabled');
- }
- },
- "fnComplete": null,
- "fnInit": function( nButton, oConfig ) {
- $(nButton).addClass('DTTT_disabled');
- },
- "fnCellRender": null
- },
- "select_single": {
- "sAction": "text",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
- "sButtonText": "Select button",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": null,
- "fnSelect": function( nButton, oConfig ) {
- var iSelected = this.fnGetSelected().length;
- if ( iSelected == 1 ) {
- $(nButton).removeClass('DTTT_disabled');
- } else {
- $(nButton).addClass('DTTT_disabled');
- }
- },
- "fnComplete": null,
- "fnInit": function( nButton, oConfig ) {
- $(nButton).addClass('DTTT_disabled');
- },
- "fnCellRender": null
- },
- "select_all": {
- "sAction": "text",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
- "sButtonText": "Select all",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": function( nButton, oConfig ) {
- this.fnSelectAll();
- },
- "fnSelect": function( nButton, oConfig ) {
- if ( this.fnGetSelected().length == this.s.dt.fnRecordsDisplay() ) {
- $(nButton).addClass('DTTT_disabled');
- } else {
- $(nButton).removeClass('DTTT_disabled');
- }
- },
- "fnComplete": null,
- "fnInit": null,
- "fnCellRender": null
- },
- "select_none": {
- "sAction": "text",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
- "sButtonText": "Deselect all",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": function( nButton, oConfig ) {
- this.fnSelectNone();
- },
- "fnSelect": function( nButton, oConfig ) {
- if ( this.fnGetSelected().length !== 0 ) {
- $(nButton).removeClass('DTTT_disabled');
- } else {
- $(nButton).addClass('DTTT_disabled');
- }
- },
- "fnComplete": null,
- "fnInit": function( nButton, oConfig ) {
- $(nButton).addClass('DTTT_disabled');
- },
- "fnCellRender": null
- },
- "ajax": {
- "sAction": "text",
- "sFieldBoundary": "",
- "sFieldSeperator": "\t",
- "sNewLine": "\n",
- "sAjaxUrl": "/xhr.php",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_text",
- "sButtonClassHover": "DTTT_button_text_hover",
- "sButtonText": "Ajax button",
- "mColumns": "all",
- "bHeader": true,
- "bFooter": true,
- "bSelectedOnly": false,
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": function( nButton, oConfig ) {
- var sData = this.fnGetTableData(oConfig);
- $.ajax( {
- "url": oConfig.sAjaxUrl,
- "data": [
- { "name": "tableData", "value": sData }
- ],
- "success": oConfig.fnAjaxComplete,
- "dataType": "json",
- "type": "POST",
- "cache": false,
- "error": function () {
- alert( "Error detected when sending table data to server" );
- }
- } );
- },
- "fnSelect": null,
- "fnComplete": null,
- "fnInit": null,
- "fnAjaxComplete": function( json ) {
- alert( 'Ajax complete' );
- },
- "fnCellRender": null
- },
- "div": {
- "sAction": "div",
- "sToolTip": "",
- "sButtonClass": "DTTT_nonbutton",
- "sButtonClassHover": "",
- "sButtonText": "Text button",
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": null,
- "fnSelect": null,
- "fnComplete": null,
- "fnInit": null,
- "nContent": null,
- "fnCellRender": null
- },
- "collection": {
- "sAction": "collection",
- "sToolTip": "",
- "sButtonClass": "DTTT_button_collection",
- "sButtonClassHover": "DTTT_button_collection_hover",
- "sButtonText": "Collection",
- "fnMouseover": null,
- "fnMouseout": null,
- "fnClick": function( nButton, oConfig ) {
- this._fnCollectionShow(nButton, oConfig);
- },
- "fnSelect": null,
- "fnComplete": null,
- "fnInit": null,
- "fnCellRender": null
- }
-};
-/*
- * on* callback parameters:
- * 1. node - button element
- * 2. object - configuration object for this button
- * 3. object - ZeroClipboard reference (flash button only)
- * 4. string - Returned string from Flash (flash button only - and only on 'complete')
- */
-
-
-/**
- * @namespace TableTools default settings for initialisation
- */
-TableTools.DEFAULTS = {
- "sSwfPath": "media/swf/copy_cvs_xls_pdf.swf",
- "sRowSelect": "none",
- "sSelectedClass": "DTTT_selected",
- "fnPreRowSelect": null,
- "fnRowSelected": null,
- "fnRowDeselected": null,
- "aButtons": [ "copy", "csv", "xls", "pdf", "print" ]
-};
-
-
-/**
- * Name of this class
- * @constant CLASS
- * @type String
- * @default TableTools
- */
-TableTools.prototype.CLASS = "TableTools";
-
-
-/**
- * TableTools version
- * @constant VERSION
- * @type String
- * @default 2.0.2
- */
-TableTools.VERSION = "2.0.2";
-TableTools.prototype.VERSION = TableTools.VERSION;
-
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Initialisation
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Register a new feature with DataTables
- */
-if ( typeof $.fn.dataTable == "function" &&
- typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
- $.fn.dataTableExt.fnVersionCheck('1.8.2') )
-{
- $.fn.dataTableExt.aoFeatures.push( {
- "fnInit": function( oDTSettings ) {
- var oOpts = typeof oDTSettings.oInit.oTableTools != 'undefined' ?
- oDTSettings.oInit.oTableTools : {};
-
- var oTT = new TableTools( oDTSettings.oInstance, oOpts );
- TableTools._aInstances.push( oTT );
-
- return oTT.dom.container;
- },
- "cFeature": "T",
- "sFeature": "TableTools"
- } );
-}
-else
-{
- alert( "Warning: TableTools 2 requires DataTables 1.8.2 or newer - www.datatables.net/download");
-}
-
-})(jQuery, window, document);
diff --git a/airtime_mvc/public/js/datatables/plugin/dataTables.ZeroClipboard.js b/airtime_mvc/public/js/datatables/plugin/dataTables.ZeroClipboard.js
deleted file mode 100644
index 73707f024..000000000
--- a/airtime_mvc/public/js/datatables/plugin/dataTables.ZeroClipboard.js
+++ /dev/null
@@ -1,367 +0,0 @@
-// Simple Set Clipboard System
-// Author: Joseph Huckaby
-
-var ZeroClipboard = {
-
- version: "1.0.4-TableTools2",
- clients: {}, // registered upload clients on page, indexed by id
- moviePath: '', // URL to movie
- nextId: 1, // ID of next movie
-
- $: function(thingy) {
- // simple DOM lookup utility function
- if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
- if (!thingy.addClass) {
- // extend element with a few useful methods
- thingy.hide = function() { this.style.display = 'none'; };
- thingy.show = function() { this.style.display = ''; };
- thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
- thingy.removeClass = function(name) {
- this.className = this.className.replace( new RegExp("\\s*" + name + "\\s*"), " ").replace(/^\s+/, '').replace(/\s+$/, '');
- };
- thingy.hasClass = function(name) {
- return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
- }
- }
- return thingy;
- },
-
- setMoviePath: function(path) {
- // set path to ZeroClipboard.swf
- this.moviePath = path;
- },
-
- dispatch: function(id, eventName, args) {
- // receive event from flash movie, send to client
- var client = this.clients[id];
- if (client) {
- client.receiveEvent(eventName, args);
- }
- },
-
- register: function(id, client) {
- // register new client to receive events
- this.clients[id] = client;
- },
-
- getDOMObjectPosition: function(obj) {
- // get absolute coordinates for dom element
- var info = {
- left: 0,
- top: 0,
- width: obj.width ? obj.width : obj.offsetWidth,
- height: obj.height ? obj.height : obj.offsetHeight
- };
-
- if ( obj.style.width != "" )
- info.width = obj.style.width.replace("px","");
-
- if ( obj.style.height != "" )
- info.height = obj.style.height.replace("px","");
-
- while (obj) {
- info.left += obj.offsetLeft;
- info.top += obj.offsetTop;
- obj = obj.offsetParent;
- }
-
- return info;
- },
-
- Client: function(elem) {
- // constructor for new simple upload client
- this.handlers = {};
-
- // unique ID
- this.id = ZeroClipboard.nextId++;
- this.movieId = 'ZeroClipboardMovie_' + this.id;
-
- // register client with singleton to receive flash events
- ZeroClipboard.register(this.id, this);
-
- // create movie
- if (elem) this.glue(elem);
- }
-};
-
-ZeroClipboard.Client.prototype = {
-
- id: 0, // unique ID for us
- ready: false, // whether movie is ready to receive events or not
- movie: null, // reference to movie object
- clipText: '', // text to copy to clipboard
- fileName: '', // default file save name
- action: 'copy', // action to perform
- handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
- cssEffects: true, // enable CSS mouse effects on dom container
- handlers: null, // user event handlers
- sized: false,
-
- glue: function(elem, title) {
- // glue to DOM element
- // elem can be ID or actual DOM element object
- this.domElement = ZeroClipboard.$(elem);
-
- // float just above object, or zIndex 99 if dom element isn't set
- var zIndex = 99;
- if (this.domElement.style.zIndex) {
- zIndex = parseInt(this.domElement.style.zIndex) + 1;
- }
-
- // find X/Y position of domElement
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
-
- // create floating DIV above element
- this.div = document.createElement('div');
- var style = this.div.style;
- style.position = 'absolute';
- style.left = (this.domElement.offsetLeft)+'px';
- //style.left = (this.domElement.offsetLeft+2)+'px';
- style.top = this.domElement.offsetTop+'px';
- style.width = (box.width) + 'px';
- //style.width = (box.width-4) + 'px';
- style.height = box.height + 'px';
- style.zIndex = zIndex;
- if ( typeof title != "undefined" && title != "" ) {
- this.div.title = title;
- }
- if ( box.width != 0 && box.height != 0 ) {
- this.sized = true;
- }
-
- // style.backgroundColor = '#f00'; // debug
- this.domElement.parentNode.appendChild(this.div);
-
- this.div.innerHTML = this.getHTML( box.width, box.height );
- },
-
- positionElement: function() {
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
- var style = this.div.style;
-
- style.position = 'absolute';
- style.left = (this.domElement.offsetLeft)+'px';
- style.top = this.domElement.offsetTop+'px';
- style.width = box.width + 'px';
- style.height = box.height + 'px';
-
- if ( box.width != 0 && box.height != 0 ) {
- this.sized = true;
- } else {
- return;
- }
-
- var flash = this.div.childNodes[0];
- flash.width = box.width;
- flash.height = box.height;
- },
-
- getHTML: function(width, height) {
- // return HTML for movie
- var html = '';
- var flashvars = 'id=' + this.id +
- '&width=' + width +
- '&height=' + height;
-
- if (navigator.userAgent.match(/MSIE/)) {
- // IE gets an OBJECT tag
- var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
- html += '';
- }
- else {
- // all other browsers get an EMBED tag
- html += '';
- }
- return html;
- },
-
- hide: function() {
- // temporarily hide floater offscreen
- if (this.div) {
- this.div.style.left = '-2000px';
- }
- },
-
- show: function() {
- // show ourselves after a call to hide()
- this.reposition();
- },
-
- destroy: function() {
- // destroy control and floater
- if (this.domElement && this.div) {
- this.hide();
- this.div.innerHTML = '';
-
- var body = document.getElementsByTagName('body')[0];
- try { body.removeChild( this.div ); } catch(e) {;}
-
- this.domElement = null;
- this.div = null;
- }
- },
-
- reposition: function(elem) {
- // reposition our floating div, optionally to new container
- // warning: container CANNOT change size, only position
- if (elem) {
- this.domElement = ZeroClipboard.$(elem);
- if (!this.domElement) this.hide();
- }
-
- if (this.domElement && this.div) {
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
- var style = this.div.style;
- style.left = '' + box.left + 'px';
- style.top = '' + box.top + 'px';
- }
- },
-
- clearText: function() {
- // clear the text to be copy / saved
- this.clipText = '';
- if (this.ready) this.movie.clearText();
- },
-
- appendText: function(newText) {
- // append text to that which is to be copied / saved
- this.clipText += newText;
- if (this.ready) { this.movie.appendText(newText) ;}
- },
-
- setText: function(newText) {
- // set text to be copied to be copied / saved
- this.clipText = newText;
- if (this.ready) { this.movie.setText(newText) ;}
- },
-
- setCharSet: function(charSet) {
- // set the character set (UTF16LE or UTF8)
- this.charSet = charSet;
- if (this.ready) { this.movie.setCharSet(charSet) ;}
- },
-
- setBomInc: function(bomInc) {
- // set if the BOM should be included or not
- this.incBom = bomInc;
- if (this.ready) { this.movie.setBomInc(bomInc) ;}
- },
-
- setFileName: function(newText) {
- // set the file name
- this.fileName = newText;
- if (this.ready) this.movie.setFileName(newText);
- },
-
- setAction: function(newText) {
- // set action (save or copy)
- this.action = newText;
- if (this.ready) this.movie.setAction(newText);
- },
-
- addEventListener: function(eventName, func) {
- // add user event listener for event
- // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
- eventName = eventName.toString().toLowerCase().replace(/^on/, '');
- if (!this.handlers[eventName]) this.handlers[eventName] = [];
- this.handlers[eventName].push(func);
- },
-
- setHandCursor: function(enabled) {
- // enable hand cursor (true), or default arrow cursor (false)
- this.handCursorEnabled = enabled;
- if (this.ready) this.movie.setHandCursor(enabled);
- },
-
- setCSSEffects: function(enabled) {
- // enable or disable CSS effects on DOM container
- this.cssEffects = !!enabled;
- },
-
- receiveEvent: function(eventName, args) {
- // receive event from flash
- eventName = eventName.toString().toLowerCase().replace(/^on/, '');
-
- // special behavior for certain events
- switch (eventName) {
- case 'load':
- // movie claims it is ready, but in IE this isn't always the case...
- // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
- this.movie = document.getElementById(this.movieId);
- if (!this.movie) {
- var self = this;
- setTimeout( function() { self.receiveEvent('load', null); }, 1 );
- return;
- }
-
- // firefox on pc needs a "kick" in order to set these in certain cases
- if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
- var self = this;
- setTimeout( function() { self.receiveEvent('load', null); }, 100 );
- this.ready = true;
- return;
- }
-
- this.ready = true;
- this.movie.clearText();
- this.movie.appendText( this.clipText );
- this.movie.setFileName( this.fileName );
- this.movie.setAction( this.action );
- this.movie.setCharSet( this.charSet );
- this.movie.setBomInc( this.incBom );
- this.movie.setHandCursor( this.handCursorEnabled );
- break;
-
- case 'mouseover':
- if (this.domElement && this.cssEffects) {
- //this.domElement.addClass('hover');
- if (this.recoverActive) this.domElement.addClass('active');
- }
- break;
-
- case 'mouseout':
- if (this.domElement && this.cssEffects) {
- this.recoverActive = false;
- if (this.domElement.hasClass('active')) {
- this.domElement.removeClass('active');
- this.recoverActive = true;
- }
- //this.domElement.removeClass('hover');
- }
- break;
-
- case 'mousedown':
- if (this.domElement && this.cssEffects) {
- this.domElement.addClass('active');
- }
- break;
-
- case 'mouseup':
- if (this.domElement && this.cssEffects) {
- this.domElement.removeClass('active');
- this.recoverActive = false;
- }
- break;
- } // switch eventName
-
- if (this.handlers[eventName]) {
- for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
- var func = this.handlers[eventName][idx];
-
- if (typeof(func) == 'function') {
- // actual function reference
- func(this, args);
- }
- else if ((typeof(func) == 'object') && (func.length == 2)) {
- // PHP style object + method, i.e. [myObject, 'myMethod']
- func[0][ func[1] ](this, args);
- }
- else if (typeof(func) == 'string') {
- // name of function
- window[func](this, args);
- }
- } // foreach event handler defined
- } // user defined handler for event
- }
-
-};
diff --git a/airtime_mvc/public/js/libs/jquery-1.10.2.js b/airtime_mvc/public/js/libs/jquery-1.10.2.js
new file mode 100644
index 000000000..c5c648255
--- /dev/null
+++ b/airtime_mvc/public/js/libs/jquery-1.10.2.js
@@ -0,0 +1,9789 @@
+/*!
+ * jQuery JavaScript Library v1.10.2
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-07-03T13:48Z
+ */
+(function( window, undefined ) {
+
+// Can't do this because several apps including ASP.NET trace
+// the stack via arguments.caller.callee and Firefox dies if
+// you try to trace through "use strict" call chains. (#13335)
+// Support: Firefox 18+
+//"use strict";
+var
+ // The deferred used on DOM ready
+ readyList,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // Support: IE<10
+ // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
+ core_strundefined = typeof undefined,
+
+ // Use the correct document accordingly with window argument (sandbox)
+ location = window.location,
+ document = window.document,
+ docElem = document.documentElement,
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // [[Class]] -> type pairs
+ class2type = {},
+
+ // List of deleted data cache ids, so we can reuse them
+ core_deletedIds = [],
+
+ core_version = "1.10.2",
+
+ // Save a reference to some core methods
+ core_concat = core_deletedIds.concat,
+ core_push = core_deletedIds.push,
+ core_slice = core_deletedIds.slice,
+ core_indexOf = core_deletedIds.indexOf,
+ core_toString = class2type.toString,
+ core_hasOwn = class2type.hasOwnProperty,
+ core_trim = core_version.trim,
+
+ // Define a local copy of jQuery
+ jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Used for matching numbers
+ core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
+
+ // Used for splitting on whitespace
+ core_rnotwhite = /\S+/g,
+
+ // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
+
+ // A simple way to check for HTML strings
+ // Prioritize #id over Print view
a";
+
+ // Finish early in limited (non-browser) environments
+ all = div.getElementsByTagName("*") || [];
+ a = div.getElementsByTagName("a")[ 0 ];
+ if ( !a || !a.style || !all.length ) {
+ return support;
+ }
+
+ // First batch of tests
+ select = document.createElement("select");
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName("input")[ 0 ];
+
+ a.style.cssText = "top:1px;float:left;opacity:.5";
+
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ support.getSetAttribute = div.className !== "t";
+
+ // IE strips leading whitespace when .innerHTML is used
+ support.leadingWhitespace = div.firstChild.nodeType === 3;
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ support.tbody = !div.getElementsByTagName("tbody").length;
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ support.htmlSerialize = !!div.getElementsByTagName("link").length;
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ support.style = /top/.test( a.getAttribute("style") );
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ support.hrefNormalized = a.getAttribute("href") === "/a";
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ support.opacity = /^0.5/.test( a.style.opacity );
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ support.cssFloat = !!a.style.cssFloat;
+
+ // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
+ support.checkOn = !!input.value;
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ support.optSelected = opt.selected;
+
+ // Tests for enctype support on a form (#6743)
+ support.enctype = !!document.createElement("form").enctype;
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>";
+
+ // Will be defined later
+ support.inlineBlockNeedsLayout = false;
+ support.shrinkWrapBlocks = false;
+ support.pixelPosition = false;
+ support.deleteExpando = true;
+ support.noCloneEvent = true;
+ support.reliableMarginRight = true;
+ support.boxSizingReliable = true;
+
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Support: IE<9
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ // Check if we can trust getAttribute("value")
+ input = document.createElement("input");
+ input.setAttribute( "value", "" );
+ support.input = input.getAttribute( "value" ) === "";
+
+ // Check if an input maintains its value after becoming a radio
+ input.value = "t";
+ input.setAttribute( "type", "radio" );
+ support.radioValue = input.value === "t";
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ input.setAttribute( "checked", "t" );
+ input.setAttribute( "name", "t" );
+
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( input );
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Support: IE<9
+ // Opera does not clone events (and typeof div.attachEvent === undefined).
+ // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
+ if ( div.attachEvent ) {
+ div.attachEvent( "onclick", function() {
+ support.noCloneEvent = false;
+ });
+
+ div.cloneNode( true ).click();
+ }
+
+ // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
+ // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
+ for ( i in { submit: true, change: true, focusin: true }) {
+ div.setAttribute( eventName = "on" + i, "t" );
+
+ support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
+ }
+
+ div.style.backgroundClip = "content-box";
+ div.cloneNode( true ).style.backgroundClip = "";
+ support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+ // Support: IE<9
+ // Iteration over object's inherited properties before its own.
+ for ( i in jQuery( support ) ) {
+ break;
+ }
+ support.ownLast = i !== "0";
+
+ // Run tests that need a body at doc ready
+ jQuery(function() {
+ var container, marginDiv, tds,
+ divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ container = document.createElement("div");
+ container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
+
+ body.appendChild( container ).appendChild( div );
+
+ // Support: IE8
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ div.innerHTML = "
";
+ tds = div.getElementsByTagName("td");
+ tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Support: IE8
+ // Check if empty table cells still have offsetWidth/Height
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Check box-sizing and margin behavior.
+ div.innerHTML = "";
+ div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
+
+ // Workaround failing boxSizing test due to offsetWidth returning wrong value
+ // with some non-1 values of body zoom, ticket #13543
+ jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
+ support.boxSizing = div.offsetWidth === 4;
+ });
+
+ // Use window.getComputedStyle because jsdom on node.js will break without it.
+ if ( window.getComputedStyle ) {
+ support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+ support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. (#3333)
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ marginDiv = div.appendChild( document.createElement("div") );
+ marginDiv.style.cssText = div.style.cssText = divReset;
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
+ div.style.width = "1px";
+
+ support.reliableMarginRight =
+ !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+ }
+
+ if ( typeof div.style.zoom !== core_strundefined ) {
+ // Support: IE<8
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ div.innerHTML = "";
+ div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+ // Support: IE6
+ // Check if elements with layout shrink-wrap their children
+ div.style.display = "block";
+ div.innerHTML = "";
+ div.firstChild.style.width = "5px";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+
+ if ( support.inlineBlockNeedsLayout ) {
+ // Prevent IE 6 from affecting layout for positioned elements #11048
+ // Prevent IE from shrinking the body in IE 7 mode #12869
+ // Support: IE<8
+ body.style.zoom = 1;
+ }
+ }
+
+ body.removeChild( container );
+
+ // Null elements to avoid leaks in IE
+ container = div = tds = marginDiv = null;
+ });
+
+ // Null elements to avoid leaks in IE
+ all = select = fragment = opt = a = input = null;
+
+ return support;
+})({});
+
+var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+function internalData( elem, name, data, pvt /* Internal Use Only */ ){
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var ret, thisCache,
+ internalKey = jQuery.expando,
+
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
+
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
+
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
+
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
+ return;
+ }
+
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
+ if ( isNode ) {
+ id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
+ } else {
+ id = internalKey;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ // Avoid exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
+ }
+
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ] = jQuery.extend( cache[ id ], name );
+ } else {
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+ }
+ }
+
+ thisCache = cache[ id ];
+
+ // jQuery data() is stored in a separate object inside the object's internal data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data.
+ if ( !pvt ) {
+ if ( !thisCache.data ) {
+ thisCache.data = {};
+ }
+
+ thisCache = thisCache.data;
+ }
+
+ if ( data !== undefined ) {
+ thisCache[ jQuery.camelCase( name ) ] = data;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( typeof name === "string" ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
+}
+
+function internalRemoveData( elem, name, pvt ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, i,
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
+ if ( name ) {
+
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+ if ( thisCache ) {
+
+ // Support array or space separated string names for data keys
+ if ( !jQuery.isArray( name ) ) {
+
+ // try the string as a key before any manipulation
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+
+ // split the camel cased version by spaces unless a key with the spaces exists
+ name = jQuery.camelCase( name );
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+ name = name.split(" ");
+ }
+ }
+ } else {
+ // If "name" is an array of keys...
+ // When data is initially created, via ("key", "val") signature,
+ // keys will be converted to camelCase.
+ // Since there is no way to tell _how_ a key was added, remove
+ // both plain key and camelCase key. #12786
+ // This will only penalize the array argument path.
+ name = name.concat( jQuery.map( name, jQuery.camelCase ) );
+ }
+
+ i = name.length;
+ while ( i-- ) {
+ delete thisCache[ name[i] ];
+ }
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
+ return;
+ }
+ }
+ }
+
+ // See jQuery.data for more information
+ if ( !pvt ) {
+ delete cache[ id ].data;
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject( cache[ id ] ) ) {
+ return;
+ }
+ }
+
+ // Destroy the cache
+ if ( isNode ) {
+ jQuery.cleanData( [ elem ], true );
+
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
+ /* jshint eqeqeq: false */
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+ /* jshint eqeqeq: true */
+ delete cache[ id ];
+
+ // When all else fails, null
+ } else {
+ cache[ id ] = null;
+ }
+}
+
+jQuery.extend({
+ cache: {},
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "applet": true,
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data ) {
+ return internalData( elem, name, data );
+ },
+
+ removeData: function( elem, name ) {
+ return internalRemoveData( elem, name );
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return internalData( elem, name, data, true );
+ },
+
+ _removeData: function( elem, name ) {
+ return internalRemoveData( elem, name, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ // Do not set data on non-element because it will not be cleared (#8335).
+ if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
+ return false;
+ }
+
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ // nodes accept data unless otherwise specified; rejection can be conditional
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var attrs, name,
+ data = null,
+ i = 0,
+ elem = this[0];
+
+ // Special expections of .data basically thwart jQuery.access,
+ // so implement the relevant behavior ourselves
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = jQuery.data( elem );
+
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+ attrs = elem.attributes;
+ for ( ; i < attrs.length; i++ ) {
+ name = attrs[i].name;
+
+ if ( name.indexOf("data-") === 0 ) {
+ name = jQuery.camelCase( name.slice(5) );
+
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ jQuery._data( elem, "parsedAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ return arguments.length > 1 ?
+
+ // Sets one value
+ this.each(function() {
+ jQuery.data( this, key, value );
+ }) :
+
+ // Gets one value
+ // Try to fetch any internally stored data first
+ elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ // Only convert to a number if it doesn't change the string
+ +data + "" === data ? +data :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+ var name;
+ for ( name in obj ) {
+
+ // if the public data object is empty, the private is still empty
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+ continue;
+ }
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ var queue;
+
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ queue = jQuery._data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !queue || jQuery.isArray(data) ) {
+ queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ queue.push( data );
+ }
+ }
+ return queue || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ startLength = queue.length,
+ fn = queue.shift(),
+ hooks = jQuery._queueHooks( elem, type ),
+ next = function() {
+ jQuery.dequeue( elem, type );
+ };
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ startLength--;
+ }
+
+ if ( fn ) {
+
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ // clear up the last queue stop function
+ delete hooks.stop;
+ fn.call( elem, next, hooks );
+ }
+
+ if ( !startLength && hooks ) {
+ hooks.empty.fire();
+ }
+ },
+
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
+ _queueHooks: function( elem, type ) {
+ var key = type + "queueHooks";
+ return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+ empty: jQuery.Callbacks("once memory").add(function() {
+ jQuery._removeData( elem, type + "queue" );
+ jQuery._removeData( elem, key );
+ })
+ });
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ var setter = 2;
+
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ setter--;
+ }
+
+ if ( arguments.length < setter ) {
+ return jQuery.queue( this[0], type );
+ }
+
+ return data === undefined ?
+ this :
+ this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ // ensure a hooks for this queue
+ jQuery._queueHooks( this, type );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function( next, hooks ) {
+ var timeout = setTimeout( next, time );
+ hooks.stop = function() {
+ clearTimeout( timeout );
+ };
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, obj ) {
+ var tmp,
+ count = 1,
+ defer = jQuery.Deferred(),
+ elements = this,
+ i = this.length,
+ resolve = function() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ };
+
+ if ( typeof type !== "string" ) {
+ obj = type;
+ type = undefined;
+ }
+ type = type || "fx";
+
+ while( i-- ) {
+ tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+ if ( tmp && tmp.empty ) {
+ count++;
+ tmp.empty.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( obj );
+ }
+});
+var nodeHook, boolHook,
+ rclass = /[\t\r\n\f]/g,
+ rreturn = /\r/g,
+ rfocusable = /^(?:input|select|textarea|button|object)$/i,
+ rclickable = /^(?:a|area)$/i,
+ ruseDefault = /^(?:checked|selected)$/i,
+ getSetAttribute = jQuery.support.getSetAttribute,
+ getSetInput = jQuery.support.input;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ },
+
+ prop: function( name, value ) {
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+ },
+
+ removeProp: function( name ) {
+ name = jQuery.propFix[ name ] || name;
+ return this.each(function() {
+ // try/catch handles cases where IE balks (such as removing a property on window)
+ try {
+ this[ name ] = undefined;
+ delete this[ name ];
+ } catch( e ) {}
+ });
+ },
+
+ addClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call( this, j, this.className ) );
+ });
+ }
+
+ if ( proceed ) {
+ // The disjunction here is for better compressibility (see removeClass)
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ " "
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
+ cur += clazz + " ";
+ }
+ }
+ elem.className = jQuery.trim( cur );
+
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = arguments.length === 0 || typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call( this, j, this.className ) );
+ });
+ }
+ if ( proceed ) {
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ // This expression is here for better compressibility (see addClass)
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ ""
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ // Remove *all* instances
+ while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
+ cur = cur.replace( " " + clazz + " ", " " );
+ }
+ }
+ elem.className = value ? jQuery.trim( cur ) : "";
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value;
+
+ if ( typeof stateVal === "boolean" && type === "string" ) {
+ return stateVal ? this.addClass( value ) : this.removeClass( value );
+ }
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ classNames = value.match( core_rnotwhite ) || [];
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space separated list
+ if ( self.hasClass( className ) ) {
+ self.removeClass( className );
+ } else {
+ self.addClass( className );
+ }
+ }
+
+ // Toggle whole class name
+ } else if ( type === core_strundefined || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // If the element has a class name or if we're passed "false",
+ // then remove the whole classname (if there was one, the above saved it).
+ // Otherwise bring back whatever was previously saved (if anything),
+ // falling back to the empty string if nothing was stored.
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ",
+ i = 0,
+ l = this.length;
+ for ( ; i < l; i++ ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var ret, hooks, isFunction,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return;
+ }
+
+ isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var val;
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, jQuery( this ).val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map(val, function ( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ // Use proper attribute retrieval(#6932, #12072)
+ var val = jQuery.find.attr( elem, "value" );
+ return val != null ?
+ val :
+ elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, option,
+ options = elem.options,
+ index = elem.selectedIndex,
+ one = elem.type === "select-one" || index < 0,
+ values = one ? null : [],
+ max = one ? index + 1 : options.length,
+ i = index < 0 ?
+ max :
+ one ? index : 0;
+
+ // Loop through all the selected options
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // oldIE doesn't update selected after form reset (#2551)
+ if ( ( option.selected || i === index ) &&
+ // Don't return options that are disabled or in a disabled optgroup
+ ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
+ ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var optionSet, option,
+ options = elem.options,
+ values = jQuery.makeArray( value ),
+ i = options.length;
+
+ while ( i-- ) {
+ option = options[ i ];
+ if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
+ optionSet = true;
+ }
+ }
+
+ // force browsers to behave consistently when non-matching value is set
+ if ( !optionSet ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attr: function( elem, name, value ) {
+ var hooks, ret,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === core_strundefined ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] ||
+ ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+
+ } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, value + "" );
+ return value;
+ }
+
+ } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ ret = jQuery.find.attr( elem, name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret == null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var name, propName,
+ i = 0,
+ attrNames = value && value.match( core_rnotwhite );
+
+ if ( attrNames && elem.nodeType === 1 ) {
+ while ( (name = attrNames[i++]) ) {
+ propName = jQuery.propFix[ name ] || name;
+
+ // Boolean attributes get special treatment (#10870)
+ if ( jQuery.expr.match.bool.test( name ) ) {
+ // Set corresponding property to false
+ if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+ elem[ propName ] = false;
+ // Support: IE<9
+ // Also clear defaultChecked/defaultSelected (if appropriate)
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] =
+ elem[ propName ] = false;
+ }
+
+ // See #9699 for explanation of this approach (setting first, then removal)
+ } else {
+ jQuery.attr( elem, name, "" );
+ }
+
+ elem.removeAttribute( getSetAttribute ? name : propName );
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to default in case type is set after value during creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ }
+ },
+
+ propFix: {
+ "for": "htmlFor",
+ "class": "className"
+ },
+
+ prop: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
+ ret :
+ ( elem[ name ] = value );
+
+ } else {
+ return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
+ ret :
+ elem[ name ];
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ // Use proper attribute retrieval(#12072)
+ var tabindex = jQuery.find.attr( elem, "tabindex" );
+
+ return tabindex ?
+ parseInt( tabindex, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ -1;
+ }
+ }
+ }
+});
+
+// Hooks for boolean attributes
+boolHook = {
+ set: function( elem, value, name ) {
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+ // IE<8 needs the *property* name
+ elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
+
+ // Use defaultChecked and defaultSelected for oldIE
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
+ }
+
+ return name;
+ }
+};
+jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
+ var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
+
+ jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
+ function( elem, name, isXML ) {
+ var fn = jQuery.expr.attrHandle[ name ],
+ ret = isXML ?
+ undefined :
+ /* jshint eqeqeq: false */
+ (jQuery.expr.attrHandle[ name ] = undefined) !=
+ getter( elem, name, isXML ) ?
+
+ name.toLowerCase() :
+ null;
+ jQuery.expr.attrHandle[ name ] = fn;
+ return ret;
+ } :
+ function( elem, name, isXML ) {
+ return isXML ?
+ undefined :
+ elem[ jQuery.camelCase( "default-" + name ) ] ?
+ name.toLowerCase() :
+ null;
+ };
+});
+
+// fix oldIE attroperties
+if ( !getSetInput || !getSetAttribute ) {
+ jQuery.attrHooks.value = {
+ set: function( elem, value, name ) {
+ if ( jQuery.nodeName( elem, "input" ) ) {
+ // Does not return so that setAttribute is also used
+ elem.defaultValue = value;
+ } else {
+ // Use nodeHook if defined (#1954); otherwise setAttribute is fine
+ return nodeHook && nodeHook.set( elem, value, name );
+ }
+ }
+ };
+}
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = {
+ set: function( elem, value, name ) {
+ // Set the existing or create a new attribute node
+ var ret = elem.getAttributeNode( name );
+ if ( !ret ) {
+ elem.setAttributeNode(
+ (ret = elem.ownerDocument.createAttribute( name ))
+ );
+ }
+
+ ret.value = value += "";
+
+ // Break association with cloned elements by also using setAttribute (#9646)
+ return name === "value" || value === elem.getAttribute( name ) ?
+ value :
+ undefined;
+ }
+ };
+ jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =
+ // Some attributes are constructed with empty-string values when not defined
+ function( elem, name, isXML ) {
+ var ret;
+ return isXML ?
+ undefined :
+ (ret = elem.getAttributeNode( name )) && ret.value !== "" ?
+ ret.value :
+ null;
+ };
+ jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return ret && ret.specified ?
+ ret.value :
+ undefined;
+ },
+ set: nodeHook.set
+ };
+
+ // Set contenteditable to false on removals(#10429)
+ // Setting to empty string throws an error as an invalid value
+ jQuery.attrHooks.contenteditable = {
+ set: function( elem, value, name ) {
+ nodeHook.set( elem, value === "" ? false : value, name );
+ }
+ };
+
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+ // This is for removals
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ };
+ });
+}
+
+
+// Some attributes require a special call on IE
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !jQuery.support.hrefNormalized ) {
+ // href/src property should get the full normalized URL (#10299/#12915)
+ jQuery.each([ "href", "src" ], function( i, name ) {
+ jQuery.propHooks[ name ] = {
+ get: function( elem ) {
+ return elem.getAttribute( name, 4 );
+ }
+ };
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Note: IE uppercases css property names, but if we were to .toLowerCase()
+ // .cssText, that would destroy case senstitivity in URL's, like in "background"
+ return elem.style.cssText || undefined;
+ },
+ set: function( elem, value ) {
+ return ( elem.style.cssText = value + "" );
+ }
+ };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ return null;
+ }
+ };
+}
+
+jQuery.each([
+ "tabIndex",
+ "readOnly",
+ "maxLength",
+ "cellSpacing",
+ "cellPadding",
+ "rowSpan",
+ "colSpan",
+ "useMap",
+ "frameBorder",
+ "contentEditable"
+], function() {
+ jQuery.propFix[ this.toLowerCase() ] = this;
+});
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+ jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ };
+ if ( !jQuery.support.checkOn ) {
+ jQuery.valHooks[ this ].get = function( elem ) {
+ // Support: Webkit
+ // "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ };
+ }
+});
+var rformElems = /^(?:input|select|textarea)$/i,
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+
+function returnTrue() {
+ return true;
+}
+
+function returnFalse() {
+ return false;
+}
+
+function safeActiveElement() {
+ try {
+ return document.activeElement;
+ } catch ( err ) { }
+}
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ global: {},
+
+ add: function( elem, types, handler, data, selector ) {
+ var tmp, events, t, handleObjIn,
+ special, eventHandle, handleObj,
+ handlers, type, namespaces, origType,
+ elemData = jQuery._data( elem );
+
+ // Don't attach events to noData or text/comment nodes (but allow plain objects)
+ if ( !elemData ) {
+ return;
+ }
+
+ // Caller can pass in an object of custom data in lieu of the handler
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ selector = handleObjIn.selector;
+ }
+
+ // Make sure that the handler has a unique ID, used to find/remove it later
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure and main handler, if this is the first
+ if ( !(events = elemData.events) ) {
+ events = elemData.events = {};
+ }
+ if ( !(eventHandle = elemData.handle) ) {
+ eventHandle = elemData.handle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+ eventHandle.elem = elem;
+ }
+
+ // Handle multiple events separated by a space
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // There *must* be a type, no attaching namespace-only handlers
+ if ( !type ) {
+ continue;
+ }
+
+ // If event changes its type, use the special event handlers for the changed type
+ special = jQuery.event.special[ type ] || {};
+
+ // If selector defined, determine special event api type, otherwise given type
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+
+ // Update special based on newly reset type
+ special = jQuery.event.special[ type ] || {};
+
+ // handleObj is passed to all event handlers
+ handleObj = jQuery.extend({
+ type: type,
+ origType: origType,
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ if ( !(handlers = events[ type ]) ) {
+ handlers = events[ type ] = [];
+ handlers.delegateCount = 0;
+
+ // Only use addEventListener/attachEvent if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add to the element's handler list, delegates in front
+ if ( selector ) {
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
+ } else {
+ handlers.push( handleObj );
+ }
+
+ // Keep track of which events have ever been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+ var j, handleObj, tmp,
+ origCount, t, events,
+ special, handlers, type,
+ namespaces, origType,
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem );
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // Unbind all events (on this namespace, if provided) for the element
+ if ( !type ) {
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+ }
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+ handlers = events[ type ] || [];
+ tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
+
+ // Remove matching events
+ origCount = j = handlers.length;
+ while ( j-- ) {
+ handleObj = handlers[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !tmp || tmp.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ handlers.splice( j, 1 );
+
+ if ( handleObj.selector ) {
+ handlers.delegateCount--;
+ }
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+ }
+
+ // Remove generic event handler if we removed something and no more handlers exist
+ // (avoids potential for endless recursion during removal of special event handlers)
+ if ( origCount && !handlers.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ delete elemData.handle;
+
+ // removeData also checks for emptiness and clears the expando if empty
+ // so use it instead of delete
+ jQuery._removeData( elem, "events" );
+ }
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+ var handle, ontype, cur,
+ bubbleType, special, tmp, i,
+ eventPath = [ elem || document ],
+ type = core_hasOwn.call( event, "type" ) ? event.type : event,
+ namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
+
+ cur = tmp = elem = elem || document;
+
+ // Don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+ return;
+ }
+
+ if ( type.indexOf(".") >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+ ontype = type.indexOf(":") < 0 && "on" + type;
+
+ // Caller can pass in a jQuery.Event object, Object, or just an event type string
+ event = event[ jQuery.expando ] ?
+ event :
+ new jQuery.Event( type, typeof event === "object" && event );
+
+ // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
+ event.isTrigger = onlyHandlers ? 2 : 3;
+ event.namespace = namespaces.join(".");
+ event.namespace_re = event.namespace ?
+ new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+ null;
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ if ( !event.target ) {
+ event.target = elem;
+ }
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data == null ?
+ [ event ] :
+ jQuery.makeArray( data, [ event ] );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
+ return;
+ }
+
+ // Determine event propagation path in advance, per W3C events spec (#9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ if ( !rfocusMorph.test( bubbleType + type ) ) {
+ cur = cur.parentNode;
+ }
+ for ( ; cur; cur = cur.parentNode ) {
+ eventPath.push( cur );
+ tmp = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( tmp === (elem.ownerDocument || document) ) {
+ eventPath.push( tmp.defaultView || tmp.parentWindow || window );
+ }
+ }
+
+ // Fire handlers on the event path
+ i = 0;
+ while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+
+ event.type = i > 1 ?
+ bubbleType :
+ special.bindType || type;
+
+ // jQuery handler
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+
+ // Native handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
+ event.preventDefault();
+ }
+ }
+ event.type = type;
+
+ // If nobody prevented the default action, do it now
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+ if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
+ jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ tmp = elem[ ontype ];
+
+ if ( tmp ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ try {
+ elem[ type ]();
+ } catch ( e ) {
+ // IE<9 dies on focus/blur to hidden element (#1486,#12518)
+ // only reproducible on winXP IE8 native, not IE9 in IE8 mode
+ }
+ jQuery.event.triggered = undefined;
+
+ if ( tmp ) {
+ elem[ ontype ] = tmp;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event );
+
+ var i, ret, handleObj, matched, j,
+ handlerQueue = [],
+ args = core_slice.call( arguments ),
+ handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
+ special = jQuery.event.special[ event.type ] || {};
+
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
+ args[0] = event;
+ event.delegateTarget = this;
+
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+ return;
+ }
+
+ // Determine handlers
+ handlerQueue = jQuery.event.handlers.call( this, event, handlers );
+
+ // Run delegates first; they may want to stop propagation beneath us
+ i = 0;
+ while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
+ event.currentTarget = matched.elem;
+
+ j = 0;
+ while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
+
+ // Triggered event must either 1) have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.handleObj = handleObj;
+ event.data = handleObj.data;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ if ( (event.result = ret) === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+ }
+ }
+
+ // Call the postDispatch hook for the mapped type
+ if ( special.postDispatch ) {
+ special.postDispatch.call( this, event );
+ }
+
+ return event.result;
+ },
+
+ handlers: function( event, handlers ) {
+ var sel, handleObj, matches, i,
+ handlerQueue = [],
+ delegateCount = handlers.delegateCount,
+ cur = event.target;
+
+ // Find delegate handlers
+ // Black-hole SVG t