diff --git a/CREDITS b/CREDITS index 518f7366c..83b80fcc6 100644 --- a/CREDITS +++ b/CREDITS @@ -2,24 +2,10 @@ 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 +Version 2.4.0 ------------- +Martin Konecny (martin.konecny@sourcefabric.org) + Role: Developer Team Lead Denise Rigato (denise.rigato@sourcefabric.org) Role: Software Developer diff --git a/LICENSE_3RD_PARTY b/LICENSE_3RD_PARTY index 7096a6f55..e48f0b314 100644 --- a/LICENSE_3RD_PARTY +++ b/LICENSE_3RD_PARTY @@ -8,7 +8,7 @@ Common Non-linked Code - Web site: https://github.com/torvalds/linux - License: GPLv2 - * RabbitMQ + * RabbitMQ (works with version 1.7.2 and above) - What is it: Interprocess Message Passing with Queuing - Web site: http://www.rabbitmq.com/ - License: Mozilla Public License (http://www.rabbitmq.com/mpl.html) @@ -63,11 +63,11 @@ Non-linked code: - Web site: http://httpd.apache.org/ - License: Apache 2.0. See http://httpd.apache.org/docs/2.2/license.html - * PostgreSQL 9.1 + * PostgreSQL 8.4 - Web site: http://www.postgresql.org/ - License: The PostgreSQL License. See http://www.postgresql.org/about/licence - * PHP 5.3 + * PHP 5.3 - Web site: http://www.php.net/ - License: The PHP License. See http://www.php.net/license/3_01.txt @@ -137,7 +137,7 @@ Linked code: - License: MIT Non-linked code: - * Python 2.7 + * Python 2.6 - Web site: http://www.python.org/ - License: PSF License. See http://docs.python.org/license.html @@ -158,11 +158,11 @@ Linked code: - Compatible with GPLv3? Yes. Non-linked code: - * Python 2.7 + * Python 2.6 - Web site: http://www.python.org/ - License: PSF License. See http://docs.python.org/license.html - * ecasound 2.8.1 + * ecasound 2.7.2 - What is it: Records audio from line-in - Web site: http://www.eca.cx/ecasound/ - License: GPLv2 @@ -177,10 +177,10 @@ Linked code: - Compatible with GPLv3? Yes. Non-linked code: - * Python 2.7 + * Python 2.6 - Web site: http://www.python.org/ - License: PSF License. See http://docs.python.org/license.html - * Liquidsoap 1.1.1 + * Liquidsoap 1.0.1 - Web site: http://savonet.sourceforge.net/ - License: GPLv2 diff --git a/VERSION b/VERSION index 5a1ef0b72..42fde3a5e 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ PRODUCT_ID=Airtime -PRODUCT_RELEASE=2.5.0 +PRODUCT_RELEASE=2.4.0 diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 313e448c8..e289e9c54 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,26 +83,23 @@ 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.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-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.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/common/Timezone.php b/airtime_mvc/application/common/Timezone.php index 7da82f6f9..271ea5f02 100644 --- a/airtime_mvc/application/common/Timezone.php +++ b/airtime_mvc/application/common/Timezone.php @@ -14,8 +14,7 @@ class Application_Common_Timezone 'Australia' => DateTimeZone::AUSTRALIA, 'Europe' => DateTimeZone::EUROPE, 'Indian' => DateTimeZone::INDIAN, - 'Pacific' => DateTimeZone::PACIFIC, - 'UTC' => DateTimeZone::UTC + 'Pacific' => DateTimeZone::PACIFIC ); $tzlist = array(); diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php index 83cba4b08..a23846a99 100644 --- a/airtime_mvc/application/configs/ACL.php +++ b/airtime_mvc/application/configs/ACL.php @@ -23,7 +23,6 @@ $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')) @@ -47,8 +46,7 @@ $ccAcl->allow('G', 'index') ->allow('H', 'plupload') ->allow('H', 'library') ->allow('H', 'playlist') - ->allow('H', 'playouthistory') - ->allow('A', 'playouthistorytemplate') + ->allow('A', 'playouthistory') ->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 fb4284681..ef0357425 100644 --- a/airtime_mvc/application/configs/classmap-airtime-conf.php +++ b/airtime_mvc/application/configs/classmap-airtime-conf.php @@ -183,13 +183,6 @@ return array ( 'BaseCcWebstreamMetadataPeer' => 'airtime/om/BaseCcWebstreamMetadataPeer.php', 'BaseCcWebstreamMetadata' => 'airtime/om/BaseCcWebstreamMetadata.php', 'BaseCcWebstreamMetadataQuery' => 'airtime/om/BaseCcWebstreamMetadataQuery.php', - 'CcMountNameTableMap' => 'airtime/map/CcMountNameTableMap.php', - 'CcMountNamePeer' => 'airtime/CcMountNamePeer.php', - 'CcMountName' => 'airtime/CcMountName.php', - 'CcMountNameQuery' => 'airtime/CcMountNameQuery.php', - 'BaseCcMountNamePeer' => 'airtime/om/BaseCcMountNamePeer.php', - 'BaseCcMountName' => 'airtime/om/BaseCcMountName.php', - 'BaseCcMountNameQuery' => 'airtime/om/BaseCcMountNameQuery.php', 'CcTimestampTableMap' => 'airtime/map/CcTimestampTableMap.php', 'CcTimestampPeer' => 'airtime/CcTimestampPeer.php', 'CcTimestamp' => 'airtime/CcTimestamp.php', @@ -211,32 +204,4 @@ 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 34f8cab41..4a1f3e55a 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -38,21 +38,6 @@ 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 f3149f146..32b4af39d 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,6 +79,13 @@ $pages = array( 'action' => 'index', 'resource' => 'systemstatus' ), + array( + 'label' => _('Playout History'), + 'module' => 'default', + 'controller' => 'playouthistory', + 'action' => 'index', + 'resource' => 'playouthistory' + ), array( 'label' => _('Listener Stats'), 'module' => 'default', @@ -88,27 +95,6 @@ $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 ac32ae832..63c24d14a 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -209,43 +209,6 @@ class ApiController extends Zend_Controller_Action } } - public function onAirLightAction() - { - $this->view->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - $result = array(); - $result["on_air_light"] = false; - $result["on_air_light_expected_status"] = false; - $result["station_down"] = false; - - $range = Application_Model_Schedule::GetPlayOrderRange(); - - $isItemCurrentlyScheduled = !is_null($range["current"]) && count($range["currentShow"]) > 0 ? true : false; - - $isCurrentItemPlaying = $range["current"]["media_item_played"] ? true : false; - - if ($isItemCurrentlyScheduled || - Application_Model_Preference::GetSourceSwitchStatus("live_dj") == "on" || - Application_Model_Preference::GetSourceSwitchStatus("master_dj") == "on") - { - $result["on_air_light_expected_status"] = true; - } - - if (($isItemCurrentlyScheduled && $isCurrentItemPlaying) || - Application_Model_Preference::GetSourceSwitchStatus("live_dj") == "on" || - Application_Model_Preference::GetSourceSwitchStatus("master_dj") == "on") - { - $result["on_air_light"] = true; - } - - if ($result["on_air_light_expected_status"] != $result["on_air_light"]) { - $result["station_down"] = true; - } - - echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result); - } - /** * Retrieve the currently playing show as well as upcoming shows. * Number of shows returned and the time interval in which to @@ -400,9 +363,6 @@ 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 @@ -1009,30 +969,23 @@ class ApiController extends Zend_Controller_Action //calculated with silan by actually scanning the entire file. This //process takes a really long time, and so we only do it in the background //after the file has already been imported -MK - try { - $length = $file->getDbLength(); - if (isset($info['length'])) { - $length = $info['length']; - //length decimal number in seconds. Need to convert it to format - //HH:mm:ss to get around silly PHP limitations. - $length = Application_Common_DateHelper::secondsToPlaylistTime($length); - $file->setDbLength($length); - } + $length = $file->getDbLength(); + if (isset($info['length'])) { + $length = $info['length']; + //length decimal number in seconds. Need to convert it to format + //HH:mm:ss to get around silly PHP limitations. + $length = Application_Common_DateHelper::secondsToPlaylistTime($length); - $cuein = isset($info['cuein']) ? $info['cuein'] : 0; - $cueout = isset($info['cueout']) ? $info['cueout'] : $length; - - $file->setDbCuein($cuein); - $file->setDbCueout($cueout); - $file->setDbSilanCheck(true); - $file->save(); - } catch (Exception $e) { - Logging::info("Failed to update silan values for ".$file->getDbTrackTitle()); - Logging::info("File length analyzed by Silan is: ".$length); - //set silan_check to true so we don't attempt to re-anaylze again - $file->setDbSilanCheck(true); - $file->save(); + $file->setDbLength($length); } + + $cuein = isset($info['cuein']) ? $info['cuein'] : 0; + $cueout = isset($info['cueout']) ? $info['cueout'] : $length; + + $file->setDbCuein($cuein); + $file->setDbCueout($cueout); + $file->setDbSilanCheck(true); + $file->save(); } $this->_helper->json->sendJson(array()); diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 2102a662e..780348372 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,7 +179,9 @@ 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(); @@ -248,7 +250,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") { @@ -371,15 +373,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') { @@ -391,15 +393,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())); } @@ -547,7 +549,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/ListenerstatController.php b/airtime_mvc/application/controllers/ListenerstatController.php index 3ec495839..bb280378d 100644 --- a/airtime_mvc/application/controllers/ListenerstatController.php +++ b/airtime_mvc/application/controllers/ListenerstatController.php @@ -9,36 +9,36 @@ class ListenerstatController extends Zend_Controller_Action ->addActionContext('get-data', 'json') ->initContext(); } - + public function indexAction() { $CC_CONFIG = Config::getConfig(); - + $request = $this->getRequest(); $baseUrl = Application_Common_OsPath::getBaseDir(); - + $this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.crosshair.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/listenerstat/listenerstat.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/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->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); - + //default time is the last 24 hours. $now = time(); $from = $request->getParam("from", $now - (24*60*60)); $to = $request->getParam("to", $now); - + $start = DateTime::createFromFormat("U", $from, new DateTimeZone("UTC")); $start->setTimezone(new DateTimeZone(date_default_timezone_get())); $end = DateTime::createFromFormat("U", $to, new DateTimeZone("UTC")); $end->setTimezone(new DateTimeZone(date_default_timezone_get())); - + $form = new Application_Form_DateRange(); $form->populate(array( 'his_date_start' => $start->format("Y-m-d"), @@ -46,7 +46,7 @@ class ListenerstatController extends Zend_Controller_Action 'his_date_end' => $end->format("Y-m-d"), 'his_time_end' => $end->format("H:i") )); - + $errorStatus = Application_Model_StreamSetting::GetAllListenerStatErrors(); Logging::info($errorStatus); $out = array(); @@ -57,24 +57,25 @@ class ListenerstatController extends Zend_Controller_Action } $out[$key[0]] = $v['value']; } - + $this->view->errorStatus = $out; $this->view->date_form = $form; } - + public function getDataAction(){ $request = $this->getRequest(); $current_time = time(); - + $params = $request->getParams(); - + $starts_epoch = $request->getParam("startTimestamp", $current_time - (60*60*24)); $ends_epoch = $request->getParam("endTimestamp", $current_time); - + $mountName = $request->getParam("mountName", null); + $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC")); $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC")); - - $data = Application_Model_ListenerStat::getDataPointsWithinRange($startsDT->format("Y-m-d H:i:s"), $endsDT->format("Y-m-d H:i:s")); - $this->_helper->json->sendJson($data); + + $data = Application_Model_ListenerStat::getDataPointsWithinRange($startsDT->format("Y-m-d H:i:s"), $endsDT->format("Y-m-d H:i:s"), $mountName); + $this->_helper->json->sendJson($data); } } diff --git a/airtime_mvc/application/controllers/PlayouthistoryController.php b/airtime_mvc/application/controllers/PlayouthistoryController.php index d28c96412..3269fcd46 100644 --- a/airtime_mvc/application/controllers/PlayouthistoryController.php +++ b/airtime_mvc/application/controllers/PlayouthistoryController.php @@ -6,16 +6,7 @@ class PlayouthistoryController extends Zend_Controller_Action { $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext - ->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') + ->addActionContext('playout-history-feed', 'json') ->initContext(); } @@ -51,219 +42,45 @@ 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-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'); + $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'); $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.'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.'js/datatables/plugin/TableTools/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 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() + public function playoutHistoryFeedAction() { $request = $this->getRequest(); - $params = $request->getPost(); - Logging::info($params); + $current_time = time(); - $historyService = new Application_Service_HistoryService(); - $json = $historyService->editPlayedFile($params); + $params = $request->getParams(); - $this->_helper->json->sendJson($json); + $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"]; } + } diff --git a/airtime_mvc/application/controllers/PlayouthistorytemplateController.php b/airtime_mvc/application/controllers/PlayouthistorytemplateController.php deleted file mode 100644 index c6651d8eb..000000000 --- a/airtime_mvc/application/controllers/PlayouthistorytemplateController.php +++ /dev/null @@ -1,143 +0,0 @@ -_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 e13547c88..b610063af 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -46,17 +46,6 @@ class ScheduleController extends Zend_Controller_Action $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendScript( - "var calendarPref = {};\n". - "calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n". - "calendarPref.timestamp = ".time().";\n". - "calendarPref.timezoneOffset = ".date("Z").";\n". - "calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n". - "calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n". - "calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n". - "var calendarEvents = null;" - ); - $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); //full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time @@ -85,6 +74,7 @@ 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'); @@ -96,6 +86,7 @@ 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 @@ -107,6 +98,16 @@ class ScheduleController extends Zend_Controller_Action } $this->view->addNewShow = true; + $this->view->headScript()->appendScript( + "var calendarPref = {};\n". + "calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n". + "calendarPref.timestamp = ".time().";\n". + "calendarPref.timezoneOffset = ".date("Z").";\n". + "calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n". + "calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n". + "calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n". + "var calendarEvents = null;" + ); } public function eventFeedAction() diff --git a/airtime_mvc/application/forms/EditHistory.php b/airtime_mvc/application/forms/EditHistory.php deleted file mode 100644 index ad7ae7a05..000000000 --- a/airtime_mvc/application/forms/EditHistory.php +++ /dev/null @@ -1,211 +0,0 @@ - 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 deleted file mode 100644 index b58db19a1..000000000 --- a/airtime_mvc/application/forms/EditHistoryFile.php +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index 16ba5ded5..000000000 --- a/airtime_mvc/application/forms/EditHistoryItem.php +++ /dev/null @@ -1,66 +0,0 @@ -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/forms/SmartBlockCriteria.php b/airtime_mvc/application/forms/SmartBlockCriteria.php index 52ea8d86d..cd588a215 100644 --- a/airtime_mvc/application/forms/SmartBlockCriteria.php +++ b/airtime_mvc/application/forms/SmartBlockCriteria.php @@ -5,7 +5,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm private $stringCriteriaOptions; private $numericCriteriaOptions; private $limitOptions; - + /* We need to know if the criteria value will be a string * or numeric value in order to populate the modifier * select list @@ -40,7 +40,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm "info_url" => "s", "year" => "n" ); - + private function getCriteriaOptions($option = null) { if (!isset($this->criteriaOptions)) { @@ -75,7 +75,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm "year" => _("Year") ); } - + if (is_null($option)) return $this->criteriaOptions; else return $this->criteriaOptions[$option]; } @@ -122,7 +122,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm } return $this->limitOptions; } - + public function init() { @@ -259,7 +259,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $repeatTracks->setChecked($storedCrit["repeat_tracks"]["value"] == 1?true:false); } $this->addElement($repeatTracks); - + $limit = new Zend_Form_Element_Select('sp_limit_options'); $limit->setAttrib('class', 'sp_input_select') ->setDecorators(array('viewHelper')) @@ -268,7 +268,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $limit->setValue($storedCrit["limit"]["modifier"]); } $this->addElement($limit); - + $limitValue = new Zend_Form_Element_Text('sp_limit_value'); $limitValue->setAttrib('class', 'sp_input_text_limit') ->setLabel(_('Limit to')) @@ -541,7 +541,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $isValid = false; } // length check - if ($d['sp_criteria_value'] >= pow(2,31)) { + if (intval($d['sp_criteria_value']) >= pow(2,31)) { $element->addError(_("The value should be less then 2147483648")); $isValid = false; } diff --git a/airtime_mvc/application/models/Datatables.php b/airtime_mvc/application/models/Datatables.php index d39a939fa..b3b370352 100644 --- a/airtime_mvc/application/models/Datatables.php +++ b/airtime_mvc/application/models/Datatables.php @@ -58,6 +58,43 @@ 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 @@ -65,45 +102,6 @@ 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']); @@ -121,6 +119,7 @@ class Application_Model_Datatables $sql = $selectorCount." FROM ".$fromTable; $sqlTotalRows = $sql; + if (isset($searchTerms)) { $searchCols = array(); for ($i = 0; $i < $data["iColumns"]; $i++) { @@ -165,47 +164,57 @@ class Application_Model_Datatables $sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby; - } - else { + //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; + //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 { - //Logging::info("sql is not set."); + } else { $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/ListenerStat.php b/airtime_mvc/application/models/ListenerStat.php index 69560b320..52360c55a 100644 --- a/airtime_mvc/application/models/ListenerStat.php +++ b/airtime_mvc/application/models/ListenerStat.php @@ -4,7 +4,7 @@ class Application_Model_ListenerStat public function __construct() { } - + public static function getDataPointsWithinRange($p_start, $p_end) { $sql = <<$p_start, 'p2'=>$p_end)); - + $out = array(); foreach ($data as $d) { $jump = intval($d['count']/1000); $jump = max(1, $jump); $remainder = $jump == 1?0:1; - + $sql = <<setTimezone(new DateTimeZone(date_default_timezone_get())); // tricking javascript so it thinks the server timezone is in UTC $dt = new DateTime($t->format("Y-m-d H:i:s"), new DateTimeZone("UTC")); - + $r['timestamp'] = $dt->format("U"); $out[$r['mount_name']][] = $r; } } - + $enabledStreamIds = Application_Model_StreamSetting::getEnabledStreamIds(); $enabledOut = array(); - + foreach ($enabledStreamIds as $sId) { - + $sql = "SELECT value FROM cc_stream_setting" ." WHERE keyname = :key"; - + $result = Application_Common_Database::prepareAndExecute($sql, array('key' => $sId."_mount"), "single"); - + $enabledMountPoint = $result["value"]; - + if (isset($out[$enabledMountPoint])) { $enabledOut[$enabledMountPoint] = $out[$enabledMountPoint]; } - else { - //TODO fix this hack (here for CC-5254) - //all shoutcast streams are automatically put under "shoutcast" mount point. - if (isset($out["shoutcast"])) { - $enabledOut["shoutcast"] = $out["shoutcast"]; - } - } } - + return $enabledOut; } diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index 7eaad0a64..7011a501f 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -505,12 +505,11 @@ SQL; foreach ($p_items as $ac) { $res = $this->insertPlaylistElement($this->buildEntry($ac, $pos)); + // update is_playlist flag in cc_files to indicate the // file belongs to a playlist or block (in this case a playlist) - if ($ac[1] == "audioclip") { - $db_file = CcFilesQuery::create()->findPk($ac[0], $this->con); - $db_file->setDbIsPlaylist(true)->save($this->con); - } + $db_file = CcFilesQuery::create()->findPk($ac[0], $this->con); + $db_file->setDbIsPlaylist(true)->save($this->con); $pos = $pos + 1; } diff --git a/airtime_mvc/application/models/PlayoutHistory.php b/airtime_mvc/application/models/PlayoutHistory.php new file mode 100644 index 000000000..7da1ff2c2 --- /dev/null +++ b/airtime_mvc/application/models/PlayoutHistory.php @@ -0,0 +1,83 @@ + "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 015d400c5..5df8d878f 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -1369,20 +1369,4 @@ 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/Scheduler.php b/airtime_mvc/application/models/Scheduler.php index 661df065b..c62fed647 100644 --- a/airtime_mvc/application/models/Scheduler.php +++ b/airtime_mvc/application/models/Scheduler.php @@ -17,7 +17,7 @@ class Application_Model_Scheduler private $epochNow; private $nowDT; private $user; - + private $crossfadeDuration; private $checkUserPermissions = true; @@ -40,7 +40,7 @@ class Application_Model_Scheduler } $this->user = Application_Model_User::getCurrentUser(); - + $this->crossfadeDuration = Application_Model_Preference::GetDefaultCrossfadeDuration(); } @@ -200,12 +200,9 @@ class Application_Model_Scheduler } else { $data = $this->fileInfo; $data["id"] = $id; - - $cuein = Application_Common_DateHelper::playlistTimeToSeconds($file->getDbCuein()); - $cueout = Application_Common_DateHelper::playlistTimeToSeconds($file->getDbCueout()); - $row_length = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); - - $data["cliplength"] = $row_length; + $data["cliplength"] = Application_Model_StoredFile::getRealClipLength( + $file->getDbCuein(), + $file->getDbCueout()); $data["cuein"] = $file->getDbCuein(); $data["cueout"] = $file->getDbCueout(); @@ -268,11 +265,11 @@ class Application_Model_Scheduler $cuein = Application_Common_DateHelper::calculateLengthInSeconds($data["cuein"]); $cueout = Application_Common_DateHelper::calculateLengthInSeconds($data["cueout"]); $data["cliplength"] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); - + //fade is in format SS.uuuuuu $data["fadein"] = $defaultFadeIn; $data["fadeout"] = $defaultFadeOut; - + $data["type"] = 0; $files[] = $data; } @@ -327,11 +324,11 @@ class Application_Model_Scheduler $cuein = Application_Common_DateHelper::calculateLengthInSeconds($data["cuein"]); $cueout = Application_Common_DateHelper::calculateLengthInSeconds($data["cueout"]); $data["cliplength"] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); - + //fade is in format SS.uuuuuu $data["fadein"] = $defaultFadeIn; $data["fadeout"] = $defaultFadeOut; - + $data["type"] = 0; $files[] = $data; } @@ -341,7 +338,7 @@ class Application_Model_Scheduler return $files; } - + /* * @param DateTime startDT in UTC * @param string duration @@ -352,18 +349,18 @@ class Application_Model_Scheduler private function findTimeDifference($p_startDT, $p_seconds) { $startEpoch = $p_startDT->format("U.u"); - + //add two float numbers to 6 subsecond precision //DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. $newEpoch = bcsub($startEpoch , (string) $p_seconds, 6); - + $dt = DateTime::createFromFormat("U.u", $newEpoch, new DateTimeZone("UTC")); - + if ($dt === false) { //PHP 5.3.2 problem $dt = DateTime::createFromFormat("U", intval($newEpoch), new DateTimeZone("UTC")); } - + return $dt; } @@ -423,7 +420,7 @@ class Application_Model_Scheduler return $nextDT; } - + /* * @param int $showInstance * This function recalculates the start/end times of items in a gapless show to @@ -502,7 +499,7 @@ class Application_Model_Scheduler } /** - * + * * Enter description here ... * @param $scheduleItems * cc_schedule items, where the items get inserted after @@ -885,7 +882,7 @@ class Application_Model_Scheduler private function updateMovedItem() { - + } private function getInstances($instanceId) @@ -1105,7 +1102,7 @@ class Application_Model_Scheduler } else { $removedItem->delete($this->con); } - + // update is_scheduled in cc_files but only if // the file is not scheduled somewhere else $fileId = $removedItem->getDbFileId(); diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index f5cac2aa0..2930a7ff3 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -949,7 +949,6 @@ 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 6f0a98cce..0c503344c 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -778,30 +778,17 @@ 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(); - } - } + $len_formatter = new LengthFormatter( + self::getRealClipLength($row["cuein"], $row["cueout"])); + $row['length'] = $len_formatter->format(); + + $cuein_formatter = new LengthFormatter($row["cuein"]); + $row["cuein"] = $cuein_formatter->format(); + + $cueout_formatter = new LengthFormatter($row["cueout"]); + $row["cueout"] = $cueout_formatter->format(); if ($row['ftype'] === "audioclip") { - - $cuein_formatter = new LengthFormatter($row["cuein"]); - $row["cuein"] = $cuein_formatter->format(); - - $cueout_formatter = new LengthFormatter($row["cueout"]); - $row["cueout"] = $cueout_formatter->format(); - - $cuein = Application_Common_DateHelper::playlistTimeToSeconds($row["cuein"]); - $cueout = Application_Common_DateHelper::playlistTimeToSeconds($row["cueout"]); - $row_length = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); - $formatter = new SamplerateFormatter($row['sample_rate']); $row['sample_rate'] = $formatter->format(); @@ -814,17 +801,10 @@ SQL; // for audio preview $row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION); - - } - else { - + } else { $row['audioFile'] = $row['id']; - $row_length = $row['length']; } - $len_formatter = new LengthFormatter($row_length); - $row['length'] = $len_formatter->format(); - //convert mtime and utime to localtime $row['mtime'] = new DateTime($row['mtime'], new DateTimeZone('UTC')); $row['mtime']->setTimeZone(new DateTimeZone(date_default_timezone_get())); @@ -1367,6 +1347,14 @@ SQL; Application_Common_Database::prepareAndExecute($sql, array(), Application_Common_Database::EXECUTE); } + + public static function getRealClipLength($p_cuein, $p_cueout) { + $sql = "SELECT :cueout::INTERVAL - :cuein::INTERVAL"; + + return Application_Common_Database::prepareAndExecute($sql, array( + ':cueout' => $p_cueout, + ':cuein' => $p_cuein), 'column'); + } } class DeleteScheduledFileException extends Exception {} diff --git a/airtime_mvc/application/models/User.php b/airtime_mvc/application/models/User.php index 8a1008577..a3b2c5d3d 100644 --- a/airtime_mvc/application/models/User.php +++ b/airtime_mvc/application/models/User.php @@ -1,5 +1,10 @@ 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 deleted file mode 100644 index 2b02b8368..000000000 --- a/airtime_mvc/application/models/airtime/CcTag.php +++ /dev/null @@ -1,18 +0,0 @@ -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 6f9f414dd..56e7a5fff 100644 --- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php @@ -123,7 +123,6 @@ 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/CcListenerCountTableMap.php b/airtime_mvc/application/models/airtime/map/CcListenerCountTableMap.php index 2b9476a75..ec7a5165b 100644 --- a/airtime_mvc/application/models/airtime/map/CcListenerCountTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcListenerCountTableMap.php @@ -51,7 +51,7 @@ class CcListenerCountTableMap extends TableMap { public function buildRelations() { $this->addRelation('CcTimestamp', 'CcTimestamp', RelationMap::MANY_TO_ONE, array('timestamp_id' => 'id', ), 'CASCADE', null); - $this->addRelation('CcMountName', 'CcMountName', RelationMap::MANY_TO_ONE, array('mount_name_id' => 'id', ), 'CASCADE', null); + $this->addRelation('CcTimestamp', 'CcTimestamp', RelationMap::MANY_TO_ONE, array('mount_name_id' => 'id', ), 'CASCADE', null); } // buildRelations() } // CcListenerCountTableMap diff --git a/airtime_mvc/application/models/airtime/map/CcMountNameTableMap.php b/airtime_mvc/application/models/airtime/map/CcMountNameTableMap.php deleted file mode 100644 index f07bc5403..000000000 --- a/airtime_mvc/application/models/airtime/map/CcMountNameTableMap.php +++ /dev/null @@ -1,54 +0,0 @@ -setName('cc_mount_name'); - $this->setPhpName('CcMountName'); - $this->setClassname('CcMountName'); - $this->setPackage('airtime'); - $this->setUseIdGenerator(true); - $this->setPrimaryKeyMethodInfo('cc_mount_name_id_seq'); - // columns - $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); - $this->addColumn('MOUNT_NAME', 'DbMountName', 'VARCHAR', true, 255, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CcListenerCount', 'CcListenerCount', RelationMap::ONE_TO_MANY, array('id' => 'mount_name_id', ), 'CASCADE', null); - } // buildRelations() - -} // CcMountNameTableMap diff --git a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryMetaDataTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryMetaDataTableMap.php deleted file mode 100644 index 8e937f6e5..000000000 --- a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryMetaDataTableMap.php +++ /dev/null @@ -1,56 +0,0 @@ -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 deleted file mode 100644 index 6c365d7bb..000000000 --- a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTableMap.php +++ /dev/null @@ -1,59 +0,0 @@ -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 deleted file mode 100644 index f68db26a1..000000000 --- a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php +++ /dev/null @@ -1,59 +0,0 @@ -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 deleted file mode 100644 index e5aea573d..000000000 --- a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTableMap.php +++ /dev/null @@ -1,55 +0,0 @@ -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 deleted file mode 100644 index 9ce9ab7e1..000000000 --- a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTagTableMap.php +++ /dev/null @@ -1,58 +0,0 @@ -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 c55e86080..e6a7b87a0 100644 --- a/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php @@ -63,7 +63,6 @@ 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 deleted file mode 100644 index 0cfbcbb2c..000000000 --- a/airtime_mvc/application/models/airtime/map/CcTagTableMap.php +++ /dev/null @@ -1,57 +0,0 @@ -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 deleted file mode 100644 index eea6b63e0..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcFileTag.php +++ /dev/null @@ -1,936 +0,0 @@ -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 deleted file mode 100644 index e4454a44f..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcFileTagPeer.php +++ /dev/null @@ -1,1365 +0,0 @@ - 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 deleted file mode 100644 index 991c4e05a..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcFileTagQuery.php +++ /dev/null @@ -1,371 +0,0 @@ -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 38d147c07..55f868769 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php @@ -493,11 +493,6 @@ 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. @@ -3114,8 +3109,6 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->collCcSchedules = null; - $this->collCcPlayoutHistorys = null; - } // if (deep) } @@ -3307,14 +3300,6 @@ 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; } @@ -3442,14 +3427,6 @@ 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; } @@ -4374,12 +4351,6 @@ 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) @@ -5183,140 +5154,6 @@ 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 */ @@ -5433,18 +5270,12 @@ 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 dbfbeaf06..82ebc7851 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php @@ -695,9 +695,6 @@ 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 50a21a332..fe42ad88c 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php @@ -180,10 +180,6 @@ * @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 * @@ -2539,70 +2535,6 @@ 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/BaseCcListenerCount.php b/airtime_mvc/application/models/airtime/om/BaseCcListenerCount.php index 42c435123..04d4b60f3 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcListenerCount.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcListenerCount.php @@ -54,9 +54,9 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent protected $aCcTimestamp; /** - * @var CcMountName + * @var CcTimestamp */ - protected $aCcMountName; + protected $aCcTimestamp; /** * Flag to prevent endless save loop, if this object is referenced @@ -173,8 +173,8 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent $this->modifiedColumns[] = CcListenerCountPeer::MOUNT_NAME_ID; } - if ($this->aCcMountName !== null && $this->aCcMountName->getDbId() !== $v) { - $this->aCcMountName = null; + if ($this->aCcTimestamp !== null && $this->aCcTimestamp->getDbId() !== $v) { + $this->aCcTimestamp = null; } return $this; @@ -270,8 +270,8 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent if ($this->aCcTimestamp !== null && $this->timestamp_id !== $this->aCcTimestamp->getDbId()) { $this->aCcTimestamp = null; } - if ($this->aCcMountName !== null && $this->mount_name_id !== $this->aCcMountName->getDbId()) { - $this->aCcMountName = null; + if ($this->aCcTimestamp !== null && $this->mount_name_id !== $this->aCcTimestamp->getDbId()) { + $this->aCcTimestamp = null; } } // ensureConsistency @@ -313,7 +313,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent if ($deep) { // also de-associate any related objects? $this->aCcTimestamp = null; - $this->aCcMountName = null; + $this->aCcTimestamp = null; } // if (deep) } @@ -436,11 +436,11 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent $this->setCcTimestamp($this->aCcTimestamp); } - if ($this->aCcMountName !== null) { - if ($this->aCcMountName->isModified() || $this->aCcMountName->isNew()) { - $affectedRows += $this->aCcMountName->save($con); + if ($this->aCcTimestamp !== null) { + if ($this->aCcTimestamp->isModified() || $this->aCcTimestamp->isNew()) { + $affectedRows += $this->aCcTimestamp->save($con); } - $this->setCcMountName($this->aCcMountName); + $this->setCcTimestamp($this->aCcTimestamp); } if ($this->isNew() ) { @@ -543,9 +543,9 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent } } - if ($this->aCcMountName !== null) { - if (!$this->aCcMountName->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcMountName->getValidationFailures()); + if ($this->aCcTimestamp !== null) { + if (!$this->aCcTimestamp->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcTimestamp->getValidationFailures()); } } @@ -633,8 +633,8 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent if (null !== $this->aCcTimestamp) { $result['CcTimestamp'] = $this->aCcTimestamp->toArray($keyType, $includeLazyLoadColumns, true); } - if (null !== $this->aCcMountName) { - $result['CcMountName'] = $this->aCcMountName->toArray($keyType, $includeLazyLoadColumns, true); + if (null !== $this->aCcTimestamp) { + $result['CcTimestamp'] = $this->aCcTimestamp->toArray($keyType, $includeLazyLoadColumns, true); } } return $result; @@ -879,13 +879,13 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent } /** - * Declares an association between this object and a CcMountName object. + * Declares an association between this object and a CcTimestamp object. * - * @param CcMountName $v + * @param CcTimestamp $v * @return CcListenerCount The current object (for fluent API support) * @throws PropelException */ - public function setCcMountName(CcMountName $v = null) + public function setCcTimestamp(CcTimestamp $v = null) { if ($v === null) { $this->setDbMountNameId(NULL); @@ -893,10 +893,10 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent $this->setDbMountNameId($v->getDbId()); } - $this->aCcMountName = $v; + $this->aCcTimestamp = $v; // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcMountName object, it will not be re-added. + // If this object has already been added to the CcTimestamp object, it will not be re-added. if ($v !== null) { $v->addCcListenerCount($this); } @@ -906,25 +906,25 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent /** - * Get the associated CcMountName object + * Get the associated CcTimestamp object * * @param PropelPDO Optional Connection object. - * @return CcMountName The associated CcMountName object. + * @return CcTimestamp The associated CcTimestamp object. * @throws PropelException */ - public function getCcMountName(PropelPDO $con = null) + public function getCcTimestamp(PropelPDO $con = null) { - if ($this->aCcMountName === null && ($this->mount_name_id !== null)) { - $this->aCcMountName = CcMountNameQuery::create()->findPk($this->mount_name_id, $con); + if ($this->aCcTimestamp === null && ($this->mount_name_id !== null)) { + $this->aCcTimestamp = CcTimestampQuery::create()->findPk($this->mount_name_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->aCcMountName->addCcListenerCounts($this); + $this->aCcTimestamp->addCcListenerCounts($this); */ } - return $this->aCcMountName; + return $this->aCcTimestamp; } /** @@ -959,7 +959,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent } // if ($deep) $this->aCcTimestamp = null; - $this->aCcMountName = null; + $this->aCcTimestamp = null; } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcListenerCountPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcListenerCountPeer.php index dad3a53b9..9e3a7cb87 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcListenerCountPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcListenerCountPeer.php @@ -496,7 +496,7 @@ abstract class BaseCcListenerCountPeer { /** - * Returns the number of rows matching criteria, joining the related CcMountName table + * Returns the number of rows matching criteria, joining the related CcTimestamp table * * @param Criteria $criteria * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. @@ -504,7 +504,7 @@ abstract class BaseCcListenerCountPeer { * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return int Number of matching rows. */ - public static function doCountJoinCcMountName(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doCountJoinCcTimestamp(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; @@ -531,7 +531,7 @@ abstract class BaseCcListenerCountPeer { $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ); } - $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior); + $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcTimestampPeer::ID, $join_behavior); $stmt = BasePeer::doCount($criteria, $con); @@ -612,7 +612,7 @@ abstract class BaseCcListenerCountPeer { /** - * Selects a collection of CcListenerCount objects pre-filled with their CcMountName objects. + * Selects a collection of CcListenerCount objects pre-filled with their CcTimestamp objects. * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN @@ -620,7 +620,7 @@ abstract class BaseCcListenerCountPeer { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelectJoinCcMountName(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doSelectJoinCcTimestamp(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; @@ -631,9 +631,9 @@ abstract class BaseCcListenerCountPeer { CcListenerCountPeer::addSelectColumns($criteria); $startcol = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS); - CcMountNamePeer::addSelectColumns($criteria); + CcTimestampPeer::addSelectColumns($criteria); - $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior); + $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcTimestampPeer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -653,19 +653,19 @@ abstract class BaseCcListenerCountPeer { CcListenerCountPeer::addInstanceToPool($obj1, $key1); } // if $obj1 already loaded - $key2 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol); + $key2 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol); if ($key2 !== null) { - $obj2 = CcMountNamePeer::getInstanceFromPool($key2); + $obj2 = CcTimestampPeer::getInstanceFromPool($key2); if (!$obj2) { - $cls = CcMountNamePeer::getOMClass(false); + $cls = CcTimestampPeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol); - CcMountNamePeer::addInstanceToPool($obj2, $key2); + CcTimestampPeer::addInstanceToPool($obj2, $key2); } // if obj2 already loaded - // Add the $obj1 (CcListenerCount) to $obj2 (CcMountName) + // Add the $obj1 (CcListenerCount) to $obj2 (CcTimestamp) $obj2->addCcListenerCount($obj1); } // if joined row was not null @@ -715,7 +715,7 @@ abstract class BaseCcListenerCountPeer { $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior); - $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior); + $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcTimestampPeer::ID, $join_behavior); $stmt = BasePeer::doCount($criteria, $con); @@ -753,12 +753,12 @@ abstract class BaseCcListenerCountPeer { CcTimestampPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS); - CcMountNamePeer::addSelectColumns($criteria); - $startcol4 = $startcol3 + (CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS); + CcTimestampPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS); $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior); - $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior); + $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcTimestampPeer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -795,21 +795,21 @@ abstract class BaseCcListenerCountPeer { $obj2->addCcListenerCount($obj1); } // if joined row not null - // Add objects for joined CcMountName rows + // Add objects for joined CcTimestamp rows - $key3 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol3); + $key3 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { - $obj3 = CcMountNamePeer::getInstanceFromPool($key3); + $obj3 = CcTimestampPeer::getInstanceFromPool($key3); if (!$obj3) { - $cls = CcMountNamePeer::getOMClass(false); + $cls = CcTimestampPeer::getOMClass(false); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); - CcMountNamePeer::addInstanceToPool($obj3, $key3); + CcTimestampPeer::addInstanceToPool($obj3, $key3); } // if obj3 loaded - // Add the $obj1 (CcListenerCount) to the collection in $obj3 (CcMountName) + // Add the $obj1 (CcListenerCount) to the collection in $obj3 (CcTimestamp) $obj3->addCcListenerCount($obj1); } // if joined row not null @@ -856,8 +856,6 @@ abstract class BaseCcListenerCountPeer { $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ); } - $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior); - $stmt = BasePeer::doCount($criteria, $con); if ($row = $stmt->fetch(PDO::FETCH_NUM)) { @@ -871,7 +869,7 @@ abstract class BaseCcListenerCountPeer { /** - * Returns the number of rows matching criteria, joining the related CcMountName table + * Returns the number of rows matching criteria, joining the related CcTimestamp table * * @param Criteria $criteria * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. @@ -879,7 +877,7 @@ abstract class BaseCcListenerCountPeer { * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return int Number of matching rows. */ - public static function doCountJoinAllExceptCcMountName(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doCountJoinAllExceptCcTimestamp(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; @@ -906,8 +904,6 @@ abstract class BaseCcListenerCountPeer { $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ); } - $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior); - $stmt = BasePeer::doCount($criteria, $con); if ($row = $stmt->fetch(PDO::FETCH_NUM)) { @@ -944,11 +940,6 @@ abstract class BaseCcListenerCountPeer { CcListenerCountPeer::addSelectColumns($criteria); $startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS); - CcMountNamePeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior); - $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -967,25 +958,6 @@ abstract class BaseCcListenerCountPeer { CcListenerCountPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded - // Add objects for joined CcMountName rows - - $key2 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcMountNamePeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcMountNamePeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcMountNamePeer::addInstanceToPool($obj2, $key2); - } // if $obj2 already loaded - - // Add the $obj1 (CcListenerCount) to the collection in $obj2 (CcMountName) - $obj2->addCcListenerCount($obj1); - - } // if joined row is not null - $results[] = $obj1; } $stmt->closeCursor(); @@ -994,7 +966,7 @@ abstract class BaseCcListenerCountPeer { /** - * Selects a collection of CcListenerCount objects pre-filled with all related objects except CcMountName. + * Selects a collection of CcListenerCount objects pre-filled with all related objects except CcTimestamp. * * @param Criteria $criteria * @param PropelPDO $con @@ -1003,7 +975,7 @@ abstract class BaseCcListenerCountPeer { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelectJoinAllExceptCcMountName(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doSelectJoinAllExceptCcTimestamp(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; @@ -1017,11 +989,6 @@ abstract class BaseCcListenerCountPeer { CcListenerCountPeer::addSelectColumns($criteria); $startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS); - CcTimestampPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior); - $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -1040,25 +1007,6 @@ abstract class BaseCcListenerCountPeer { CcListenerCountPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded - // Add objects for joined CcTimestamp rows - - $key2 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcTimestampPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcTimestampPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcTimestampPeer::addInstanceToPool($obj2, $key2); - } // if $obj2 already loaded - - // Add the $obj1 (CcListenerCount) to the collection in $obj2 (CcTimestamp) - $obj2->addCcListenerCount($obj1); - - } // if joined row is not null - $results[] = $obj1; } $stmt->closeCursor(); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcListenerCountQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcListenerCountQuery.php index 30c702e6e..ed04cd146 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcListenerCountQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcListenerCountQuery.php @@ -24,9 +24,9 @@ * @method CcListenerCountQuery rightJoinCcTimestamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcTimestamp relation * @method CcListenerCountQuery innerJoinCcTimestamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcTimestamp relation * - * @method CcListenerCountQuery leftJoinCcMountName($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcMountName relation - * @method CcListenerCountQuery rightJoinCcMountName($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcMountName relation - * @method CcListenerCountQuery innerJoinCcMountName($relationAlias = '') Adds a INNER JOIN clause to the query using the CcMountName relation + * @method CcListenerCountQuery leftJoinCcTimestamp($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcTimestamp relation + * @method CcListenerCountQuery rightJoinCcTimestamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcTimestamp relation + * @method CcListenerCountQuery innerJoinCcTimestamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcTimestamp relation * * @method CcListenerCount findOne(PropelPDO $con = null) Return the first CcListenerCount matching the query * @method CcListenerCount findOneOrCreate(PropelPDO $con = null) Return the first CcListenerCount matching the query, or a new CcListenerCount object populated from the query conditions when no match is found @@ -324,31 +324,31 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria } /** - * Filter the query by a related CcMountName object + * Filter the query by a related CcTimestamp object * - * @param CcMountName $ccMountName the related object to use as filter + * @param CcTimestamp $ccTimestamp the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcListenerCountQuery The current query, for fluid interface */ - public function filterByCcMountName($ccMountName, $comparison = null) + public function filterByCcTimestamp($ccTimestamp, $comparison = null) { return $this - ->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $ccMountName->getDbId(), $comparison); + ->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $ccTimestamp->getDbId(), $comparison); } /** - * Adds a JOIN clause to the query using the CcMountName relation + * Adds a JOIN clause to the query using the CcTimestamp relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return CcListenerCountQuery The current query, for fluid interface */ - public function joinCcMountName($relationAlias = '', $joinType = Criteria::INNER_JOIN) + public function joinCcTimestamp($relationAlias = '', $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcMountName'); + $relationMap = $tableMap->getRelation('CcTimestamp'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -363,14 +363,14 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'CcMountName'); + $this->addJoinObject($join, 'CcTimestamp'); } return $this; } /** - * Use the CcMountName relation CcMountName object + * Use the CcTimestamp relation CcTimestamp object * * @see useQuery() * @@ -378,13 +378,13 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return CcMountNameQuery A secondary query class using the current class as primary query + * @return CcTimestampQuery A secondary query class using the current class as primary query */ - public function useCcMountNameQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + public function useCcTimestampQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) { return $this - ->joinCcMountName($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcMountName', 'CcMountNameQuery'); + ->joinCcTimestamp($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcTimestamp', 'CcTimestampQuery'); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMountName.php b/airtime_mvc/application/models/airtime/om/BaseCcMountName.php deleted file mode 100644 index b476f05a8..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcMountName.php +++ /dev/null @@ -1,893 +0,0 @@ -id; - } - - /** - * Get the [mount_name] column value. - * - * @return string - */ - public function getDbMountName() - { - return $this->mount_name; - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CcMountName 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[] = CcMountNamePeer::ID; - } - - return $this; - } // setDbId() - - /** - * Set the value of [mount_name] column. - * - * @param string $v new value - * @return CcMountName The current object (for fluent API support) - */ - public function setDbMountName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->mount_name !== $v) { - $this->mount_name = $v; - $this->modifiedColumns[] = CcMountNamePeer::MOUNT_NAME; - } - - return $this; - } // setDbMountName() - - /** - * 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->mount_name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 2; // 2 = CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcMountName 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(CcMountNamePeer::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 = CcMountNamePeer::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->collCcListenerCounts = 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcMountNameQuery::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(CcMountNamePeer::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); - CcMountNamePeer::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[] = CcMountNamePeer::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(CcMountNamePeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMountNamePeer::ID.')'); - } - - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows = 1; - $this->setDbId($pk); //[IMV] update autoincrement primary key - $this->setNew(false); - } else { - $affectedRows = CcMountNamePeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - if ($this->collCcListenerCounts !== null) { - foreach ($this->collCcListenerCounts 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 = CcMountNamePeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - if ($this->collCcListenerCounts !== null) { - foreach ($this->collCcListenerCounts 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 = CcMountNamePeer::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->getDbMountName(); - 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 = CcMountNamePeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getDbId(), - $keys[1] => $this->getDbMountName(), - ); - 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 = CcMountNamePeer::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->setDbMountName($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 = CcMountNamePeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setDbMountName($arr[$keys[1]]); - } - - /** - * 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(CcMountNamePeer::DATABASE_NAME); - - if ($this->isColumnModified(CcMountNamePeer::ID)) $criteria->add(CcMountNamePeer::ID, $this->id); - if ($this->isColumnModified(CcMountNamePeer::MOUNT_NAME)) $criteria->add(CcMountNamePeer::MOUNT_NAME, $this->mount_name); - - 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(CcMountNamePeer::DATABASE_NAME); - $criteria->add(CcMountNamePeer::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 CcMountName (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->setDbMountName($this->mount_name); - - 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->getCcListenerCounts() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcListenerCount($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 CcMountName 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 CcMountNamePeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcMountNamePeer(); - } - return self::$peer; - } - - /** - * Clears out the collCcListenerCounts 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 addCcListenerCounts() - */ - public function clearCcListenerCounts() - { - $this->collCcListenerCounts = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Initializes the collCcListenerCounts collection. - * - * By default this just sets the collCcListenerCounts collection to an empty array (like clearcollCcListenerCounts()); - * 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 initCcListenerCounts() - { - $this->collCcListenerCounts = new PropelObjectCollection(); - $this->collCcListenerCounts->setModel('CcListenerCount'); - } - - /** - * Gets an array of CcListenerCount 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 CcMountName 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 CcListenerCount[] List of CcListenerCount objects - * @throws PropelException - */ - public function getCcListenerCounts($criteria = null, PropelPDO $con = null) - { - if(null === $this->collCcListenerCounts || null !== $criteria) { - if ($this->isNew() && null === $this->collCcListenerCounts) { - // return empty collection - $this->initCcListenerCounts(); - } else { - $collCcListenerCounts = CcListenerCountQuery::create(null, $criteria) - ->filterByCcMountName($this) - ->find($con); - if (null !== $criteria) { - return $collCcListenerCounts; - } - $this->collCcListenerCounts = $collCcListenerCounts; - } - } - return $this->collCcListenerCounts; - } - - /** - * Returns the number of related CcListenerCount objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related CcListenerCount objects. - * @throws PropelException - */ - public function countCcListenerCounts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - if(null === $this->collCcListenerCounts || null !== $criteria) { - if ($this->isNew() && null === $this->collCcListenerCounts) { - return 0; - } else { - $query = CcListenerCountQuery::create(null, $criteria); - if($distinct) { - $query->distinct(); - } - return $query - ->filterByCcMountName($this) - ->count($con); - } - } else { - return count($this->collCcListenerCounts); - } - } - - /** - * Method called to associate a CcListenerCount object to this object - * through the CcListenerCount foreign key attribute. - * - * @param CcListenerCount $l CcListenerCount - * @return void - * @throws PropelException - */ - public function addCcListenerCount(CcListenerCount $l) - { - if ($this->collCcListenerCounts === null) { - $this->initCcListenerCounts(); - } - if (!$this->collCcListenerCounts->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcListenerCounts[]= $l; - $l->setCcMountName($this); - } - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this CcMountName is new, it will return - * an empty collection; or if this CcMountName has previously - * been saved, it will retrieve related CcListenerCounts 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 CcMountName. - * - * @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 CcListenerCount[] List of CcListenerCount objects - */ - public function getCcListenerCountsJoinCcTimestamp($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $query = CcListenerCountQuery::create(null, $criteria); - $query->joinWith('CcTimestamp', $join_behavior); - - return $this->getCcListenerCounts($query, $con); - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->mount_name = 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->collCcListenerCounts) { - foreach ((array) $this->collCcListenerCounts as $o) { - $o->clearAllReferences($deep); - } - } - } // if ($deep) - - $this->collCcListenerCounts = 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); - } - -} // BaseCcMountName diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMountNamePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcMountNamePeer.php deleted file mode 100644 index af2e416b1..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcMountNamePeer.php +++ /dev/null @@ -1,742 +0,0 @@ - array ('DbId', 'DbMountName', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbMountName', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::MOUNT_NAME, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'MOUNT_NAME', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'mount_name', ), - BasePeer::TYPE_NUM => array (0, 1, ) - ); - - /** - * 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, 'DbMountName' => 1, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbMountName' => 1, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::MOUNT_NAME => 1, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'MOUNT_NAME' => 1, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'mount_name' => 1, ), - BasePeer::TYPE_NUM => array (0, 1, ) - ); - - /** - * 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. CcMountNamePeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcMountNamePeer::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(CcMountNamePeer::ID); - $criteria->addSelectColumn(CcMountNamePeer::MOUNT_NAME); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.MOUNT_NAME'); - } - } - - /** - * 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(CcMountNamePeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcMountNamePeer::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(CcMountNamePeer::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 CcMountName - * @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 = CcMountNamePeer::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 CcMountNamePeer::populateObjects(CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcMountNamePeer::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 CcMountName $value A CcMountName object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcMountName $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 CcMountName object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcMountName) { - $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 CcMountName 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 CcMountName 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_mount_name - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - // Invalidate objects in CcListenerCountPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - CcListenerCountPeer::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 = CcMountNamePeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcMountNamePeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcMountNamePeer::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; - CcMountNamePeer::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 (CcMountName object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcMountNamePeer::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 + CcMountNamePeer::NUM_COLUMNS; - } else { - $cls = CcMountNamePeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcMountNamePeer::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(BaseCcMountNamePeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcMountNamePeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcMountNameTableMap()); - } - } - - /** - * 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 ? CcMountNamePeer::CLASS_DEFAULT : CcMountNamePeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcMountName or Criteria object. - * - * @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcMountName object - } - - if ($criteria->containsKey(CcMountNamePeer::ID) && $criteria->keyContainsValue(CcMountNamePeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMountNamePeer::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 CcMountName or Criteria object. - * - * @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcMountNamePeer::ID); - $value = $criteria->remove(CcMountNamePeer::ID); - if ($value) { - $selectCriteria->add(CcMountNamePeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcMountNamePeer::TABLE_NAME); - } - - } else { // $values is CcMountName 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_mount_name 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(CcMountNamePeer::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(CcMountNamePeer::TABLE_NAME, $con, CcMountNamePeer::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). - CcMountNamePeer::clearInstancePool(); - CcMountNamePeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcMountName or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::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. - CcMountNamePeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcMountName) { // it's a model object - // invalidate the cache for this single object - CcMountNamePeer::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(CcMountNamePeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcMountNamePeer::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); - CcMountNamePeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcMountName 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 CcMountName $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(CcMountName $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcMountNamePeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME, CcMountNamePeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcMountName - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcMountNamePeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcMountNamePeer::DATABASE_NAME); - $criteria->add(CcMountNamePeer::ID, $pk); - - $v = CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcMountNamePeer::DATABASE_NAME); - $criteria->add(CcMountNamePeer::ID, $pks, Criteria::IN); - $objs = CcMountNamePeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcMountNamePeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcMountNamePeer::buildTableMap(); - diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMountNameQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcMountNameQuery.php deleted file mode 100644 index 52af75f38..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcMountNameQuery.php +++ /dev/null @@ -1,259 +0,0 @@ -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 CcMountName|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcMountNamePeer::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 CcMountNameQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcMountNamePeer::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 CcMountNameQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcMountNamePeer::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 CcMountNameQuery 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(CcMountNamePeer::ID, $dbId, $comparison); - } - - /** - * Filter the query on the mount_name column - * - * @param string $dbMountName 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 CcMountNameQuery The current query, for fluid interface - */ - public function filterByDbMountName($dbMountName = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbMountName)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbMountName)) { - $dbMountName = str_replace('*', '%', $dbMountName); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcMountNamePeer::MOUNT_NAME, $dbMountName, $comparison); - } - - /** - * Filter the query by a related CcListenerCount object - * - * @param CcListenerCount $ccListenerCount the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcMountNameQuery The current query, for fluid interface - */ - public function filterByCcListenerCount($ccListenerCount, $comparison = null) - { - return $this - ->addUsingAlias(CcMountNamePeer::ID, $ccListenerCount->getDbMountNameId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcListenerCount relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcMountNameQuery The current query, for fluid interface - */ - public function joinCcListenerCount($relationAlias = '', $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcListenerCount'); - - // 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, 'CcListenerCount'); - } - - return $this; - } - - /** - * Use the CcListenerCount relation CcListenerCount 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 CcListenerCountQuery A secondary query class using the current class as primary query - */ - public function useCcListenerCountQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinCcListenerCount($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcListenerCount', 'CcListenerCountQuery'); - } - - /** - * Exclude object from result - * - * @param CcMountName $ccMountName Object to remove from the list of results - * - * @return CcMountNameQuery The current query, for fluid interface - */ - public function prune($ccMountName = null) - { - if ($ccMountName) { - $this->addUsingAlias(CcMountNamePeer::ID, $ccMountName->getDbId(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcMountNameQuery diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistory.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistory.php deleted file mode 100644 index 2e55a484f..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistory.php +++ /dev/null @@ -1,1288 +0,0 @@ -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 deleted file mode 100644 index a0cbb9539..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaData.php +++ /dev/null @@ -1,905 +0,0 @@ -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 deleted file mode 100644 index 0b980ec4e..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php +++ /dev/null @@ -1,983 +0,0 @@ - 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 deleted file mode 100644 index 7a27c61af..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php +++ /dev/null @@ -1,320 +0,0 @@ -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 deleted file mode 100644 index 01b944a65..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryPeer.php +++ /dev/null @@ -1,1378 +0,0 @@ - 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 deleted file mode 100644 index b772a0d7a..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryQuery.php +++ /dev/null @@ -1,509 +0,0 @@ -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 deleted file mode 100644 index 222227af6..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplate.php +++ /dev/null @@ -1,916 +0,0 @@ -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 deleted file mode 100644 index 3476aa459..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateField.php +++ /dev/null @@ -1,1076 +0,0 @@ -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 deleted file mode 100644 index 91586fa1d..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php +++ /dev/null @@ -1,998 +0,0 @@ - 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 deleted file mode 100644 index 2bccd58ca..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php +++ /dev/null @@ -1,402 +0,0 @@ -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 deleted file mode 100644 index 9e1d216f1..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplatePeer.php +++ /dev/null @@ -1,747 +0,0 @@ - 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 deleted file mode 100644 index ca2f84229..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateQuery.php +++ /dev/null @@ -1,285 +0,0 @@ -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 deleted file mode 100644 index bd2530992..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTag.php +++ /dev/null @@ -1,1028 +0,0 @@ -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 deleted file mode 100644 index 617bcf2dc..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTagPeer.php +++ /dev/null @@ -1,993 +0,0 @@ - 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 deleted file mode 100644 index 62b7eff77..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateTagQuery.php +++ /dev/null @@ -1,376 +0,0 @@ -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 a783a8e20..1caf7df62 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php @@ -125,11 +125,6 @@ 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. @@ -894,8 +889,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent $this->collCcSchedules = null; - $this->collCcPlayoutHistorys = null; - } // if (deep) } @@ -1071,14 +1064,6 @@ 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; } @@ -1190,14 +1175,6 @@ 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; } @@ -1530,12 +1507,6 @@ 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) @@ -2046,140 +2017,6 @@ 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 */ @@ -2228,16 +2065,10 @@ 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 ad91f182c..076f2182c 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php @@ -399,9 +399,6 @@ 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 871b907ae..08a245d2e 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php @@ -56,10 +56,6 @@ * @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 * @@ -852,70 +848,6 @@ 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 deleted file mode 100644 index af656868b..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcTag.php +++ /dev/null @@ -1,1306 +0,0 @@ -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 deleted file mode 100644 index 6a68b6ede..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcTagPeer.php +++ /dev/null @@ -1,753 +0,0 @@ - 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 deleted file mode 100644 index c90d8cb09..000000000 --- a/airtime_mvc/application/models/airtime/om/BaseCcTagQuery.php +++ /dev/null @@ -1,421 +0,0 @@ -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/models/airtime/om/BaseCcTimestamp.php b/airtime_mvc/application/models/airtime/om/BaseCcTimestamp.php index d61b8e513..5ede5b73c 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcTimestamp.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcTimestamp.php @@ -861,31 +861,6 @@ abstract class BaseCcTimestamp extends BaseObject implements Persistent } } - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this CcTimestamp is new, it will return - * an empty collection; or if this CcTimestamp has previously - * been saved, it will retrieve related CcListenerCounts 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 CcTimestamp. - * - * @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 CcListenerCount[] List of CcListenerCount objects - */ - public function getCcListenerCountsJoinCcMountName($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $query = CcListenerCountQuery::create(null, $criteria); - $query->joinWith('CcMountName', $join_behavior); - - return $this->getCcListenerCounts($query, $con); - } - /** * Clears the current object and sets all attributes to their default values */ diff --git a/airtime_mvc/application/services/CalendarService.php b/airtime_mvc/application/services/CalendarService.php index b0e1ad865..b0a98174f 100644 --- a/airtime_mvc/application/services/CalendarService.php +++ b/airtime_mvc/application/services/CalendarService.php @@ -45,16 +45,11 @@ class Application_Service_CalendarService if ($this->ccShowInstance->isRecorded()) { $ccFile = $this->ccShowInstance->getCcFiles(); - if (!isset($ccFile)) { - $menu["error when recording"] = array ( - "name" => _("Record file doesn't exist"), - "icon" => "error"); - }else { - $menu["view_recorded"] = array( - "name" => _("View Recorded File Metadata"), - "icon" => "overview", - "url" => $baseUrl."library/edit-file-md/id/".$ccFile->getDbId()); - } + + $menu["view_recorded"] = array( + "name" => _("View Recorded File Metadata"), + "icon" => "overview", + "url" => $baseUrl."library/edit-file-md/id/".$ccFile->getDbId()); //recorded show can be uploaded to soundcloud if (Application_Model_Preference::GetUploadToSoundcloudOption()) { @@ -80,10 +75,10 @@ class Application_Service_CalendarService } } else { //Show content can be modified from the calendar if: - // the show has not started, + // the show has not ended, // the user is admin or hosting the show, // the show is not recorded - if ($now < $start && ($isAdminOrPM || $isHostOfShow) && + if ($now < $end && ($isAdminOrPM || $isHostOfShow) && !$this->ccShowInstance->isRecorded() ) { $menu["schedule"] = array( @@ -333,4 +328,4 @@ class Application_Service_CalendarService } } -} +} \ No newline at end of file diff --git a/airtime_mvc/application/services/HistoryService.php b/airtime_mvc/application/services/HistoryService.php deleted file mode 100644 index 10e559c3b..000000000 --- a/airtime_mvc/application/services/HistoryService.php +++ /dev/null @@ -1,1465 +0,0 @@ -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/SchedulerService.php b/airtime_mvc/application/services/SchedulerService.php index c1dd6fc1f..7ab662c5c 100644 --- a/airtime_mvc/application/services/SchedulerService.php +++ b/airtime_mvc/application/services/SchedulerService.php @@ -248,24 +248,22 @@ class Application_Service_SchedulerService } } //foreach linked instance - if (!empty($values)) { - $insert_sql = "INSERT INTO cc_schedule (starts, ends, ". - "clip_length, fade_in, fade_out, cue_in, cue_out, ". - "file_id, stream_id, instance_id, position) VALUES ". - implode($values, ","); + $insert_sql = "INSERT INTO cc_schedule (starts, ends, ". + "clip_length, fade_in, fade_out, cue_in, cue_out, ". + "file_id, stream_id, instance_id, position) VALUES ". + implode($values, ","); - Application_Common_Database::prepareAndExecute( - $insert_sql, array(), Application_Common_Database::EXECUTE); + Application_Common_Database::prepareAndExecute( + $insert_sql, array(), Application_Common_Database::EXECUTE); - //update time_filled in cc_show_instances - $now = gmdate("Y-m-d H:i:s"); - $update_sql = "UPDATE cc_show_instances SET ". - "time_filled = '{$timeFilled}', ". - "last_scheduled = '{$now}' ". - "WHERE show_id = {$ccShow->getDbId()}"; - Application_Common_Database::prepareAndExecute( - $update_sql, array(), Application_Common_Database::EXECUTE); - } + //update time_filled in cc_show_instances + $now = gmdate("Y-m-d H:i:s"); + $update_sql = "UPDATE cc_show_instances SET ". + "time_filled = '{$timeFilled}', ". + "last_scheduled = '{$now}' ". + "WHERE show_id = {$ccShow->getDbId()}"; + Application_Common_Database::prepareAndExecute( + $update_sql, array(), Application_Common_Database::EXECUTE); } //if at least one linked instance has content } diff --git a/airtime_mvc/application/services/ShowFormService.php b/airtime_mvc/application/services/ShowFormService.php index c651c8ebd..6b3e67239 100644 --- a/airtime_mvc/application/services/ShowFormService.php +++ b/airtime_mvc/application/services/ShowFormService.php @@ -441,7 +441,7 @@ class Application_Service_ShowFormService $rebroadcast = true; $absRebroadcast = true; - if (isset($formData["add_show_rebroadcast"]) && $formData["add_show_rebroadcast"]) { + if ($formData["add_show_rebroadcast"]) { $formData["add_show_duration"] = Application_Service_ShowService::formatShowDuration( $formData["add_show_duration"]); $absRebroadcast = $forms["abs_rebroadcast"]->isValid($formData); diff --git a/airtime_mvc/application/services/ShowService.php b/airtime_mvc/application/services/ShowService.php index 8b39eadd1..f0adcbfff 100644 --- a/airtime_mvc/application/services/ShowService.php +++ b/airtime_mvc/application/services/ShowService.php @@ -169,8 +169,8 @@ class Application_Service_ShowService } /** - * - * Receives a cc_show id and determines whether to create a + * + * Receives a cc_show id and determines whether to create a * single show instance or repeating show instances */ public function delegateInstanceCreation($daysAdded=null, $end=null, $fillInstances=false) @@ -179,6 +179,9 @@ class Application_Service_ShowService if (is_null($this->ccShow)) { $ccShowDays = $this->getShowDaysInRange($populateUntil, $end); + if (count($ccShowDays) > 0) { + $this->ccShow = $ccShowDays[0]->getCcShow(); + } } else { $ccShowDays = $this->ccShow->getCcShowDays(); } @@ -187,22 +190,7 @@ class Application_Service_ShowService $populateUntil = $end; } - /* In case the user is moving forward in the calendar and there are - * linked shows in the schedule we need to keep track of each cc_show - * so we know which shows need to be filled with content - */ - $ccShows = array(); - foreach ($ccShowDays as $day) { - - $this->ccShow = $day->getCcShow(); - $this->isRecorded = isset($this->isRecorded) ? $this->isRecorded : $this->ccShow->isRecorded(); - $this->isRebroadcast = isset($this->isRebroadcast) ? $this->isRebroadcast : $this->ccShow->isRebroadcast(); - - if (!isset($ccShows[$day->getDbShowId()])) { - $ccShows[$day->getDbShowId()] = $day->getccShow(); - } - switch ($day->getDbRepeatType()) { case NO_REPEAT: $this->createNonRepeatingInstance($day, $populateUntil); @@ -224,10 +212,9 @@ class Application_Service_ShowService } } - foreach ($ccShows as $ccShow) { - if (($this->isUpdate || $fillInstances) && $ccShow->isLinked()) { - Application_Service_SchedulerService::fillNewLinkedInstances($ccShow); - } + if (isset($this->ccShow) && ($this->isUpdate || $fillInstances) && + $this->ccShow->isLinked()) { + Application_Service_SchedulerService::fillNewLinkedInstances($this->ccShow); } if (isset($this->linkedShowContent)) { @@ -277,7 +264,7 @@ class Application_Service_ShowService } /** - * + * * Deletes all the cc_show_days entries for a specific show * that is currently being edited. They will get recreated with * the new show day specs @@ -302,12 +289,12 @@ SQL; /** * TODO: This function is messy. Needs refactoring - * + * * When editing a show we may need to perform some actions to reflect the new specs: * - Delete some show instances * - Update duration * - Update start and end time - * + * * @param $showData edit show form values in raw form * @param $isRecorded value computed from the edit show form * @param $repeatType value computed from the edit show form @@ -346,7 +333,7 @@ SQL; //if the start date changes, these are the repeat types //that require show instance deletion - $deleteRepeatTypes = array(REPEAT_BI_WEEKLY, REPEAT_MONTHLY_MONTHLY, + $deleteRepeatTypes = array(REPEAT_BI_WEEKLY, REPEAT_MONTHLY_MONTHLY, REPEAT_MONTHLY_WEEKLY); if (in_array($this->repeatType, $deleteRepeatTypes) && @@ -410,7 +397,7 @@ SQL; $this->deleteInstancesBeforeDate($showData['add_show_start_date'], $showId); } - + } } @@ -500,7 +487,7 @@ SQL; } /** - * + * * Enter description here ... * @param $daysRemoved array of days (days of the week) removed * (days of the week are represented numerically @@ -631,45 +618,29 @@ SQL; ->filterByDbShowId($showId) ->filterByDbModifiedInstance(false) ->filterByDbRebroadcast(0) - ->orderByDbStarts() ->find(); if ($ccShowInstances->isEmpty()) { return true; } - /* We need to update the last_show in cc_show_days so the instances - * don't get recreated as the user moves forward in the calendar - */ - else if (count($ccShowInstances) >= 1) { - $lastShowDays = array(); - /* Creates an array where the key is the day of the week (monday, - * tuesday, etc.) and the value is the last show date for each - * day of the week. We will use this array to update the last_show - * for each cc_show_days entry of a cc_show - */ - foreach ($ccShowInstances as $instance) { - $instanceStartDT = new DateTime($instance->getDbStarts(), - new DateTimeZone("UTC")); - $lastShowDays[$instanceStartDT->format("w")] = $instanceStartDT; - } + //only 1 show instance left of the show, make it non repeating. + else if (count($ccShowInstances) === 1) { + $ccShowInstance = $ccShowInstances[0]; - foreach ($lastShowDays as $dayOfWeek => $lastShowStartDT) { - $ccShowDay = CcShowDaysQuery::create() - ->filterByDbShowId($showId) - ->filterByDbDay($dayOfWeek) - ->findOne(); + $ccShowDay = CcShowDaysQuery::create() + ->filterByDbShowId($showId) + ->findOne(); + $tz = $ccShowDay->getDbTimezone(); - if (isset($ccShowDay)) { - $lastShowStartDT->setTimeZone(new DateTimeZone( - $ccShowDay->getDbTimezone())); - $lastShowEndDT = Application_Service_CalendarService::addDeltas( - $lastShowStartDT, 1, 0); + $startDate = new DateTime($ccShowInstance->getDbStarts(), new DateTimeZone("UTC")); + $startDate->setTimeZone(new DateTimeZone($tz)); + $endDate = Application_Service_CalendarService::addDeltas($startDate, 1, 0); - $ccShowDay - ->setDbLastShow($lastShowEndDT->format("Y-m-d")) - ->save(); - } - } + $ccShowDay->setDbFirstShow($startDate->format("Y-m-d")); + $ccShowDay->setDbLastShow($endDate->format("Y-m-d")); + $ccShowDay->setDbStartTime($startDate->format("H:i:s")); + $ccShowDay->setDbRepeatType(-1); + $ccShowDay->save(); //remove the old repeating deleted instances. CcShowInstancesQuery::create() @@ -712,10 +683,10 @@ SQL; } /** - * + * * Determines what the show end date should be based on * the form data - * + * * @param $showData add/edit show form data * @return DateTime object in user's local timezone */ @@ -758,10 +729,10 @@ SQL; } /** - * + * * Returns the difference in seconds between a show's new and * old start time - * + * * @param $newStartDateTime DateTime object * @param $oldStartDateTime DateTime object */ @@ -771,9 +742,9 @@ SQL; } /** - * + * * Updates the start and end time for cc_show_instances - * + * * @param $showData edit show form data */ private function updateInstanceStartEndTime($diff) @@ -787,13 +758,13 @@ WHERE show_id = :showId SQL; Application_Common_Database::prepareAndExecute($sql, - array(':diff1' => $diff, ':diff2' => $diff, + array(':diff1' => $diff, ':diff2' => $diff, ':showId' => $this->ccShow->getDbId(), ':timestamp' => gmdate("Y-m-d H:i:s")), 'execute'); } /** - * + * * Enter description here ... * @param ccShowDays $showDay * @param DateTime $showStartDate user's local time @@ -830,7 +801,7 @@ SQL; } /** - * + * * Sets a single cc_show_instance table row * @param $showDay * @param $populateUntil @@ -867,7 +838,7 @@ SQL; } /** - * + * * Sets multiple cc_show_instances table rows * @param unknown_type $showDay * @param unknown_type $populateUntil @@ -877,7 +848,6 @@ SQL; private function createWeeklyRepeatInstances($showDay, $populateUntil, $repeatType, $repeatInterval, $daysAdded=null) { - $show_id = $showDay->getDbShowId(); $first_show = $showDay->getDbFirstShow(); //non-UTC $last_show = $showDay->getDbLastShow(); //non-UTC @@ -900,15 +870,16 @@ SQL; $utcLastShowDateTime = $last_show ? Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null; + $utcStartDateTime = new DateTime("now"); $previousDate = clone $start; - foreach ($datePeriod as $date) { + list($utcStartDateTime, $utcEndDateTime) = $this->createUTCStartEndDateTime( $date, $duration); /* * Make sure start date is less than populate until date AND * last show date is null OR start date is less than last show date - * + * * (NOTE: We cannot call getTimestamp() to compare the dates because of * a PHP 5.3.3 bug with DatePeriod objects - See CC-5159 for more details) */ @@ -916,7 +887,6 @@ SQL; ( is_null($utcLastShowDateTime) || $utcStartDateTime->format("Y-m-d H:i:s") < $utcLastShowDateTime->format("Y-m-d H:i:s")) ) { - $lastCreatedShow = clone $utcStartDateTime; /* There may not always be an instance when editing a show * This will be the case when we are adding a new show day to * a repeating show @@ -960,20 +930,12 @@ SQL; $previousDate = clone $date; } - /* We need to set the next populate date for repeat shows so when a user - * moves forward in the calendar we know when to start generating new - * show instances. - * If $utcStartDateTime is not set then we know zero new shows were - * created and we shouldn't update the next populate date. + /* Set UTC to local time before setting the next repeat date. If we don't + * the next repeat date might be scheduled for the following day */ - if (isset($lastCreatedShow)) { - /* Set UTC to local time before setting the next repeat date. If we don't - * the next repeat date might be scheduled for the following day - * THIS MUST BE IN THE TIMEZONE THE SHOW WAS CREATED IN */ - $lastCreatedShow->setTimezone(new DateTimeZone($timezone)); - $nextDate = $lastCreatedShow->add($repeatInterval); - $this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id); - } + $utcStartDateTime->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone())); + $nextDate = $utcStartDateTime->add($repeatInterval); + $this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id); } private function createMonthlyRepeatInstances($showDay, $populateUntil) @@ -1015,7 +977,6 @@ SQL; ( is_null($utcLastShowDateTime) || $utcStartDateTime->getTimestamp() < $utcLastShowDateTime->getTimestamp()) ) { - $lastCreatedShow = clone $utcStartDateTime; /* There may not always be an instance when editing a show * This will be the case when we are adding a new show day to * a repeating show @@ -1069,10 +1030,10 @@ SQL; } /** - * + * * i.e. last thursday of each month * i.e. second monday of each month - * + * * @param string $showStart * @param string $timezone user's local timezone */ @@ -1117,7 +1078,7 @@ SQL; } /** - * + * * Enter description here ... * @param $start user's local time */ @@ -1187,7 +1148,7 @@ SQL; } /** - * + * * Create a DatePeriod object in the user's local time * It will get converted to UTC before the show instance gets created */ @@ -1208,11 +1169,11 @@ SQL; } /** - * + * * Attempts to retrieve the cc_show_instance belonging to a cc_show * that starts at $starts. We have to pass in the start * time in case the show is repeating - * + * * Returns the instance if one was found (one that is not a recording * and modified instance is false (has not been deleted)) */ @@ -1255,7 +1216,7 @@ SQL; } /** - * + * * Sets the fields for a cc_show table row * @param $ccShow * @param $showData @@ -1290,7 +1251,7 @@ SQL; } /** - * + * * Sets the fields for a cc_show_days table row * @param $showData * @param $showId @@ -1372,7 +1333,7 @@ SQL; } /** - * + * * Deletes all the cc_show_rebroadcast entries for a specific show * that is currently being edited. They will get recreated with * the new show specs @@ -1383,7 +1344,7 @@ SQL; } /** - * + * * Sets the fields for a cc_show_rebroadcast table row * @param $showData * @param $showId @@ -1422,7 +1383,7 @@ SQL; } /** - * + * * Deletes all the cc_show_hosts entries for a specific show * that is currently being edited. They will get recreated with * the new show specs @@ -1433,7 +1394,7 @@ SQL; } /** - * + * * Sets the fields for a cc_show_hosts table row * @param $showData * @param $showId @@ -1451,10 +1412,10 @@ SQL; } /** - * + * * Gets the date and time shows (particularly repeating shows) * can be populated until. - * + * * @return DateTime object */ private static function getPopulateShowUntilDateTIme() @@ -1469,13 +1430,13 @@ SQL; } /** - * + * * Enter description here ... * @param DateTime $showStart user's local time * @param string $duration time interval (h)h:(m)m(:ss) * @param string $timezone "Europe/Prague" * @param array $offset (days, hours, mins) used for rebroadcast shows - * + * * @return array of 2 DateTime objects, start/end time of the show in UTC */ private function createUTCStartEndDateTime($showStart, $duration, $offset=null) @@ -1501,12 +1462,12 @@ SQL; } /** - * + * * Show instances for repeating shows only get created up * until what is visible on the calendar. We need to set the * date for when the next repeating show instance should be created * as the user browses the calendar further. - * + * * @param $nextDate * @param $showId * @param $day @@ -1523,4 +1484,4 @@ SQL; $repeatInfo->setDbNextPopDate($nextInfo[0]) ->save(); } -} +} \ No newline at end of file diff --git a/airtime_mvc/application/services/UserService.php b/airtime_mvc/application/services/UserService.php index 40e077a39..879ba4d48 100644 --- a/airtime_mvc/application/services/UserService.php +++ b/airtime_mvc/application/services/UserService.php @@ -1,5 +1,10 @@ ' + - '
' + - '' + - DPGlobal.headTemplate + - DPGlobal.contTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - '
'+ - '
'; - var TPGlobal = { - hourTemplate: '', - minuteTemplate: '', - secondTemplate: '' - }; - TPGlobal.getTemplate = function(is12Hours, showSeconds) { - return ( - '
' + - '' + - '' + - '' + - '' + - '' + - (showSeconds ? - '' + - '': '')+ - (is12Hours ? '' : '') + - '' + - '' + - ' ' + - '' + - ' ' + - (showSeconds ? - '' + - '' : '') + - (is12Hours ? - '' + - '' : '') + - '' + - '' + - '' + - '' + - '' + - (showSeconds ? - '' + - '': '') + - (is12Hours ? '' : '') + - '' + - '
' + TPGlobal.hourTemplate + ':' + TPGlobal.minuteTemplate + ':' + TPGlobal.secondTemplate + '' + - '' + - '
' + - '
' + - '
' + - '' + - '
'+ - '
'+ - '
' + - '' + - '
'+ - '
'+ - (showSeconds ? - '
' + - '' + - '
'+ - '
': '') - ); - } - - -})(window.jQuery) \ No newline at end of file diff --git a/airtime_mvc/public/js/bootstrap-datetime/bootstrap-datetimepicker.min.js b/airtime_mvc/public/js/bootstrap-datetime/bootstrap-datetimepicker.min.js deleted file mode 100644 index a30f77645..000000000 --- a/airtime_mvc/public/js/bootstrap-datetime/bootstrap-datetimepicker.min.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @license - * ========================================================= - * bootstrap-datetimepicker.js - * http://www.eyecon.ro/bootstrap-datepicker - * ========================================================= - * Copyright 2012 Stefan Petre - * - * Contributions: - * - Andrew Rowls - * - Thiago de Arruda - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================= - */ -(function($){var smartPhone=window.orientation!=undefined;var DateTimePicker=function(element,options){this.id=dpgId++;this.init(element,options)};var dateToDate=function(dt){if(typeof dt==="string"){return new Date(dt)}return dt};DateTimePicker.prototype={constructor:DateTimePicker,init:function(element,options){var icon;if(!(options.pickTime||options.pickDate))throw new Error("Must choose at least one picker");this.options=options;this.$element=$(element);this.language=options.language in dates?options.language:"en";this.pickDate=options.pickDate;this.pickTime=options.pickTime;this.isInput=this.$element.is("input");this.component=false;if(this.$element.find(".input-append")||this.$element.find(".input-prepend"))this.component=this.$element.find(".add-on");this.format=options.format;if(!this.format){if(this.isInput)this.format=this.$element.data("format");else this.format=this.$element.find("input").data("format");if(!this.format)this.format="MM/dd/yyyy"}this._compileFormat();if(this.component){icon=this.component.find("i")}if(this.pickTime){if(icon&&icon.length)this.timeIcon=icon.data("time-icon");if(!this.timeIcon)this.timeIcon="icon-time";icon.addClass(this.timeIcon)}if(this.pickDate){if(icon&&icon.length)this.dateIcon=icon.data("date-icon");if(!this.dateIcon)this.dateIcon="icon-calendar";icon.removeClass(this.timeIcon);icon.addClass(this.dateIcon)}this.widget=$(getTemplate(this.timeIcon,options.pickDate,options.pickTime,options.pick12HourFormat,options.pickSeconds,options.collapse)).appendTo("body");this.minViewMode=options.minViewMode||this.$element.data("date-minviewmode")||0;if(typeof this.minViewMode==="string"){switch(this.minViewMode){case"months":this.minViewMode=1;break;case"years":this.minViewMode=2;break;default:this.minViewMode=0;break}}this.viewMode=options.viewMode||this.$element.data("date-viewmode")||0;if(typeof this.viewMode==="string"){switch(this.viewMode){case"months":this.viewMode=1;break;case"years":this.viewMode=2;break;default:this.viewMode=0;break}}this.startViewMode=this.viewMode;this.weekStart=options.weekStart||this.$element.data("date-weekstart")||0;this.weekEnd=this.weekStart===0?6:this.weekStart-1;this.setStartDate(options.startDate||this.$element.data("date-startdate"));this.setEndDate(options.endDate||this.$element.data("date-enddate"));this.fillDow();this.fillMonths();this.fillHours();this.fillMinutes();this.fillSeconds();this.update();this.showMode();this._attachDatePickerEvents()},show:function(e){this.widget.show();this.height=this.component?this.component.outerHeight():this.$element.outerHeight();this.place();this.$element.trigger({type:"show",date:this._date});this._attachDatePickerGlobalEvents();if(e){e.stopPropagation();e.preventDefault()}},disable:function(){this.$element.find("input").prop("disabled",true);this._detachDatePickerEvents()},enable:function(){this.$element.find("input").prop("disabled",false);this._attachDatePickerEvents()},hide:function(){var collapse=this.widget.find(".collapse");for(var i=0;i");while(dowCnt'+dates[this.language].daysMin[dowCnt++%7]+"")}this.widget.find(".datepicker-days thead").append(html)},fillMonths:function(){var html="";var i=0;while(i<12){html+=''+dates[this.language].monthsShort[i++]+""}this.widget.find(".datepicker-months td").append(html)},fillDate:function(){var year=this.viewDate.getUTCFullYear();var month=this.viewDate.getUTCMonth();var currentDate=UTCDate(this._date.getUTCFullYear(),this._date.getUTCMonth(),this._date.getUTCDate(),0,0,0,0);var startYear=typeof this.startDate==="object"?this.startDate.getUTCFullYear():-Infinity;var startMonth=typeof this.startDate==="object"?this.startDate.getUTCMonth():-1;var endYear=typeof this.endDate==="object"?this.endDate.getUTCFullYear():Infinity;var endMonth=typeof this.endDate==="object"?this.endDate.getUTCMonth():12;this.widget.find(".datepicker-days").find(".disabled").removeClass("disabled");this.widget.find(".datepicker-months").find(".disabled").removeClass("disabled");this.widget.find(".datepicker-years").find(".disabled").removeClass("disabled");this.widget.find(".datepicker-days th:eq(1)").text(dates[this.language].months[month]+" "+year);var prevMonth=UTCDate(year,month-1,28,0,0,0,0);var day=DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(),prevMonth.getUTCMonth());prevMonth.setUTCDate(day);prevMonth.setUTCDate(day-(prevMonth.getUTCDay()-this.weekStart+7)%7);if(year==startYear&&month<=startMonth||year=endMonth||year>endYear){this.widget.find(".datepicker-days th:eq(2)").addClass("disabled")}var nextMonth=new Date(prevMonth.valueOf());nextMonth.setUTCDate(nextMonth.getUTCDate()+42);nextMonth=nextMonth.valueOf();var html=[];var row;var clsName;while(prevMonth.valueOf()");html.push(row)}clsName="";if(prevMonth.getUTCFullYear()year||prevMonth.getUTCFullYear()==year&&prevMonth.getUTCMonth()>month){clsName+=" new"}if(prevMonth.valueOf()===currentDate.valueOf()){clsName+=" active"}if(prevMonth.valueOf()+864e5<=this.startDate){clsName+=" disabled"}if(prevMonth.valueOf()>this.endDate){clsName+=" disabled"}row.append(''+prevMonth.getUTCDate()+"");prevMonth.setUTCDate(prevMonth.getUTCDate()+1)}this.widget.find(".datepicker-days tbody").empty().append(html);var currentYear=this._date.getUTCFullYear();var months=this.widget.find(".datepicker-months").find("th:eq(1)").text(year).end().find("span").removeClass("active");if(currentYear===year){months.eq(this._date.getUTCMonth()).addClass("active")}if(currentYear-1endYear){this.widget.find(".datepicker-months th:eq(2)").addClass("disabled")}for(var i=0;i<12;i++){if(year==startYear&&startMonth>i||yearendYear){$(months[i]).addClass("disabled")}}html="";year=parseInt(year/10,10)*10;var yearCont=this.widget.find(".datepicker-years").find("th:eq(1)").text(year+"-"+(year+9)).end().find("td");this.widget.find(".datepicker-years").find("th").removeClass("disabled");if(startYear>year){this.widget.find(".datepicker-years").find("th:eq(0)").addClass("disabled")}if(endYearendYear?" disabled":"")+'">'+year+"";year+=1}yearCont.html(html)},fillHours:function(){var table=this.widget.find(".timepicker .timepicker-hours table");table.parent().hide();var html="";if(this.options.pick12HourFormat){var current=1;for(var i=0;i<3;i+=1){html+="";for(var j=0;j<4;j+=1){var c=current.toString();html+=''+padLeft(c,2,"0")+"";current++}html+=""}}else{var current=0;for(var i=0;i<6;i+=1){html+="";for(var j=0;j<4;j+=1){var c=current.toString();html+=''+padLeft(c,2,"0")+"";current++}html+=""}}table.html(html)},fillMinutes:function(){var table=this.widget.find(".timepicker .timepicker-minutes table");table.parent().hide();var html="";var current=0;for(var i=0;i<5;i++){html+="";for(var j=0;j<4;j+=1){var c=current.toString();html+=''+padLeft(c,2,"0")+"";current+=3}html+=""}table.html(html)},fillSeconds:function(){var table=this.widget.find(".timepicker .timepicker-seconds table");table.parent().hide();var html="";var current=0;for(var i=0;i<5;i++){html+="";for(var j=0;j<4;j+=1){var c=current.toString();html+=''+padLeft(c,2,"0")+"";current+=3}html+=""}table.html(html)},fillTime:function(){if(!this._date)return;var timeComponents=this.widget.find(".timepicker span[data-time-component]");var table=timeComponents.closest("table");var is12HourFormat=this.options.pick12HourFormat;var hour=this._date.getUTCHours();var period="AM";if(is12HourFormat){if(hour>=12)period="PM";if(hour===0)hour=12;else if(hour!=12)hour=hour%12;this.widget.find(".timepicker [data-action=togglePeriod]").text(period)}hour=padLeft(hour.toString(),2,"0");var minute=padLeft(this._date.getUTCMinutes().toString(),2,"0");var second=padLeft(this._date.getUTCSeconds().toString(),2,"0");timeComponents.filter("[data-time-component=hours]").text(hour);timeComponents.filter("[data-time-component=minutes]").text(minute);timeComponents.filter("[data-time-component=seconds]").text(second)},click:function(e){e.stopPropagation();e.preventDefault();this._unset=false;var target=$(e.target).closest("span, td, th");if(target.length===1){if(!target.is(".disabled")){switch(target[0].nodeName.toLowerCase()){case"th":switch(target[0].className){case"switch":this.showMode(1);break;case"prev":case"next":var vd=this.viewDate;var navFnc=DPGlobal.modes[this.viewMode].navFnc;var step=DPGlobal.modes[this.viewMode].navStep;if(target[0].className==="prev")step=step*-1;vd["set"+navFnc](vd["get"+navFnc]()+step);this.fillDate();this.set();break}break;case"span":if(target.is(".month")){var month=target.parent().find("span").index(target);this.viewDate.setUTCMonth(month)}else{var year=parseInt(target.text(),10)||0;this.viewDate.setUTCFullYear(year)}if(this.viewMode!==0){this._date=UTCDate(this.viewDate.getUTCFullYear(),this.viewDate.getUTCMonth(),this.viewDate.getUTCDate(),this._date.getUTCHours(),this._date.getUTCMinutes(),this._date.getUTCSeconds(),this._date.getUTCMilliseconds());this.notifyChange()}this.showMode(-1);this.fillDate();this.set();break;case"td":if(target.is(".day")){var day=parseInt(target.text(),10)||1;var month=this.viewDate.getUTCMonth();var year=this.viewDate.getUTCFullYear();if(target.is(".old")){if(month===0){month=11;year-=1}else{month-=1}}else if(target.is(".new")){if(month==11){month=0;year+=1}else{month+=1}}this._date=UTCDate(year,month,day,this._date.getUTCHours(),this._date.getUTCMinutes(),this._date.getUTCSeconds(),this._date.getUTCMilliseconds());this.viewDate=UTCDate(year,month,Math.min(28,day),0,0,0,0);this.fillDate();this.set();this.notifyChange()}break}}}},actions:{incrementHours:function(e){this._date.setUTCHours(this._date.getUTCHours()+1)},incrementMinutes:function(e){this._date.setUTCMinutes(this._date.getUTCMinutes()+1)},incrementSeconds:function(e){this._date.setUTCSeconds(this._date.getUTCSeconds()+1)},decrementHours:function(e){this._date.setUTCHours(this._date.getUTCHours()-1)},decrementMinutes:function(e){this._date.setUTCMinutes(this._date.getUTCMinutes()-1)},decrementSeconds:function(e){this._date.setUTCSeconds(this._date.getUTCSeconds()-1)},togglePeriod:function(e){var hour=this._date.getUTCHours();if(hour>=12)hour-=12;else hour+=12;this._date.setUTCHours(hour)},showPicker:function(){this.widget.find(".timepicker > div:not(.timepicker-picker)").hide();this.widget.find(".timepicker .timepicker-picker").show()},showHours:function(){this.widget.find(".timepicker .timepicker-picker").hide();this.widget.find(".timepicker .timepicker-hours").show()},showMinutes:function(){this.widget.find(".timepicker .timepicker-picker").hide();this.widget.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){this.widget.find(".timepicker .timepicker-picker").hide();this.widget.find(".timepicker .timepicker-seconds").show()},selectHour:function(e){var tgt=$(e.target);var value=parseInt(tgt.text(),10);if(this.options.pick12HourFormat){var current=this._date.getUTCHours();if(current>=12){if(value!=12)value=(value+12)%24}else{if(value===12)value=0;else value=value%12}}this._date.setUTCHours(value);this.actions.showPicker.call(this)},selectMinute:function(e){var tgt=$(e.target);var value=parseInt(tgt.text(),10);this._date.setUTCMinutes(value);this.actions.showPicker.call(this)},selectSecond:function(e){var tgt=$(e.target);var value=parseInt(tgt.text(),10);this._date.setUTCSeconds(value);this.actions.showPicker.call(this)}},doAction:function(e){e.stopPropagation();e.preventDefault();if(!this._date)this._date=UTCDate(1970,0,0,0,0,0,0);var action=$(e.currentTarget).data("action");var rv=this.actions[action].apply(this,arguments);this.set();this.fillTime();this.notifyChange();return rv},stopEvent:function(e){e.stopPropagation();e.preventDefault()},keydown:function(e){var self=this,k=e.which,input=$(e.target);if(k==8||k==46){setTimeout(function(){self._resetMaskPos(input)})}},keypress:function(e){var k=e.which;if(k==8||k==46){return}var input=$(e.target);var c=String.fromCharCode(k);var val=input.val()||"";val+=c;var mask=this._mask[this._maskPos];if(!mask){return false}if(mask.end!=val.length){return}if(!mask.pattern.test(val.slice(mask.start))){val=val.slice(0,val.length-1);while((mask=this._mask[this._maskPos])&&mask.character){val+=mask.character;this._maskPos++}val+=c;if(mask.end!=val.length){input.val(val);return false}else{if(!mask.pattern.test(val.slice(mask.start))){input.val(val.slice(0,mask.start));return false}else{input.val(val);this._maskPos++;return false}}}else{this._maskPos++}},change:function(e){var input=$(e.target);var val=input.val();if(this._formatPattern.test(val)){this.update();this.setValue(this._date.getTime());this.notifyChange();this.set()}else if(val&&val.trim()){this.setValue(this._date.getTime());if(this._date)this.set();else input.val("")}else{if(this._date){this.setValue(null);this.notifyChange();this._unset=true}}this._resetMaskPos(input)},showMode:function(dir){if(dir){this.viewMode=Math.max(this.minViewMode,Math.min(2,this.viewMode+dir))}this.widget.find(".datepicker > div").hide().filter(".datepicker-"+DPGlobal.modes[this.viewMode].clsName).show()},destroy:function(){this._detachDatePickerEvents();this._detachDatePickerGlobalEvents();this.widget.remove();this.$element.removeData("datetimepicker");this.component.removeData("datetimepicker")},formatDate:function(d){return this.format.replace(formatReplacer,function(match){var methodName,property,rv,len=match.length;if(match==="ms")len=1;property=dateFormatComponents[match].property;if(property==="Hours12"){rv=d.getUTCHours();if(rv===0)rv=12;else if(rv!==12)rv=rv%12}else if(property==="Period12"){if(d.getUTCHours()>=12)return"PM";else return"AM"}else{methodName="get"+property;rv=d[methodName]()}if(methodName==="getUTCMonth")rv=rv+1;if(methodName==="getUTCYear")rv=rv+1900-2e3;return padLeft(rv.toString(),len,"0")})},parseDate:function(str){var match,i,property,methodName,value,parsed={};if(!(match=this._formatPattern.exec(str)))return null;for(i=1;ival.length){this._maskPos=i;break}else if(this._mask[i].end===val.length){this._maskPos=i+1;break}}},_finishParsingDate:function(parsed){var year,month,date,hours,minutes,seconds,milliseconds;year=parsed.UTCFullYear;if(parsed.UTCYear)year=2e3+parsed.UTCYear;if(!year)year=1970;if(parsed.UTCMonth)month=parsed.UTCMonth-1;else month=0;date=parsed.UTCDate||1;hours=parsed.UTCHours||0;minutes=parsed.UTCMinutes||0;seconds=parsed.UTCSeconds||0;milliseconds=parsed.UTCMilliseconds||0;if(parsed.Hours12){hours=parsed.Hours12}if(parsed.Period12){if(/pm/i.test(parsed.Period12)){if(hours!=12)hours=(hours+12)%24}else{hours=hours%12}}return UTCDate(year,month,date,hours,minutes,seconds,milliseconds)},_compileFormat:function(){var match,component,components=[],mask=[],str=this.format,propertiesByIndex={},i=0,pos=0;while(match=formatComponent.exec(str)){component=match[0];if(component in dateFormatComponents){i++;propertiesByIndex[i]=dateFormatComponents[component].property;components.push("\\s*"+dateFormatComponents[component].getPattern(this)+"\\s*");mask.push({pattern:new RegExp(dateFormatComponents[component].getPattern(this)),property:dateFormatComponents[component].property,start:pos,end:pos+=component.length})}else{components.push(escapeRegExp(component));mask.push({pattern:new RegExp(escapeRegExp(component)),character:component,start:pos,end:++pos})}str=str.slice(component.length)}this._mask=mask;this._maskPos=0;this._formatPattern=new RegExp("^\\s*"+components.join("")+"\\s*$");this._propertiesByIndex=propertiesByIndex},_attachDatePickerEvents:function(){var self=this;this.widget.on("click",".datepicker *",$.proxy(this.click,this));this.widget.on("click","[data-action]",$.proxy(this.doAction,this));this.widget.on("mousedown",$.proxy(this.stopEvent,this));if(this.pickDate&&this.pickTime){this.widget.on("click.togglePicker",".accordion-toggle",function(e){e.stopPropagation();var $this=$(this);var $parent=$this.closest("ul");var expanded=$parent.find(".collapse.in");var closed=$parent.find(".collapse:not(.in)");if(expanded&&expanded.length){var collapseData=expanded.data("collapse");if(collapseData&&collapseData.transitioning)return;expanded.collapse("hide");closed.collapse("show");$this.find("i").toggleClass(self.timeIcon+" "+self.dateIcon);self.$element.find(".add-on i").toggleClass(self.timeIcon+" "+self.dateIcon)}})}if(this.isInput){this.$element.on({focus:$.proxy(this.show,this),change:$.proxy(this.change,this)});if(this.options.maskInput){this.$element.on({keydown:$.proxy(this.keydown,this),keypress:$.proxy(this.keypress,this)})}}else{this.$element.on({change:$.proxy(this.change,this)},"input");if(this.options.maskInput){this.$element.on({keydown:$.proxy(this.keydown,this),keypress:$.proxy(this.keypress,this)},"input")}if(this.component){this.component.on("click",$.proxy(this.show,this))}else{this.$element.on("click",$.proxy(this.show,this))}}},_attachDatePickerGlobalEvents:function(){$(window).on("resize.datetimepicker"+this.id,$.proxy(this.place,this));if(!this.isInput){$(document).on("mousedown.datetimepicker"+this.id,$.proxy(this.hide,this))}},_detachDatePickerEvents:function(){this.widget.off("click",".datepicker *",this.click);this.widget.off("click","[data-action]");this.widget.off("mousedown",this.stopEvent);if(this.pickDate&&this.pickTime){this.widget.off("click.togglePicker")}if(this.isInput){this.$element.off({focus:this.show,change:this.change});if(this.options.maskInput){this.$element.off({keydown:this.keydown,keypress:this.keypress})}}else{this.$element.off({change:this.change},"input");if(this.options.maskInput){this.$element.off({keydown:this.keydown,keypress:this.keypress},"input")}if(this.component){this.component.off("click",this.show)}else{this.$element.off("click",this.show)}}},_detachDatePickerGlobalEvents:function(){$(window).off("resize.datetimepicker"+this.id);if(!this.isInput){$(document).off("mousedown.datetimepicker"+this.id)}},_isInFixed:function(){if(this.$element){var parents=this.$element.parents();var inFixed=false;for(var i=0;i'+"
    "+""+'
    '+DPGlobal.template+"
    "+""+'
  • '+""+'
    '+TPGlobal.getTemplate(is12Hours,showSeconds)+"
    "+""+"
"+""}else if(pickTime){return'"}else{return'"}}function UTCDate(){return new Date(Date.UTC.apply(Date,arguments))}var DPGlobal={modes:[{clsName:"days",navFnc:"UTCMonth",navStep:1},{clsName:"months",navFnc:"UTCFullYear",navStep:1},{clsName:"years",navFnc:"UTCFullYear",navStep:10}],isLeapYear:function(year){return year%4===0&&year%100!==0||year%400===0},getDaysInMonth:function(year,month){return[31,DPGlobal.isLeapYear(year)?29:28,31,30,31,30,31,31,30,31,30,31][month]},headTemplate:""+""+'‹'+''+'›'+""+"",contTemplate:''};DPGlobal.template='
'+''+DPGlobal.headTemplate+""+"
"+"
"+'
'+''+DPGlobal.headTemplate+DPGlobal.contTemplate+"
"+"
"+'
'+''+DPGlobal.headTemplate+DPGlobal.contTemplate+"
"+"
";var TPGlobal={hourTemplate:'',minuteTemplate:'',secondTemplate:''};TPGlobal.getTemplate=function(is12Hours,showSeconds){return'
'+'"+""+''+''+''+(showSeconds?''+'':"")+(is12Hours?'':"")+""+""+" "+''+" "+(showSeconds?''+"":"")+(is12Hours?''+"":"")+""+""+''+''+''+(showSeconds?''+'':"")+(is12Hours?'':"")+""+"
"+TPGlobal.hourTemplate+":"+TPGlobal.minuteTemplate+":"+TPGlobal.secondTemplate+""+''+"
"+"
"+'
'+''+"
"+"
"+'
'+''+"
"+"
"+(showSeconds?'
'+''+"
"+"
":"")}})(window.jQuery); \ No newline at end of file diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/css/TableTools.css b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/css/TableTools.css deleted file mode 100755 index 705008b01..000000000 --- a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/css/TableTools.css +++ /dev/null @@ -1,321 +0,0 @@ -/* - * File: TableTools.css - * Description: Styles for TableTools 2 - * Author: Allan Jardine (www.sprymedia.co.uk) - * Language: Javascript - * License: GPL v2 / 3 point BSD - * Project: DataTables - * - * Copyright 2009-2012 Allan Jardine, all rights reserved. - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * CSS name space: - * DTTT DataTables TableTools - * - * 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 - */ - - -/* - * CONTAINER - * TableTools container element and styles applying to all components - */ -div.DTTT_container { - position: relative; - float: right; - margin-bottom: 1em; -} - -button.DTTT_button, -div.DTTT_button, -a.DTTT_button { - position: relative; - float: left; - margin-right: 3px; - padding: 5px 8px; - border: 1px solid #999; - cursor: pointer; - *cursor: hand; - font-size: 0.88em; - color: black !important; - - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - -ms-border-radius: 2px; - -o-border-radius: 2px; - border-radius: 2px; - - -webkit-box-shadow: 1px 1px 3px #ccc; - -moz-box-shadow: 1px 1px 3px #ccc; - -ms-box-shadow: 1px 1px 3px #ccc; - -o-box-shadow: 1px 1px 3px #ccc; - box-shadow: 1px 1px 3px #ccc; - - /* Generated by http://www.colorzilla.com/gradient-editor/ */ - background: #ffffff; /* Old browsers */ - background: -webkit-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* IE10+ */ - background: -o-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 ); /* IE6-9 */ -} - - -/* Buttons are cunning border-box sizing - we can't just use that for A and DIV due to IE6/7 */ -button.DTTT_button { - height: 30px; - padding: 3px 8px; -} - -.DTTT_button embed { - outline: none; -} - -button.DTTT_button:hover, -div.DTTT_button:hover, -a.DTTT_button:hover { - border: 1px solid #666; - text-decoration: none !important; - - -webkit-box-shadow: 1px 1px 3px #999; - -moz-box-shadow: 1px 1px 3px #999; - -ms-box-shadow: 1px 1px 3px #999; - -o-box-shadow: 1px 1px 3px #999; - box-shadow: 1px 1px 3px #999; - - background: #f3f3f3; /* Old browsers */ - background: -webkit-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* IE10+ */ - background: -o-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f3f3f3', endColorstr='#f4f4f4',GradientType=0 ); /* IE6-9 */ -} - -button.DTTT_disabled, -div.DTTT_disabled, -a.DTTT_disabled { - color: #999; - border: 1px solid #d0d0d0; - - background: #ffffff; /* Old browsers */ - background: -webkit-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* IE10+ */ - background: -o-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fafafa',GradientType=0 ); /* IE6-9 */ -} - - - -/* - * BUTTON_STYLES - * Action specific button styles - * If you want images - comment this back in - -a.DTTT_button_csv, -a.DTTT_button_xls, -a.DTTT_button_copy, -a.DTTT_button_pdf, -a.DTTT_button_print { - padding-right: 0px; -} - -a.DTTT_button_csv span, -a.DTTT_button_xls span, -a.DTTT_button_copy span, -a.DTTT_button_pdf span, -a.DTTT_button_print span { - display: inline-block; - height: 24px; - line-height: 24px; - padding-right: 30px; -} - - -a.DTTT_button_csv span { background: url(../images/csv.png) no-repeat bottom right; } -a.DTTT_button_csv:hover span { background: url(../images/csv_hover.png) no-repeat center right; } - -a.DTTT_button_xls span { background: url(../images/xls.png) no-repeat center right; } -a.DTTT_button_xls:hover span { background: #f0f0f0 url(../images/xls_hover.png) no-repeat center right; } - -a.DTTT_button_copy span { background: url(../images/copy.png) no-repeat center right; } -a.DTTT_button_copy:hover span { background: #f0f0f0 url(../images/copy_hover.png) no-repeat center right; } - -a.DTTT_button_pdf span { background: url(../images/pdf.png) no-repeat center right; } -a.DTTT_button_pdf:hover span { background: #f0f0f0 url(../images/pdf_hover.png) no-repeat center right; } - -a.DTTT_button_print span { background: url(../images/print.png) no-repeat center right; } -a.DTTT_button_print:hover span { background: #f0f0f0 url(../images/print_hover.png) no-repeat center right; } - - */ - -button.DTTT_button_collection span { - padding-right: 17px; - background: url(../images/collection.png) no-repeat center right; -} - -button.DTTT_button_collection:hover span { - padding-right: 17px; - background: #f0f0f0 url(../images/collection_hover.png) no-repeat center right; -} - - -/* - * SELECTING - * Row selection styles - */ -table.DTTT_selectable tbody tr { - cursor: pointer; - *cursor: hand; -} - -table.dataTable tr.DTTT_selected.odd { - background-color: #9FAFD1; -} - -table.dataTable tr.DTTT_selected.odd td.sorting_1 { - background-color: #9FAFD1; -} - -table.dataTable tr.DTTT_selected.odd td.sorting_2 { - background-color: #9FAFD1; -} - -table.dataTable tr.DTTT_selected.odd td.sorting_3 { - background-color: #9FAFD1; -} - - -table.dataTable tr.DTTT_selected.even { - background-color: #B0BED9; -} - -table.dataTable tr.DTTT_selected.even td.sorting_1 { - background-color: #B0BED9; -} - -table.dataTable tr.DTTT_selected.even td.sorting_2 { - background-color: #B0BED9; -} - -table.dataTable tr.DTTT_selected.even td.sorting_3 { - background-color: #B0BED9; -} - - -/* - * COLLECTIONS - * Drop down list (collection) styles - */ - -div.DTTT_collection { - width: 150px; - padding: 8px 8px 4px 8px; - border: 1px solid #ccc; - border: 1px solid rgba( 0, 0, 0, 0.4 ); - background-color: #f3f3f3; - background-color: rgba( 255, 255, 255, 0.3 ); - overflow: hidden; - z-index: 2002; - - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -ms-border-radius: 5px; - -o-border-radius: 5px; - border-radius: 5px; - - -webkit-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - -ms-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - -o-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); -} - -div.DTTT_collection_background { - background: transparent url(../images/background.png) repeat top left; - z-index: 2001; -} - -div.DTTT_collection button.DTTT_button, -div.DTTT_collection div.DTTT_button, -div.DTTT_collection a.DTTT_button { - position: relative; - left: 0; - right: 0; - - display: block; - float: none; - margin-bottom: 4px; - - -webkit-box-shadow: 1px 1px 3px #999; - -moz-box-shadow: 1px 1px 3px #999; - -ms-box-shadow: 1px 1px 3px #999; - -o-box-shadow: 1px 1px 3px #999; - box-shadow: 1px 1px 3px #999; -} - - -/* - * PRINTING - * Print display styles - */ - -.DTTT_print_info { - position: fixed; - top: 50%; - left: 50%; - width: 400px; - height: 150px; - margin-left: -200px; - margin-top: -75px; - text-align: center; - color: #333; - padding: 10px 30px; - - background: #ffffff; /* Old browsers */ - background: -webkit-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* IE10+ */ - background: -o-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 ); /* IE6-9 */ - - opacity: 0.95; - - border: 1px solid black; - border: 1px solid rgba(0, 0, 0, 0.5); - - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - -ms-border-radius: 6px; - -o-border-radius: 6px; - border-radius: 6px; - - -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - -ms-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - -o-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - box-shadow: 0 3px 7px 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; -} - diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/psd/copy document.psd b/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/psd/copy document.psd deleted file mode 100755 index ca207adc6..000000000 Binary files a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/psd/copy document.psd and /dev/null differ 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 deleted file mode 100644 index e580c9936..000000000 --- a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.min.js +++ /dev/null @@ -1,77 +0,0 @@ -// 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"\u00a1".toString().length?b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""):b.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g,"")},fnCalcColRatios:function(a){var b=this.s.dt.aoColumns, -a=this._fnColumnTargets(a.mColumns),c=[],d=0,f=0,e,g;e=0;for(g=a.length;eh?m:h)+"px";l.style.width=(k>o?k:o)+"px";l.className=this.classes.collection.background;e(l).css("opacity",0);g.body.appendChild(l);g.body.appendChild(f);m=e(f).outerWidth();k=e(f).outerHeight(); -j+m>o&&(f.style.left=o-m+"px");d+k>h&&(f.style.top=d-k-e(a).outerHeight()+"px");this.dom.collection.collection=f;this.dom.collection.background=l;setTimeout(function(){e(f).animate({opacity:1},500);e(l).animate({opacity:0.25},500)},10);this.fnResizeButtons();e(l).click(function(){c._fnCollectionHide.call(c,null,null)})},_fnCollectionHide:function(a,b){!(null!==b&&"collection"==b.sExtends)&&null!==this.dom.collection.collection&&(e(this.dom.collection.collection).animate({opacity:0},500,function(){this.style.display= -"none"}),e(this.dom.collection.background).animate({opacity:0},500,function(){this.parentNode.removeChild(this)}),this.dom.collection.collection=null,this.dom.collection.background=null)},_fnRowSelectConfig:function(){if(this.s.master){var a=this,b=this.s.dt;e(b.nTable).addClass(this.classes.select.table);e(b.nTBody).on("click.DTTT_Select","tr",function(c){this.parentNode==b.nTBody&&null!==b.oInstance.fnGetData(this)&&(a.fnIsSelected(this)?a._fnRowDeselect(this,c):"single"==a.s.select.type?(a.fnSelectNone(), -a._fnRowSelect(this,c)):"multi"==a.s.select.type&&a._fnRowSelect(this,c))});b.oApi._fnCallbackReg(b,"aoRowCreatedCallback",function(c,d,f){b.aoData[f]._DTTT_selected&&e(c).addClass(a.classes.select.row)},"TableTools-SelectAll")}},_fnRowSelect:function(a,b){var c=this._fnSelectData(a),d=[],f,j;f=0;for(j=c.length;f/g, -"").replace(/^\s+|\s+$/g,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator))}var p=k.aiDisplay;f=this.fnGetSelected();if("none"!==this.s.select.type&&d&&0!==f.length){p=[];b=0;for(c=f.length;b]+)).*?>/gi,"$1$2$3"),h=h.replace(/<.*?>/g,"")):h+="",h=h.replace(/^\s+/,"").replace(/\s+$/,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator));a.bOpenRows&&(b=e.grep(k.aoOpenRows,function(a){return a.nParent===o}),1===b.length&&(h=this._fnBoundData(e("td",b[0].nTr).html(),a.sFieldBoundary,l),g.push(h)))}if(a.bFooter&&null!==k.nTFoot){j=[];b=0;for(c=k.aoColumns.length;b< -c;b++)n[b]&&null!==k.aoColumns[b].nTf&&(h=k.aoColumns[b].nTf.innerHTML.replace(/\n/g," ").replace(/<.*?>/g,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator))}return _sLastData=g.join(this._fnNewline(a))},_fnBoundData:function(a,b,c){return""===b?a:b+a.replace(c,b+b)+b},_fnChunkData:function(a,b){for(var c=[],d=a.length,f=0;fTable copied

Copied "+a+" row"+(1==a?"":"s")+ -" to the clipboard.

",1500)}}),pdf:e.extend({},TableTools.buttonBase,{sAction:"flash_pdf",sNewLine:"\n",sFileName:"*.pdf",sButtonClass:"DTTT_button_pdf",sButtonText:"PDF",sPdfOrientation:"portrait",sPdfSize:"A4",sPdfMessage:"",fnClick:function(a,b,c){this.fnSetText(c,"title:"+this.fnGetTitle(b)+"\nmessage:"+b.sPdfMessage+"\ncolWidth:"+this.fnCalcColRatios(b)+"\norientation:"+b.sPdfOrientation+"\nsize:"+b.sPdfSize+"\n--/TableToolsOpts--\n"+this.fnGetTableData(b))}}),print:e.extend({},TableTools.buttonBase, -{sInfo:"
Print view

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 deleted file mode 100644 index 01ce7c041..000000000 Binary files a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.min.js.gz and /dev/null differ 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 deleted file mode 100644 index 082c7acbf..000000000 Binary files a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/swf/copy_csv_xls.swf and /dev/null 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 deleted file mode 100644 index 063131dfe..000000000 Binary files a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/swf/copy_csv_xls_pdf.swf and /dev/null differ diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/as3/ZeroClipboard.as b/airtime_mvc/public/js/datatables/plugin/TableTools/as3/ZeroClipboard.as old mode 100755 new mode 100644 similarity index 88% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/as3/ZeroClipboard.as rename to airtime_mvc/public/js/datatables/plugin/TableTools/as3/ZeroClipboard.as index d6b9c072d..367b0497d --- a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/as3/ZeroClipboard.as +++ b/airtime_mvc/public/js/datatables/plugin/TableTools/as3/ZeroClipboard.as @@ -32,7 +32,7 @@ package { // import flashvars var flashvars:Object = LoaderInfo( this.root.loaderInfo ).parameters; - domId = flashvars.id.split("\\").join("\\\\"); + domId = flashvars.id; // invisible button covers entire stage button = new Sprite(); @@ -45,16 +45,16 @@ package { button.addEventListener(MouseEvent.CLICK, clickHandler); button.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event):void { - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseOver', null ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'mouseOver', null ); } ); button.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event):void { - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseOut', null ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'mouseOut', null ); } ); button.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event):void { - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseDown', null ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'mouseDown', null ); } ); button.addEventListener(MouseEvent.MOUSE_UP, function(event:Event):void { - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseUp', null ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'mouseUp', null ); } ); // External functions - readd whenever the stage is made active for IE @@ -62,10 +62,10 @@ package { stage.addEventListener(Event.ACTIVATE, addCallbacks); // signal to the browser that we are ready - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'load', null ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'load', null ); } - public function addCallbacks (evt:Event = null):void { + public function addCallbacks ():void { ExternalInterface.addCallback("setHandCursor", setHandCursor); ExternalInterface.addCallback("clearText", clearText); ExternalInterface.addCallback("setText", setText); @@ -133,13 +133,13 @@ package { } else { /* Copy the text to the clipboard. Note charset and BOM have no effect here */ System.setClipboard( clipText ); - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'complete', clipText ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'complete', clipText ); } } private function saveComplete(event:Event):void { - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'complete', clipText ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'complete', clipText ); } diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/as3/ZeroClipboardPdf.as b/airtime_mvc/public/js/datatables/plugin/TableTools/as3/ZeroClipboardPdf.as old mode 100755 new mode 100644 similarity index 91% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/as3/ZeroClipboardPdf.as rename to airtime_mvc/public/js/datatables/plugin/TableTools/as3/ZeroClipboardPdf.as index 158d5f188..937187e43 --- a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/as3/ZeroClipboardPdf.as +++ b/airtime_mvc/public/js/datatables/plugin/TableTools/as3/ZeroClipboardPdf.as @@ -46,7 +46,7 @@ package { // import flashvars var flashvars:Object = LoaderInfo( this.root.loaderInfo ).parameters; - domId = flashvars.id.split("\\").join("\\\\"); + domId = flashvars.id; // invisible button covers entire stage button = new Sprite(); @@ -61,16 +61,16 @@ package { clickHandler(event); } ); button.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event):void { - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseOver', null ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'mouseOver', null ); } ); button.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event):void { - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseOut', null ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'mouseOut', null ); } ); button.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event):void { - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseDown', null ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'mouseDown', null ); } ); button.addEventListener(MouseEvent.MOUSE_UP, function(event:Event):void { - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'mouseUp', null ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'mouseUp', null ); } ); // External functions - readd whenever the stage is made active for IE @@ -78,10 +78,10 @@ package { stage.addEventListener(Event.ACTIVATE, addCallbacks); // signal to the browser that we are ready - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'load', null ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'load', null ); } - public function addCallbacks (evt:Event = null):void { + public function addCallbacks ():void { ExternalInterface.addCallback("setHandCursor", setHandCursor); ExternalInterface.addCallback("clearText", clearText); ExternalInterface.addCallback("setText", setText); @@ -150,13 +150,13 @@ package { } else { /* Copy the text to the clipboard. Note charset and BOM have no effect here */ System.setClipboard( clipText ); - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'complete', clipText ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'complete', clipText ); } } private function saveComplete(event:Event):void { - ExternalInterface.call( 'ZeroClipboard_TableTools.dispatch', domId, 'complete', clipText ); + ExternalInterface.call( 'ZeroClipboard.dispatch', domId, 'complete', clipText ); } diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/as3/lib/AlivePDF.swc b/airtime_mvc/public/js/datatables/plugin/TableTools/as3/lib/AlivePDF.swc similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/as3/lib/AlivePDF.swc rename to airtime_mvc/public/js/datatables/plugin/TableTools/as3/lib/AlivePDF.swc diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools/css/TableTools.css b/airtime_mvc/public/js/datatables/plugin/TableTools/css/TableTools.css new file mode 100644 index 000000000..4f3dd532e --- /dev/null +++ b/airtime_mvc/public/js/datatables/plugin/TableTools/css/TableTools.css @@ -0,0 +1,264 @@ +/* + * 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-2.1.5/css/TableTools_JUI.css b/airtime_mvc/public/js/datatables/plugin/TableTools/css/TableTools_JUI.css old mode 100755 new mode 100644 similarity index 83% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/css/TableTools_JUI.css rename to airtime_mvc/public/js/datatables/plugin/TableTools/css/TableTools_JUI.css index 4c41138ee..95996ed2b --- a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/css/TableTools_JUI.css +++ b/airtime_mvc/public/js/datatables/plugin/TableTools/css/TableTools_JUI.css @@ -41,19 +41,19 @@ div.DTTT_container { float: left; } -.DTTT_button { +button.DTTT_button { position: relative; float: left; + height: 24px; margin-right: 3px; padding: 3px 10px; border: 1px solid #d0d0d0; background-color: #fff; - color: #333 !important; cursor: pointer; *cursor: hand; } -.DTTT_button::-moz-focus-inner { +button.DTTT_button::-moz-focus-inner { border: none !important; padding: 0; } @@ -69,36 +69,36 @@ table.DTTT_selectable tbody tr { *cursor: hand; } -table.dataTable tr.DTTT_selected.odd { +tr.DTTT_selected.odd { background-color: #9FAFD1; } -table.dataTable tr.DTTT_selected.odd td.sorting_1 { +tr.DTTT_selected.odd td.sorting_1 { background-color: #9FAFD1; } -table.dataTable tr.DTTT_selected.odd td.sorting_2 { +tr.DTTT_selected.odd td.sorting_2 { background-color: #9FAFD1; } -table.dataTable tr.DTTT_selected.odd td.sorting_3 { +tr.DTTT_selected.odd td.sorting_3 { background-color: #9FAFD1; } -table.dataTable tr.DTTT_selected.even { +tr.DTTT_selected.even { background-color: #B0BED9; } -table.dataTable tr.DTTT_selected.even td.sorting_1 { +tr.DTTT_selected.even td.sorting_1 { background-color: #B0BED9; } -table.dataTable tr.DTTT_selected.even td.sorting_2 { +tr.DTTT_selected.even td.sorting_2 { background-color: #B0BED9; } -table.dataTable tr.DTTT_selected.even td.sorting_3 { +tr.DTTT_selected.even td.sorting_3 { background-color: #B0BED9; } @@ -124,9 +124,7 @@ div.DTTT_collection_background { z-index: 2001; } -div.DTTT_collection button.DTTT_button, -div.DTTT_collection div.DTTT_button, -div.DTTT_collection a.DTTT_button { +div.DTTT_collection button.DTTT_button { float: none; width: 100%; margin-bottom: -0.1em; @@ -139,7 +137,7 @@ div.DTTT_collection a.DTTT_button { */ .DTTT_print_info { - position: fixed; + position: absolute; top: 50%; left: 50%; width: 400px; diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/background.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/background.png similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/background.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/background.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/collection.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/collection.png similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/collection.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/collection.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/collection_hover.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/collection_hover.png similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/collection_hover.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/collection_hover.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/copy.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/copy.png old mode 100755 new mode 100644 similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/copy.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/copy.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/copy_hover.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/copy_hover.png old mode 100755 new mode 100644 similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/copy_hover.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/copy_hover.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/csv.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/csv.png old mode 100755 new mode 100644 similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/csv.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/csv.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/csv_hover.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/csv_hover.png old mode 100755 new mode 100644 similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/csv_hover.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/csv_hover.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/pdf.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/pdf.png similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/pdf.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/pdf.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/pdf_hover.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/pdf_hover.png similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/pdf_hover.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/pdf_hover.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/print.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/print.png old mode 100755 new mode 100644 similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/print.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/print.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/print_hover.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/print_hover.png old mode 100755 new mode 100644 similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/print_hover.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/print_hover.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/psd/collection.psd b/airtime_mvc/public/js/datatables/plugin/TableTools/images/psd/collection.psd similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/psd/collection.psd rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/psd/collection.psd diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/psd/file_types.psd b/airtime_mvc/public/js/datatables/plugin/TableTools/images/psd/file_types.psd old mode 100755 new mode 100644 similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/psd/file_types.psd rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/psd/file_types.psd diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/psd/printer.psd b/airtime_mvc/public/js/datatables/plugin/TableTools/images/psd/printer.psd old mode 100755 new mode 100644 similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/psd/printer.psd rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/psd/printer.psd diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/xls.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/xls.png old mode 100755 new mode 100644 similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/xls.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/xls.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/xls_hover.png b/airtime_mvc/public/js/datatables/plugin/TableTools/images/xls_hover.png old mode 100755 new mode 100644 similarity index 100% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/images/xls_hover.png rename to airtime_mvc/public/js/datatables/plugin/TableTools/images/xls_hover.png diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.js b/airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.js old mode 100755 new mode 100644 similarity index 66% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.js rename to airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.js index 3c3ae9115..3e02c2c08 --- a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/TableTools.js +++ b/airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.js @@ -1,13 +1,13 @@ /* * File: TableTools.js - * Version: 2.1.5 + * 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-2013 Allan Jardine, all rights reserved. + * 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: @@ -36,7 +36,7 @@ var TableTools; TableTools = function( oDT, oOpts ) { /* Santiy check that we are a new instance */ - if ( ! this instanceof TableTools ) + if ( !this.CLASS || this.CLASS != "TableTools" ) { alert( "Warning: TableTools must be initialised with the keyword 'new'" ); } @@ -51,7 +51,7 @@ TableTools = function( oDT, oOpts ) */ this.s = { /** - * Store 'this' so the instance can be retrieved from the settings object + * Store 'this' so the instance can be retreieved from the settings object * @property that * @type object * @default this @@ -62,9 +62,9 @@ TableTools = function( oDT, oOpts ) * DataTables settings objects * @property dt * @type object - * @default From the oDT init option + * @default null */ - "dt": oDT.fnSettings(), + "dt": null, /** * @namespace Print specific information @@ -204,13 +204,7 @@ TableTools = function( oDT, oOpts ) * @type boolean * @default false */ - "master": false, - - /** - * Tag names that are used for creating collections and buttons - * @namesapce - */ - "tags": {} + "master": false }; @@ -247,7 +241,7 @@ TableTools = function( oDT, oOpts ) "hidden": [], /** - * The information display saying telling the user about the print display + * The information display saying tellng the user about the print display * @property message * @type node * @default null @@ -276,16 +270,7 @@ TableTools = function( oDT, oOpts ) "background": null } }; - - /** - * @namespace Name space for the classes that this TableTools instance will use - * @extends TableTools.classes - */ - this.classes = $.extend( true, {}, TableTools.classes ); - if ( this.s.dt.bJUI ) - { - $.extend( true, this.classes, TableTools.classes_themeroller ); - } + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -308,6 +293,7 @@ TableTools = function( oDT, oOpts ) oOpts = {}; } + this.s.dt = oDT.fnSettings(); this._fnConstruct( oOpts ); return this; @@ -322,64 +308,31 @@ TableTools.prototype = { /** * Retreieve the settings object from an instance + * @method fnGetSelected * @returns {array} List of TR nodes which are currently selected - * @param {boolean} [filtered=false] Get only selected rows which are - * available given the filtering applied to the table. By default - * this is false - i.e. all rows, regardless of filtering are - selected. */ - "fnGetSelected": function ( filtered ) + "fnGetSelected": function () { - var - out = [], - data = this.s.dt.aoData, - displayed = this.s.dt.aiDisplay, - i, iLen; - - if ( filtered ) - { - // Only consider filtered rows - for ( i=0, iLen=displayed.length ; i

Copied '+len+' row'+plural+' to the clipboard.

', - 1500 - ); - } - } ), - - "pdf": $.extend( {}, TableTools.buttonBase, { + alert( 'Copied '+len+' row'+plural+' to the clipboard' ); + }, + "fnInit": null, + "fnCellRender": null + }, + "pdf": { "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": "", @@ -2221,87 +2275,167 @@ TableTools.BUTTONS = { "--/TableToolsOpts--\n" + this.fnGetTableData(oConfig) ); - } - } ), - - "print": $.extend( {}, TableTools.buttonBase, { + }, + "fnSelect": null, + "fnComplete": null, + "fnInit": null, + "fnCellRender": null + }, + "print": { + "sAction": "print", "sInfo": "
Print view

Please use your browser's print function to "+ "print this table. Press escape when finished.", - "sMessage": null, + "sMessage": "", "bShowAll": true, "sToolTip": "View print view", "sButtonClass": "DTTT_button_print", + "sButtonClassHover": "DTTT_button_print_hover", "sButtonText": "Print", - "fnClick": function ( nButton, oConfig ) { - this.fnPrint( true, oConfig ); - } - } ), - - "text": $.extend( {}, TableTools.buttonBase ), - - "select": $.extend( {}, TableTools.buttonBase, { + "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( this.classes.buttons.disabled ); + $(nButton).removeClass('DTTT_disabled'); } else { - $(nButton).addClass( this.classes.buttons.disabled ); + $(nButton).addClass('DTTT_disabled'); } }, + "fnComplete": null, "fnInit": function( nButton, oConfig ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } - } ), - - "select_single": $.extend( {}, TableTools.buttonBase, { + $(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( this.classes.buttons.disabled ); + $(nButton).removeClass('DTTT_disabled'); } else { - $(nButton).addClass( this.classes.buttons.disabled ); + $(nButton).addClass('DTTT_disabled'); } }, + "fnComplete": null, "fnInit": function( nButton, oConfig ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } - } ), - - "select_all": $.extend( {}, TableTools.buttonBase, { + $(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( this.classes.buttons.disabled ); + $(nButton).addClass('DTTT_disabled'); } else { - $(nButton).removeClass( this.classes.buttons.disabled ); + $(nButton).removeClass('DTTT_disabled'); } - } - } ), - - "select_none": $.extend( {}, TableTools.buttonBase, { + }, + "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( this.classes.buttons.disabled ); + $(nButton).removeClass('DTTT_disabled'); } else { - $(nButton).addClass( this.classes.buttons.disabled ); + $(nButton).addClass('DTTT_disabled'); } }, + "fnComplete": null, "fnInit": function( nButton, oConfig ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } - } ), - - "ajax": $.extend( {}, TableTools.buttonBase, { + $(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( { @@ -2318,26 +2452,45 @@ TableTools.BUTTONS = { } } ); }, + "fnSelect": null, + "fnComplete": null, + "fnInit": null, "fnAjaxComplete": function( json ) { alert( 'Ajax complete' ); - } - } ), - - "div": $.extend( {}, TableTools.buttonBase, { + }, + "fnCellRender": null + }, + "div": { "sAction": "div", - "sTag": "div", + "sToolTip": "", "sButtonClass": "DTTT_nonbutton", - "sButtonText": "Text button" - } ), - - "collection": $.extend( {}, TableTools.buttonBase, { + "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: @@ -2348,75 +2501,17 @@ 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_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" - } - } + "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" ] }; @@ -2433,9 +2528,9 @@ TableTools.prototype.CLASS = "TableTools"; * TableTools version * @constant VERSION * @type String - * @default See code + * @default 2.0.2 */ -TableTools.VERSION = "2.1.5"; +TableTools.VERSION = "2.0.2"; TableTools.prototype.VERSION = TableTools.VERSION; @@ -2450,7 +2545,7 @@ TableTools.prototype.VERSION = TableTools.VERSION; */ if ( typeof $.fn.dataTable == "function" && typeof $.fn.dataTableExt.fnVersionCheck == "function" && - $.fn.dataTableExt.fnVersionCheck('1.9.0') ) + $.fn.dataTableExt.fnVersionCheck('1.8.2') ) { $.fn.dataTableExt.aoFeatures.push( { "fnInit": function( oDTSettings ) { @@ -2468,9 +2563,7 @@ if ( typeof $.fn.dataTable == "function" && } else { - alert( "Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download"); + alert( "Warning: TableTools 2 requires DataTables 1.8.2 or newer - www.datatables.net/download"); } -$.fn.DataTable.TableTools = TableTools; - })(jQuery, window, document); 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 new file mode 100644 index 000000000..3455faf03 --- /dev/null +++ b/airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.min.js @@ -0,0 +1,81 @@ +// 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"\u00a1".toString().length?b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""):b.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g,"")},fnCalcColRatios:function(a){var b=this.s.dt.aoColumns,a=this._fnColumnTargets(a.mColumns),c=[],d=0,e=0,f,g;for(f=0,g=a.length;fl?g:l)+"px";k.style.width=(m>o?m:o)+"px";k.className="DTTT_collection_background";e(k).css("opacity",0);h.body.appendChild(k);h.body.appendChild(j); +g=e(j).outerWidth();m=e(j).outerHeight();if(f+g>o)j.style.left=o-g+"px";if(d+m>l)j.style.top=d-m-e(a).outerHeight()+"px";this.dom.collection.collection=j;this.dom.collection.background=k;setTimeout(function(){e(j).animate({opacity:1},500);e(k).animate({opacity:0.25},500)},10);e(k).click(function(){c._fnCollectionHide.call(c,null,null)})},_fnCollectionHide:function(a,b){if(!(null!==b&&"collection"==b.sExtends)&&null!==this.dom.collection.collection)e(this.dom.collection.collection).animate({opacity:0}, +500,function(){this.style.display="none"}),e(this.dom.collection.background).animate({opacity:0},500,function(){this.parentNode.removeChild(this)}),this.dom.collection.collection=null,this.dom.collection.background=null},_fnRowSelectConfig:function(){if(this.s.master){var a=this;e(a.s.dt.nTable).addClass("DTTT_selectable");e("tr",a.s.dt.nTBody).live("click",function(b){if(this.parentNode==a.s.dt.nTBody){var c=a.s.dt.oInstance.fnGetNodes();-1===e.inArray(this,c)||null!==a.s.select.preRowSelect&&!a.s.select.preRowSelect.call(a, +b)||("single"==a.s.select.type?a._fnRowSelectSingle.call(a,this):a._fnRowSelectMulti.call(a,this))}});a.s.dt.aoDrawCallback.push({fn:function(){a.s.select.all&&a.s.dt.oFeatures.bServerSide&&a.fnSelectAll()},sName:"TableTools_select"})}},_fnRowSelectSingle:function(a){this.s.master&&!e("td",a).hasClass(this.s.dt.oClasses.sRowEmpty)&&(e(a).hasClass(this.s.select.selectedClass)?this._fnRowDeselect(a):(0!==this.s.select.selected.length&&this._fnRowDeselectAll(),this.s.select.selected.push(a),e(a).addClass(this.s.select.selectedClass), +null!==this.s.select.postSelected&&this.s.select.postSelected.call(this,a)),TableTools._fnEventDispatch(this,"select",a))},_fnRowSelectMulti:function(a){this.s.master&&!e("td",a).hasClass(this.s.dt.oClasses.sRowEmpty)&&(e(a).hasClass(this.s.select.selectedClass)?this._fnRowDeselect(a):(this.s.select.selected.push(a),e(a).addClass(this.s.select.selectedClass),null!==this.s.select.postSelected&&this.s.select.postSelected.call(this,a)),TableTools._fnEventDispatch(this,"select",a))},_fnRowSelectAll:function(){if(this.s.master){for(var a, +b=0,c=this.s.dt.aiDisplayMaster.length;b/g, +"").replace(/^\s+|\s+$/g,""),g=this._fnHtmlDecode(g),f+=this._fnBoundData(g,a.sFieldBoundary,m)+a.sFieldSeperator);f=f.slice(0,-1*a.sFieldSeperator.length);f+=k}for(d=0,j=h.aiDisplay.length;d]+)).*?>/gi,"$1$2$3"),g=g.replace(/<.*?>/g,"")):g+="",g=g.replace(/^\s+/,"").replace(/\s+$/,""),g=this._fnHtmlDecode(g),f+=this._fnBoundData(g,a.sFieldBoundary,m)+a.sFieldSeperator);f=f.slice(0,-1*a.sFieldSeperator.length);f+=k}f.slice(0,-1);if(a.bFooter){for(b=0,c=h.aoColumns.length;b/g,""),g=this._fnHtmlDecode(g),f+=this._fnBoundData(g, +a.sFieldBoundary,m)+a.sFieldSeperator);f=f.slice(0,-1*a.sFieldSeperator.length)}return _sLastData=f},_fnBoundData:function(a,b,c){return""===b?a:b+a.replace(c,b+b)+b},_fnChunkData:function(a,b){for(var c=[],d=a.length,e=0;ea[c].length- +8&&(a[c].substr(e),a[c]=a[c].substr(0,e)),b.innerHTML=a[c],f+=b.childNodes[0].nodeValue;return f},_fnPrintConfig:function(a,b){var c=this;null!==b.fnInit&&b.fnInit.call(this,a,b);if(""!==b.sToolTip)a.title=b.sToolTip;e(a).hover(function(){e(a).addClass(b.sButtonClassHover)},function(){e(a).removeClass(b.sButtonClassHover)});null!==b.fnSelect&&TableTools._fnEventListen(this,"select",function(d){b.fnSelect.call(c,a,b,d)});e(a).click(function(d){d.preventDefault();c._fnPrintStart.call(c,d,b);null!== +b.fnClick&&b.fnClick.call(c,a,b,null);null!==b.fnComplete&&b.fnComplete.call(c,a,b,null,null);c._fnCollectionHide(a,b)})},_fnPrintStart:function(a,b){var c=this,d=this.s.dt;this._fnPrintHideNodes(d.nTable);this.s.print.saveStart=d._iDisplayStart;this.s.print.saveLength=d._iDisplayLength;if(b.bShowAll)d._iDisplayStart=0,d._iDisplayLength=-1,d.oApi._fnCalculateEnd(d),d.oApi._fnDraw(d);(""!==d.oScroll.sX||""!==d.oScroll.sY)&&this._fnPrintScrollStart(d);var d=d.aanFeatures,j;for(j in d)if("i"!=j&&"t"!= +j&&1==j.length)for(var f=0,g=d[j].length;fPrint view

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 new file mode 100644 index 000000000..6ec0fb9cb Binary files /dev/null and b/airtime_mvc/public/js/datatables/plugin/TableTools/js/TableTools.min.js.gz differ diff --git a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js b/airtime_mvc/public/js/datatables/plugin/TableTools/js/ZeroClipboard.js old mode 100755 new mode 100644 similarity index 86% rename from airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js rename to airtime_mvc/public/js/datatables/plugin/TableTools/js/ZeroClipboard.js index de0f6b67b..73707f024 --- a/airtime_mvc/public/js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js +++ b/airtime_mvc/public/js/datatables/plugin/TableTools/js/ZeroClipboard.js @@ -1,7 +1,7 @@ // Simple Set Clipboard System // Author: Joseph Huckaby -var ZeroClipboard_TableTools = { +var ZeroClipboard = { version: "1.0.4-TableTools2", clients: {}, // registered upload clients on page, indexed by id @@ -73,18 +73,18 @@ var ZeroClipboard_TableTools = { this.handlers = {}; // unique ID - this.id = ZeroClipboard_TableTools.nextId++; - this.movieId = 'ZeroClipboard_TableToolsMovie_' + this.id; + this.id = ZeroClipboard.nextId++; + this.movieId = 'ZeroClipboardMovie_' + this.id; // register client with singleton to receive flash events - ZeroClipboard_TableTools.register(this.id, this); + ZeroClipboard.register(this.id, this); // create movie if (elem) this.glue(elem); } }; -ZeroClipboard_TableTools.Client.prototype = { +ZeroClipboard.Client.prototype = { id: 0, // unique ID for us ready: false, // whether movie is ready to receive events or not @@ -100,7 +100,7 @@ ZeroClipboard_TableTools.Client.prototype = { glue: function(elem, title) { // glue to DOM element // elem can be ID or actual DOM element object - this.domElement = ZeroClipboard_TableTools.$(elem); + this.domElement = ZeroClipboard.$(elem); // float just above object, or zIndex 99 if dom element isn't set var zIndex = 99; @@ -109,18 +109,19 @@ ZeroClipboard_TableTools.Client.prototype = { } // find X/Y position of domElement - var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.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 = '0px'; - style.top = '0px'; + 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; } @@ -129,19 +130,18 @@ ZeroClipboard_TableTools.Client.prototype = { } // style.backgroundColor = '#f00'; // debug - if ( this.domElement ) { - this.domElement.appendChild(this.div); - this.div.innerHTML = this.getHTML( box.width, box.height ); - } + this.domElement.parentNode.appendChild(this.div); + + this.div.innerHTML = this.getHTML( box.width, box.height ); }, positionElement: function() { - var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); + 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.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_TableTools.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_TableTools.Client.prototype = { // reposition our floating div, optionally to new container // warning: container CANNOT change size, only position if (elem) { - this.domElement = ZeroClipboard_TableTools.$(elem); + this.domElement = ZeroClipboard.$(elem); if (!this.domElement) this.hide(); } if (this.domElement && this.div) { - var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); + var box = ZeroClipboard.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/swf/copy_cvs_xls.swf b/airtime_mvc/public/js/datatables/plugin/TableTools/swf/copy_cvs_xls.swf new file mode 100644 index 000000000..4c0156d5e Binary files /dev/null and b/airtime_mvc/public/js/datatables/plugin/TableTools/swf/copy_cvs_xls.swf 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 new file mode 100644 index 000000000..9b8aabd0b Binary files /dev/null and b/airtime_mvc/public/js/datatables/plugin/TableTools/swf/copy_cvs_xls_pdf.swf differ diff --git a/airtime_mvc/public/js/datatables/plugin/dataTables.TableTools.js b/airtime_mvc/public/js/datatables/plugin/dataTables.TableTools.js new file mode 100644 index 000000000..3e02c2c08 --- /dev/null +++ b/airtime_mvc/public/js/datatables/plugin/dataTables.TableTools.js @@ -0,0 +1,2569 @@ +/* + * 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 0 ) + { + sTitle = anTitle[0].innerHTML; + } + } + + /* Strip characters which the OS will object to - checking for UTF8 support in the scripting + * engine + */ + if ( "\u00A1".toString().length < 4 ) { + return sTitle.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g, ""); + } else { + return sTitle.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g, ""); + } + }, + + + /** + * Calculate a unity array with the column width by proportion for a set of columns to be + * included for a button. This is particularly useful for PDF creation, where we can use the + * column widths calculated by the browser to size the columns in the PDF. + * @method fnCalcColRations + * @param {Object} oConfig Button configuration object + * @returns {Array} Unity array of column ratios + */ + "fnCalcColRatios": function ( oConfig ) + { + var + aoCols = this.s.dt.aoColumns, + aColumnsInc = this._fnColumnTargets( oConfig.mColumns ), + aColWidths = [], + iWidth = 0, iTotal = 0, i, iLen; + + for ( i=0, iLen=aColumnsInc.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 new file mode 100644 index 000000000..73707f024 --- /dev/null +++ b/airtime_mvc/public/js/datatables/plugin/dataTables.ZeroClipboard.js @@ -0,0 +1,367 @@ +// 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/fullcalendar/AIRTIME_DEV_README b/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README index 5b10a3157..ffa4294a0 100644 --- a/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README +++ b/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README @@ -3,14 +3,14 @@ in this file. Running a diff between the original fullcalendar.js and our modified one: -denise@denise-desktop:~/airtime/airtime_mvc/public/js/fullcalendar$ diff -u fullcalendar_orig.js fullcalendar.js ---- fullcalendar_orig.js 2013-05-24 08:33:54.462735215 -0400 -+++ fullcalendar.js 2013-07-19 12:42:37.274284180 -0400 +martin@Thinkpad-T410:~/workspace/airtime/airtime_mvc/public/js/fullcalendar$ diff -u fullcalendar_orig.js fullcalendar.js +--- fullcalendar_orig.js 2011-04-09 17:13:15.000000000 -0400 ++++ fullcalendar.js 2011-11-18 17:03:57.000000000 -0500 @@ -1,6 +1,6 @@ /** * @preserve -- * FullCalendar v1.5.3 -+ * FullCalendar v1.5.3-CUSTOM (Changes by Martin Konecny -added primitive support for timezones) +- * FullCalendar v1.5.1 ++ * FullCalendar v1.5.1-CUSTOM (Changes by Martin Konecny -added primitive support for timezones) * http://arshaw.com/fullcalendar/ * * Use fullcalendar.css for basic styling. @@ -23,7 +23,7 @@ denise@denise-desktop:~/airtime/airtime_mvc/public/js/fullcalendar$ diff -u full var events = []; var _dragElement; -@@ -2277,7 +2277,7 @@ +@@ -2275,7 +2275,7 @@ function updateCells(firstTime) { var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating? var month = t.start.getMonth(); @@ -32,7 +32,7 @@ denise@denise-desktop:~/airtime/airtime_mvc/public/js/fullcalendar$ diff -u full var cell; var date; var row; -@@ -3110,7 +3110,7 @@ +@@ -3108,7 +3108,7 @@ var headCell; var bodyCell; var date; @@ -41,16 +41,9 @@ denise@denise-desktop:~/airtime/airtime_mvc/public/js/fullcalendar$ diff -u full for (i=0; i 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 to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // The ready event handler - completed = function( event ) { - - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } - }, - // Clean-up method for dom ready events - detach = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: core_version, - - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - /* jshint eqeqeq: false */ - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; - }, - - isPlainObject: function( obj ) { - var key; - - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Support: IE<9 - // Handle iteration over inherited properties before own properties. - if ( jQuery.support.ownLast ) { - for ( key in obj ) { - return core_hasOwn.call( obj, key ); - } - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - if ( scripts ) { - jQuery( scripts ).remove(); - } - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: function( data ) { - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - if ( data === null ) { - return data; - } - - if ( typeof data === "string" ) { - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - if ( data ) { - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - } - } - } - - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - core_push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return core_concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations. - // Note: this method belongs to the css module but it's needed here for the support module. - // If support gets modularized, this method should be moved back to the css module. - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); - - if ( jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -/*! - * Sizzle CSS Selector Engine v1.10.2 - * http://sizzlejs.com/ - * - * Copyright 2013 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-07-03 - */ -(function( window, undefined ) { - -var i, - support, - cachedruns, - Expr, - getText, - isXML, - compile, - outermostContext, - sortInput, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - hasDuplicate = false, - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - return 0; - }, - - // General-purpose constants - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rsibling = new RegExp( whitespace + "*[+~]" ), - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rescape = /'|\\/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - // BMP codepoint - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( documentIsHTML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // QSA path - if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - nid = old = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return !!fn( div ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( div.parentNode ) { - div.parentNode.removeChild( div ); - } - // release memory in IE - div = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = attrs.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - ( ~b.sourceIndex || MAX_NEGATIVE ) - - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Detect xml - * @param {Element|Object} elem An element or a document - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc, - parent = doc.defaultView; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - - // Support tests - documentIsHTML = !isXML( doc ); - - // Support: IE>8 - // If iframe document is assigned to "document" variable and if iframe has been reloaded, - // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 - // IE6-8 do not support the defaultView property so parent will be undefined - if ( parent && parent.attachEvent && parent !== parent.top ) { - parent.attachEvent( "onbeforeunload", function() { - setDocument(); - }); - } - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) - support.attributes = assert(function( div ) { - div.className = "i"; - return !div.getAttribute("className"); - }); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Check if getElementsByClassName can be trusted - support.getElementsByClassName = assert(function( div ) { - div.innerHTML = "

"; - - // Support: Safari<4 - // Catch class over-caching - div.firstChild.className = "i"; - // Support: Opera<10 - // Catch gEBCN failure to find non-leading classes - return div.getElementsByClassName("i").length === 2; - }); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( div ) { - docElem.appendChild( div ).id = expando; - return !doc.getElementsByName || !doc.getElementsByName( expando ).length; - }); - - // ID find and filter - if ( support.getById ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && documentIsHTML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - // Support: IE6/7 - // getElementById is not reliable as a find shortcut - delete Expr.find["ID"]; - - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See http://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = ""; - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - - // Support: Opera 10-12/IE8 - // ^= $= *= and empty values - // Should not select anything - // Support: Windows 8 Native Apps - // The type attribute is restricted during .innerHTML assignment - var input = doc.createElement("input"); - input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "t", "" ); - - if ( div.querySelectorAll("[t^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); - - if ( compare ) { - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === doc || contains(preferredDoc, a) ) { - return -1; - } - if ( b === doc || contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } - - // Not directly comparable, sort on existence of method - return a.compareDocumentPosition ? -1 : 1; - } : - function( a, b ) { - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Parentless nodes are either documents or disconnected - } else if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return doc; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val === undefined ? - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null : - val; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[5] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[3] && match[4] !== undefined ) { - match[2] = match[4]; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( tokens = [] ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var data, cache, outerCache, - dirkey = dirruns + " " + doneName; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { - if ( (data = cache[1]) === true || data === cachedruns ) { - return data === true; - } - } else { - cache = outerCache[ dir ] = [ dirkey ]; - cache[1] = matcher( elem, context, xml ) || cachedruns; - if ( cache[1] === true ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - // A counter to specify which element is currently being matched - var matcherCachedRuns = 0, - bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); - - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = matcherCachedRuns; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++matcherCachedRuns; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { - var i, tokens, token, type, find, - match = tokenize( selector ); - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - } - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && context.parentNode || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - !documentIsHTML, - results, - rsibling.test( selector ) - ); - return results; -} - -// One-time assignments - -// Sort stability -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -// Support: Chrome<14 -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( div1 ) { - // Should return 1, but returns 4 (following) - return div1.compareDocumentPosition( document.createElement("div") ) & 1; -}); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( div ) { - div.innerHTML = ""; - return div.firstChild.getAttribute("href") === "#" ; -}) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - }); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( div ) { - div.innerHTML = ""; - div.firstChild.setAttribute( "value", "" ); - return div.firstChild.getAttribute( "value" ) === ""; -}) ) { - addHandle( "value", function( elem, name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - }); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( div ) { - return div.getAttribute("disabled") == null; -}) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - elem[ name ] === true ? name.toLowerCase() : null; - } - }); -} - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})( window ); -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - firingLength = 0; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( list && ( !fired || stack ) ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); -jQuery.support = (function( support ) { - - var all, a, input, select, fragment, opt, eventName, isSupported, i, - div = document.createElement("div"); - - // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = "
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 = "
t
"; - 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 instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - /* jshint eqeqeq: false */ - for ( ; cur != this; cur = cur.parentNode || this ) { - /* jshint eqeqeq: true */ - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return jQuery.nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Even when returnValue equals to undefined Firefox will still show alert - if ( event.result !== undefined ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === core_strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); -var isSimple = /^.[^:#\[\.,]*$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, - ret = [], - self = this, - len = self.length; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = this.selector ? this.selector + " " + selector : selector; - return ret; - }, - - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector || [], true) ); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector || [], false) ); - }, - - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { - // Always skip document fragments - if ( cur.nodeType < 11 && (pos ? - pos.index(cur) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector(cur, selectors)) ) { - - cur = ret.push( cur ); - break; - } - } - } - - return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( jQuery.unique(all) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - if ( this.length > 1 ) { - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - ret = jQuery.unique( ret ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - } - - return this.pushStack( ret ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 && elem.nodeType === 1 ? - jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : - jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - })); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - /* jshint -W018 */ - return !!qualifier.call( elem, i, elem ) !== not; - }); - - } - - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - }); - - } - - if ( typeof qualifier === "string" ) { - if ( isSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } - - qualifier = jQuery.filter( qualifier, elements ); - } - - return jQuery.grep( elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; - }); -} -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
", "
" ], - area: [ 1, "", "" ], - param: [ 1, "", "" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - col: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - append: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - elems = selector ? jQuery.filter( selector, this ) : this, - i = 0; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var - // Snapshot the DOM in case .domManip sweeps something relevant into its fragment - args = jQuery.map( this, function( elem ) { - return [ elem.nextSibling, elem.parentNode ]; - }), - i = 0; - - // Make the changes, replacing each context element with the new content - this.domManip( arguments, function( elem ) { - var next = args[ i++ ], - parent = args[ i++ ]; - - if ( parent ) { - // Don't use the snapshot next if it has moved (#13810) - if ( next && next.parentNode !== parent ) { - next = this.nextSibling; - } - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - // Allow new content to include elements from the context set - }, true ); - - // Force removal if there was no new content (e.g., from empty arguments) - return i ? this : this.remove(); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, callback, allowIntersection ) { - - // Flatten any nested arrays - args = core_concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, self.html() ); - } - self.domManip( args, callback, allowIntersection ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( this[i], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Hope ajax is available... - jQuery._evalUrl( node.src ); - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -// Support: IE<8 -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName("tbody")[0] || - elem.appendChild( elem.ownerDocument.createElement("tbody") ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - core_push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( manipulation_rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted from table fragments - if ( !jQuery.support.tbody ) { - - // String was a , *may* have spurious - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare or - wrap[1] === "
" && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== core_strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - core_deletedIds.push( id ); - } - } - } - } - }, - - _evalUrl: function( url ) { - return jQuery.ajax({ - url: url, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } -}); -jQuery.fn.extend({ - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - } -}); -var iframe, getStyles, curCSS, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity\s*=\s*([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -function showHide( elements, show ) { - var display, elem, hidden, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - values[ index ] = jQuery._data( elem, "olddisplay" ); - display = elem.style.display; - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); - } - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - var len, styles, - map = {}, - i = 0; - - if ( jQuery.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each(function() { - if ( isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var num, val, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - } -}); - -// NOTE: we've included the "window" in window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - getStyles = function( elem ) { - return window.getComputedStyle( elem, null ); - }; - - curCSS = function( elem, name, _computed ) { - var width, minWidth, maxWidth, - computed = _computed || getStyles( elem ), - - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, - style = elem.style; - - if ( computed ) { - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; - }; -} else if ( document.documentElement.currentStyle ) { - getStyles = function( elem ) { - return elem.currentStyle; - }; - - curCSS = function( elem, name, _computed ) { - var left, rs, rsLeft, - computed = _computed || getStyles( elem ), - ret = computed ? computed[ name ] : undefined, - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - - // Remember the original values - left = style.left; - rs = elem.runtimeStyle; - rsLeft = rs && rs.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - rs.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - rs.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); - } - - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } else { - // at this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - styles = getStyles( elem ), - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, styles ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles - ) - ) + "px"; -} - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - // Use the already-created iframe if possible - iframe = ( iframe || - jQuery("':""),a._keyEvent=!1,K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='
',m="";if(f||!i)m+=''+g[b]+"";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='"}k||(l+=m+(f||!i||!j?" ":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+=''+c+"";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='",l+=a.yearshtml,a.yearshtml=null}}return l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?" ":"")+m),l+="
",l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&bd?d:e,e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));return b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return typeof a!="string"||a!="isDisabled"&&a!="getDate"&&a!="widget"?a=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)}):$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.24",window["DP_jQuery_"+dpuuid]=$}(jQuery),function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||" ",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("
")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a)}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("
")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover")},function(){j.removeClass("ui-state-hover")}).focus(function(){j.addClass("ui-state-focus")}).blur(function(){j.removeClass("ui-state-focus")}).click(function(a){return b.close(a),!1}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;return a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle),a},widget:function(){return this.uiDialog},close:function(b){var c=this,d,e;if(!1===c._trigger("beforeClose",b))return;return c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)))}),a.ui.dialog.maxZ=d),c},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var d=this,e=d.options,f;return e.modal&&!b||!e.stack&&!e.modal?d._trigger("focus",c):(e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c),d)},open:function(){if(this._isOpen)return;var b=this,c=b.options,d=b.uiDialog;return b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode!==a.ui.keyCode.TAB)return;var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey)return d.focus(1),!1;if(b.target===d[0]&&b.shiftKey)return e.focus(1),!1}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open"),b},_createButtons:function(b){var c=this,d=!1,e=a("
").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),f=a("
").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0)}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('').click(function(){d.click.apply(c.element[0],arguments)}).appendTo(f);a.each(d,function(a,b){if(a==="click")return;a in e?e[a](b):e.attr(a,b)}),a.fn.button&&e.button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset}}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g))},drag:function(a,c){b._trigger("drag",a,f(c))},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize()}})},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c))},resize:function(a,b){d._trigger("resize",a,h(b))},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize()}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide()},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b)}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f)},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||" "))}a.Widget.prototype._setOption.apply(e,arguments)},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d))}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),a.extend(a.ui.dialog,{version:"1.8.24",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");return b||(this.uuid+=1,b=this.uuid),"ui-dialog-title-"+b},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});return a.fn.bgiframe&&c.bgiframe(),this.instances.push(c),c},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"))}),this.maxZ=d},height:function(){var b,c;return a.browser.msie&&a.browser.version<7?(b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),b0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?a.isFunction(b)?this.each(function(c){a(this).offset(b.call(this,c,a(this).offset()))}):this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),a.curCSS||(a.curCSS=a.css),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()}(jQuery),function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){return a===b?this._value():(this._setOption("value",a),this)},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;return typeof a!="number"&&(a=0),Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.24"})}(jQuery),function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("
").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;ic&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.24"})}(jQuery),function(a,b){function e(){return++c}function f(){return++d}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return e.selected=a,!1}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1)return this.blur(),!1;e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected"))return e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur(),!1;if(!f.length)return e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur(),!1}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){return typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']"))),a},destroy:function(){var b=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie),this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);return j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e])),this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();return d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0])),this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)==-1)return;return this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;return a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))),this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;return this.anchors.eq(a).trigger(this.options.event+".tabs"),this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}return this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(a,b){return this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b),this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.24"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++au;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(j.has(n,a)&&t.call(e,n[a],a,n)===r)return};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduce===v)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduceRight===h)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},j.find=j.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:g&&n.every===g?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var O=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,function(n){return n[t]})},j.where=function(n,t,r){return j.isEmpty(t)?r?void 0:[]:j[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},j.findWhere=function(n,t){return j.where(n,t,!0)},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&j.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>e.computed&&(e={value:n,computed:a})}),e.value},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&j.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;ae||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.indexi;){var o=i+a>>>1;r.call(e,n[o])=0})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var M=function(){};j.bind=function(n,t){var r,e;if(w&&n.bind===w)return w.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));M.prototype=n.prototype;var u=new M;M.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=r.leading===!1?0:new Date,a=null,i=n.apply(e,u)};return function(){var l=new Date;o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u)):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u=null;return function(){var i=this,a=arguments,o=function(){u=null,r||(e=n.apply(i,a))},c=r&&!u;return clearTimeout(u),u=setTimeout(o,t),c&&(e=n.apply(i,a)),e}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){var t=[];for(var r in n)j.has(n,r)&&t.push(n[r]);return t},j.pairs=function(n){var t=[];for(var r in n)j.has(n,r)&&t.push([r,n[r]]);return t},j.invert=function(n){var t={};for(var r in n)j.has(n,r)&&(t[n[r]]=r);return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};I.unescape=j.invert(I.escape);var T={escape:new RegExp("["+j.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(I.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(T[n],function(t){return I[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this); -//# sourceMappingURL=underscore-min.map \ No newline at end of file diff --git a/airtime_mvc/public/js/timepicker/jquery-ui-timepicker-addon.js b/airtime_mvc/public/js/timepicker/jquery-ui-timepicker-addon.js deleted file mode 100644 index 6f35ee532..000000000 --- a/airtime_mvc/public/js/timepicker/jquery-ui-timepicker-addon.js +++ /dev/null @@ -1,2128 +0,0 @@ -/* - * jQuery timepicker addon - * By: Trent Richardson [http://trentrichardson.com] - * Version 1.3.1 - * Last Modified: 07/07/2013 - * - * Copyright 2013 Trent Richardson - * You may use this project under MIT or GPL licenses. - * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt - * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt - */ - -/*jslint evil: true, white: false, undef: false, nomen: false */ - -(function($) { - - /* - * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded" - */ - $.ui.datetimepicker = $.ui.datetimepicker || {}; - if ($.ui.datetimepicker.version) { - return; - } - - /* - * Extend jQueryUI, get it started with our version number - */ - $.extend($.ui, { - datetimepicker: { - version: "1.3.1" - } - }); - - /* - * Timepicker manager. - * Use the singleton instance of this class, $.datetimepicker, to interact with the time picker. - * Settings for (groups of) time pickers are maintained in an instance object, - * allowing multiple different settings on the same page. - */ - var Timepicker = function() { - this.regional = []; // Available regional settings, indexed by language code - this.regional[''] = { // Default regional settings - currentText: 'Now', - closeText: 'Done', - amNames: ['AM', 'A'], - pmNames: ['PM', 'P'], - timeFormat: 'HH:mm', - timeSuffix: '', - timeOnlyTitle: 'Choose Time', - timeText: 'Time', - hourText: 'Hour', - minuteText: 'Minute', - secondText: 'Second', - millisecText: 'Millisecond', - microsecText: 'Microsecond', - timezoneText: 'Time Zone', - isRTL: false - }; - this._defaults = { // Global defaults for all the datetime picker instances - showButtonPanel: true, - timeOnly: false, - showHour: null, - showMinute: null, - showSecond: null, - showMillisec: null, - showMicrosec: null, - showTimezone: null, - showTime: true, - stepHour: 1, - stepMinute: 1, - stepSecond: 1, - stepMillisec: 1, - stepMicrosec: 1, - hour: 0, - minute: 0, - second: 0, - millisec: 0, - microsec: 0, - timezone: null, - hourMin: 0, - minuteMin: 0, - secondMin: 0, - millisecMin: 0, - microsecMin: 0, - hourMax: 23, - minuteMax: 59, - secondMax: 59, - millisecMax: 999, - microsecMax: 999, - minDateTime: null, - maxDateTime: null, - onSelect: null, - hourGrid: 0, - minuteGrid: 0, - secondGrid: 0, - millisecGrid: 0, - microsecGrid: 0, - alwaysSetTime: true, - separator: ' ', - altFieldTimeOnly: true, - altTimeFormat: null, - altSeparator: null, - altTimeSuffix: null, - pickerTimeFormat: null, - pickerTimeSuffix: null, - showTimepicker: true, - timezoneList: null, - addSliderAccess: false, - sliderAccessArgs: null, - controlType: 'slider', - defaultValue: null, - parse: 'strict' - }; - $.extend(this._defaults, this.regional['']); - }; - - $.extend(Timepicker.prototype, { - $input: null, - $altInput: null, - $timeObj: null, - inst: null, - hour_slider: null, - minute_slider: null, - second_slider: null, - millisec_slider: null, - microsec_slider: null, - timezone_select: null, - hour: 0, - minute: 0, - second: 0, - millisec: 0, - microsec: 0, - timezone: null, - hourMinOriginal: null, - minuteMinOriginal: null, - secondMinOriginal: null, - millisecMinOriginal: null, - microsecMinOriginal: null, - hourMaxOriginal: null, - minuteMaxOriginal: null, - secondMaxOriginal: null, - millisecMaxOriginal: null, - microsecMaxOriginal: null, - ampm: '', - formattedDate: '', - formattedTime: '', - formattedDateTime: '', - timezoneList: null, - units: ['hour','minute','second','millisec', 'microsec'], - support: {}, - control: null, - - /* - * Override the default settings for all instances of the time picker. - * @param settings object - the new settings to use as defaults (anonymous object) - * @return the manager object - */ - setDefaults: function(settings) { - extendRemove(this._defaults, settings || {}); - return this; - }, - - /* - * Create a new Timepicker instance - */ - _newInst: function($input, opts) { - var tp_inst = new Timepicker(), - inlineSettings = {}, - fns = {}, - overrides, i; - - for (var attrName in this._defaults) { - if(this._defaults.hasOwnProperty(attrName)){ - var attrValue = $input.attr('time:' + attrName); - if (attrValue) { - try { - inlineSettings[attrName] = eval(attrValue); - } catch (err) { - inlineSettings[attrName] = attrValue; - } - } - } - } - - overrides = { - beforeShow: function (input, dp_inst) { - if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) { - return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst); - } - }, - onChangeMonthYear: function (year, month, dp_inst) { - // Update the time as well : this prevents the time from disappearing from the $input field. - tp_inst._updateDateTime(dp_inst); - if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) { - tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst); - } - }, - onClose: function (dateText, dp_inst) { - if (tp_inst.timeDefined === true && $input.val() !== '') { - tp_inst._updateDateTime(dp_inst); - } - if ($.isFunction(tp_inst._defaults.evnts.onClose)) { - tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst); - } - } - }; - for (i in overrides) { - if (overrides.hasOwnProperty(i)) { - fns[i] = opts[i] || null; - } - } - - tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, { - evnts:fns, - timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker'); - }); - tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) { - return val.toUpperCase(); - }); - tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) { - return val.toUpperCase(); - }); - - // detect which units are supported - tp_inst.support = detectSupport( - tp_inst._defaults.timeFormat + - (tp_inst._defaults.pickerTimeFormat? tp_inst._defaults.pickerTimeFormat:'') + - (tp_inst._defaults.altTimeFormat? tp_inst._defaults.altTimeFormat:'')); - - // controlType is string - key to our this._controls - if(typeof(tp_inst._defaults.controlType) === 'string'){ - if(tp_inst._defaults.controlType == 'slider' && typeof(jQuery.ui.slider) === 'undefined'){ - tp_inst._defaults.controlType = 'select'; - } - tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType]; - } - // controlType is an object and must implement create, options, value methods - else{ - tp_inst.control = tp_inst._defaults.controlType; - } - - // prep the timezone options - var timezoneList = [-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60, - 0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840]; - if (tp_inst._defaults.timezoneList !== null) { - timezoneList = tp_inst._defaults.timezoneList; - } - var tzl=timezoneList.length,tzi=0,tzv=null; - if (tzl > 0 && typeof timezoneList[0] !== 'object') { - for(; tzi tp_inst._defaults.hourMax? tp_inst._defaults.hourMax : tp_inst._defaults.hour; - tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin? tp_inst._defaults.minuteMin : - tp_inst._defaults.minute > tp_inst._defaults.minuteMax? tp_inst._defaults.minuteMax : tp_inst._defaults.minute; - tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin? tp_inst._defaults.secondMin : - tp_inst._defaults.second > tp_inst._defaults.secondMax? tp_inst._defaults.secondMax : tp_inst._defaults.second; - tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin? tp_inst._defaults.millisecMin : - tp_inst._defaults.millisec > tp_inst._defaults.millisecMax? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec; - tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin? tp_inst._defaults.microsecMin : - tp_inst._defaults.microsec > tp_inst._defaults.microsecMax? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec; - tp_inst.ampm = ''; - tp_inst.$input = $input; - - if (tp_inst._defaults.altField) { - tp_inst.$altInput = $(tp_inst._defaults.altField).css({ - cursor: 'pointer' - }).focus(function() { - $input.trigger("focus"); - }); - } - - if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) { - tp_inst._defaults.minDate = new Date(); - } - if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) { - tp_inst._defaults.maxDate = new Date(); - } - - // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime.. - if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) { - tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime()); - } - if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) { - tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime()); - } - if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) { - tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime()); - } - if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) { - tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime()); - } - tp_inst.$input.bind('focus', function() { - tp_inst._onFocus(); - }); - - return tp_inst; - }, - - /* - * add our sliders to the calendar - */ - _addTimePicker: function(dp_inst) { - var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val(); - - this.timeDefined = this._parseTime(currDT); - this._limitMinMaxDateTime(dp_inst, false); - this._injectTimePicker(); - }, - - /* - * parse the time string from input value or _setTime - */ - _parseTime: function(timeString, withDate) { - if (!this.inst) { - this.inst = $.datepicker._getInst(this.$input[0]); - } - - if (withDate || !this._defaults.timeOnly) { - var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat'); - try { - var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults); - if (!parseRes.timeObj) { - return false; - } - $.extend(this, parseRes.timeObj); - } catch (err) { - $.datetimepicker.log("Error parsing the date/time string: " + err + - "\ndate/time string = " + timeString + - "\ntimeFormat = " + this._defaults.timeFormat + - "\ndateFormat = " + dp_dateFormat); - return false; - } - return true; - } else { - var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults); - if (!timeObj) { - return false; - } - $.extend(this, timeObj); - return true; - } - }, - - /* - * generate and inject html for timepicker into ui datepicker - */ - _injectTimePicker: function() { - var $dp = this.inst.dpDiv, - o = this.inst.settings, - tp_inst = this, - litem = '', - uitem = '', - show = null, - max = {}, - gridSize = {}, - size = null, - i=0, - l=0; - - // Prevent displaying twice - if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) { - var noDisplay = ' style="display:none;"', - html = '
    ' + '
    ' + o.timeText + '
    ' + - '
    '; - - // Create the markup - for(i=0,l=this.units.length; i' + o[litem +'Text'] + '' + - '
    '; - - if (show && o[litem+'Grid'] > 0) { - html += '
    '; - - if(litem == 'hour'){ - for (var h = o[litem+'Min']; h <= max[litem]; h += parseInt(o[litem+'Grid'], 10)) { - gridSize[litem]++; - var tmph = $.datepicker.formatTime(this.support.ampm? 'hht':'HH', {hour:h}, o); - html += ''; - } - } - else{ - for (var m = o[litem+'Min']; m <= max[litem]; m += parseInt(o[litem+'Grid'], 10)) { - gridSize[litem]++; - html += ''; - } - } - - html += '
    ' + tmph + '' + ((m < 10) ? '0' : '') + m + '
    '; - } - html += ''; - } - - // Timezone - var showTz = o.showTimezone !== null? o.showTimezone : this.support.timezone; - html += '
    ' + o.timezoneText + '
    '; - html += '
    '; - - // Create the elements from string - html += ''; - var $tp = $(html); - - // if we only want time picker... - if (o.timeOnly === true) { - $tp.prepend('
    ' + '
    ' + o.timeOnlyTitle + '
    ' + '
    '); - $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide(); - } - - // add sliders, adjust grids, add events - for(i=0,l=tp_inst.units.length; i 0) { - size = 100 * gridSize[litem] * o[litem+'Grid'] / (max[litem] - o[litem+'Min']); - $tp.find('.ui_tpicker_'+litem+' table').css({ - width: size + "%", - marginLeft: o.isRTL? '0' : ((size / (-2 * gridSize[litem])) + "%"), - marginRight: o.isRTL? ((size / (-2 * gridSize[litem])) + "%") : '0', - borderCollapse: 'collapse' - }).find("td").click(function(e){ - var $t = $(this), - h = $t.html(), - n = parseInt(h.replace(/[^0-9]/g),10), - ap = h.replace(/[^apm]/ig), - f = $t.data('for'); // loses scope, so we use data-for - - if(f == 'hour'){ - if(ap.indexOf('p') !== -1 && n < 12){ - n += 12; - } - else{ - if(ap.indexOf('a') !== -1 && n === 12){ - n = 0; - } - } - } - - tp_inst.control.value(tp_inst, tp_inst[f+'_slider'], litem, n); - - tp_inst._onTimeChange(); - tp_inst._onSelectHandler(); - }).css({ - cursor: 'pointer', - width: (100 / gridSize[litem]) + '%', - textAlign: 'center', - overflow: 'hidden' - }); - } // end if grid > 0 - } // end for loop - - // Add timezone options - this.timezone_select = $tp.find('.ui_tpicker_timezone').append('').find("select"); - $.fn.append.apply(this.timezone_select, - $.map(o.timezoneList, function(val, idx) { - return $("