diff --git a/.gitignore b/.gitignore index 3f52a5722..5a4e08e87 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ *.pyc /files python_apps/pypo/liquidsoap_bin/liquidsoap +python_apps/pypo/liquidsoap/ build/build.properties diff --git a/CREDITS b/CREDITS index b6108f552..745ae324b 100644 --- a/CREDITS +++ b/CREDITS @@ -1,6 +1,21 @@ ======= CREDITS ======= +Version 1.9.4 +------------- +Same as previous version. + +Version 1.9.3 +------------- +Same as previous version. + +Version 1.9.2 +------------- +Same as previous version. + +Version 1.9.1 +------------- +Same as previous version. Version 1.9.0 ------------- diff --git a/LICENSE_3RD_PARTY b/LICENSE_3RD_PARTY index 1b6aebdc7..9bc1f8019 100644 --- a/LICENSE_3RD_PARTY +++ b/LICENSE_3RD_PARTY @@ -3,7 +3,10 @@ This application uses the following 3rd Party software: ---------------------- Common Non-linked Code ---------------------- - * Linux (Ubuntu & Debian) + * Linux + - What is it: Kernel + - Web site: https://github.com/torvalds/linux + - License: GPLv2 * RabbitMQ (works with version 1.7.2 and above) - What is it: Interprocess Message Passing with Queuing @@ -40,7 +43,7 @@ Linked code: * Phing - What is it: PHP project build system - Web site: http://phing.info/trac/ - - Note: Only used for development, not needed to run Airtime. + - Note: Only used for database installation and development, not needed to run Airtime. - License: LGPLv3 * PHP-AMQPLIB @@ -108,6 +111,10 @@ Non-linked code: * Server Browse - Web site: http://code.google.com/p/jq-serverbrowse/ - License: BSD 2-Clause + + * meioMask + - Web site: http://www.meiocodigo.com/ + - License: MIT ------------- Media-Monitor diff --git a/VERSION b/VERSION index df9515d6e..aa0e5423d 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ PRODUCT_ID=Airtime -PRODUCT_RELEASE=1.9.1 +PRODUCT_RELEASE=2.0.0-beta1 diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index c60840fb4..f3bf8f561 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -6,24 +6,12 @@ require_once __DIR__."/configs/ACL.php"; require_once 'propel/runtime/lib/Propel.php'; Propel::init(__DIR__."/configs/airtime-conf.php"); -//DateTime in PHP 5.3.0+ need a default timezone set. -$tz = ini_get('date.timezone') ? ini_get('date.timezone') : 'UTC'; -date_default_timezone_set($tz); - require_once __DIR__."/logging/Logging.php"; require_once __DIR__."/configs/constants.php"; require_once __DIR__."/configs/conf.php"; require_once 'DB.php'; -require_once 'Soundcloud.php'; -require_once 'MusicDir.php'; -require_once 'Playlist.php'; -require_once 'StoredFile.php'; -require_once 'Schedule.php'; -require_once 'Shows.php'; -require_once 'Users.php'; -require_once 'RabbitMq.php'; -require_once 'DateHelper.php'; +require_once 'Preference.php'; require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php'; global $CC_CONFIG, $CC_DBC; @@ -31,49 +19,58 @@ $dsn = $CC_CONFIG['dsn']; $CC_DBC = DB::connect($dsn, FALSE); if (PEAR::isError($CC_DBC)) { - echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n"; - exit(1); + echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n"; + exit(1); } $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); + +//DateTime in PHP 5.3.0+ need a default timezone set. +date_default_timezone_set(Application_Model_Preference::GetTimezone()); + Logging::setLogPath('/var/log/airtime/zendphp.log'); Zend_Validate::setDefaultNamespaces("Zend"); $front = Zend_Controller_Front::getInstance(); -$front->registerPlugin(new RabbitMqPlugin()); +$front->registerPlugin(new RabbitMqPlugin()); + +/* The bootstrap class should only be used to initialize actions that return a view. + Actions that return JSON will not use the bootstrap class! */ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { - protected function _initDoctype() + protected function _initDoctype() { $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype('XHTML1_STRICT'); } - protected function _initHeadLink() - { - $view = $this->getResource('view'); + protected function _initHeadLink() + { + $view = $this->getResource('view'); $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); - $view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css'); + $view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css'); $view->headLink()->appendStylesheet($baseUrl.'/css/pro_dropdown_3.css'); - $view->headLink()->appendStylesheet($baseUrl.'/css/styles.css'); - } + $view->headLink()->appendStylesheet($baseUrl.'/css/styles.css'); + } - protected function _initHeadScript() - { - $view = $this->getResource('view'); + protected function _initHeadScript() + { + $view = $this->getResource('view'); $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-1.5.2.min.js','text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-ui-1.8.11.custom.min.js','text/javascript'); + $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-ui-1.8.11.custom.min.js','text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/libs/jquery.stickyPanel.js','text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip-1.0.0.min.js','text/javascript'); + $view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip2.min.js','text/javascript'); + $view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js'); + $view->headScript()->appendScript("var baseUrl='$baseUrl/'"); //scripts for now playing bar $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js','text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/playlist.js','text/javascript'); + $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/playlist.js','text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js','text/javascript'); } @@ -90,5 +87,26 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view->headTitle(Application_Model_Preference::GetHeadTitle()); } + protected function _initZFDebug() + { + if (APPLICATION_ENV == "development"){ + global $CC_DBC; + + $autoloader = Zend_Loader_Autoloader::getInstance(); + $autoloader->registerNamespace('ZFDebug'); + + $options = array( + 'plugins' => array('Variables', + 'Exception', + 'Memory', + 'Time') + ); + $debug = new ZFDebug_Controller_Plugin_Debug($options); + + $this->bootstrap('frontController'); + $frontController = $this->getResource('frontController'); + $frontController->registerPlugin($debug); + } + } } diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php index 5fa4b7a05..72187e4e9 100644 --- a/airtime_mvc/application/configs/ACL.php +++ b/airtime_mvc/application/configs/ACL.php @@ -19,6 +19,7 @@ $ccAcl->add(new Zend_Acl_Resource('library')) ->add(new Zend_Acl_Resource('schedule')) ->add(new Zend_Acl_Resource('api')) ->add(new Zend_Acl_Resource('nowplaying')) + ->add(new Zend_Acl_Resource('systemstatus')) ->add(new Zend_Acl_Resource('search')) ->add(new Zend_Acl_Resource('dashboard')) ->add(new Zend_Acl_Resource('preference')) @@ -40,6 +41,7 @@ $ccAcl->allow('G', 'index') ->allow('H', 'search') ->allow('H', 'playlist') ->allow('A', 'user') + ->allow('A', 'systemstatus') ->allow('A', 'preference'); $aclPlugin = new Zend_Controller_Plugin_Acl($ccAcl); diff --git a/airtime_mvc/application/configs/airtime-conf.php b/airtime_mvc/application/configs/airtime-conf.php index 1fe0ecb7e..74936f1ca 100644 --- a/airtime_mvc/application/configs/airtime-conf.php +++ b/airtime_mvc/application/configs/airtime-conf.php @@ -1,6 +1,6 @@ array ( diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php index 7dec19b57..ef3b99a4b 100644 --- a/airtime_mvc/application/configs/classmap-airtime-conf.php +++ b/airtime_mvc/application/configs/classmap-airtime-conf.php @@ -120,4 +120,25 @@ return array ( 'BaseCcCountryPeer' => 'airtime/om/BaseCcCountryPeer.php', 'BaseCcCountry' => 'airtime/om/BaseCcCountry.php', 'BaseCcCountryQuery' => 'airtime/om/BaseCcCountryQuery.php', + 'CcStreamSettingTableMap' => 'airtime/map/CcStreamSettingTableMap.php', + 'CcStreamSettingPeer' => 'airtime/CcStreamSettingPeer.php', + 'CcStreamSetting' => 'airtime/CcStreamSetting.php', + 'CcStreamSettingQuery' => 'airtime/CcStreamSettingQuery.php', + 'BaseCcStreamSettingPeer' => 'airtime/om/BaseCcStreamSettingPeer.php', + 'BaseCcStreamSetting' => 'airtime/om/BaseCcStreamSetting.php', + 'BaseCcStreamSettingQuery' => 'airtime/om/BaseCcStreamSettingQuery.php', + 'CcLoginAttemptsTableMap' => 'airtime/map/CcLoginAttemptsTableMap.php', + 'CcLoginAttemptsPeer' => 'airtime/CcLoginAttemptsPeer.php', + 'CcLoginAttempts' => 'airtime/CcLoginAttempts.php', + 'CcLoginAttemptsQuery' => 'airtime/CcLoginAttemptsQuery.php', + 'BaseCcLoginAttemptsPeer' => 'airtime/om/BaseCcLoginAttemptsPeer.php', + 'BaseCcLoginAttempts' => 'airtime/om/BaseCcLoginAttempts.php', + 'BaseCcLoginAttemptsQuery' => 'airtime/om/BaseCcLoginAttemptsQuery.php', + 'CcServiceRegisterTableMap' => 'airtime/map/CcServiceRegisterTableMap.php', + 'CcServiceRegisterPeer' => 'airtime/CcServiceRegisterPeer.php', + 'CcServiceRegister' => 'airtime/CcServiceRegister.php', + 'CcServiceRegisterQuery' => 'airtime/CcServiceRegisterQuery.php', + 'BaseCcServiceRegisterPeer' => 'airtime/om/BaseCcServiceRegisterPeer.php', + 'BaseCcServiceRegister' => 'airtime/om/BaseCcServiceRegister.php', + 'BaseCcServiceRegisterQuery' => 'airtime/om/BaseCcServiceRegisterQuery.php', ); \ No newline at end of file diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index 28db07932..50008e3f8 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -1,6 +1,5 @@ 'schedule' ), array( - 'label' => 'Configure', + 'label' => 'System', 'uri' => '#', 'resource' => 'preference', 'pages' => array( @@ -57,22 +57,55 @@ $pages = array( 'label' => 'Manage Media Folders', 'module' => 'default', 'controller' => 'Preference', - 'action' => 'directory-config' + 'action' => 'directory-config', + 'id' => 'manage_folder' + ), + array( + 'label' => 'Stream Settings', + 'module' => 'default', + 'controller' => 'Preference', + 'action' => 'stream-setting' ), array( 'label' => 'Support Settings', 'module' => 'default', 'controller' => 'Preference', 'action' => 'support-setting' + ), + array( + 'label' => 'Status', + 'module' => 'default', + 'controller' => 'systemstatus', + 'action' => 'index', + 'resource' => 'systemstatus' ) ) ), array( 'label' => 'Help', - 'module' => 'default', - 'controller' => 'dashboard', - 'action' => 'help', - 'resource' => 'dashboard' + 'uri' => '#', + 'resource' => 'dashboard', + 'pages' => array( + array( + 'label' => 'Getting Started', + 'module' => 'default', + 'controller' => 'dashboard', + 'action' => 'help', + 'resource' => 'dashboard' + ), + array( + 'label' => 'User Manual', + 'uri' => "http://en.flossmanuals.net/airtime/", + 'target' => "_blank" + ), + array( + 'label' => 'About', + 'module' => 'default', + 'controller' => 'dashboard', + 'action' => 'about', + 'resource' => 'dashboard' + ) + ) ) ); diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index a02183492..1902ea905 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -9,6 +9,7 @@ class ApiController extends Zend_Controller_Action $context = $this->_helper->getHelper('contextSwitch'); $context->addActionContext('version', 'json') ->addActionContext('recorded-shows', 'json') + ->addActionContext('calendar-init', 'json') ->addActionContext('upload-file', 'json') ->addActionContext('upload-recorded', 'json') ->addActionContext('media-monitor-setup', 'json') @@ -19,6 +20,12 @@ class ApiController extends Zend_Controller_Action ->addActionContext('add-watched-dir', 'json') ->addActionContext('remove-watched-dir', 'json') ->addActionContext('set-storage-dir', 'json') + ->addActionContext('get-stream-setting', 'json') + ->addActionContext('status', 'json') + ->addActionContext('register-component', 'json') + ->addActionContext('update-liquidsoap-error', 'json') + ->addActionContext('update-liquidsoap-connection', 'json') + ->addActionContext('library-init', 'json') ->initContext(); } @@ -32,7 +39,7 @@ class ApiController extends Zend_Controller_Action * * First checks to ensure the correct API key was * supplied, then returns AIRTIME_VERSION as defined - * in application/conf.php + * in the database * * @return void * @@ -52,9 +59,32 @@ class ApiController extends Zend_Controller_Action print 'You are not allowed to access this resource.'; exit; } - $jsonStr = json_encode(array("version"=>AIRTIME_VERSION)); + $jsonStr = json_encode(array("version"=>Application_Model_Preference::GetAirtimeVersion())); echo $jsonStr; } + + /** + * Sets up and send init values used in the Calendar. + * This is only being used by schedule.js at the moment. + */ + public function calendarInitAction(){ + $this->view->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + + if(is_null(Zend_Auth::getInstance()->getStorage()->read())) { + header('HTTP/1.0 401 Unauthorized'); + print 'You are not allowed to access this resource.'; + return; + } + + $this->view->calendarInit = array( + "timestamp" => time(), + "timezoneOffset" => date("Z"), + "timeScale" => Application_Model_Preference::GetCalendarTimeScale(), + "timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(), + "weekStartDay" => Application_Model_Preference::GetWeekStartDay() + ); + } /** * Allows remote client to download requested media file. @@ -87,7 +117,7 @@ class ApiController extends Zend_Controller_Action $filename = $this->_getParam("file"); $file_id = substr($filename, 0, strpos($filename, ".")); if (ctype_alnum($file_id) && strlen($file_id) == 32) { - $media = StoredFile::RecallByGunid($file_id); + $media = Application_Model_StoredFile::RecallByGunid($file_id); if ($media != null && !PEAR::isError($media)) { $filepath = $media->getFilePath(); if(is_file($filepath)){ @@ -112,6 +142,7 @@ class ApiController extends Zend_Controller_Action $file_base_name = substr($file_base_name, 1); header('Content-Disposition: attachment; filename="'.$file_base_name.'"'); } + $logger->info("Sending $filepath"); header("Content-Length: " . filesize($filepath)); // !! binary mode !! @@ -148,12 +179,13 @@ class ApiController extends Zend_Controller_Action $this->view->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - $date = new DateHelper; + $date = new Application_Model_DateHelper; $timeNow = $date->getTimestamp(); + $result = array("env"=>APPLICATION_ENV, "schedulerTime"=>gmdate("Y-m-d H:i:s"), - "currentShow"=>Show_DAL::GetCurrentShow($timeNow), - "nextShow"=>Show_DAL::GetNextShows($timeNow, 5), + "currentShow"=>Application_Model_Show::GetCurrentShow($timeNow), + "nextShow"=>Application_Model_Show::GetNextShows($timeNow, 5), "timezone"=> date("T"), "timezoneOffset"=> date("Z")); @@ -178,7 +210,7 @@ class ApiController extends Zend_Controller_Action $result = array(); for ($i=0; $i<7; $i++){ - $result[$dow[$i]] = Show_DAL::GetShowsByDayOfWeek($i); + $result[$dow[$i]] = Application_Model_Show::GetShowsByDayOfWeek($i); } header("Content-type: text/javascript"); @@ -209,7 +241,7 @@ class ApiController extends Zend_Controller_Action PEAR::setErrorHandling(PEAR_ERROR_RETURN); - $result = Schedule::GetScheduledPlaylists(); + $result = Application_Model_Schedule::GetScheduledPlaylists(); echo json_encode($result); } @@ -231,7 +263,7 @@ class ApiController extends Zend_Controller_Action $schedule_group_id = $this->_getParam("schedule_id"); $media_id = $this->_getParam("media_id"); - $result = Schedule::UpdateMediaPlayedStatus($media_id); + $result = Application_Model_Schedule::UpdateMediaPlayedStatus($media_id); if (!PEAR::isError($result)) { echo json_encode(array("status"=>1, "message"=>"")); @@ -260,7 +292,7 @@ class ApiController extends Zend_Controller_Action $schedule_group_id = $this->_getParam("schedule_id"); if (is_numeric($schedule_group_id)) { - $sg = new ScheduleGroup($schedule_group_id); + $sg = new Application_Model_ScheduleGroup($schedule_group_id); if ($sg->exists()) { $result = $sg->notifyGroupStartPlay(); if (!PEAR::isError($result)) { @@ -296,12 +328,12 @@ class ApiController extends Zend_Controller_Action $now = new DateTime($today_timestamp); $end_timestamp = $now->add(new DateInterval("PT2H")); $end_timestamp = $end_timestamp->format("Y-m-d H:i:s"); - $this->view->shows = Show::getShows($today_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE); + $this->view->shows = Application_Model_Show::getShows($today_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE); $this->view->is_recording = false; - $rows = Show_DAL::GetCurrentShow($today_timestamp); + $rows = Application_Model_Show::GetCurrentShow($today_timestamp); if (count($rows) > 0){ $this->view->is_recording = ($rows[0]['record'] == 1); } @@ -320,9 +352,9 @@ class ApiController extends Zend_Controller_Action } $upload_dir = ini_get("upload_tmp_dir"); - StoredFile::uploadFile($upload_dir); + Application_Model_StoredFile::uploadFile($upload_dir); $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : ''; - StoredFile::copyFileToStor($upload_dir, $fileName); + Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName); } public function uploadRecordedAction() @@ -346,17 +378,17 @@ class ApiController extends Zend_Controller_Action $showCanceled = false; - $file = StoredFile::Recall($file_id); + $file = Application_Model_StoredFile::Recall($file_id); //$show_instance = $this->_getParam('show_instance'); $show_name = null; try { - $show_inst = new ShowInstance($show_instance_id); + $show_inst = new Application_Model_ShowInstance($show_instance_id); $show_inst->setRecordedFile($file_id); $show_name = $show_inst->getName(); $show_genre = $show_inst->getGenre(); - $show_start_time = $show_inst->getShowStart(); + $show_start_time = ConvertToLocalDateTimeString($show_inst->getShowStart()); } catch (Exception $e){ //we've reached here probably because the show was @@ -379,24 +411,31 @@ class ApiController extends Zend_Controller_Action $file->setMetadataValue('MDATA_KEY_CREATOR', "Airtime Show Recorder"); $file->setMetadataValue('MDATA_KEY_TRACKNUMBER', null); - if (!$showCanceled && Application_Model_Preference::GetDoSoundCloudUpload()) + if (!$showCanceled && Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud()) { for ($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) { - $show = new Show($show_inst->getShowId()); + $show = new Application_Model_Show($show_inst->getShowId()); $description = $show->getDescription(); $hosts = $show->getHosts(); $tags = array_merge($hosts, array($show_name)); try { - $soundcloud = new ATSoundcloud(); + $soundcloud = new Application_Model_Soundcloud(); $soundcloud_id = $soundcloud->uploadTrack($file->getFilePath(), $tmpTitle, $description, $tags, $show_start_time, $show_genre); - $show_inst->setSoundCloudFileId($soundcloud_id); + $file->setSoundCloudFileId($soundcloud_id); break; } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) { $code = $e->getHttpCode(); + $msg = $e->getHttpBody(); + $temp = explode('"error":',$msg); + $msg = trim($temp[1], '"}'); + $this->setSoundCloudErrorCode($code); + $this->setSoundCloudErrorMsg($msg); + // setting sc id to -3 which indicates error + $this->setSoundCloudFileId(SOUNDCLOUD_ERROR); if(!in_array($code, array(0, 100))) { break; } @@ -425,7 +464,14 @@ class ApiController extends Zend_Controller_Action exit; } - $this->view->stor = MusicDir::getStorDir()->getDirectory(); + $this->view->stor = Application_Model_MusicDir::getStorDir()->getDirectory(); + + $watchedDirs = Application_Model_MusicDir::getWatchedDirs(); + $watchedDirsPath = array(); + foreach($watchedDirs as $wd){ + $watchedDirsPath[] = $wd->getDirectory(); + } + $this->view->watched_dirs = $watchedDirsPath; } public function reloadMetadataAction() { @@ -458,10 +504,10 @@ class ApiController extends Zend_Controller_Action $filepath = $md['MDATA_KEY_FILEPATH']; $filepath = str_replace("\\", "", $filepath); - $file = StoredFile::RecallByFilepath($filepath); + $file = Application_Model_StoredFile::RecallByFilepath($filepath); if (is_null($file)) { - $file = StoredFile::Insert($md); + $file = Application_Model_StoredFile::Insert($md); } else { $this->view->error = "File already exists in Airtime."; @@ -471,7 +517,7 @@ class ApiController extends Zend_Controller_Action else if ($mode == "modify") { $filepath = $md['MDATA_KEY_FILEPATH']; $filepath = str_replace("\\", "", $filepath); - $file = StoredFile::RecallByFilepath($filepath); + $file = Application_Model_StoredFile::RecallByFilepath($filepath); //File is not in database anymore. if (is_null($file)) { @@ -485,7 +531,7 @@ class ApiController extends Zend_Controller_Action } else if ($mode == "moved") { $md5 = $md['MDATA_KEY_MD5']; - $file = StoredFile::RecallByMd5($md5); + $file = Application_Model_StoredFile::RecallByMd5($md5); if (is_null($file)) { $this->view->error = "File doesn't exist in Airtime."; @@ -501,7 +547,7 @@ class ApiController extends Zend_Controller_Action else if ($mode == "delete") { $filepath = $md['MDATA_KEY_FILEPATH']; $filepath = str_replace("\\", "", $filepath); - $file = StoredFile::RecallByFilepath($filepath); + $file = Application_Model_StoredFile::RecallByFilepath($filepath); if (is_null($file)) { $this->view->error = "File doesn't exist in Airtime."; @@ -511,6 +557,16 @@ class ApiController extends Zend_Controller_Action $file->delete(); } } + else if ($mode == "delete_dir") { + $filepath = $md['MDATA_KEY_FILEPATH']; + $filepath = str_replace("\\", "", $filepath); + $files = Application_Model_StoredFile::RecallByPartialFilepath($filepath); + + foreach($files as $file){ + $file->delete(); + } + return; + } $this->view->id = $file->getId(); } @@ -527,7 +583,7 @@ class ApiController extends Zend_Controller_Action } $dir_id = $request->getParam('dir_id'); - $this->view->files = StoredFile::listAllFiles($dir_id); + $this->view->files = Application_Model_StoredFile::listAllFiles($dir_id); } public function listAllWatchedDirsAction() { @@ -544,8 +600,8 @@ class ApiController extends Zend_Controller_Action $result = array(); - $arrWatchedDirs = MusicDir::getWatchedDirs(); - $storDir = MusicDir::getStorDir(); + $arrWatchedDirs = Application_Model_MusicDir::getWatchedDirs(); + $storDir = Application_Model_MusicDir::getStorDir(); $result[$storDir->getId()] = $storDir->getDirectory(); @@ -570,7 +626,7 @@ class ApiController extends Zend_Controller_Action exit; } - $this->view->msg = MusicDir::addWatchedDir($path); + $this->view->msg = Application_Model_MusicDir::addWatchedDir($path); } public function removeWatchedDirAction() { @@ -587,7 +643,7 @@ class ApiController extends Zend_Controller_Action exit; } - $this->view->msg = MusicDir::removeWatchedDir($path); + $this->view->msg = Application_Model_MusicDir::removeWatchedDir($path); } public function setStorageDirAction() { @@ -604,7 +660,97 @@ class ApiController extends Zend_Controller_Action exit; } - $this->view->msg = MusicDir::setStorDir($path); + $this->view->msg = Application_Model_MusicDir::setStorDir($path); + } + + public function getStreamSettingAction() { + global $CC_CONFIG; + + $request = $this->getRequest(); + $api_key = $request->getParam('api_key'); + if (!in_array($api_key, $CC_CONFIG["apiKey"])) + { + header('HTTP/1.0 401 Unauthorized'); + print 'You are not allowed to access this resource.'; + exit; + } + + $this->view->msg = Application_Model_StreamSetting::getStreamSetting(); + } + + public function statusAction() { + global $CC_CONFIG; + + $request = $this->getRequest(); + $api_key = $request->getParam('api_key'); + /* + if (!in_array($api_key, $CC_CONFIG["apiKey"])) + { + header('HTTP/1.0 401 Unauthorized'); + print 'You are not allowed to access this resource.'; + exit; + } + */ + + $status = array( + "platform"=>Application_Model_Systemstatus::GetPlatformInfo(), + "airtime_version"=>Application_Model_Preference::GetAirtimeVersion(), + "services"=>array( + "rabbitmq"=>Application_Model_Systemstatus::GetRabbitMqStatus(), + "pypo"=>Application_Model_Systemstatus::GetPypoStatus(), + "liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(), + "show_recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(), + "media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus() + ), + "partitions"=>Application_Model_Systemstatus::GetDiskInfo() + ); + + $this->view->status = $status; + } + + public function registerComponentAction(){ + $request = $this->getRequest(); + + $component = $request->getParam('component'); + $remoteAddr = $_SERVER['REMOTE_ADDR']; + Logging::log("Registered Component: ".$component."@".$remoteAddr); + + Application_Model_ServiceRegister::Register($component, $remoteAddr); + } + + public function updateLiquidsoapErrorAction(){ + $request = $this->getRequest(); + + $error_msg = $request->getParam('error_msg'); + $stream_id = $request->getParam('stream_id'); + Application_Model_StreamSetting::setLiquidsoapError($stream_id, $error_msg); + } + + public function updateLiquidsoapConnectionAction(){ + $request = $this->getRequest(); + + $stream_id = $request->getParam('stream_id'); + // setting error_msg as "" when there is no error_msg + Application_Model_StreamSetting::setLiquidsoapError($stream_id, "OK"); + } + + /** + * Sets up and send init values used in the Library. + * This is being used by library.js + */ + public function libraryInitAction(){ + $this->view->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + + if(is_null(Zend_Auth::getInstance()->getStorage()->read())) { + header('HTTP/1.0 401 Unauthorized'); + print 'You are not allowed to access this resource.'; + return; + } + + $this->view->libraryInit = array( + "numEntries"=>Application_Model_Preference::GetLibraryNumEntries() + ); } } diff --git a/airtime_mvc/application/controllers/DashboardController.php b/airtime_mvc/application/controllers/DashboardController.php index 55652fc12..8b918137d 100644 --- a/airtime_mvc/application/controllers/DashboardController.php +++ b/airtime_mvc/application/controllers/DashboardController.php @@ -13,10 +13,30 @@ class DashboardController extends Zend_Controller_Action // action body } + public function streamPlayerAction() + { + $request = $this->getRequest(); + $baseUrl = $request->getBaseUrl(); + $this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.blue.monday.css'); + $this->_helper->layout->setLayout('bare'); + + $logo = Application_Model_Preference::GetStationLogo(); + if($logo){ + $this->view->logo = "data:image/png;base64,$logo"; + } else { + $this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png"; + } + } + public function helpAction() { // action body } + public function aboutAction() + { + // action body + } + } diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 67efa7638..6aa4a5b43 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -13,6 +13,9 @@ class LibraryController extends Zend_Controller_Action ->addActionContext('delete', 'json') ->addActionContext('context-menu', 'json') ->addActionContext('get-file-meta-data', 'html') + ->addActionContext('upload-file-soundcloud', 'json') + ->addActionContext('get-upload-to-soundcloud-status', 'json') + ->addActionContext('set-num-entries', 'json') ->initContext(); $this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME); @@ -25,7 +28,6 @@ class LibraryController extends Zend_Controller_Action $baseUrl = $request->getBaseUrl(); $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js','text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js','text/javascript'); @@ -34,6 +36,8 @@ class LibraryController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css'); + $this->view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css'); + $this->_helper->layout->setLayout('library'); $this->_helper->viewRenderer->setResponseSegment('library'); @@ -64,7 +68,7 @@ class LibraryController extends Zend_Controller_Action $paramsPop = str_replace('#type#', $type, $paramsPop); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id); + $user = new Application_Model_User($userInfo->id); $pl_sess = $this->pl_sess; @@ -82,12 +86,29 @@ class LibraryController extends Zend_Controller_Action $id = $this->_getParam('id'); $file_id = $this->_getParam('id', null); - $file = StoredFile::Recall($file_id); + $file = Application_Model_StoredFile::Recall($file_id); - $url = $file->getRelativeFileUrl($baseUrl).'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true'; + $url = $file->getRelativeFileUrl($baseUrl).'/download/true'; $menu[] = array('action' => array('type' => 'gourl', 'url' => $url), 'title' => 'Download'); - + + if (Application_Model_Preference::GetUploadToSoundcloudOption()) { + $text = "Upload to Soundcloud"; + if(!is_null($file->getSoundCloudId())){ + $text = "Re-upload to Soundcloud"; + } + $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Library/upload-file-soundcloud/id/#id#', + 'callback'=>"window['addProgressIcon']('$file_id')"),'title' => $text); + + $scid = $file->getSoundCloudId(); + + if($scid > 0){ + $link_to_file = $file->getSoundCloudLinkToFile(); + $menu[] = array('action' => array('type' => 'fn', + 'callback' => "window['openFileOnSoundCloud']('$link_to_file')"), + 'title' => 'View on SoundCloud'); + } + } if ($user->isAdmin()) { $menu[] = array('action' => array('type' => 'fn', @@ -128,12 +149,12 @@ class LibraryController extends Zend_Controller_Action { $id = $this->_getParam('id'); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id); + $user = new Application_Model_User($userInfo->id); if ($user->isAdmin()) { if (!is_null($id)) { - $file = StoredFile::Recall($id); + $file = Application_Model_StoredFile::Recall($id); if (PEAR::isError($file)) { $this->view->message = $file->getMessage(); @@ -153,7 +174,7 @@ class LibraryController extends Zend_Controller_Action else { $res = settype($res, "integer"); $data = array("filepath" => $file->getFilePath(), "delete" => $res); - RabbitMq::SendMessageToMediaMonitor("file_delete", $data); + Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data); } } @@ -164,12 +185,23 @@ class LibraryController extends Zend_Controller_Action public function contentsAction() { $post = $this->getRequest()->getPost(); - $datatables = StoredFile::searchFilesForPlaylistBuilder($post); + $datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($post); //format clip lengh to 1 decimal foreach($datatables["aaData"] as &$data){ - $sec = Playlist::playlistTimeToSeconds($data[5]); - $data[5] = Playlist::secondsToPlaylistTime($sec); + if($data[6] == 'audioclip'){ + $file = Application_Model_StoredFile::Recall($data[0]); + $scid = $file->getSoundCloudId(); + if($scid == "-2"){ + $data[1] .= ''; + }else if($scid == "-3"){ + $data[1] .= ''; + }else if(!is_null($scid)){ + $data[1] .= ''; + } + } + $sec = Application_Model_Playlist::playlistTimeToSeconds($data[5]); + $data[5] = Application_Model_Playlist::secondsToPlaylistTime($sec); } die(json_encode($datatables)); @@ -179,9 +211,10 @@ class LibraryController extends Zend_Controller_Action { $request = $this->getRequest(); $form = new Application_Form_EditAudioMD(); - + $file_id = $this->_getParam('id', null); - $file = StoredFile::Recall($file_id); + $file = Application_Model_StoredFile::Recall($file_id); + $form->populate($file->getDbColMetadata()); if ($request->isPost()) { if ($form->isValid($request->getPost())) { @@ -190,14 +223,17 @@ class LibraryController extends Zend_Controller_Action $file->setDbColMetadata($formdata); $data = $file->getMetadata(); + + // set MDATA_KEY_FILEPATH + $data['MDATA_KEY_FILEPATH'] = $file->getFilePath(); + Logging::log($data['MDATA_KEY_FILEPATH']); + Application_Model_RabbitMq::SendMessageToMediaMonitor("md_update", $data); - RabbitMq::SendMessageToMediaMonitor("md_update", $data); $this->_helper->redirector('index'); } } - $form->populate($file->getDbColMetadata()); $this->view->form = $form; } @@ -207,16 +243,50 @@ class LibraryController extends Zend_Controller_Action $type = $this->_getParam('type'); if($type == "au") { - $file = StoredFile::Recall($id); + $file = Application_Model_StoredFile::Recall($id); $this->view->type = $type; $this->view->md = $file->getMetadata(); } else if($type == "pl") { - $file = Playlist::Recall($id); + $file = Application_Model_Playlist::Recall($id); $this->view->type = $type; $this->view->md = $file->getAllPLMetaData(); $this->view->contents = $file->getContents(); } } + + public function uploadFileSoundcloudAction(){ + $id = $this->_getParam('id'); + $res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &"); + // we should die with ui info + die(); + } + + public function getUploadToSoundcloudStatusAction(){ + $id = $this->_getParam('id'); + $type = $this->_getParam('type'); + if($type == "show"){ + $show_instance = new Application_Model_ShowInstance($id); + $this->view->sc_id = $show_instance->getSoundCloudFileId(); + $file = $show_instance->getRecordedFile(); + $this->view->error_code = $file->getSoundCloudErrorCode(); + $this->view->error_msg = $file->getSoundCloudErrorMsg(); + }else{ + $file = Application_Model_StoredFile::Recall($id); + $this->view->sc_id = $file->getSoundCloudId(); + $this->view->error_code = $file->getSoundCloudErrorCode(); + $this->view->error_msg = $file->getSoundCloudErrorMsg(); + } + } + + /** + * Stores the number of entries user chose to show in the Library + * to the pref db + */ + public function setNumEntriesAction() { + $request = $this->getRequest(); + $numEntries = $request->getParam('numEntries'); + Application_Model_Preference::SetLibraryNumEntries($numEntries); + } } diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index 107c50872..87ddc30a2 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -10,61 +10,80 @@ class LoginController extends Zend_Controller_Action public function indexAction() { - if(Zend_Auth::getInstance()->hasIdentity()) - { - $this->_redirect('Nowplaying'); - } - - //uses separate layout without a navigation. - $this->_helper->layout->setLayout('login'); - - $request = $this->getRequest(); + if(Zend_Auth::getInstance()->hasIdentity()) + { + $this->_redirect('Nowplaying'); + } + + //uses separate layout without a navigation. + $this->_helper->layout->setLayout('login'); + + $error = false; + $request = $this->getRequest(); + $baseUrl = $request->getBaseUrl(); + + $this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/login.js','text/javascript'); + $form = new Application_Form_Login(); - - $message = "Please enter your user name and password"; + + $message = "Please enter your user name and password"; if($request->isPost()) { + // if the post contains recaptcha field, which means form had recaptcha field. + // Hence add the element for validation. + if(array_key_exists('recaptcha_response_field', $request->getPost())){ + $form->addRecaptcha(); + } if($form->isValid($request->getPost())) { - - $authAdapter = $this->getAuthAdapter(); - //get the username and password from the form $username = $form->getValue('username'); $password = $form->getValue('password'); + if(Application_Model_Subjects::getLoginAttempts($username) >= 3 && $form->getElement('captcha') == NULL){ + $form->addRecaptcha(); + }else{ + $authAdapter = $this->getAuthAdapter(); - //pass to the adapter the submitted username and password - $authAdapter->setIdentity($username) - ->setCredential($password); - - $auth = Zend_Auth::getInstance(); - $result = $auth->authenticate($authAdapter); - - if($result->isValid()) - { - //all info about this user from the login table omit only the password - $userInfo = $authAdapter->getResultRowObject(null, 'password'); - - //the default storage is a session with namespace Zend_Auth - $authStorage = $auth->getStorage(); - $authStorage->write($userInfo); - - $tempSess = new Zend_Session_Namespace("referrer"); - $tempSess->referrer = 'login'; - - $this->_redirect('Nowplaying'); - } - else - { - $message = "Wrong username or password provided. Please try again."; + //pass to the adapter the submitted username and password + $authAdapter->setIdentity($username) + ->setCredential($password); + + $auth = Zend_Auth::getInstance(); + $result = $auth->authenticate($authAdapter); + if($result->isValid()) + { + //all info about this user from the login table omit only the password + $userInfo = $authAdapter->getResultRowObject(null, 'password'); + + //the default storage is a session with namespace Zend_Auth + $authStorage = $auth->getStorage(); + $authStorage->write($userInfo); + + Application_Model_LoginAttempts::resetAttempts($_SERVER['REMOTE_ADDR']); + Application_Model_Subjects::resetLoginAttempts($username); + + $tempSess = new Zend_Session_Namespace("referrer"); + $tempSess->referrer = 'login'; + + $this->_redirect('Nowplaying'); + } + else + { + $message = "Wrong username or password provided. Please try again."; + Application_Model_Subjects::increaseLoginAttempts($username); + Application_Model_LoginAttempts::increaseAttempts($_SERVER['REMOTE_ADDR']); + $form = new Application_Form_Login(); + $error = true; + } } } } - + $this->view->message = $message; + $this->view->error = $error; $this->view->form = $form; - $this->view->airtimeVersion = AIRTIME_VERSION; + $this->view->airtimeVersion = Application_Model_Preference::GetAirtimeVersion(); $this->view->airtimeCopyright = AIRTIME_COPYRIGHT_DATE; } diff --git a/airtime_mvc/application/controllers/NowplayingController.php b/airtime_mvc/application/controllers/NowplayingController.php index 257b354a2..4b9e0430f 100644 --- a/airtime_mvc/application/controllers/NowplayingController.php +++ b/airtime_mvc/application/controllers/NowplayingController.php @@ -23,14 +23,17 @@ class NowplayingController extends Zend_Controller_Action $refer_sses = new Zend_Session_Namespace('referrer'); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id); + $user = new Application_Model_User($userInfo->id); if ($request->isPost()) { $form = new Application_Form_RegisterAirtime(); $values = $request->getPost(); - if ($values["Publicise"] != 1){ + if ($values["Publicise"] != 1 && $form->isValid($values)){ Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); + if(isset($values["Privacy"])){ + Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]); + } // unset session Zend_Session::namespaceUnset('referrer'); } @@ -49,10 +52,12 @@ class NowplayingController extends Zend_Controller_Action Application_Model_Preference::SetStationDescription($values["Description"]); Application_Model_Preference::SetStationLogo($imagePath); Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); + if(isset($values["Privacy"])){ + Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]); + } // unset session Zend_Session::namespaceUnset('referrer'); }else{ - var_dump($form->getMessages()); $logo = Application_Model_Preference::GetStationLogo(); if($logo){ $this->view->logoImg = $logo; @@ -85,12 +90,13 @@ class NowplayingController extends Zend_Controller_Action $this->view->entries = Application_Model_Nowplaying::GetDataGridData($viewType, $dateString); } - +/* public function livestreamAction() { //use bare bones layout (no header bar or menu) $this->_helper->layout->setLayout('bare'); } +*/ public function dayViewAction() { diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index ec2cc345b..f6ca476ba 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -33,7 +33,7 @@ class PlaylistController extends Zend_Controller_Action if(isset($pl_sess->id)) { - $pl = Playlist::Recall($pl_sess->id); + $pl = Application_Model_Playlist::Recall($pl_sess->id); if($pl === FALSE) { unset($pl_sess->id); return; @@ -48,7 +48,7 @@ class PlaylistController extends Zend_Controller_Action if(isset($pl_sess->id)) { - $pl = Playlist::Recall($pl_sess->id); + $pl = Application_Model_Playlist::Recall($pl_sess->id); if($pl !== FALSE) { $this->closePlaylist($pl); } @@ -56,7 +56,7 @@ class PlaylistController extends Zend_Controller_Action $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $pl = Playlist::Recall($pl_id); + $pl = Application_Model_Playlist::Recall($pl_id); if($pl === FALSE) { return FALSE; } @@ -92,7 +92,7 @@ class PlaylistController extends Zend_Controller_Action $pl_sess = $this->pl_sess; $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $pl = new Playlist(); + $pl = new Application_Model_Playlist(); $pl->create("Untitled Playlist"); $pl->setPLMetaData('dc:creator', $userInfo->login); @@ -285,11 +285,11 @@ class PlaylistController extends Zend_Controller_Action public function deleteAction() { $id = $this->_getParam('id', null); - $pl = Playlist::Recall($id); + $pl = Application_Model_Playlist::Recall($id); if ($pl !== FALSE) { - Playlist::Delete($id); + Application_Model_Playlist::Delete($id); $pl_sess = $this->pl_sess; @@ -305,7 +305,7 @@ class PlaylistController extends Zend_Controller_Action public function deleteActiveAction() { $pl = $this->getPlaylist(); - Playlist::Delete($pl->getId()); + Application_Model_Playlist::Delete($pl->getId()); $pl_sess = $this->pl_sess; unset($pl_sess->id); diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php index 73d35196a..6003374f7 100644 --- a/airtime_mvc/application/controllers/PluploadController.php +++ b/airtime_mvc/application/controllers/PluploadController.php @@ -26,7 +26,7 @@ class PluploadController extends Zend_Controller_Action public function uploadAction() { $upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload"; - StoredFile::uploadFile($upload_dir); + Application_Model_StoredFile::uploadFile($upload_dir); die('{"jsonrpc" : "2.0"}'); } @@ -34,7 +34,7 @@ class PluploadController extends Zend_Controller_Action public function copyfileAction(){ $upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload"; $filename = $this->_getParam('name'); - StoredFile::copyFileToStor($upload_dir, $filename); + Application_Model_StoredFile::copyFileToStor($upload_dir, $filename); die('{"jsonrpc" : "2.0"}'); } diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 7b7c62c65..414f3dae2 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -12,6 +12,8 @@ class PreferenceController extends Zend_Controller_Action ->addActionContext('reload-watch-directory', 'json') ->addActionContext('remove-watch-directory', 'json') ->addActionContext('is-import-in-progress', 'json') + ->addActionContext('change-stream-setting', 'json') + ->addActionContext('get-liquidsoap-status', 'json') ->initContext(); } @@ -33,8 +35,12 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]); Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]); Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]); + Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]); + Application_Model_Preference::SetWeekStartDay($values["preferences_general"]["weekStartDay"]); - Application_Model_Preference::SetDoSoundCloudUpload($values["preferences_soundcloud"]["UseSoundCloud"]); + Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]); + Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]); + Application_Model_Preference::SetSoundCloudDownloadbleOption($values["preferences_soundcloud"]["SoundCloudDownloadbleOption"]); Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]); Application_Model_Preference::SetSoundCloudPassword($values["preferences_soundcloud"]["SoundCloudPassword"]); Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]); @@ -60,24 +66,32 @@ class PreferenceController extends Zend_Controller_Action $form = new Application_Form_SupportSettings(); if ($request->isPost()) { - if ($form->isValid($request->getPost())) { - $values = $form->getValues(); + $values = $request->getPost(); + if ($form->isValid($values)) { + if ($values["Publicise"] != 1){ + Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); + if(isset($values["Privacy"])){ + Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]); + } + }else{ + Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view); + Application_Model_Preference::SetPhone($values["Phone"]); + Application_Model_Preference::SetEmail($values["Email"]); + Application_Model_Preference::SetStationWebSite($values["StationWebSite"]); + Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); + Application_Model_Preference::SetPublicise($values["Publicise"]); - Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view); - Application_Model_Preference::SetPhone($values["Phone"]); - Application_Model_Preference::SetEmail($values["Email"]); - Application_Model_Preference::SetStationWebSite($values["StationWebSite"]); - Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); - Application_Model_Preference::SetPublicise($values["Publicise"]); - - $form->Logo->receive(); - $imagePath = $form->Logo->getFileName(); - - Application_Model_Preference::SetStationCountry($values["Country"]); - Application_Model_Preference::SetStationCity($values["City"]); - Application_Model_Preference::SetStationDescription($values["Description"]); - Application_Model_Preference::SetStationLogo($imagePath); + $form->Logo->receive(); + $imagePath = $form->Logo->getFileName(); + Application_Model_Preference::SetStationCountry($values["Country"]); + Application_Model_Preference::SetStationCity($values["City"]); + Application_Model_Preference::SetStationDescription($values["Description"]); + Application_Model_Preference::SetStationLogo($imagePath); + if(isset($values["Privacy"])){ + Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]); + } + } $this->view->statusMsg = "
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 = CcLoginAttemptsPeer::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 = CcLoginAttemptsPeer::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->getDbIP();
+ break;
+ case 1:
+ return $this->getDbAttempts();
+ 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 = CcLoginAttemptsPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbIP(),
+ $keys[1] => $this->getDbAttempts(),
+ );
+ 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 = CcLoginAttemptsPeer::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->setDbIP($value);
+ break;
+ case 1:
+ $this->setDbAttempts($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 = CcLoginAttemptsPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbIP($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbAttempts($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(CcLoginAttemptsPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcLoginAttemptsPeer::IP)) $criteria->add(CcLoginAttemptsPeer::IP, $this->ip);
+ if ($this->isColumnModified(CcLoginAttemptsPeer::ATTEMPTS)) $criteria->add(CcLoginAttemptsPeer::ATTEMPTS, $this->attempts);
+
+ 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(CcLoginAttemptsPeer::DATABASE_NAME);
+ $criteria->add(CcLoginAttemptsPeer::IP, $this->ip);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return string
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbIP();
+ }
+
+ /**
+ * Generic method to set the primary key (ip column).
+ *
+ * @param string $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbIP($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbIP();
+ }
+
+ /**
+ * 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 CcLoginAttempts (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->setDbIP($this->ip);
+ $copyObj->setDbAttempts($this->attempts);
+
+ $copyObj->setNew(true);
+ }
+
+ /**
+ * 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 CcLoginAttempts 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 CcLoginAttemptsPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcLoginAttemptsPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->ip = null;
+ $this->attempts = 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)
+
+ }
+
+ /**
+ * 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);
+ }
+
+} // BaseCcLoginAttempts
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsPeer.php
new file mode 100644
index 000000000..27b4cd90c
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsPeer.php
@@ -0,0 +1,735 @@
+ array ('DbIP', 'DbAttempts', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbIP', 'dbAttempts', ),
+ BasePeer::TYPE_COLNAME => array (self::IP, self::ATTEMPTS, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('IP', 'ATTEMPTS', ),
+ BasePeer::TYPE_FIELDNAME => array ('ip', 'attempts', ),
+ 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 ('DbIP' => 0, 'DbAttempts' => 1, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbIP' => 0, 'dbAttempts' => 1, ),
+ BasePeer::TYPE_COLNAME => array (self::IP => 0, self::ATTEMPTS => 1, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('IP' => 0, 'ATTEMPTS' => 1, ),
+ BasePeer::TYPE_FIELDNAME => array ('ip' => 0, 'attempts' => 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. CcLoginAttemptsPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcLoginAttemptsPeer::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(CcLoginAttemptsPeer::IP);
+ $criteria->addSelectColumn(CcLoginAttemptsPeer::ATTEMPTS);
+ } else {
+ $criteria->addSelectColumn($alias . '.IP');
+ $criteria->addSelectColumn($alias . '.ATTEMPTS');
+ }
+ }
+
+ /**
+ * 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(CcLoginAttemptsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcLoginAttemptsPeer::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(CcLoginAttemptsPeer::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 CcLoginAttempts
+ * @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 = CcLoginAttemptsPeer::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 CcLoginAttemptsPeer::populateObjects(CcLoginAttemptsPeer::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(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcLoginAttemptsPeer::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 CcLoginAttempts $value A CcLoginAttempts object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcLoginAttempts $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbIP();
+ } // 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 CcLoginAttempts object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcLoginAttempts) {
+ $key = (string) $value->getDbIP();
+ } 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 CcLoginAttempts 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 CcLoginAttempts 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_login_attempts
+ * 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 (string) $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 = CcLoginAttemptsPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcLoginAttemptsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcLoginAttemptsPeer::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;
+ CcLoginAttemptsPeer::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 (CcLoginAttempts object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcLoginAttemptsPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcLoginAttemptsPeer::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 + CcLoginAttemptsPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcLoginAttemptsPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcLoginAttemptsPeer::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(BaseCcLoginAttemptsPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcLoginAttemptsPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcLoginAttemptsTableMap());
+ }
+ }
+
+ /**
+ * 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 ? CcLoginAttemptsPeer::CLASS_DEFAULT : CcLoginAttemptsPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcLoginAttempts or Criteria object.
+ *
+ * @param mixed $values Criteria or CcLoginAttempts 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(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcLoginAttempts object
+ }
+
+
+ // 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 CcLoginAttempts or Criteria object.
+ *
+ * @param mixed $values Criteria or CcLoginAttempts 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(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcLoginAttemptsPeer::IP);
+ $value = $criteria->remove(CcLoginAttemptsPeer::IP);
+ if ($value) {
+ $selectCriteria->add(CcLoginAttemptsPeer::IP, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcLoginAttemptsPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcLoginAttempts 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_login_attempts 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(CcLoginAttemptsPeer::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(CcLoginAttemptsPeer::TABLE_NAME, $con, CcLoginAttemptsPeer::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).
+ CcLoginAttemptsPeer::clearInstancePool();
+ CcLoginAttemptsPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcLoginAttempts or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcLoginAttempts 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(CcLoginAttemptsPeer::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.
+ CcLoginAttemptsPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcLoginAttempts) { // it's a model object
+ // invalidate the cache for this single object
+ CcLoginAttemptsPeer::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(CcLoginAttemptsPeer::IP, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcLoginAttemptsPeer::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);
+ CcLoginAttemptsPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcLoginAttempts 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 CcLoginAttempts $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(CcLoginAttempts $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcLoginAttemptsPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcLoginAttemptsPeer::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(CcLoginAttemptsPeer::DATABASE_NAME, CcLoginAttemptsPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param string $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcLoginAttempts
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcLoginAttemptsPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcLoginAttemptsPeer::DATABASE_NAME);
+ $criteria->add(CcLoginAttemptsPeer::IP, $pk);
+
+ $v = CcLoginAttemptsPeer::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(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcLoginAttemptsPeer::DATABASE_NAME);
+ $criteria->add(CcLoginAttemptsPeer::IP, $pks, Criteria::IN);
+ $objs = CcLoginAttemptsPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcLoginAttemptsPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcLoginAttemptsPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsQuery.php
new file mode 100644
index 000000000..930f32eda
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsQuery.php
@@ -0,0 +1,205 @@
+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 CcLoginAttempts|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcLoginAttemptsPeer::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 CcLoginAttemptsQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcLoginAttemptsPeer::IP, $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 CcLoginAttemptsQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcLoginAttemptsPeer::IP, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the ip column
+ *
+ * @param string $dbIP 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 CcLoginAttemptsQuery The current query, for fluid interface
+ */
+ public function filterByDbIP($dbIP = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbIP)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbIP)) {
+ $dbIP = str_replace('*', '%', $dbIP);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcLoginAttemptsPeer::IP, $dbIP, $comparison);
+ }
+
+ /**
+ * Filter the query on the attempts column
+ *
+ * @param int|array $dbAttempts 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 CcLoginAttemptsQuery The current query, for fluid interface
+ */
+ public function filterByDbAttempts($dbAttempts = null, $comparison = null)
+ {
+ if (is_array($dbAttempts)) {
+ $useMinMax = false;
+ if (isset($dbAttempts['min'])) {
+ $this->addUsingAlias(CcLoginAttemptsPeer::ATTEMPTS, $dbAttempts['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbAttempts['max'])) {
+ $this->addUsingAlias(CcLoginAttemptsPeer::ATTEMPTS, $dbAttempts['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcLoginAttemptsPeer::ATTEMPTS, $dbAttempts, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcLoginAttempts $ccLoginAttempts Object to remove from the list of results
+ *
+ * @return CcLoginAttemptsQuery The current query, for fluid interface
+ */
+ public function prune($ccLoginAttempts = null)
+ {
+ if ($ccLoginAttempts) {
+ $this->addUsingAlias(CcLoginAttemptsPeer::IP, $ccLoginAttempts->getDbIP(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcLoginAttemptsQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcServiceRegister.php b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegister.php
new file mode 100644
index 000000000..dbb3aa6a2
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegister.php
@@ -0,0 +1,708 @@
+name;
+ }
+
+ /**
+ * Get the [ip] column value.
+ *
+ * @return string
+ */
+ public function getDbIp()
+ {
+ return $this->ip;
+ }
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return CcServiceRegister 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[] = CcServiceRegisterPeer::NAME;
+ }
+
+ return $this;
+ } // setDbName()
+
+ /**
+ * Set the value of [ip] column.
+ *
+ * @param string $v new value
+ * @return CcServiceRegister The current object (for fluent API support)
+ */
+ public function setDbIp($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->ip !== $v) {
+ $this->ip = $v;
+ $this->modifiedColumns[] = CcServiceRegisterPeer::IP;
+ }
+
+ return $this;
+ } // setDbIp()
+
+ /**
+ * 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->name = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null;
+ $this->ip = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 2; // 2 = CcServiceRegisterPeer::NUM_COLUMNS - CcServiceRegisterPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcServiceRegister 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(CcServiceRegisterPeer::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 = CcServiceRegisterPeer::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?
+
+ } // 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(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcServiceRegisterQuery::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(CcServiceRegisterPeer::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);
+ CcServiceRegisterPeer::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 object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows = 1;
+ $this->setNew(false);
+ } else {
+ $affectedRows = CcServiceRegisterPeer::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();
+
+
+ if (($retval = CcServiceRegisterPeer::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 = CcServiceRegisterPeer::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->getDbName();
+ break;
+ case 1:
+ return $this->getDbIp();
+ 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 = CcServiceRegisterPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbName(),
+ $keys[1] => $this->getDbIp(),
+ );
+ 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 = CcServiceRegisterPeer::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->setDbName($value);
+ break;
+ case 1:
+ $this->setDbIp($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 = CcServiceRegisterPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbName($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbIp($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(CcServiceRegisterPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcServiceRegisterPeer::NAME)) $criteria->add(CcServiceRegisterPeer::NAME, $this->name);
+ if ($this->isColumnModified(CcServiceRegisterPeer::IP)) $criteria->add(CcServiceRegisterPeer::IP, $this->ip);
+
+ 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(CcServiceRegisterPeer::DATABASE_NAME);
+ $criteria->add(CcServiceRegisterPeer::NAME, $this->name);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return string
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbName();
+ }
+
+ /**
+ * Generic method to set the primary key (name column).
+ *
+ * @param string $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbName($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbName();
+ }
+
+ /**
+ * 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 CcServiceRegister (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->setDbIp($this->ip);
+
+ $copyObj->setNew(true);
+ }
+
+ /**
+ * 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 CcServiceRegister 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 CcServiceRegisterPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcServiceRegisterPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->name = null;
+ $this->ip = 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)
+
+ }
+
+ /**
+ * 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);
+ }
+
+} // BaseCcServiceRegister
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterPeer.php
new file mode 100644
index 000000000..ab7d35634
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterPeer.php
@@ -0,0 +1,735 @@
+ array ('DbName', 'DbIp', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbName', 'dbIp', ),
+ BasePeer::TYPE_COLNAME => array (self::NAME, self::IP, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('NAME', 'IP', ),
+ BasePeer::TYPE_FIELDNAME => array ('name', 'ip', ),
+ 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 ('DbName' => 0, 'DbIp' => 1, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbName' => 0, 'dbIp' => 1, ),
+ BasePeer::TYPE_COLNAME => array (self::NAME => 0, self::IP => 1, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('NAME' => 0, 'IP' => 1, ),
+ BasePeer::TYPE_FIELDNAME => array ('name' => 0, 'ip' => 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. CcServiceRegisterPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcServiceRegisterPeer::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(CcServiceRegisterPeer::NAME);
+ $criteria->addSelectColumn(CcServiceRegisterPeer::IP);
+ } else {
+ $criteria->addSelectColumn($alias . '.NAME');
+ $criteria->addSelectColumn($alias . '.IP');
+ }
+ }
+
+ /**
+ * 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(CcServiceRegisterPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcServiceRegisterPeer::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(CcServiceRegisterPeer::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 CcServiceRegister
+ * @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 = CcServiceRegisterPeer::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 CcServiceRegisterPeer::populateObjects(CcServiceRegisterPeer::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(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcServiceRegisterPeer::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 CcServiceRegister $value A CcServiceRegister object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcServiceRegister $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbName();
+ } // 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 CcServiceRegister object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcServiceRegister) {
+ $key = (string) $value->getDbName();
+ } 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 CcServiceRegister 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 CcServiceRegister 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_service_register
+ * 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 (string) $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 = CcServiceRegisterPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcServiceRegisterPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcServiceRegisterPeer::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;
+ CcServiceRegisterPeer::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 (CcServiceRegister object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcServiceRegisterPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcServiceRegisterPeer::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 + CcServiceRegisterPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcServiceRegisterPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcServiceRegisterPeer::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(BaseCcServiceRegisterPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcServiceRegisterPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcServiceRegisterTableMap());
+ }
+ }
+
+ /**
+ * 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 ? CcServiceRegisterPeer::CLASS_DEFAULT : CcServiceRegisterPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcServiceRegister or Criteria object.
+ *
+ * @param mixed $values Criteria or CcServiceRegister 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(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcServiceRegister object
+ }
+
+
+ // 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 CcServiceRegister or Criteria object.
+ *
+ * @param mixed $values Criteria or CcServiceRegister 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(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcServiceRegisterPeer::NAME);
+ $value = $criteria->remove(CcServiceRegisterPeer::NAME);
+ if ($value) {
+ $selectCriteria->add(CcServiceRegisterPeer::NAME, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcServiceRegisterPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcServiceRegister 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_service_register 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(CcServiceRegisterPeer::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(CcServiceRegisterPeer::TABLE_NAME, $con, CcServiceRegisterPeer::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).
+ CcServiceRegisterPeer::clearInstancePool();
+ CcServiceRegisterPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcServiceRegister or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcServiceRegister 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(CcServiceRegisterPeer::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.
+ CcServiceRegisterPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcServiceRegister) { // it's a model object
+ // invalidate the cache for this single object
+ CcServiceRegisterPeer::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(CcServiceRegisterPeer::NAME, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcServiceRegisterPeer::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);
+ CcServiceRegisterPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcServiceRegister 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 CcServiceRegister $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(CcServiceRegister $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcServiceRegisterPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcServiceRegisterPeer::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(CcServiceRegisterPeer::DATABASE_NAME, CcServiceRegisterPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param string $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcServiceRegister
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcServiceRegisterPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcServiceRegisterPeer::DATABASE_NAME);
+ $criteria->add(CcServiceRegisterPeer::NAME, $pk);
+
+ $v = CcServiceRegisterPeer::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(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcServiceRegisterPeer::DATABASE_NAME);
+ $criteria->add(CcServiceRegisterPeer::NAME, $pks, Criteria::IN);
+ $objs = CcServiceRegisterPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcServiceRegisterPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcServiceRegisterPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterQuery.php
new file mode 100644
index 000000000..a8df529a7
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterQuery.php
@@ -0,0 +1,196 @@
+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 CcServiceRegister|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcServiceRegisterPeer::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 CcServiceRegisterQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcServiceRegisterPeer::NAME, $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 CcServiceRegisterQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcServiceRegisterPeer::NAME, $keys, Criteria::IN);
+ }
+
+ /**
+ * 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 CcServiceRegisterQuery 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(CcServiceRegisterPeer::NAME, $dbName, $comparison);
+ }
+
+ /**
+ * Filter the query on the ip column
+ *
+ * @param string $dbIp 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 CcServiceRegisterQuery The current query, for fluid interface
+ */
+ public function filterByDbIp($dbIp = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbIp)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbIp)) {
+ $dbIp = str_replace('*', '%', $dbIp);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcServiceRegisterPeer::IP, $dbIp, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcServiceRegister $ccServiceRegister Object to remove from the list of results
+ *
+ * @return CcServiceRegisterQuery The current query, for fluid interface
+ */
+ public function prune($ccServiceRegister = null)
+ {
+ if ($ccServiceRegister) {
+ $this->addUsingAlias(CcServiceRegisterPeer::NAME, $ccServiceRegister->getDbName(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcServiceRegisterQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowDays.php b/airtime_mvc/application/models/airtime/om/BaseCcShowDays.php
index 3a2d48f37..be9f66086 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowDays.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowDays.php
@@ -48,6 +48,12 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
*/
protected $start_time;
+ /**
+ * The value for the timezone field.
+ * @var string
+ */
+ protected $timezone;
+
/**
* The value for the duration field.
* @var string
@@ -234,6 +240,16 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
}
}
+ /**
+ * Get the [timezone] column value.
+ *
+ * @return string
+ */
+ public function getDbTimezone()
+ {
+ return $this->timezone;
+ }
+
/**
* Get the [duration] column value.
*
@@ -484,6 +500,26 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
return $this;
} // setDbStartTime()
+ /**
+ * Set the value of [timezone] column.
+ *
+ * @param string $v new value
+ * @return CcShowDays The current object (for fluent API support)
+ */
+ public function setDbTimezone($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->timezone !== $v) {
+ $this->timezone = $v;
+ $this->modifiedColumns[] = CcShowDaysPeer::TIMEZONE;
+ }
+
+ return $this;
+ } // setDbTimezone()
+
/**
* Set the value of [duration] column.
*
@@ -677,12 +713,13 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
$this->first_show = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->last_show = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->start_time = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->duration = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
- $this->day = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
- $this->repeat_type = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
- $this->next_pop_date = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
- $this->show_id = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
- $this->record = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null;
+ $this->timezone = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->duration = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->day = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
+ $this->repeat_type = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
+ $this->next_pop_date = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+ $this->show_id = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null;
+ $this->record = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null;
$this->resetModified();
$this->setNew(false);
@@ -691,7 +728,7 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
$this->ensureConsistency();
}
- return $startcol + 10; // 10 = CcShowDaysPeer::NUM_COLUMNS - CcShowDaysPeer::NUM_LAZY_LOAD_COLUMNS).
+ return $startcol + 11; // 11 = CcShowDaysPeer::NUM_COLUMNS - CcShowDaysPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcShowDays object", $e);
@@ -1031,21 +1068,24 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
return $this->getDbStartTime();
break;
case 4:
- return $this->getDbDuration();
+ return $this->getDbTimezone();
break;
case 5:
- return $this->getDbDay();
+ return $this->getDbDuration();
break;
case 6:
- return $this->getDbRepeatType();
+ return $this->getDbDay();
break;
case 7:
- return $this->getDbNextPopDate();
+ return $this->getDbRepeatType();
break;
case 8:
- return $this->getDbShowId();
+ return $this->getDbNextPopDate();
break;
case 9:
+ return $this->getDbShowId();
+ break;
+ case 10:
return $this->getDbRecord();
break;
default:
@@ -1076,12 +1116,13 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
$keys[1] => $this->getDbFirstShow(),
$keys[2] => $this->getDbLastShow(),
$keys[3] => $this->getDbStartTime(),
- $keys[4] => $this->getDbDuration(),
- $keys[5] => $this->getDbDay(),
- $keys[6] => $this->getDbRepeatType(),
- $keys[7] => $this->getDbNextPopDate(),
- $keys[8] => $this->getDbShowId(),
- $keys[9] => $this->getDbRecord(),
+ $keys[4] => $this->getDbTimezone(),
+ $keys[5] => $this->getDbDuration(),
+ $keys[6] => $this->getDbDay(),
+ $keys[7] => $this->getDbRepeatType(),
+ $keys[8] => $this->getDbNextPopDate(),
+ $keys[9] => $this->getDbShowId(),
+ $keys[10] => $this->getDbRecord(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcShow) {
@@ -1131,21 +1172,24 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
$this->setDbStartTime($value);
break;
case 4:
- $this->setDbDuration($value);
+ $this->setDbTimezone($value);
break;
case 5:
- $this->setDbDay($value);
+ $this->setDbDuration($value);
break;
case 6:
- $this->setDbRepeatType($value);
+ $this->setDbDay($value);
break;
case 7:
- $this->setDbNextPopDate($value);
+ $this->setDbRepeatType($value);
break;
case 8:
- $this->setDbShowId($value);
+ $this->setDbNextPopDate($value);
break;
case 9:
+ $this->setDbShowId($value);
+ break;
+ case 10:
$this->setDbRecord($value);
break;
} // switch()
@@ -1176,12 +1220,13 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
if (array_key_exists($keys[1], $arr)) $this->setDbFirstShow($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbLastShow($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbStartTime($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbDuration($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbDay($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setDbRepeatType($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setDbNextPopDate($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setDbShowId($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setDbRecord($arr[$keys[9]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbTimezone($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbDuration($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbDay($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbRepeatType($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbNextPopDate($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setDbShowId($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setDbRecord($arr[$keys[10]]);
}
/**
@@ -1197,6 +1242,7 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
if ($this->isColumnModified(CcShowDaysPeer::FIRST_SHOW)) $criteria->add(CcShowDaysPeer::FIRST_SHOW, $this->first_show);
if ($this->isColumnModified(CcShowDaysPeer::LAST_SHOW)) $criteria->add(CcShowDaysPeer::LAST_SHOW, $this->last_show);
if ($this->isColumnModified(CcShowDaysPeer::START_TIME)) $criteria->add(CcShowDaysPeer::START_TIME, $this->start_time);
+ if ($this->isColumnModified(CcShowDaysPeer::TIMEZONE)) $criteria->add(CcShowDaysPeer::TIMEZONE, $this->timezone);
if ($this->isColumnModified(CcShowDaysPeer::DURATION)) $criteria->add(CcShowDaysPeer::DURATION, $this->duration);
if ($this->isColumnModified(CcShowDaysPeer::DAY)) $criteria->add(CcShowDaysPeer::DAY, $this->day);
if ($this->isColumnModified(CcShowDaysPeer::REPEAT_TYPE)) $criteria->add(CcShowDaysPeer::REPEAT_TYPE, $this->repeat_type);
@@ -1267,6 +1313,7 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
$copyObj->setDbFirstShow($this->first_show);
$copyObj->setDbLastShow($this->last_show);
$copyObj->setDbStartTime($this->start_time);
+ $copyObj->setDbTimezone($this->timezone);
$copyObj->setDbDuration($this->duration);
$copyObj->setDbDay($this->day);
$copyObj->setDbRepeatType($this->repeat_type);
@@ -1374,6 +1421,7 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
$this->first_show = null;
$this->last_show = null;
$this->start_time = null;
+ $this->timezone = null;
$this->duration = null;
$this->day = null;
$this->repeat_type = null;
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowDaysPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowDaysPeer.php
index fadf97576..df6b9081d 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowDaysPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowDaysPeer.php
@@ -26,7 +26,7 @@ abstract class BaseCcShowDaysPeer {
const TM_CLASS = 'CcShowDaysTableMap';
/** The total number of columns. */
- const NUM_COLUMNS = 10;
+ const NUM_COLUMNS = 11;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -43,6 +43,9 @@ abstract class BaseCcShowDaysPeer {
/** the column name for the START_TIME field */
const START_TIME = 'cc_show_days.START_TIME';
+ /** the column name for the TIMEZONE field */
+ const TIMEZONE = 'cc_show_days.TIMEZONE';
+
/** the column name for the DURATION field */
const DURATION = 'cc_show_days.DURATION';
@@ -77,12 +80,12 @@ abstract class BaseCcShowDaysPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFirstShow', 'DbLastShow', 'DbStartTime', 'DbDuration', 'DbDay', 'DbRepeatType', 'DbNextPopDate', 'DbShowId', 'DbRecord', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFirstShow', 'dbLastShow', 'dbStartTime', 'dbDuration', 'dbDay', 'dbRepeatType', 'dbNextPopDate', 'dbShowId', 'dbRecord', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::FIRST_SHOW, self::LAST_SHOW, self::START_TIME, self::DURATION, self::DAY, self::REPEAT_TYPE, self::NEXT_POP_DATE, self::SHOW_ID, self::RECORD, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FIRST_SHOW', 'LAST_SHOW', 'START_TIME', 'DURATION', 'DAY', 'REPEAT_TYPE', 'NEXT_POP_DATE', 'SHOW_ID', 'RECORD', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'first_show', 'last_show', 'start_time', 'duration', 'day', 'repeat_type', 'next_pop_date', 'show_id', 'record', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFirstShow', 'DbLastShow', 'DbStartTime', 'DbTimezone', 'DbDuration', 'DbDay', 'DbRepeatType', 'DbNextPopDate', 'DbShowId', 'DbRecord', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFirstShow', 'dbLastShow', 'dbStartTime', 'dbTimezone', 'dbDuration', 'dbDay', 'dbRepeatType', 'dbNextPopDate', 'dbShowId', 'dbRecord', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::FIRST_SHOW, self::LAST_SHOW, self::START_TIME, self::TIMEZONE, self::DURATION, self::DAY, self::REPEAT_TYPE, self::NEXT_POP_DATE, self::SHOW_ID, self::RECORD, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FIRST_SHOW', 'LAST_SHOW', 'START_TIME', 'TIMEZONE', 'DURATION', 'DAY', 'REPEAT_TYPE', 'NEXT_POP_DATE', 'SHOW_ID', 'RECORD', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'first_show', 'last_show', 'start_time', 'timezone', 'duration', 'day', 'repeat_type', 'next_pop_date', 'show_id', 'record', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -92,12 +95,12 @@ abstract class BaseCcShowDaysPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFirstShow' => 1, 'DbLastShow' => 2, 'DbStartTime' => 3, 'DbDuration' => 4, 'DbDay' => 5, 'DbRepeatType' => 6, 'DbNextPopDate' => 7, 'DbShowId' => 8, 'DbRecord' => 9, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFirstShow' => 1, 'dbLastShow' => 2, 'dbStartTime' => 3, 'dbDuration' => 4, 'dbDay' => 5, 'dbRepeatType' => 6, 'dbNextPopDate' => 7, 'dbShowId' => 8, 'dbRecord' => 9, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::FIRST_SHOW => 1, self::LAST_SHOW => 2, self::START_TIME => 3, self::DURATION => 4, self::DAY => 5, self::REPEAT_TYPE => 6, self::NEXT_POP_DATE => 7, self::SHOW_ID => 8, self::RECORD => 9, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FIRST_SHOW' => 1, 'LAST_SHOW' => 2, 'START_TIME' => 3, 'DURATION' => 4, 'DAY' => 5, 'REPEAT_TYPE' => 6, 'NEXT_POP_DATE' => 7, 'SHOW_ID' => 8, 'RECORD' => 9, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'first_show' => 1, 'last_show' => 2, 'start_time' => 3, 'duration' => 4, 'day' => 5, 'repeat_type' => 6, 'next_pop_date' => 7, 'show_id' => 8, 'record' => 9, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFirstShow' => 1, 'DbLastShow' => 2, 'DbStartTime' => 3, 'DbTimezone' => 4, 'DbDuration' => 5, 'DbDay' => 6, 'DbRepeatType' => 7, 'DbNextPopDate' => 8, 'DbShowId' => 9, 'DbRecord' => 10, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFirstShow' => 1, 'dbLastShow' => 2, 'dbStartTime' => 3, 'dbTimezone' => 4, 'dbDuration' => 5, 'dbDay' => 6, 'dbRepeatType' => 7, 'dbNextPopDate' => 8, 'dbShowId' => 9, 'dbRecord' => 10, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::FIRST_SHOW => 1, self::LAST_SHOW => 2, self::START_TIME => 3, self::TIMEZONE => 4, self::DURATION => 5, self::DAY => 6, self::REPEAT_TYPE => 7, self::NEXT_POP_DATE => 8, self::SHOW_ID => 9, self::RECORD => 10, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FIRST_SHOW' => 1, 'LAST_SHOW' => 2, 'START_TIME' => 3, 'TIMEZONE' => 4, 'DURATION' => 5, 'DAY' => 6, 'REPEAT_TYPE' => 7, 'NEXT_POP_DATE' => 8, 'SHOW_ID' => 9, 'RECORD' => 10, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'first_show' => 1, 'last_show' => 2, 'start_time' => 3, 'timezone' => 4, 'duration' => 5, 'day' => 6, 'repeat_type' => 7, 'next_pop_date' => 8, 'show_id' => 9, 'record' => 10, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
/**
@@ -173,6 +176,7 @@ abstract class BaseCcShowDaysPeer {
$criteria->addSelectColumn(CcShowDaysPeer::FIRST_SHOW);
$criteria->addSelectColumn(CcShowDaysPeer::LAST_SHOW);
$criteria->addSelectColumn(CcShowDaysPeer::START_TIME);
+ $criteria->addSelectColumn(CcShowDaysPeer::TIMEZONE);
$criteria->addSelectColumn(CcShowDaysPeer::DURATION);
$criteria->addSelectColumn(CcShowDaysPeer::DAY);
$criteria->addSelectColumn(CcShowDaysPeer::REPEAT_TYPE);
@@ -184,6 +188,7 @@ abstract class BaseCcShowDaysPeer {
$criteria->addSelectColumn($alias . '.FIRST_SHOW');
$criteria->addSelectColumn($alias . '.LAST_SHOW');
$criteria->addSelectColumn($alias . '.START_TIME');
+ $criteria->addSelectColumn($alias . '.TIMEZONE');
$criteria->addSelectColumn($alias . '.DURATION');
$criteria->addSelectColumn($alias . '.DAY');
$criteria->addSelectColumn($alias . '.REPEAT_TYPE');
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowDaysQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowDaysQuery.php
index 9df957145..18653bd70 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowDaysQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowDaysQuery.php
@@ -10,6 +10,7 @@
* @method CcShowDaysQuery orderByDbFirstShow($order = Criteria::ASC) Order by the first_show column
* @method CcShowDaysQuery orderByDbLastShow($order = Criteria::ASC) Order by the last_show column
* @method CcShowDaysQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
+ * @method CcShowDaysQuery orderByDbTimezone($order = Criteria::ASC) Order by the timezone column
* @method CcShowDaysQuery orderByDbDuration($order = Criteria::ASC) Order by the duration column
* @method CcShowDaysQuery orderByDbDay($order = Criteria::ASC) Order by the day column
* @method CcShowDaysQuery orderByDbRepeatType($order = Criteria::ASC) Order by the repeat_type column
@@ -21,6 +22,7 @@
* @method CcShowDaysQuery groupByDbFirstShow() Group by the first_show column
* @method CcShowDaysQuery groupByDbLastShow() Group by the last_show column
* @method CcShowDaysQuery groupByDbStartTime() Group by the start_time column
+ * @method CcShowDaysQuery groupByDbTimezone() Group by the timezone column
* @method CcShowDaysQuery groupByDbDuration() Group by the duration column
* @method CcShowDaysQuery groupByDbDay() Group by the day column
* @method CcShowDaysQuery groupByDbRepeatType() Group by the repeat_type column
@@ -43,6 +45,7 @@
* @method CcShowDays findOneByDbFirstShow(string $first_show) Return the first CcShowDays filtered by the first_show column
* @method CcShowDays findOneByDbLastShow(string $last_show) Return the first CcShowDays filtered by the last_show column
* @method CcShowDays findOneByDbStartTime(string $start_time) Return the first CcShowDays filtered by the start_time column
+ * @method CcShowDays findOneByDbTimezone(string $timezone) Return the first CcShowDays filtered by the timezone column
* @method CcShowDays findOneByDbDuration(string $duration) Return the first CcShowDays filtered by the duration column
* @method CcShowDays findOneByDbDay(int $day) Return the first CcShowDays filtered by the day column
* @method CcShowDays findOneByDbRepeatType(int $repeat_type) Return the first CcShowDays filtered by the repeat_type column
@@ -54,6 +57,7 @@
* @method array findByDbFirstShow(string $first_show) Return CcShowDays objects filtered by the first_show column
* @method array findByDbLastShow(string $last_show) Return CcShowDays objects filtered by the last_show column
* @method array findByDbStartTime(string $start_time) Return CcShowDays objects filtered by the start_time column
+ * @method array findByDbTimezone(string $timezone) Return CcShowDays objects filtered by the timezone column
* @method array findByDbDuration(string $duration) Return CcShowDays objects filtered by the duration column
* @method array findByDbDay(int $day) Return CcShowDays objects filtered by the day column
* @method array findByDbRepeatType(int $repeat_type) Return CcShowDays objects filtered by the repeat_type column
@@ -279,6 +283,28 @@ abstract class BaseCcShowDaysQuery extends ModelCriteria
return $this->addUsingAlias(CcShowDaysPeer::START_TIME, $dbStartTime, $comparison);
}
+ /**
+ * Filter the query on the timezone column
+ *
+ * @param string $dbTimezone The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcShowDaysQuery The current query, for fluid interface
+ */
+ public function filterByDbTimezone($dbTimezone = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbTimezone)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbTimezone)) {
+ $dbTimezone = str_replace('*', '%', $dbTimezone);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcShowDaysPeer::TIMEZONE, $dbTimezone, $comparison);
+ }
+
/**
* Filter the query on the duration column
*
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php
index 790a460cc..ebadd9600 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php
@@ -74,12 +74,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
*/
protected $file_id;
- /**
- * The value for the soundcloud_id field.
- * @var int
- */
- protected $soundcloud_id;
-
/**
* The value for the time_filled field.
* @var string
@@ -273,16 +267,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
return $this->file_id;
}
- /**
- * Get the [soundcloud_id] column value.
- *
- * @return int
- */
- public function getDbSoundCloudId()
- {
- return $this->soundcloud_id;
- }
-
/**
* Get the [optionally formatted] temporal [time_filled] column value.
*
@@ -546,26 +530,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
return $this;
} // setDbRecordedFile()
- /**
- * Set the value of [soundcloud_id] column.
- *
- * @param int $v new value
- * @return CcShowInstances The current object (for fluent API support)
- */
- public function setDbSoundCloudId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->soundcloud_id !== $v) {
- $this->soundcloud_id = $v;
- $this->modifiedColumns[] = CcShowInstancesPeer::SOUNDCLOUD_ID;
- }
-
- return $this;
- } // setDbSoundCloudId()
-
/**
* Sets the value of [time_filled] column to a normalized version of the date/time value specified.
*
@@ -663,8 +627,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$this->rebroadcast = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
$this->instance_id = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
$this->file_id = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
- $this->soundcloud_id = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
- $this->time_filled = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
+ $this->time_filled = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->resetModified();
$this->setNew(false);
@@ -673,7 +636,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$this->ensureConsistency();
}
- return $startcol + 10; // 10 = CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS).
+ return $startcol + 9; // 9 = CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcShowInstances object", $e);
@@ -1095,9 +1058,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
return $this->getDbRecordedFile();
break;
case 8:
- return $this->getDbSoundCloudId();
- break;
- case 9:
return $this->getDbTimeFilled();
break;
default:
@@ -1132,8 +1092,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$keys[5] => $this->getDbRebroadcast(),
$keys[6] => $this->getDbOriginalShow(),
$keys[7] => $this->getDbRecordedFile(),
- $keys[8] => $this->getDbSoundCloudId(),
- $keys[9] => $this->getDbTimeFilled(),
+ $keys[8] => $this->getDbTimeFilled(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcShow) {
@@ -1201,9 +1160,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$this->setDbRecordedFile($value);
break;
case 8:
- $this->setDbSoundCloudId($value);
- break;
- case 9:
$this->setDbTimeFilled($value);
break;
} // switch()
@@ -1238,8 +1194,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
if (array_key_exists($keys[5], $arr)) $this->setDbRebroadcast($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setDbOriginalShow($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDbRecordedFile($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setDbSoundCloudId($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setDbTimeFilled($arr[$keys[9]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbTimeFilled($arr[$keys[8]]);
}
/**
@@ -1259,7 +1214,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
if ($this->isColumnModified(CcShowInstancesPeer::REBROADCAST)) $criteria->add(CcShowInstancesPeer::REBROADCAST, $this->rebroadcast);
if ($this->isColumnModified(CcShowInstancesPeer::INSTANCE_ID)) $criteria->add(CcShowInstancesPeer::INSTANCE_ID, $this->instance_id);
if ($this->isColumnModified(CcShowInstancesPeer::FILE_ID)) $criteria->add(CcShowInstancesPeer::FILE_ID, $this->file_id);
- if ($this->isColumnModified(CcShowInstancesPeer::SOUNDCLOUD_ID)) $criteria->add(CcShowInstancesPeer::SOUNDCLOUD_ID, $this->soundcloud_id);
if ($this->isColumnModified(CcShowInstancesPeer::TIME_FILLED)) $criteria->add(CcShowInstancesPeer::TIME_FILLED, $this->time_filled);
return $criteria;
@@ -1329,7 +1283,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$copyObj->setDbRebroadcast($this->rebroadcast);
$copyObj->setDbOriginalShow($this->instance_id);
$copyObj->setDbRecordedFile($this->file_id);
- $copyObj->setDbSoundCloudId($this->soundcloud_id);
$copyObj->setDbTimeFilled($this->time_filled);
if ($deepCopy) {
@@ -1847,7 +1800,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$this->rebroadcast = null;
$this->instance_id = null;
$this->file_id = null;
- $this->soundcloud_id = null;
$this->time_filled = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php
index d7dda7647..bbbfc3da9 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php
@@ -26,7 +26,7 @@ abstract class BaseCcShowInstancesPeer {
const TM_CLASS = 'CcShowInstancesTableMap';
/** The total number of columns. */
- const NUM_COLUMNS = 10;
+ const NUM_COLUMNS = 9;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -55,9 +55,6 @@ abstract class BaseCcShowInstancesPeer {
/** the column name for the FILE_ID field */
const FILE_ID = 'cc_show_instances.FILE_ID';
- /** the column name for the SOUNDCLOUD_ID field */
- const SOUNDCLOUD_ID = 'cc_show_instances.SOUNDCLOUD_ID';
-
/** the column name for the TIME_FILLED field */
const TIME_FILLED = 'cc_show_instances.TIME_FILLED';
@@ -77,12 +74,12 @@ abstract class BaseCcShowInstancesPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbSoundCloudId', 'DbTimeFilled', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbSoundCloudId', 'dbTimeFilled', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::SHOW_ID, self::RECORD, self::REBROADCAST, self::INSTANCE_ID, self::FILE_ID, self::SOUNDCLOUD_ID, self::TIME_FILLED, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'SOUNDCLOUD_ID', 'TIME_FILLED', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'soundcloud_id', 'time_filled', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbTimeFilled', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbTimeFilled', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::SHOW_ID, self::RECORD, self::REBROADCAST, self::INSTANCE_ID, self::FILE_ID, self::TIME_FILLED, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'TIME_FILLED', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'time_filled', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -92,12 +89,12 @@ abstract class BaseCcShowInstancesPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbShowId' => 3, 'DbRecord' => 4, 'DbRebroadcast' => 5, 'DbOriginalShow' => 6, 'DbRecordedFile' => 7, 'DbSoundCloudId' => 8, 'DbTimeFilled' => 9, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbShowId' => 3, 'dbRecord' => 4, 'dbRebroadcast' => 5, 'dbOriginalShow' => 6, 'dbRecordedFile' => 7, 'dbSoundCloudId' => 8, 'dbTimeFilled' => 9, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::SHOW_ID => 3, self::RECORD => 4, self::REBROADCAST => 5, self::INSTANCE_ID => 6, self::FILE_ID => 7, self::SOUNDCLOUD_ID => 8, self::TIME_FILLED => 9, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'SHOW_ID' => 3, 'RECORD' => 4, 'REBROADCAST' => 5, 'INSTANCE_ID' => 6, 'FILE_ID' => 7, 'SOUNDCLOUD_ID' => 8, 'TIME_FILLED' => 9, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'show_id' => 3, 'record' => 4, 'rebroadcast' => 5, 'instance_id' => 6, 'file_id' => 7, 'soundcloud_id' => 8, 'time_filled' => 9, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbShowId' => 3, 'DbRecord' => 4, 'DbRebroadcast' => 5, 'DbOriginalShow' => 6, 'DbRecordedFile' => 7, 'DbTimeFilled' => 8, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbShowId' => 3, 'dbRecord' => 4, 'dbRebroadcast' => 5, 'dbOriginalShow' => 6, 'dbRecordedFile' => 7, 'dbTimeFilled' => 8, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::SHOW_ID => 3, self::RECORD => 4, self::REBROADCAST => 5, self::INSTANCE_ID => 6, self::FILE_ID => 7, self::TIME_FILLED => 8, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'SHOW_ID' => 3, 'RECORD' => 4, 'REBROADCAST' => 5, 'INSTANCE_ID' => 6, 'FILE_ID' => 7, 'TIME_FILLED' => 8, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'show_id' => 3, 'record' => 4, 'rebroadcast' => 5, 'instance_id' => 6, 'file_id' => 7, 'time_filled' => 8, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -177,7 +174,6 @@ abstract class BaseCcShowInstancesPeer {
$criteria->addSelectColumn(CcShowInstancesPeer::REBROADCAST);
$criteria->addSelectColumn(CcShowInstancesPeer::INSTANCE_ID);
$criteria->addSelectColumn(CcShowInstancesPeer::FILE_ID);
- $criteria->addSelectColumn(CcShowInstancesPeer::SOUNDCLOUD_ID);
$criteria->addSelectColumn(CcShowInstancesPeer::TIME_FILLED);
} else {
$criteria->addSelectColumn($alias . '.ID');
@@ -188,7 +184,6 @@ abstract class BaseCcShowInstancesPeer {
$criteria->addSelectColumn($alias . '.REBROADCAST');
$criteria->addSelectColumn($alias . '.INSTANCE_ID');
$criteria->addSelectColumn($alias . '.FILE_ID');
- $criteria->addSelectColumn($alias . '.SOUNDCLOUD_ID');
$criteria->addSelectColumn($alias . '.TIME_FILLED');
}
}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php
index 3d49926a9..cdd85beed 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php
@@ -14,7 +14,6 @@
* @method CcShowInstancesQuery orderByDbRebroadcast($order = Criteria::ASC) Order by the rebroadcast column
* @method CcShowInstancesQuery orderByDbOriginalShow($order = Criteria::ASC) Order by the instance_id column
* @method CcShowInstancesQuery orderByDbRecordedFile($order = Criteria::ASC) Order by the file_id column
- * @method CcShowInstancesQuery orderByDbSoundCloudId($order = Criteria::ASC) Order by the soundcloud_id column
* @method CcShowInstancesQuery orderByDbTimeFilled($order = Criteria::ASC) Order by the time_filled column
*
* @method CcShowInstancesQuery groupByDbId() Group by the id column
@@ -25,7 +24,6 @@
* @method CcShowInstancesQuery groupByDbRebroadcast() Group by the rebroadcast column
* @method CcShowInstancesQuery groupByDbOriginalShow() Group by the instance_id column
* @method CcShowInstancesQuery groupByDbRecordedFile() Group by the file_id column
- * @method CcShowInstancesQuery groupByDbSoundCloudId() Group by the soundcloud_id column
* @method CcShowInstancesQuery groupByDbTimeFilled() Group by the time_filled column
*
* @method CcShowInstancesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
@@ -63,7 +61,6 @@
* @method CcShowInstances findOneByDbRebroadcast(int $rebroadcast) Return the first CcShowInstances filtered by the rebroadcast column
* @method CcShowInstances findOneByDbOriginalShow(int $instance_id) Return the first CcShowInstances filtered by the instance_id column
* @method CcShowInstances findOneByDbRecordedFile(int $file_id) Return the first CcShowInstances filtered by the file_id column
- * @method CcShowInstances findOneByDbSoundCloudId(int $soundcloud_id) Return the first CcShowInstances filtered by the soundcloud_id column
* @method CcShowInstances findOneByDbTimeFilled(string $time_filled) Return the first CcShowInstances filtered by the time_filled column
*
* @method array findByDbId(int $id) Return CcShowInstances objects filtered by the id column
@@ -74,7 +71,6 @@
* @method array findByDbRebroadcast(int $rebroadcast) Return CcShowInstances objects filtered by the rebroadcast column
* @method array findByDbOriginalShow(int $instance_id) Return CcShowInstances objects filtered by the instance_id column
* @method array findByDbRecordedFile(int $file_id) Return CcShowInstances objects filtered by the file_id column
- * @method array findByDbSoundCloudId(int $soundcloud_id) Return CcShowInstances objects filtered by the soundcloud_id column
* @method array findByDbTimeFilled(string $time_filled) Return CcShowInstances objects filtered by the time_filled column
*
* @package propel.generator.airtime.om
@@ -419,37 +415,6 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria
return $this->addUsingAlias(CcShowInstancesPeer::FILE_ID, $dbRecordedFile, $comparison);
}
- /**
- * Filter the query on the soundcloud_id column
- *
- * @param int|array $dbSoundCloudId The value to use as filter.
- * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcShowInstancesQuery The current query, for fluid interface
- */
- public function filterByDbSoundCloudId($dbSoundCloudId = null, $comparison = null)
- {
- if (is_array($dbSoundCloudId)) {
- $useMinMax = false;
- if (isset($dbSoundCloudId['min'])) {
- $this->addUsingAlias(CcShowInstancesPeer::SOUNDCLOUD_ID, $dbSoundCloudId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbSoundCloudId['max'])) {
- $this->addUsingAlias(CcShowInstancesPeer::SOUNDCLOUD_ID, $dbSoundCloudId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcShowInstancesPeer::SOUNDCLOUD_ID, $dbSoundCloudId, $comparison);
- }
-
/**
* Filter the query on the time_filled column
*
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcStreamSetting.php b/airtime_mvc/application/models/airtime/om/BaseCcStreamSetting.php
new file mode 100644
index 000000000..6dadc9b67
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcStreamSetting.php
@@ -0,0 +1,756 @@
+keyname;
+ }
+
+ /**
+ * Get the [value] column value.
+ *
+ * @return string
+ */
+ public function getDbValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * Get the [type] column value.
+ *
+ * @return string
+ */
+ public function getDbType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * Set the value of [keyname] column.
+ *
+ * @param string $v new value
+ * @return CcStreamSetting The current object (for fluent API support)
+ */
+ public function setDbKeyName($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->keyname !== $v) {
+ $this->keyname = $v;
+ $this->modifiedColumns[] = CcStreamSettingPeer::KEYNAME;
+ }
+
+ return $this;
+ } // setDbKeyName()
+
+ /**
+ * Set the value of [value] column.
+ *
+ * @param string $v new value
+ * @return CcStreamSetting 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[] = CcStreamSettingPeer::VALUE;
+ }
+
+ return $this;
+ } // setDbValue()
+
+ /**
+ * Set the value of [type] column.
+ *
+ * @param string $v new value
+ * @return CcStreamSetting 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[] = CcStreamSettingPeer::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->keyname = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null;
+ $this->value = ($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 = CcStreamSettingPeer::NUM_COLUMNS - CcStreamSettingPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcStreamSetting 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(CcStreamSettingPeer::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 = CcStreamSettingPeer::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?
+
+ } // 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(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcStreamSettingQuery::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(CcStreamSettingPeer::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);
+ CcStreamSettingPeer::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 object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows = 1;
+ $this->setNew(false);
+ } else {
+ $affectedRows = CcStreamSettingPeer::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();
+
+
+ if (($retval = CcStreamSettingPeer::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 = CcStreamSettingPeer::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->getDbKeyName();
+ break;
+ case 1:
+ return $this->getDbValue();
+ 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 = CcStreamSettingPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbKeyName(),
+ $keys[1] => $this->getDbValue(),
+ $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 = CcStreamSettingPeer::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->setDbKeyName($value);
+ break;
+ case 1:
+ $this->setDbValue($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 = CcStreamSettingPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbKeyName($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbValue($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(CcStreamSettingPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcStreamSettingPeer::KEYNAME)) $criteria->add(CcStreamSettingPeer::KEYNAME, $this->keyname);
+ if ($this->isColumnModified(CcStreamSettingPeer::VALUE)) $criteria->add(CcStreamSettingPeer::VALUE, $this->value);
+ if ($this->isColumnModified(CcStreamSettingPeer::TYPE)) $criteria->add(CcStreamSettingPeer::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(CcStreamSettingPeer::DATABASE_NAME);
+ $criteria->add(CcStreamSettingPeer::KEYNAME, $this->keyname);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return string
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbKeyName();
+ }
+
+ /**
+ * Generic method to set the primary key (keyname column).
+ *
+ * @param string $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbKeyName($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbKeyName();
+ }
+
+ /**
+ * 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 CcStreamSetting (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->setDbKeyName($this->keyname);
+ $copyObj->setDbValue($this->value);
+ $copyObj->setDbType($this->type);
+
+ $copyObj->setNew(true);
+ }
+
+ /**
+ * 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 CcStreamSetting 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 CcStreamSettingPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcStreamSettingPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->keyname = null;
+ $this->value = 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 ($deep)
+
+ }
+
+ /**
+ * 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);
+ }
+
+} // BaseCcStreamSetting
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingPeer.php
new file mode 100644
index 000000000..f5e680b20
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingPeer.php
@@ -0,0 +1,740 @@
+ array ('DbKeyName', 'DbValue', 'DbType', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbKeyName', 'dbValue', 'dbType', ),
+ BasePeer::TYPE_COLNAME => array (self::KEYNAME, self::VALUE, self::TYPE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('KEYNAME', 'VALUE', 'TYPE', ),
+ BasePeer::TYPE_FIELDNAME => array ('keyname', 'value', '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 ('DbKeyName' => 0, 'DbValue' => 1, 'DbType' => 2, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbKeyName' => 0, 'dbValue' => 1, 'dbType' => 2, ),
+ BasePeer::TYPE_COLNAME => array (self::KEYNAME => 0, self::VALUE => 1, self::TYPE => 2, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('KEYNAME' => 0, 'VALUE' => 1, 'TYPE' => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('keyname' => 0, 'value' => 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. CcStreamSettingPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcStreamSettingPeer::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(CcStreamSettingPeer::KEYNAME);
+ $criteria->addSelectColumn(CcStreamSettingPeer::VALUE);
+ $criteria->addSelectColumn(CcStreamSettingPeer::TYPE);
+ } else {
+ $criteria->addSelectColumn($alias . '.KEYNAME');
+ $criteria->addSelectColumn($alias . '.VALUE');
+ $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(CcStreamSettingPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcStreamSettingPeer::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(CcStreamSettingPeer::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 CcStreamSetting
+ * @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 = CcStreamSettingPeer::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 CcStreamSettingPeer::populateObjects(CcStreamSettingPeer::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(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcStreamSettingPeer::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 CcStreamSetting $value A CcStreamSetting object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcStreamSetting $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbKeyName();
+ } // 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 CcStreamSetting object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcStreamSetting) {
+ $key = (string) $value->getDbKeyName();
+ } 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 CcStreamSetting 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 CcStreamSetting 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_stream_setting
+ * 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 (string) $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 = CcStreamSettingPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcStreamSettingPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcStreamSettingPeer::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;
+ CcStreamSettingPeer::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 (CcStreamSetting object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcStreamSettingPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcStreamSettingPeer::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 + CcStreamSettingPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcStreamSettingPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcStreamSettingPeer::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(BaseCcStreamSettingPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcStreamSettingPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcStreamSettingTableMap());
+ }
+ }
+
+ /**
+ * 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 ? CcStreamSettingPeer::CLASS_DEFAULT : CcStreamSettingPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcStreamSetting or Criteria object.
+ *
+ * @param mixed $values Criteria or CcStreamSetting 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(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcStreamSetting object
+ }
+
+
+ // 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 CcStreamSetting or Criteria object.
+ *
+ * @param mixed $values Criteria or CcStreamSetting 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(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcStreamSettingPeer::KEYNAME);
+ $value = $criteria->remove(CcStreamSettingPeer::KEYNAME);
+ if ($value) {
+ $selectCriteria->add(CcStreamSettingPeer::KEYNAME, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcStreamSettingPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcStreamSetting 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_stream_setting 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(CcStreamSettingPeer::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(CcStreamSettingPeer::TABLE_NAME, $con, CcStreamSettingPeer::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).
+ CcStreamSettingPeer::clearInstancePool();
+ CcStreamSettingPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcStreamSetting or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcStreamSetting 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(CcStreamSettingPeer::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.
+ CcStreamSettingPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcStreamSetting) { // it's a model object
+ // invalidate the cache for this single object
+ CcStreamSettingPeer::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(CcStreamSettingPeer::KEYNAME, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcStreamSettingPeer::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);
+ CcStreamSettingPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcStreamSetting 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 CcStreamSetting $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(CcStreamSetting $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcStreamSettingPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcStreamSettingPeer::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(CcStreamSettingPeer::DATABASE_NAME, CcStreamSettingPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param string $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcStreamSetting
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcStreamSettingPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcStreamSettingPeer::DATABASE_NAME);
+ $criteria->add(CcStreamSettingPeer::KEYNAME, $pk);
+
+ $v = CcStreamSettingPeer::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(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcStreamSettingPeer::DATABASE_NAME);
+ $criteria->add(CcStreamSettingPeer::KEYNAME, $pks, Criteria::IN);
+ $objs = CcStreamSettingPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcStreamSettingPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcStreamSettingPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingQuery.php
new file mode 100644
index 000000000..666106d6f
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingQuery.php
@@ -0,0 +1,222 @@
+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 CcStreamSetting|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcStreamSettingPeer::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 CcStreamSettingQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcStreamSettingPeer::KEYNAME, $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 CcStreamSettingQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcStreamSettingPeer::KEYNAME, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the keyname column
+ *
+ * @param string $dbKeyName 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 CcStreamSettingQuery The current query, for fluid interface
+ */
+ public function filterByDbKeyName($dbKeyName = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbKeyName)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbKeyName)) {
+ $dbKeyName = str_replace('*', '%', $dbKeyName);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcStreamSettingPeer::KEYNAME, $dbKeyName, $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 CcStreamSettingQuery 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(CcStreamSettingPeer::VALUE, $dbValue, $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 CcStreamSettingQuery 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(CcStreamSettingPeer::TYPE, $dbType, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcStreamSetting $ccStreamSetting Object to remove from the list of results
+ *
+ * @return CcStreamSettingQuery The current query, for fluid interface
+ */
+ public function prune($ccStreamSetting = null)
+ {
+ if ($ccStreamSetting) {
+ $this->addUsingAlias(CcStreamSettingPeer::KEYNAME, $ccStreamSetting->getDbKeyName(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcStreamSettingQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php
index 1bef178f3..54a0468ce 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php
@@ -95,6 +95,13 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
*/
protected $email;
+ /**
+ * The value for the login_attempts field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $login_attempts;
+
/**
* @var array CcAccess[] Collection to store aggregation of CcAccess objects.
*/
@@ -157,6 +164,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$this->type = 'U';
$this->first_name = '';
$this->last_name = '';
+ $this->login_attempts = 0;
}
/**
@@ -325,6 +333,16 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
return $this->email;
}
+ /**
+ * Get the [login_attempts] column value.
+ *
+ * @return int
+ */
+ public function getDbLoginAttempts()
+ {
+ return $this->login_attempts;
+ }
+
/**
* Set the value of [id] column.
*
@@ -603,6 +621,26 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
return $this;
} // setDbEmail()
+ /**
+ * Set the value of [login_attempts] column.
+ *
+ * @param int $v new value
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setDbLoginAttempts($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->login_attempts !== $v || $this->isNew()) {
+ $this->login_attempts = $v;
+ $this->modifiedColumns[] = CcSubjsPeer::LOGIN_ATTEMPTS;
+ }
+
+ return $this;
+ } // setDbLoginAttempts()
+
/**
* Indicates whether the columns in this object are only set to default values.
*
@@ -633,6 +671,10 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
return false;
}
+ if ($this->login_attempts !== 0) {
+ return false;
+ }
+
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@@ -666,6 +708,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$this->skype_contact = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->jabber_contact = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
$this->email = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
+ $this->login_attempts = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
$this->resetModified();
$this->setNew(false);
@@ -674,7 +717,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$this->ensureConsistency();
}
- return $startcol + 11; // 11 = CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS).
+ return $startcol + 12; // 12 = CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcSubjs object", $e);
@@ -1132,6 +1175,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
case 10:
return $this->getDbEmail();
break;
+ case 11:
+ return $this->getDbLoginAttempts();
+ break;
default:
return null;
break;
@@ -1166,6 +1212,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$keys[8] => $this->getDbSkypeContact(),
$keys[9] => $this->getDbJabberContact(),
$keys[10] => $this->getDbEmail(),
+ $keys[11] => $this->getDbLoginAttempts(),
);
return $result;
}
@@ -1230,6 +1277,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
case 10:
$this->setDbEmail($value);
break;
+ case 11:
+ $this->setDbLoginAttempts($value);
+ break;
} // switch()
}
@@ -1265,6 +1315,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
if (array_key_exists($keys[8], $arr)) $this->setDbSkypeContact($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setDbJabberContact($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setDbEmail($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setDbLoginAttempts($arr[$keys[11]]);
}
/**
@@ -1287,6 +1338,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
if ($this->isColumnModified(CcSubjsPeer::SKYPE_CONTACT)) $criteria->add(CcSubjsPeer::SKYPE_CONTACT, $this->skype_contact);
if ($this->isColumnModified(CcSubjsPeer::JABBER_CONTACT)) $criteria->add(CcSubjsPeer::JABBER_CONTACT, $this->jabber_contact);
if ($this->isColumnModified(CcSubjsPeer::EMAIL)) $criteria->add(CcSubjsPeer::EMAIL, $this->email);
+ if ($this->isColumnModified(CcSubjsPeer::LOGIN_ATTEMPTS)) $criteria->add(CcSubjsPeer::LOGIN_ATTEMPTS, $this->login_attempts);
return $criteria;
}
@@ -1358,6 +1410,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$copyObj->setDbSkypeContact($this->skype_contact);
$copyObj->setDbJabberContact($this->jabber_contact);
$copyObj->setDbEmail($this->email);
+ $copyObj->setDbLoginAttempts($this->login_attempts);
if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of
@@ -2280,6 +2333,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$this->skype_contact = null;
$this->jabber_contact = null;
$this->email = null;
+ $this->login_attempts = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->clearAllReferences();
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php
index 3743a4aab..79a9a7efa 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php
@@ -26,7 +26,7 @@ abstract class BaseCcSubjsPeer {
const TM_CLASS = 'CcSubjsTableMap';
/** The total number of columns. */
- const NUM_COLUMNS = 11;
+ const NUM_COLUMNS = 12;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -64,6 +64,9 @@ abstract class BaseCcSubjsPeer {
/** the column name for the EMAIL field */
const EMAIL = 'cc_subjs.EMAIL';
+ /** the column name for the LOGIN_ATTEMPTS field */
+ const LOGIN_ATTEMPTS = 'cc_subjs.LOGIN_ATTEMPTS';
+
/**
* An identiy map to hold any loaded instances of CcSubjs objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
@@ -80,12 +83,12 @@ abstract class BaseCcSubjsPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbLogin', 'DbPass', 'DbType', 'DbFirstName', 'DbLastName', 'DbLastlogin', 'DbLastfail', 'DbSkypeContact', 'DbJabberContact', 'DbEmail', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLogin', 'dbPass', 'dbType', 'dbFirstName', 'dbLastName', 'dbLastlogin', 'dbLastfail', 'dbSkypeContact', 'dbJabberContact', 'dbEmail', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::LOGIN, self::PASS, self::TYPE, self::FIRST_NAME, self::LAST_NAME, self::LASTLOGIN, self::LASTFAIL, self::SKYPE_CONTACT, self::JABBER_CONTACT, self::EMAIL, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOGIN', 'PASS', 'TYPE', 'FIRST_NAME', 'LAST_NAME', 'LASTLOGIN', 'LASTFAIL', 'SKYPE_CONTACT', 'JABBER_CONTACT', 'EMAIL', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'login', 'pass', 'type', 'first_name', 'last_name', 'lastlogin', 'lastfail', 'skype_contact', 'jabber_contact', 'email', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbLogin', 'DbPass', 'DbType', 'DbFirstName', 'DbLastName', 'DbLastlogin', 'DbLastfail', 'DbSkypeContact', 'DbJabberContact', 'DbEmail', 'DbLoginAttempts', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLogin', 'dbPass', 'dbType', 'dbFirstName', 'dbLastName', 'dbLastlogin', 'dbLastfail', 'dbSkypeContact', 'dbJabberContact', 'dbEmail', 'dbLoginAttempts', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::LOGIN, self::PASS, self::TYPE, self::FIRST_NAME, self::LAST_NAME, self::LASTLOGIN, self::LASTFAIL, self::SKYPE_CONTACT, self::JABBER_CONTACT, self::EMAIL, self::LOGIN_ATTEMPTS, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOGIN', 'PASS', 'TYPE', 'FIRST_NAME', 'LAST_NAME', 'LASTLOGIN', 'LASTFAIL', 'SKYPE_CONTACT', 'JABBER_CONTACT', 'EMAIL', 'LOGIN_ATTEMPTS', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'login', 'pass', 'type', 'first_name', 'last_name', 'lastlogin', 'lastfail', 'skype_contact', 'jabber_contact', 'email', 'login_attempts', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -95,12 +98,12 @@ abstract class BaseCcSubjsPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbLogin' => 1, 'DbPass' => 2, 'DbType' => 3, 'DbFirstName' => 4, 'DbLastName' => 5, 'DbLastlogin' => 6, 'DbLastfail' => 7, 'DbSkypeContact' => 8, 'DbJabberContact' => 9, 'DbEmail' => 10, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbLogin' => 1, 'dbPass' => 2, 'dbType' => 3, 'dbFirstName' => 4, 'dbLastName' => 5, 'dbLastlogin' => 6, 'dbLastfail' => 7, 'dbSkypeContact' => 8, 'dbJabberContact' => 9, 'dbEmail' => 10, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LOGIN => 1, self::PASS => 2, self::TYPE => 3, self::FIRST_NAME => 4, self::LAST_NAME => 5, self::LASTLOGIN => 6, self::LASTFAIL => 7, self::SKYPE_CONTACT => 8, self::JABBER_CONTACT => 9, self::EMAIL => 10, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOGIN' => 1, 'PASS' => 2, 'TYPE' => 3, 'FIRST_NAME' => 4, 'LAST_NAME' => 5, 'LASTLOGIN' => 6, 'LASTFAIL' => 7, 'SKYPE_CONTACT' => 8, 'JABBER_CONTACT' => 9, 'EMAIL' => 10, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'login' => 1, 'pass' => 2, 'type' => 3, 'first_name' => 4, 'last_name' => 5, 'lastlogin' => 6, 'lastfail' => 7, 'skype_contact' => 8, 'jabber_contact' => 9, 'email' => 10, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbLogin' => 1, 'DbPass' => 2, 'DbType' => 3, 'DbFirstName' => 4, 'DbLastName' => 5, 'DbLastlogin' => 6, 'DbLastfail' => 7, 'DbSkypeContact' => 8, 'DbJabberContact' => 9, 'DbEmail' => 10, 'DbLoginAttempts' => 11, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbLogin' => 1, 'dbPass' => 2, 'dbType' => 3, 'dbFirstName' => 4, 'dbLastName' => 5, 'dbLastlogin' => 6, 'dbLastfail' => 7, 'dbSkypeContact' => 8, 'dbJabberContact' => 9, 'dbEmail' => 10, 'dbLoginAttempts' => 11, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LOGIN => 1, self::PASS => 2, self::TYPE => 3, self::FIRST_NAME => 4, self::LAST_NAME => 5, self::LASTLOGIN => 6, self::LASTFAIL => 7, self::SKYPE_CONTACT => 8, self::JABBER_CONTACT => 9, self::EMAIL => 10, self::LOGIN_ATTEMPTS => 11, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOGIN' => 1, 'PASS' => 2, 'TYPE' => 3, 'FIRST_NAME' => 4, 'LAST_NAME' => 5, 'LASTLOGIN' => 6, 'LASTFAIL' => 7, 'SKYPE_CONTACT' => 8, 'JABBER_CONTACT' => 9, 'EMAIL' => 10, 'LOGIN_ATTEMPTS' => 11, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'login' => 1, 'pass' => 2, 'type' => 3, 'first_name' => 4, 'last_name' => 5, 'lastlogin' => 6, 'lastfail' => 7, 'skype_contact' => 8, 'jabber_contact' => 9, 'email' => 10, 'login_attempts' => 11, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -183,6 +186,7 @@ abstract class BaseCcSubjsPeer {
$criteria->addSelectColumn(CcSubjsPeer::SKYPE_CONTACT);
$criteria->addSelectColumn(CcSubjsPeer::JABBER_CONTACT);
$criteria->addSelectColumn(CcSubjsPeer::EMAIL);
+ $criteria->addSelectColumn(CcSubjsPeer::LOGIN_ATTEMPTS);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOGIN');
@@ -195,6 +199,7 @@ abstract class BaseCcSubjsPeer {
$criteria->addSelectColumn($alias . '.SKYPE_CONTACT');
$criteria->addSelectColumn($alias . '.JABBER_CONTACT');
$criteria->addSelectColumn($alias . '.EMAIL');
+ $criteria->addSelectColumn($alias . '.LOGIN_ATTEMPTS');
}
}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php
index 857fbcdf4..9a0cffdd0 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php
@@ -17,6 +17,7 @@
* @method CcSubjsQuery orderByDbSkypeContact($order = Criteria::ASC) Order by the skype_contact column
* @method CcSubjsQuery orderByDbJabberContact($order = Criteria::ASC) Order by the jabber_contact column
* @method CcSubjsQuery orderByDbEmail($order = Criteria::ASC) Order by the email column
+ * @method CcSubjsQuery orderByDbLoginAttempts($order = Criteria::ASC) Order by the login_attempts column
*
* @method CcSubjsQuery groupByDbId() Group by the id column
* @method CcSubjsQuery groupByDbLogin() Group by the login column
@@ -29,6 +30,7 @@
* @method CcSubjsQuery groupByDbSkypeContact() Group by the skype_contact column
* @method CcSubjsQuery groupByDbJabberContact() Group by the jabber_contact column
* @method CcSubjsQuery groupByDbEmail() Group by the email column
+ * @method CcSubjsQuery groupByDbLoginAttempts() Group by the login_attempts column
*
* @method CcSubjsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcSubjsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -76,6 +78,7 @@
* @method CcSubjs findOneByDbSkypeContact(string $skype_contact) Return the first CcSubjs filtered by the skype_contact column
* @method CcSubjs findOneByDbJabberContact(string $jabber_contact) Return the first CcSubjs filtered by the jabber_contact column
* @method CcSubjs findOneByDbEmail(string $email) Return the first CcSubjs filtered by the email column
+ * @method CcSubjs findOneByDbLoginAttempts(int $login_attempts) Return the first CcSubjs filtered by the login_attempts column
*
* @method array findByDbId(int $id) Return CcSubjs objects filtered by the id column
* @method array findByDbLogin(string $login) Return CcSubjs objects filtered by the login column
@@ -88,6 +91,7 @@
* @method array findByDbSkypeContact(string $skype_contact) Return CcSubjs objects filtered by the skype_contact column
* @method array findByDbJabberContact(string $jabber_contact) Return CcSubjs objects filtered by the jabber_contact column
* @method array findByDbEmail(string $email) Return CcSubjs objects filtered by the email column
+ * @method array findByDbLoginAttempts(int $login_attempts) Return CcSubjs objects filtered by the login_attempts column
*
* @package propel.generator.airtime.om
*/
@@ -452,6 +456,37 @@ abstract class BaseCcSubjsQuery extends ModelCriteria
return $this->addUsingAlias(CcSubjsPeer::EMAIL, $dbEmail, $comparison);
}
+ /**
+ * Filter the query on the login_attempts column
+ *
+ * @param int|array $dbLoginAttempts 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 CcSubjsQuery The current query, for fluid interface
+ */
+ public function filterByDbLoginAttempts($dbLoginAttempts = null, $comparison = null)
+ {
+ if (is_array($dbLoginAttempts)) {
+ $useMinMax = false;
+ if (isset($dbLoginAttempts['min'])) {
+ $this->addUsingAlias(CcSubjsPeer::LOGIN_ATTEMPTS, $dbLoginAttempts['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbLoginAttempts['max'])) {
+ $this->addUsingAlias(CcSubjsPeer::LOGIN_ATTEMPTS, $dbLoginAttempts['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcSubjsPeer::LOGIN_ATTEMPTS, $dbLoginAttempts, $comparison);
+ }
+
/**
* Filter the query by a related CcAccess object
*
diff --git a/airtime_mvc/application/models/cron/Cron.php b/airtime_mvc/application/models/cron/Cron.php
deleted file mode 100755
index 300fbc701..000000000
--- a/airtime_mvc/application/models/cron/Cron.php
+++ /dev/null
@@ -1,214 +0,0 @@
-
- * $cron = new Cron();
- * $access = $cron->openCrontab('write');
- * if ($access != 'write') {
- * do {
- * $access = $cron->forceWriteable();
- * } while ($access != 'write');
- * }
- * $cron->addCronJob('*','*','*','*','*',
- * 'ClassName',
- * array('first','secound','third')
- * );
- * $cron->closeCrontab();
- *
- * @package Airtime
- * @subpackage StorageServer.Cron
- */
-class Cron {
- /**
- * @var Crontab
- */
- public $ct;
-
- /**
- * @var array This array created with getCommand() function
- */
- private $params;
-
- /**
- * @var string available values: read | write
- */
- private $ctAccess = 'read';
-
- private $lockfile;
- private $cronfile;
- private $paramdir;
- private $cronUserName;
-
- /**
- * Constructor
- */
- function Cron() {
- global $CC_CONFIG;
- $this->lockfile = $CC_CONFIG['lockfile'];
- $this->cronfile = $CC_CONFIG['cronfile'];
- $this->paramdir = $CC_CONFIG['paramdir'];
- $this->cronUserName = $CC_CONFIG['cronUserName'];
- }
-
-
- /* ==================================================== Cronjob functions */
- /**
- * Add a cronjob to the crontab
- *
- * @access public
- * @param string $m minute
- * @param string $h hour
- * @param string $dom day of month
- * @param string $mo month
- * @param string $dow day of week
- * @param string $className name of class, which's execute() is called by croncall.php
- * @param string $params the parameter(s)
- * @return bool true if success else PEAR error.
- */
- function addCronJob($m, $h, $dom, $mo, $dow, $className, $params)
- {
- if ($this->ctAccess == 'write') {
- $this->ct->addCron($m, $h, $dom, $mo, $dow,
- $this->getCommand($className, $params));
- return true;
- } else {
- return PEAR::raiseError('CronJob::addCronJob : '.
- 'The crontab is not writable');
- }
- }
-
- /**
- * This function return with the active cronjobs
- *
- * @access public
- * @return array array of cronjob struct
- */
- function listCronJob()
- {
- return $this->ct->getByType(CRON_CMD);
- }
-
- /**
- * Remove a cronjob.
- *
- * @access public
- * @param int $index index of the cronjobs' array.
- * @return bool true if success else PEAR error.
- */
- function removeCronJob($index)
- {
- if ($this->ctAccess == 'write') {
- $this->crontab->delEntry($index);
- return true;
- } else {
- return PEAR::raiseError('CronJob::removeCronJob : '.
- 'The crontab is not writable');
- }
- }
-
- /* ==================================================== Crontab functions */
- /**
- * Open the crontab
- *
- * @access public
- * @param string $access only for listing 'read', for add and delete 'write'
- * @return string sucessed access - available values read | write
- */
- function openCrontab($access = 'read')
- {
- $access = strtolower($access);
- $this->ct = new Crontab($this->cronUserName);
- if ($access == 'write' &&
- $this->isCrontabWritable() &&
- $this->lockCrontab()) {
- $this->ctAccess = $access;
- } else {
- $this->ctAccess = 'read';
- }
- return $this->ctAccess;
- }
-
- /**
- * Close the crontab
- *
- * @access public
- * @return bool true if everything is ok, false is the lock file can't delete
- */
- function closeCrontab()
- {
- if ($this->ctAccess == 'write') {
- $this->ct->writeCrontab();
- }
- return $this->ctAccess == 'write' ? $this->unlockCrontab() : true;
- }
-
- /**
- * Check the crontab is writable
- *
- * @access private
- * @return bool
- */
- function isCrontabWritable()
- {
- return !is_file($this->lockfile);
- }
-
- /**
- * Try to lock the crontab
- *
- * @access private
- * @return bool true if the locking is success
- */
- function lockCrontab()
- {
- return @touch($this->lockfile);
- }
-
- /**
- * Try to unlock the crontab
- *
- * @access private
- * @return bool true if the unlocking is success
- */
- function unlockCrontab()
- {
- return unlink($this->lockfile);
- }
-
- /**
- * If the crontab opened with read access. This function force set
- * the access to write.
- *
- * @access public
- * @return bool true if the setting is success
- */
- function forceWriteable()
- {
- if ($this->isCrontabWritable() && $this->lockCrontab()) {
- $this->ctAccess = 'write';
- return true;
- }
- return false;
- }
-
- /* ======================================================= Misc functions */
- /**
- * Get the shell command for the cronjob
- *
- * @param string $className name of the class what is called by croncall.php
- * @param mixed $params with this parameter could be called the execute() of class
- * @return string shell command
- */
- function getCommand($className, $params)
- {
- $this->params = array (
- 'class' => $className,
- 'params' => $params
- );
- return $this->cronfile.' "'.str_replace('"','\"',serialize($this->params)).'"';
- }
-}
-
diff --git a/airtime_mvc/application/models/cron/CronJob.php b/airtime_mvc/application/models/cron/CronJob.php
deleted file mode 100755
index a9e56adb0..000000000
--- a/airtime_mvc/application/models/cron/CronJob.php
+++ /dev/null
@@ -1,17 +0,0 @@
- "value"
- * or a line can be a comment (string beginning with #)
- * or it can be a special command (beginning with an @)
- * @var array
- */
- private $crontabs;
-
- /**
- * The user for whom the crontab will be manipulated
- * @var string
- */
- private $user;
-
- /**
- * Lists the type of line of each line in $crontabs.
- * can be: any of the CRON_* constants.
- * so $linetype[5] is the type of $crontabs[5].
- * @var string
- */
- private $linetypes;
-
- // }}}
-
- /**
- * Constructor
- *
- * Initialises $this->crontabs
- *
- * @param string $user the user for whom the crontab will be manipulated
- */
- function Crontab($user)
- {
- $this->user = $user;
- $this->readCrontab();
- }
-
- /**
- * This reads the crontab of $this->user and parses it in $this->crontabs
- *
- */
- function readCrontab()
- {
- // return code is 0 or 1 if crontab was empty, elsewhere stop here
- $cmd = "crontab -u {$this->user} -l";
- @exec("crontab -u {$this->user} -l", $crons, $return);
- if ($return > 1) {
- return PEAR::raiseError("*** Can't read crontab ***\n".
- " Set crontab manually!\n");
- }
-
- foreach ($crons as $line)
- {
- $line = trim($line); // discarding all prepending spaces and tabs
-
- // empty lines..
- if (!$line) {
- $this->crontabs[] = "empty line";
- $this->linetypes[] = CRON_EMPTY;
- continue;
- }
-
- // checking if this is a comment
- if ($line[0] == "#") {
- $this->crontabs[] = trim($line);
- $this->linetypes[] = CRON_COMMENT;
- continue;
- }
-
- // Checking if this is an assignment
- if (ereg("(.*)=(.*)", $line, $assign)) {
- $this->crontabs[] = array ("name" => $assign[1], "value" => $assign[2]);
- $this->linetypes[] = CRON_ASSIGN;
- continue;
- }
-
- // Checking if this is a special @-entry. check man 5 crontab for more info
- if ($line[0] == '@') {
- $this->crontabs[] = split("[ \t]", $line, 2);
- $this->linetypes[] = CRON_SPECIAL;
- continue;
- }
-
- // It's a regular crontab-entry
- $ct = split("[ \t]", $line, 6);
- $this->addCron($ct[0], $ct[1], $ct[2], $ct[3], $ct[4], $ct[5]);
- }
- }
-
- /**
- * Writes the current crontab
- */
- function writeCrontab()
- {
- global $DEBUG, $PATH;
-
- if (empty($this->linetypes)) {
- return;
- }
- $filename = ($DEBUG ? tempnam("$PATH/crons", "cron") : tempnam("/tmp", "cron"));
- $file = fopen($filename, "w");
-
- foreach($this->linetypes as $i => $line) {
- switch ($this->linetypes[$i]) {
- case CRON_COMMENT:
- $line = $this->crontabs[$i];
- break;
- case CRON_ASSIGN:
- $line = $this->crontabs[$i][name]." = ".$this->crontabs[$i][value];
- break;
- case CRON_CMD:
- $line = implode(" ", $this->crontabs[$i]);
- break;
- case CRON_SPECIAL:
- $line = implode(" ", $this->crontabs[$i]);
- break;
- case CRON_EMPTY:
- $line = "\n"; // an empty line in the crontab-file
- break;
- default:
- unset($line);
- echo "Something very weird is going on. This line ($i) has an unknown type.\n";
- break;
- }
-
- // echo "line $i : $line\n";
-
- if ($line) {
- $r = @fwrite($file, $line."\n");
- if($r === FALSE) {
- return PEAR::raiseError("*** Can't write crontab ***\n".
- " Set crontab manually!\n");
- }
- }
- }
- fclose($file);
-
- if ($DEBUG) {
- echo "DEBUGMODE: not updating crontab. writing to $filename instead.\n";
- } else {
- exec("crontab -u {$this->user} $filename", $returnar, $return);
- if ($return != 0) {
- echo "Error running crontab ($return). $filename not deleted\n";
- } else {
- unlink($filename);
- }
- }
- }
-
-
- /**
- * Add a item of type CRON_CMD to the end of $this->crontabs
- *
- * @param string $m
- * minute
- * @param string $h
- * hour
- * @param string $dom
- * day of month
- * @param string $mo
- * month
- * @param string $dow
- * day of week
- * @param string $cmd
- * command
- *
- */
- function addCron($m, $h, $dom, $mo, $dow, $cmd)
- {
- $this->crontabs[] = array ("minute" => $m, "hour" => $h, "dayofmonth" => $dom, "month" => $mo, "dayofweek" => $dow, "command" => $cmd);
- $this->linetypes[] = CRON_CMD;
- }
-
-
- /**
- * Add a comment to the cron to the end of $this->crontabs
- *
- * @param string $comment
- */
- function addComment($comment)
- {
- $this->crontabs[] = "# $comment\n";
- $this->linetypes[] = CRON_COMMENT;
- }
-
-
- /**
- * Add a special command (check man 5 crontab for more information)
- *
- * @param string $sdate special date
- * string meaning
- * ------ -------
- * @reboot Run once, at startup.
- * @yearly Run once a year, "0 0 1 1 *".
- * @annually (same as @yearly)
- * @monthly Run once a month, "0 0 1 * *".
- * @weekly Run once a week, "0 0 * * 0".
- * @daily Run once a day, "0 0 * * *".
- * @midnight (same as @daily)
- * @hourly Run once an hour, "0 * * * *".
- * @param string $cmd command
- */
- function addSpecial($sdate, $cmd)
- {
- $this->crontabs[] = array ("special" => $sdate, "command" => $cmd);
- $this->linetypes[] = CRON_SPECIAL;
- }
-
-
- /**
- * Add an assignment (name = value)
- *
- * @param string $name
- * @param string $value
- */
- function addAssign($name, $value)
- {
- $this->crontabs[] = array ("name" => $name, "value" => $value);
- $this->linetypes[] = CRON_ASSIGN;
- }
-
-
- /**
- * Delete a line from the arrays.
- *
- * @param int $index the index in $this->crontabs
- */
- function delEntry($index)
- {
- unset ($this->crontabs[$index]);
- unset ($this->linetypes[$index]);
- }
-
-
- /**
- * Get all the lines of a certain type in an array
- *
- * @param string $type
- */
- function getByType($type)
- {
- if ($type < CRON_COMMENT || $type > CRON_EMPTY)
- {
- trigger_error("Wrong type: $type", E_USER_WARNING);
- return 0;
- }
-
- $returnar = array ();
- for ($i = 0; $i < count($this->linetypes); $i ++)
- if ($this->linetypes[$i] == $type)
- $returnar[] = $this->crontabs[$i];
-
- return $returnar;
- }
-}
-
diff --git a/airtime_mvc/application/models/cron/croncall.php b/airtime_mvc/application/models/cron/croncall.php
deleted file mode 100755
index 1c46966ae..000000000
--- a/airtime_mvc/application/models/cron/croncall.php
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/php
-execute($p['params']);
-exit(0);
diff --git a/airtime_mvc/application/models/tests/SchedulerExportTests.php b/airtime_mvc/application/models/tests/SchedulerExportTests.php
index 50b80e946..24a6813ba 100644
--- a/airtime_mvc/application/models/tests/SchedulerExportTests.php
+++ b/airtime_mvc/application/models/tests/SchedulerExportTests.php
@@ -12,30 +12,30 @@ class SchedulerExportTests extends PHPUnit_TestCase {
// Add a file
$values = array("filepath" => dirname(__FILE__)."/test10001.mp3");
- $this->storedFile = StoredFile::Insert($values, false);
+ $this->storedFile = Application_Model_StoredFile::Insert($values, false);
// Add a file
$values = array("filepath" => dirname(__FILE__)."/test10002.mp3");
- $this->storedFile2 = StoredFile::Insert($values, false);
+ $this->storedFile2 = Application_Model_StoredFile::Insert($values, false);
// Clear the schedule table
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"];
$CC_DBC->query($sql);
// Create a playlist
- $playlist = new Playlist();
+ $playlist = new Application_Model_Playlist();
$playlist->create("Scheduler Unit Test");
$result = $playlist->addAudioClip($this->storedFile->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
// Schedule it
- $i = new ScheduleGroup();
+ $i = new Application_Model_ScheduleGroup();
$this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId());
}
public function testExport() {
- echo Schedule::ExportRangeAsJson("2010-01-01 00:00:00", "2011-01-01 00:00:00");
+ echo Application_Model_Schedule::ExportRangeAsJson("2010-01-01 00:00:00", "2011-01-01 00:00:00");
}
}
diff --git a/airtime_mvc/application/models/tests/SchedulerTests.php b/airtime_mvc/application/models/tests/SchedulerTests.php
index 8f86b4ef9..e4094c313 100644
--- a/airtime_mvc/application/models/tests/SchedulerTests.php
+++ b/airtime_mvc/application/models/tests/SchedulerTests.php
@@ -16,11 +16,11 @@ class SchedulerTests extends PHPUnit_TestCase {
// Add a file
$values = array("filepath" => dirname(__FILE__)."/test10001.mp3");
- $this->storedFile = StoredFile::Insert($values, false);
+ $this->storedFile = Application_Model_StoredFile::Insert($values, false);
// Add a file
$values = array("filepath" => dirname(__FILE__)."/test10002.mp3");
- $this->storedFile2 = StoredFile::Insert($values, false);
+ $this->storedFile2 = Application_Model_StoredFile::Insert($values, false);
// Clear the schedule table
//$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"];
@@ -29,14 +29,14 @@ class SchedulerTests extends PHPUnit_TestCase {
function testDateToId() {
$dateStr = "2006-04-02 10:20:08.123456";
- $id = ScheduleGroup::dateToId($dateStr);
+ $id = Application_Model_ScheduleGroup::dateToId($dateStr);
$expected = "20060402102008123";
if ($id != $expected) {
$this->fail("Did not convert date to ID correctly #1: $id != $expected");
}
$dateStr = "2006-04-02 10:20:08";
- $id = ScheduleGroup::dateToId($dateStr);
+ $id = Application_Model_ScheduleGroup::dateToId($dateStr);
$expected = "20060402102008000";
if ($id != $expected) {
$this->fail("Did not convert date to ID correctly #2: $id != $expected");
@@ -44,13 +44,13 @@ class SchedulerTests extends PHPUnit_TestCase {
}
function testAddAndRemoveAudioFile() {
- $i = new ScheduleGroup();
+ $i = new Application_Model_ScheduleGroup();
$this->groupIdCreated = $i->add('2010-10-10 01:30:23', $this->storedFile->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage());
}
- $i = new ScheduleGroup($this->groupIdCreated);
+ $i = new Application_Model_ScheduleGroup($this->groupIdCreated);
$result = $i->remove();
if ($result != 1) {
$this->fail("Did not remove item.");
@@ -59,18 +59,18 @@ class SchedulerTests extends PHPUnit_TestCase {
function testAddAndRemovePlaylist() {
// Create a playlist
- $playlist = new Playlist();
+ $playlist = new Application_Model_Playlist();
$playlist->create("Scheduler Unit Test ".uniqid());
$result = $playlist->addAudioClip($this->storedFile->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
- $i = new ScheduleGroup();
+ $i = new Application_Model_ScheduleGroup();
$this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage());
}
- $group = new ScheduleGroup($this->groupIdCreated);
+ $group = new Application_Model_ScheduleGroup($this->groupIdCreated);
if ($group->count() != 3) {
$this->fail("Wrong number of items added.");
}
@@ -84,17 +84,17 @@ class SchedulerTests extends PHPUnit_TestCase {
$this->fail("Did not remove item.");
}
- Playlist::Delete($playlist->getId());
+ Application_Model_Playlist::Delete($playlist->getId());
}
function testIsScheduleEmptyInRange() {
- $i = new ScheduleGroup();
+ $i = new Application_Model_ScheduleGroup();
$this->groupIdCreated = $i->add('2011-10-10 01:30:23', $this->storedFile->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail($this->groupIdCreated->getMessage());
return;
}
- if (Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
+ if (Application_Model_Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
$this->fail("Reporting empty schedule when it isnt.");
return;
}
@@ -104,7 +104,7 @@ class SchedulerTests extends PHPUnit_TestCase {
$this->fail("Failed to delete schedule group.");
return;
}
- if (!Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
+ if (!Application_Model_Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
$this->fail("Reporting booked schedule when it isnt.");
return;
}
@@ -112,11 +112,11 @@ class SchedulerTests extends PHPUnit_TestCase {
/*
function testGetItems() {
- $i1 = new ScheduleGroup();
+ $i1 = new Application_Model_ScheduleGroup();
$groupId1 = $i1->add('2008-01-01 12:00:00.000', $this->storedFile->getId());
- $i2 = new ScheduleGroup();
+ $i2 = new Application_Model_ScheduleGroup();
$i2->addAfter($groupId1, $this->storedFile->getId());
- $items = Schedule::GetItems("2008-01-01", "2008-01-02");
+ $items = Application_Model_Schedule::GetItems("2008-01-01", "2008-01-02");
if (count($items) != 2) {
$this->fail("Wrong number of items returned.");
return;
diff --git a/airtime_mvc/application/models/tests/StoredFileTests.php b/airtime_mvc/application/models/tests/StoredFileTests.php
index 8ee3bea13..a1d0b68d2 100644
--- a/airtime_mvc/application/models/tests/StoredFileTests.php
+++ b/airtime_mvc/application/models/tests/StoredFileTests.php
@@ -43,7 +43,7 @@ class StoredFileTest extends PHPUnit_TestCase {
// Delete any old data from previous tests
$md5 = md5_file($filePath);
- $duplicate = StoredFile::RecallByMd5($md5);
+ $duplicate = Application_Model_StoredFile::RecallByMd5($md5);
if ($duplicate) {
$duplicate->delete();
}
@@ -51,7 +51,7 @@ class StoredFileTest extends PHPUnit_TestCase {
// Test inserting a file by linking
$values = array("filepath" => $filePath,
"dc:description" => "Unit test ".time());
- $storedFile = StoredFile::Insert($values, false);
+ $storedFile = Application_Model_StoredFile::Insert($values, false);
if (PEAR::isError($storedFile)) {
$this->fail("Failed to create StoredFile: ".$storedFile->getMessage());
return;
@@ -64,7 +64,7 @@ class StoredFileTest extends PHPUnit_TestCase {
}
// Test loading metadata
- $f = new StoredFile();
+ $f = new Application_Model_StoredFile();
$f->__setGunid($storedFile->getGunid());
$f->loadMetadata();
if (!is_array($md = $f->getMetadata())) {
@@ -74,7 +74,7 @@ class StoredFileTest extends PHPUnit_TestCase {
//var_dump($md);
// Check if the length field has been set.
- $f2 = StoredFile::RecallByGunid($storedFile->getGunid());
+ $f2 = Application_Model_StoredFile::RecallByGunid($storedFile->getGunid());
$m2 = $f2->getMetadata();
if (!isset($m2["length"]) || $m2["length"] == "00:00:00.000000") {
$this->fail("Length not reporting correctly in metadata.");
diff --git a/airtime_mvc/application/models/tests/populator.php b/airtime_mvc/application/models/tests/populator.php
index 4a83e6ff0..6d70e1fbb 100644
--- a/airtime_mvc/application/models/tests/populator.php
+++ b/airtime_mvc/application/models/tests/populator.php
@@ -1,7 +1,7 @@
query($sql);
/*
// Create a playlist
-$playlist = new Playlist();
+$playlist = new Application_Model_Playlist();
$playlist->create("Calendar Load test playlist ".uniqid());
// Add a file
$values = array("filepath" => __DIR__."/test10001.mp3");
-$storedFile = StoredFile::Insert($values, false);
+$storedFile = Application_Model_StoredFile::Insert($values, false);
$result = $playlist->addAudioClip($storedFile->getId());
// Add a file
$values = array("filepath" => __DIR__."/test10002.mp3");
-$storedFile2 = StoredFile::Insert($values, false);
+$storedFile2 = Application_Model_StoredFile::Insert($values, false);
$result = $playlist->addAudioClip($storedFile2->getId());
$result = $playlist->addAudioClip($storedFile2->getId());
@@ -62,13 +62,13 @@ function createTestShow($showNumber, $showTime, $duration = "1:00")
$data['add_show_background_color'] = "";
$data['add_show_record'] = 0;
$data['add_show_hosts'] ="";
- $showId = Show::create($data);
+ $showId = Application_Model_Show::create($data);
//echo "show created, ID: $showId\n";
// populating the show with a playlist
- $instances = Show::getShows($showTime->format("Y-m-d H:i:s"), $showTime->format("Y-m-d H:i:s"));
+ $instances = Application_Model_Show::getShows($showTime->format("Y-m-d H:i:s"), $showTime->format("Y-m-d H:i:s"));
$instance = array_pop($instances);
- $show = new ShowInstance($instance["instance_id"]);
+ $show = new Application_Model_ShowInstance($instance["instance_id"]);
//echo "Adding playlist to show instance ".$show->getShowInstanceId()."\n";
$show->scheduleShow(array(1));
//echo "done\n";
@@ -96,7 +96,11 @@ while ($showTime < $endDate) {
}
$showNumber = $showNumber + 1;
}
-RabbitMq::PushScheduleFinal();
+
+if (Application_Model_RabbitMq::$doPush) {
+ $md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
+ Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
+}
diff --git a/airtime_mvc/application/views/helpers/IsSaas.php b/airtime_mvc/application/views/helpers/IsSaas.php
new file mode 100644
index 000000000..0e8bc0cee
--- /dev/null
+++ b/airtime_mvc/application/views/helpers/IsSaas.php
@@ -0,0 +1,12 @@
+diff($datetime2);
+ if($interval->format('%R') == '-'){
+ return "Trial expired.";
+ }
+ return $interval->format('%a days');
+ }
+}
diff --git a/airtime_mvc/application/views/scripts/api/status.phtml b/airtime_mvc/application/views/scripts/api/status.phtml
new file mode 100644
index 000000000..1cffa8b84
--- /dev/null
+++ b/airtime_mvc/application/views/scripts/api/status.phtml
@@ -0,0 +1,3 @@
+
+
+Airtime , the open radio software for scheduling and remote station management.
+© 2011 Sourcefabric o.p.s 2011. Airtime is distributed under the GNU GPL v.3
+
Then you're good to go!
-For more detailed help, read the user manual
- Message: exception->getMessage() ?> -
- -exception->getTraceAsString() ?> -- -
request->getParams(), 1) ?> -- - +
Looks like the page you were looking for doesn't exist!
+ +