Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
c2af2c5da8
379 changed files with 27127 additions and 8178 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,4 +2,5 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
/files
|
/files
|
||||||
python_apps/pypo/liquidsoap_bin/liquidsoap
|
python_apps/pypo/liquidsoap_bin/liquidsoap
|
||||||
|
python_apps/pypo/liquidsoap/
|
||||||
build/build.properties
|
build/build.properties
|
||||||
|
|
15
CREDITS
15
CREDITS
|
@ -1,6 +1,21 @@
|
||||||
=======
|
=======
|
||||||
CREDITS
|
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
|
Version 1.9.0
|
||||||
-------------
|
-------------
|
||||||
|
|
|
@ -3,7 +3,10 @@ This application uses the following 3rd Party software:
|
||||||
----------------------
|
----------------------
|
||||||
Common Non-linked Code
|
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)
|
* RabbitMQ (works with version 1.7.2 and above)
|
||||||
- What is it: Interprocess Message Passing with Queuing
|
- What is it: Interprocess Message Passing with Queuing
|
||||||
|
@ -40,7 +43,7 @@ Linked code:
|
||||||
* Phing
|
* Phing
|
||||||
- What is it: PHP project build system
|
- What is it: PHP project build system
|
||||||
- Web site: http://phing.info/trac/
|
- 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
|
- License: LGPLv3
|
||||||
|
|
||||||
* PHP-AMQPLIB
|
* PHP-AMQPLIB
|
||||||
|
@ -109,6 +112,10 @@ Non-linked code:
|
||||||
- Web site: http://code.google.com/p/jq-serverbrowse/
|
- Web site: http://code.google.com/p/jq-serverbrowse/
|
||||||
- License: BSD 2-Clause
|
- License: BSD 2-Clause
|
||||||
|
|
||||||
|
* meioMask
|
||||||
|
- Web site: http://www.meiocodigo.com/
|
||||||
|
- License: MIT
|
||||||
|
|
||||||
-------------
|
-------------
|
||||||
Media-Monitor
|
Media-Monitor
|
||||||
-------------
|
-------------
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1,2 +1,2 @@
|
||||||
PRODUCT_ID=Airtime
|
PRODUCT_ID=Airtime
|
||||||
PRODUCT_RELEASE=1.9.1
|
PRODUCT_RELEASE=2.0.0-beta1
|
||||||
|
|
|
@ -6,24 +6,12 @@ require_once __DIR__."/configs/ACL.php";
|
||||||
require_once 'propel/runtime/lib/Propel.php';
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
Propel::init(__DIR__."/configs/airtime-conf.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__."/logging/Logging.php";
|
||||||
require_once __DIR__."/configs/constants.php";
|
require_once __DIR__."/configs/constants.php";
|
||||||
require_once __DIR__."/configs/conf.php";
|
require_once __DIR__."/configs/conf.php";
|
||||||
require_once 'DB.php';
|
require_once 'DB.php';
|
||||||
|
|
||||||
require_once 'Soundcloud.php';
|
require_once 'Preference.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 __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
|
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
|
||||||
|
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
@ -31,10 +19,14 @@ $dsn = $CC_CONFIG['dsn'];
|
||||||
|
|
||||||
$CC_DBC = DB::connect($dsn, FALSE);
|
$CC_DBC = DB::connect($dsn, FALSE);
|
||||||
if (PEAR::isError($CC_DBC)) {
|
if (PEAR::isError($CC_DBC)) {
|
||||||
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
|
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
$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');
|
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
||||||
|
|
||||||
Zend_Validate::setDefaultNamespaces("Zend");
|
Zend_Validate::setDefaultNamespaces("Zend");
|
||||||
|
@ -42,38 +34,43 @@ Zend_Validate::setDefaultNamespaces("Zend");
|
||||||
$front = Zend_Controller_Front::getInstance();
|
$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
|
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
{
|
{
|
||||||
protected function _initDoctype()
|
protected function _initDoctype()
|
||||||
{
|
{
|
||||||
$this->bootstrap('view');
|
$this->bootstrap('view');
|
||||||
$view = $this->getResource('view');
|
$view = $this->getResource('view');
|
||||||
$view->doctype('XHTML1_STRICT');
|
$view->doctype('XHTML1_STRICT');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _initHeadLink()
|
protected function _initHeadLink()
|
||||||
{
|
{
|
||||||
$view = $this->getResource('view');
|
$view = $this->getResource('view');
|
||||||
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
|
$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/pro_dropdown_3.css');
|
||||||
$view->headLink()->appendStylesheet($baseUrl.'/css/styles.css');
|
$view->headLink()->appendStylesheet($baseUrl.'/css/styles.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _initHeadScript()
|
protected function _initHeadScript()
|
||||||
{
|
{
|
||||||
$view = $this->getResource('view');
|
$view = $this->getResource('view');
|
||||||
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
|
$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-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/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
|
//scripts for now playing bar
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js','text/javascript');
|
$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');
|
$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());
|
$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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
|
||||||
->add(new Zend_Acl_Resource('schedule'))
|
->add(new Zend_Acl_Resource('schedule'))
|
||||||
->add(new Zend_Acl_Resource('api'))
|
->add(new Zend_Acl_Resource('api'))
|
||||||
->add(new Zend_Acl_Resource('nowplaying'))
|
->add(new Zend_Acl_Resource('nowplaying'))
|
||||||
|
->add(new Zend_Acl_Resource('systemstatus'))
|
||||||
->add(new Zend_Acl_Resource('search'))
|
->add(new Zend_Acl_Resource('search'))
|
||||||
->add(new Zend_Acl_Resource('dashboard'))
|
->add(new Zend_Acl_Resource('dashboard'))
|
||||||
->add(new Zend_Acl_Resource('preference'))
|
->add(new Zend_Acl_Resource('preference'))
|
||||||
|
@ -40,6 +41,7 @@ $ccAcl->allow('G', 'index')
|
||||||
->allow('H', 'search')
|
->allow('H', 'search')
|
||||||
->allow('H', 'playlist')
|
->allow('H', 'playlist')
|
||||||
->allow('A', 'user')
|
->allow('A', 'user')
|
||||||
|
->allow('A', 'systemstatus')
|
||||||
->allow('A', 'preference');
|
->allow('A', 'preference');
|
||||||
|
|
||||||
$aclPlugin = new Zend_Controller_Plugin_Acl($ccAcl);
|
$aclPlugin = new Zend_Controller_Plugin_Acl($ccAcl);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
// This file generated by Propel 1.5.2 convert-conf target
|
// This file generated by Propel 1.5.2 convert-conf target
|
||||||
// from XML runtime conf file /home/naomiaro/dev-campcaster/campcaster/build/runtime-conf.xml
|
// from XML runtime conf file /home/james/src/airtime/airtime_mvc/build/runtime-conf.xml
|
||||||
$conf = array (
|
$conf = array (
|
||||||
'datasources' =>
|
'datasources' =>
|
||||||
array (
|
array (
|
||||||
|
|
|
@ -120,4 +120,25 @@ return array (
|
||||||
'BaseCcCountryPeer' => 'airtime/om/BaseCcCountryPeer.php',
|
'BaseCcCountryPeer' => 'airtime/om/BaseCcCountryPeer.php',
|
||||||
'BaseCcCountry' => 'airtime/om/BaseCcCountry.php',
|
'BaseCcCountry' => 'airtime/om/BaseCcCountry.php',
|
||||||
'BaseCcCountryQuery' => 'airtime/om/BaseCcCountryQuery.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',
|
||||||
);
|
);
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('AIRTIME_VERSION', '1.9.1');
|
|
||||||
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
|
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
|
||||||
define('AIRTIME_REST_VERSION', '1.1');
|
define('AIRTIME_REST_VERSION', '1.1');
|
||||||
|
|
||||||
|
@ -36,3 +35,8 @@ define('UI_MDATA_VALUE_FORMAT_STREAM', 'live stream');
|
||||||
// Session Keys
|
// Session Keys
|
||||||
define('UI_PLAYLIST_SESSNAME', 'PLAYLIST');
|
define('UI_PLAYLIST_SESSNAME', 'PLAYLIST');
|
||||||
|
|
||||||
|
|
||||||
|
// Soundcloud contants
|
||||||
|
define('SOUNDCLOUD_NOT_UPLOADED_YET', -1);
|
||||||
|
define('SOUNDCLOUD_PROGRESS', -2);
|
||||||
|
define('SOUNDCLOUD_ERROR', -3);
|
||||||
|
|
|
@ -37,7 +37,7 @@ $pages = array(
|
||||||
'resource' => 'schedule'
|
'resource' => 'schedule'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => 'Configure',
|
'label' => 'System',
|
||||||
'uri' => '#',
|
'uri' => '#',
|
||||||
'resource' => 'preference',
|
'resource' => 'preference',
|
||||||
'pages' => array(
|
'pages' => array(
|
||||||
|
@ -57,22 +57,55 @@ $pages = array(
|
||||||
'label' => 'Manage Media Folders',
|
'label' => 'Manage Media Folders',
|
||||||
'module' => 'default',
|
'module' => 'default',
|
||||||
'controller' => 'Preference',
|
'controller' => 'Preference',
|
||||||
'action' => 'directory-config'
|
'action' => 'directory-config',
|
||||||
|
'id' => 'manage_folder'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'label' => 'Stream Settings',
|
||||||
|
'module' => 'default',
|
||||||
|
'controller' => 'Preference',
|
||||||
|
'action' => 'stream-setting'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => 'Support Settings',
|
'label' => 'Support Settings',
|
||||||
'module' => 'default',
|
'module' => 'default',
|
||||||
'controller' => 'Preference',
|
'controller' => 'Preference',
|
||||||
'action' => 'support-setting'
|
'action' => 'support-setting'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'label' => 'Status',
|
||||||
|
'module' => 'default',
|
||||||
|
'controller' => 'systemstatus',
|
||||||
|
'action' => 'index',
|
||||||
|
'resource' => 'systemstatus'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => 'Help',
|
'label' => 'Help',
|
||||||
'module' => 'default',
|
'uri' => '#',
|
||||||
'controller' => 'dashboard',
|
'resource' => 'dashboard',
|
||||||
'action' => 'help',
|
'pages' => array(
|
||||||
'resource' => 'dashboard'
|
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'
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$context = $this->_helper->getHelper('contextSwitch');
|
$context = $this->_helper->getHelper('contextSwitch');
|
||||||
$context->addActionContext('version', 'json')
|
$context->addActionContext('version', 'json')
|
||||||
->addActionContext('recorded-shows', 'json')
|
->addActionContext('recorded-shows', 'json')
|
||||||
|
->addActionContext('calendar-init', 'json')
|
||||||
->addActionContext('upload-file', 'json')
|
->addActionContext('upload-file', 'json')
|
||||||
->addActionContext('upload-recorded', 'json')
|
->addActionContext('upload-recorded', 'json')
|
||||||
->addActionContext('media-monitor-setup', 'json')
|
->addActionContext('media-monitor-setup', 'json')
|
||||||
|
@ -19,6 +20,12 @@ class ApiController extends Zend_Controller_Action
|
||||||
->addActionContext('add-watched-dir', 'json')
|
->addActionContext('add-watched-dir', 'json')
|
||||||
->addActionContext('remove-watched-dir', 'json')
|
->addActionContext('remove-watched-dir', 'json')
|
||||||
->addActionContext('set-storage-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();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +39,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
*
|
*
|
||||||
* First checks to ensure the correct API key was
|
* First checks to ensure the correct API key was
|
||||||
* supplied, then returns AIRTIME_VERSION as defined
|
* supplied, then returns AIRTIME_VERSION as defined
|
||||||
* in application/conf.php
|
* in the database
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
@ -52,10 +59,33 @@ class ApiController extends Zend_Controller_Action
|
||||||
print 'You are not allowed to access this resource.';
|
print 'You are not allowed to access this resource.';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$jsonStr = json_encode(array("version"=>AIRTIME_VERSION));
|
$jsonStr = json_encode(array("version"=>Application_Model_Preference::GetAirtimeVersion()));
|
||||||
echo $jsonStr;
|
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.
|
* Allows remote client to download requested media file.
|
||||||
*
|
*
|
||||||
|
@ -87,7 +117,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$filename = $this->_getParam("file");
|
$filename = $this->_getParam("file");
|
||||||
$file_id = substr($filename, 0, strpos($filename, "."));
|
$file_id = substr($filename, 0, strpos($filename, "."));
|
||||||
if (ctype_alnum($file_id) && strlen($file_id) == 32) {
|
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)) {
|
if ($media != null && !PEAR::isError($media)) {
|
||||||
$filepath = $media->getFilePath();
|
$filepath = $media->getFilePath();
|
||||||
if(is_file($filepath)){
|
if(is_file($filepath)){
|
||||||
|
@ -112,6 +142,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$file_base_name = substr($file_base_name, 1);
|
$file_base_name = substr($file_base_name, 1);
|
||||||
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
||||||
}
|
}
|
||||||
|
$logger->info("Sending $filepath");
|
||||||
header("Content-Length: " . filesize($filepath));
|
header("Content-Length: " . filesize($filepath));
|
||||||
|
|
||||||
// !! binary mode !!
|
// !! binary mode !!
|
||||||
|
@ -148,12 +179,13 @@ class ApiController extends Zend_Controller_Action
|
||||||
$this->view->layout()->disableLayout();
|
$this->view->layout()->disableLayout();
|
||||||
$this->_helper->viewRenderer->setNoRender(true);
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
$date = new DateHelper;
|
$date = new Application_Model_DateHelper;
|
||||||
$timeNow = $date->getTimestamp();
|
$timeNow = $date->getTimestamp();
|
||||||
|
|
||||||
$result = array("env"=>APPLICATION_ENV,
|
$result = array("env"=>APPLICATION_ENV,
|
||||||
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
||||||
"currentShow"=>Show_DAL::GetCurrentShow($timeNow),
|
"currentShow"=>Application_Model_Show::GetCurrentShow($timeNow),
|
||||||
"nextShow"=>Show_DAL::GetNextShows($timeNow, 5),
|
"nextShow"=>Application_Model_Show::GetNextShows($timeNow, 5),
|
||||||
"timezone"=> date("T"),
|
"timezone"=> date("T"),
|
||||||
"timezoneOffset"=> date("Z"));
|
"timezoneOffset"=> date("Z"));
|
||||||
|
|
||||||
|
@ -178,7 +210,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
for ($i=0; $i<7; $i++){
|
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");
|
header("Content-type: text/javascript");
|
||||||
|
@ -209,7 +241,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
||||||
|
|
||||||
$result = Schedule::GetScheduledPlaylists();
|
$result = Application_Model_Schedule::GetScheduledPlaylists();
|
||||||
echo json_encode($result);
|
echo json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +263,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$schedule_group_id = $this->_getParam("schedule_id");
|
$schedule_group_id = $this->_getParam("schedule_id");
|
||||||
$media_id = $this->_getParam("media_id");
|
$media_id = $this->_getParam("media_id");
|
||||||
$result = Schedule::UpdateMediaPlayedStatus($media_id);
|
$result = Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
|
||||||
|
|
||||||
if (!PEAR::isError($result)) {
|
if (!PEAR::isError($result)) {
|
||||||
echo json_encode(array("status"=>1, "message"=>""));
|
echo json_encode(array("status"=>1, "message"=>""));
|
||||||
|
@ -260,7 +292,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$schedule_group_id = $this->_getParam("schedule_id");
|
$schedule_group_id = $this->_getParam("schedule_id");
|
||||||
if (is_numeric($schedule_group_id)) {
|
if (is_numeric($schedule_group_id)) {
|
||||||
$sg = new ScheduleGroup($schedule_group_id);
|
$sg = new Application_Model_ScheduleGroup($schedule_group_id);
|
||||||
if ($sg->exists()) {
|
if ($sg->exists()) {
|
||||||
$result = $sg->notifyGroupStartPlay();
|
$result = $sg->notifyGroupStartPlay();
|
||||||
if (!PEAR::isError($result)) {
|
if (!PEAR::isError($result)) {
|
||||||
|
@ -296,12 +328,12 @@ class ApiController extends Zend_Controller_Action
|
||||||
$now = new DateTime($today_timestamp);
|
$now = new DateTime($today_timestamp);
|
||||||
$end_timestamp = $now->add(new DateInterval("PT2H"));
|
$end_timestamp = $now->add(new DateInterval("PT2H"));
|
||||||
$end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
|
$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;
|
$this->view->is_recording = false;
|
||||||
|
|
||||||
$rows = Show_DAL::GetCurrentShow($today_timestamp);
|
$rows = Application_Model_Show::GetCurrentShow($today_timestamp);
|
||||||
if (count($rows) > 0){
|
if (count($rows) > 0){
|
||||||
$this->view->is_recording = ($rows[0]['record'] == 1);
|
$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");
|
$upload_dir = ini_get("upload_tmp_dir");
|
||||||
StoredFile::uploadFile($upload_dir);
|
Application_Model_StoredFile::uploadFile($upload_dir);
|
||||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||||
StoredFile::copyFileToStor($upload_dir, $fileName);
|
Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function uploadRecordedAction()
|
public function uploadRecordedAction()
|
||||||
|
@ -346,17 +378,17 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
|
|
||||||
$showCanceled = false;
|
$showCanceled = false;
|
||||||
$file = StoredFile::Recall($file_id);
|
$file = Application_Model_StoredFile::Recall($file_id);
|
||||||
//$show_instance = $this->_getParam('show_instance');
|
//$show_instance = $this->_getParam('show_instance');
|
||||||
|
|
||||||
$show_name = null;
|
$show_name = null;
|
||||||
try {
|
try {
|
||||||
$show_inst = new ShowInstance($show_instance_id);
|
$show_inst = new Application_Model_ShowInstance($show_instance_id);
|
||||||
|
|
||||||
$show_inst->setRecordedFile($file_id);
|
$show_inst->setRecordedFile($file_id);
|
||||||
$show_name = $show_inst->getName();
|
$show_name = $show_inst->getName();
|
||||||
$show_genre = $show_inst->getGenre();
|
$show_genre = $show_inst->getGenre();
|
||||||
$show_start_time = $show_inst->getShowStart();
|
$show_start_time = ConvertToLocalDateTimeString($show_inst->getShowStart());
|
||||||
|
|
||||||
} catch (Exception $e){
|
} catch (Exception $e){
|
||||||
//we've reached here probably because the show was
|
//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_CREATOR', "Airtime Show Recorder");
|
||||||
$file->setMetadataValue('MDATA_KEY_TRACKNUMBER', null);
|
$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++) {
|
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();
|
$description = $show->getDescription();
|
||||||
$hosts = $show->getHosts();
|
$hosts = $show->getHosts();
|
||||||
|
|
||||||
$tags = array_merge($hosts, array($show_name));
|
$tags = array_merge($hosts, array($show_name));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$soundcloud = new ATSoundcloud();
|
$soundcloud = new Application_Model_Soundcloud();
|
||||||
$soundcloud_id = $soundcloud->uploadTrack($file->getFilePath(), $tmpTitle, $description, $tags, $show_start_time, $show_genre);
|
$soundcloud_id = $soundcloud->uploadTrack($file->getFilePath(), $tmpTitle, $description, $tags, $show_start_time, $show_genre);
|
||||||
$show_inst->setSoundCloudFileId($soundcloud_id);
|
$file->setSoundCloudFileId($soundcloud_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
|
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
|
||||||
$code = $e->getHttpCode();
|
$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))) {
|
if(!in_array($code, array(0, 100))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -425,7 +464,14 @@ class ApiController extends Zend_Controller_Action
|
||||||
exit;
|
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() {
|
public function reloadMetadataAction() {
|
||||||
|
@ -458,10 +504,10 @@ class ApiController extends Zend_Controller_Action
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||||
$filepath = str_replace("\\", "", $filepath);
|
$filepath = str_replace("\\", "", $filepath);
|
||||||
|
|
||||||
$file = StoredFile::RecallByFilepath($filepath);
|
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||||
|
|
||||||
if (is_null($file)) {
|
if (is_null($file)) {
|
||||||
$file = StoredFile::Insert($md);
|
$file = Application_Model_StoredFile::Insert($md);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->view->error = "File already exists in Airtime.";
|
$this->view->error = "File already exists in Airtime.";
|
||||||
|
@ -471,7 +517,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
else if ($mode == "modify") {
|
else if ($mode == "modify") {
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||||
$filepath = str_replace("\\", "", $filepath);
|
$filepath = str_replace("\\", "", $filepath);
|
||||||
$file = StoredFile::RecallByFilepath($filepath);
|
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||||
|
|
||||||
//File is not in database anymore.
|
//File is not in database anymore.
|
||||||
if (is_null($file)) {
|
if (is_null($file)) {
|
||||||
|
@ -485,7 +531,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
else if ($mode == "moved") {
|
else if ($mode == "moved") {
|
||||||
$md5 = $md['MDATA_KEY_MD5'];
|
$md5 = $md['MDATA_KEY_MD5'];
|
||||||
$file = StoredFile::RecallByMd5($md5);
|
$file = Application_Model_StoredFile::RecallByMd5($md5);
|
||||||
|
|
||||||
if (is_null($file)) {
|
if (is_null($file)) {
|
||||||
$this->view->error = "File doesn't exist in Airtime.";
|
$this->view->error = "File doesn't exist in Airtime.";
|
||||||
|
@ -501,7 +547,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
else if ($mode == "delete") {
|
else if ($mode == "delete") {
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||||
$filepath = str_replace("\\", "", $filepath);
|
$filepath = str_replace("\\", "", $filepath);
|
||||||
$file = StoredFile::RecallByFilepath($filepath);
|
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||||
|
|
||||||
if (is_null($file)) {
|
if (is_null($file)) {
|
||||||
$this->view->error = "File doesn't exist in Airtime.";
|
$this->view->error = "File doesn't exist in Airtime.";
|
||||||
|
@ -511,6 +557,16 @@ class ApiController extends Zend_Controller_Action
|
||||||
$file->delete();
|
$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();
|
$this->view->id = $file->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,7 +583,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
$dir_id = $request->getParam('dir_id');
|
$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() {
|
public function listAllWatchedDirsAction() {
|
||||||
|
@ -544,8 +600,8 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
$arrWatchedDirs = MusicDir::getWatchedDirs();
|
$arrWatchedDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||||
$storDir = MusicDir::getStorDir();
|
$storDir = Application_Model_MusicDir::getStorDir();
|
||||||
|
|
||||||
$result[$storDir->getId()] = $storDir->getDirectory();
|
$result[$storDir->getId()] = $storDir->getDirectory();
|
||||||
|
|
||||||
|
@ -570,7 +626,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->msg = MusicDir::addWatchedDir($path);
|
$this->view->msg = Application_Model_MusicDir::addWatchedDir($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeWatchedDirAction() {
|
public function removeWatchedDirAction() {
|
||||||
|
@ -587,7 +643,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->msg = MusicDir::removeWatchedDir($path);
|
$this->view->msg = Application_Model_MusicDir::removeWatchedDir($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setStorageDirAction() {
|
public function setStorageDirAction() {
|
||||||
|
@ -604,7 +660,97 @@ class ApiController extends Zend_Controller_Action
|
||||||
exit;
|
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()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,30 @@ class DashboardController extends Zend_Controller_Action
|
||||||
// action body
|
// 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()
|
public function helpAction()
|
||||||
{
|
{
|
||||||
// action body
|
// action body
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function aboutAction()
|
||||||
|
{
|
||||||
|
// action body
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,9 @@ class LibraryController extends Zend_Controller_Action
|
||||||
->addActionContext('delete', 'json')
|
->addActionContext('delete', 'json')
|
||||||
->addActionContext('context-menu', 'json')
|
->addActionContext('context-menu', 'json')
|
||||||
->addActionContext('get-file-meta-data', 'html')
|
->addActionContext('get-file-meta-data', 'html')
|
||||||
|
->addActionContext('upload-file-soundcloud', 'json')
|
||||||
|
->addActionContext('get-upload-to-soundcloud-status', 'json')
|
||||||
|
->addActionContext('set-num-entries', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
|
|
||||||
$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
|
$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
|
||||||
|
@ -25,7 +28,6 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js','text/javascript');
|
$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/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.pluginAPI.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.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/media_library.css');
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.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->layout->setLayout('library');
|
||||||
$this->_helper->viewRenderer->setResponseSegment('library');
|
$this->_helper->viewRenderer->setResponseSegment('library');
|
||||||
|
@ -64,7 +68,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$paramsPop = str_replace('#type#', $type, $paramsPop);
|
$paramsPop = str_replace('#type#', $type, $paramsPop);
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
$pl_sess = $this->pl_sess;
|
$pl_sess = $this->pl_sess;
|
||||||
|
|
||||||
|
@ -82,12 +86,29 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
|
|
||||||
$file_id = $this->_getParam('id', null);
|
$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),
|
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||||
'title' => 'Download');
|
'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()) {
|
if ($user->isAdmin()) {
|
||||||
$menu[] = array('action' => array('type' => 'fn',
|
$menu[] = array('action' => array('type' => 'fn',
|
||||||
|
@ -128,12 +149,12 @@ class LibraryController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
if ($user->isAdmin()) {
|
if ($user->isAdmin()) {
|
||||||
|
|
||||||
if (!is_null($id)) {
|
if (!is_null($id)) {
|
||||||
$file = StoredFile::Recall($id);
|
$file = Application_Model_StoredFile::Recall($id);
|
||||||
|
|
||||||
if (PEAR::isError($file)) {
|
if (PEAR::isError($file)) {
|
||||||
$this->view->message = $file->getMessage();
|
$this->view->message = $file->getMessage();
|
||||||
|
@ -153,7 +174,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
else {
|
else {
|
||||||
$res = settype($res, "integer");
|
$res = settype($res, "integer");
|
||||||
$data = array("filepath" => $file->getFilePath(), "delete" => $res);
|
$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()
|
public function contentsAction()
|
||||||
{
|
{
|
||||||
$post = $this->getRequest()->getPost();
|
$post = $this->getRequest()->getPost();
|
||||||
$datatables = StoredFile::searchFilesForPlaylistBuilder($post);
|
$datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($post);
|
||||||
|
|
||||||
//format clip lengh to 1 decimal
|
//format clip lengh to 1 decimal
|
||||||
foreach($datatables["aaData"] as &$data){
|
foreach($datatables["aaData"] as &$data){
|
||||||
$sec = Playlist::playlistTimeToSeconds($data[5]);
|
if($data[6] == 'audioclip'){
|
||||||
$data[5] = Playlist::secondsToPlaylistTime($sec);
|
$file = Application_Model_StoredFile::Recall($data[0]);
|
||||||
|
$scid = $file->getSoundCloudId();
|
||||||
|
if($scid == "-2"){
|
||||||
|
$data[1] .= '<span id="'.$data[0].'" class="small-icon progress"></span>';
|
||||||
|
}else if($scid == "-3"){
|
||||||
|
$data[1] .= '<span id="'.$data[0].'" class="small-icon sc-error"></span>';
|
||||||
|
}else if(!is_null($scid)){
|
||||||
|
$data[1] .= '<span id="'.$data[0].'" class="small-icon soundcloud"></span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sec = Application_Model_Playlist::playlistTimeToSeconds($data[5]);
|
||||||
|
$data[5] = Application_Model_Playlist::secondsToPlaylistTime($sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
die(json_encode($datatables));
|
die(json_encode($datatables));
|
||||||
|
@ -181,7 +213,8 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$form = new Application_Form_EditAudioMD();
|
$form = new Application_Form_EditAudioMD();
|
||||||
|
|
||||||
$file_id = $this->_getParam('id', null);
|
$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 ($request->isPost()) {
|
||||||
if ($form->isValid($request->getPost())) {
|
if ($form->isValid($request->getPost())) {
|
||||||
|
@ -191,13 +224,16 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
$data = $file->getMetadata();
|
$data = $file->getMetadata();
|
||||||
|
|
||||||
RabbitMq::SendMessageToMediaMonitor("md_update", $data);
|
// set MDATA_KEY_FILEPATH
|
||||||
|
$data['MDATA_KEY_FILEPATH'] = $file->getFilePath();
|
||||||
|
Logging::log($data['MDATA_KEY_FILEPATH']);
|
||||||
|
Application_Model_RabbitMq::SendMessageToMediaMonitor("md_update", $data);
|
||||||
|
|
||||||
|
|
||||||
$this->_helper->redirector('index');
|
$this->_helper->redirector('index');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$form->populate($file->getDbColMetadata());
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,16 +243,50 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$type = $this->_getParam('type');
|
$type = $this->_getParam('type');
|
||||||
|
|
||||||
if($type == "au") {
|
if($type == "au") {
|
||||||
$file = StoredFile::Recall($id);
|
$file = Application_Model_StoredFile::Recall($id);
|
||||||
$this->view->type = $type;
|
$this->view->type = $type;
|
||||||
$this->view->md = $file->getMetadata();
|
$this->view->md = $file->getMetadata();
|
||||||
}
|
}
|
||||||
else if($type == "pl") {
|
else if($type == "pl") {
|
||||||
$file = Playlist::Recall($id);
|
$file = Application_Model_Playlist::Recall($id);
|
||||||
$this->view->type = $type;
|
$this->view->type = $type;
|
||||||
$this->view->md = $file->getAllPLMetaData();
|
$this->view->md = $file->getAllPLMetaData();
|
||||||
$this->view->contents = $file->getContents();
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,61 +10,80 @@ class LoginController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
if(Zend_Auth::getInstance()->hasIdentity())
|
if(Zend_Auth::getInstance()->hasIdentity())
|
||||||
{
|
{
|
||||||
$this->_redirect('Nowplaying');
|
$this->_redirect('Nowplaying');
|
||||||
}
|
}
|
||||||
|
|
||||||
//uses separate layout without a navigation.
|
//uses separate layout without a navigation.
|
||||||
$this->_helper->layout->setLayout('login');
|
$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');
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$form = new Application_Form_Login();
|
$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($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()))
|
if($form->isValid($request->getPost()))
|
||||||
{
|
{
|
||||||
|
|
||||||
$authAdapter = $this->getAuthAdapter();
|
|
||||||
|
|
||||||
//get the username and password from the form
|
//get the username and password from the form
|
||||||
$username = $form->getValue('username');
|
$username = $form->getValue('username');
|
||||||
$password = $form->getValue('password');
|
$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
|
//pass to the adapter the submitted username and password
|
||||||
$authAdapter->setIdentity($username)
|
$authAdapter->setIdentity($username)
|
||||||
->setCredential($password);
|
->setCredential($password);
|
||||||
|
|
||||||
$auth = Zend_Auth::getInstance();
|
$auth = Zend_Auth::getInstance();
|
||||||
$result = $auth->authenticate($authAdapter);
|
$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');
|
||||||
|
|
||||||
if($result->isValid())
|
//the default storage is a session with namespace Zend_Auth
|
||||||
{
|
$authStorage = $auth->getStorage();
|
||||||
//all info about this user from the login table omit only the password
|
$authStorage->write($userInfo);
|
||||||
$userInfo = $authAdapter->getResultRowObject(null, 'password');
|
|
||||||
|
|
||||||
//the default storage is a session with namespace Zend_Auth
|
Application_Model_LoginAttempts::resetAttempts($_SERVER['REMOTE_ADDR']);
|
||||||
$authStorage = $auth->getStorage();
|
Application_Model_Subjects::resetLoginAttempts($username);
|
||||||
$authStorage->write($userInfo);
|
|
||||||
|
|
||||||
$tempSess = new Zend_Session_Namespace("referrer");
|
$tempSess = new Zend_Session_Namespace("referrer");
|
||||||
$tempSess->referrer = 'login';
|
$tempSess->referrer = 'login';
|
||||||
|
|
||||||
$this->_redirect('Nowplaying');
|
$this->_redirect('Nowplaying');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message = "Wrong username or password provided. Please try again.";
|
$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->message = $message;
|
||||||
|
$this->view->error = $error;
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->airtimeVersion = AIRTIME_VERSION;
|
$this->view->airtimeVersion = Application_Model_Preference::GetAirtimeVersion();
|
||||||
$this->view->airtimeCopyright = AIRTIME_COPYRIGHT_DATE;
|
$this->view->airtimeCopyright = AIRTIME_COPYRIGHT_DATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,17 @@ class NowplayingController extends Zend_Controller_Action
|
||||||
|
|
||||||
$refer_sses = new Zend_Session_Namespace('referrer');
|
$refer_sses = new Zend_Session_Namespace('referrer');
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
$form = new Application_Form_RegisterAirtime();
|
$form = new Application_Form_RegisterAirtime();
|
||||||
|
|
||||||
$values = $request->getPost();
|
$values = $request->getPost();
|
||||||
if ($values["Publicise"] != 1){
|
if ($values["Publicise"] != 1 && $form->isValid($values)){
|
||||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||||
|
if(isset($values["Privacy"])){
|
||||||
|
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||||
|
}
|
||||||
// unset session
|
// unset session
|
||||||
Zend_Session::namespaceUnset('referrer');
|
Zend_Session::namespaceUnset('referrer');
|
||||||
}
|
}
|
||||||
|
@ -49,10 +52,12 @@ class NowplayingController extends Zend_Controller_Action
|
||||||
Application_Model_Preference::SetStationDescription($values["Description"]);
|
Application_Model_Preference::SetStationDescription($values["Description"]);
|
||||||
Application_Model_Preference::SetStationLogo($imagePath);
|
Application_Model_Preference::SetStationLogo($imagePath);
|
||||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||||
|
if(isset($values["Privacy"])){
|
||||||
|
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||||
|
}
|
||||||
// unset session
|
// unset session
|
||||||
Zend_Session::namespaceUnset('referrer');
|
Zend_Session::namespaceUnset('referrer');
|
||||||
}else{
|
}else{
|
||||||
var_dump($form->getMessages());
|
|
||||||
$logo = Application_Model_Preference::GetStationLogo();
|
$logo = Application_Model_Preference::GetStationLogo();
|
||||||
if($logo){
|
if($logo){
|
||||||
$this->view->logoImg = $logo;
|
$this->view->logoImg = $logo;
|
||||||
|
@ -85,12 +90,13 @@ class NowplayingController extends Zend_Controller_Action
|
||||||
$this->view->entries = Application_Model_Nowplaying::GetDataGridData($viewType, $dateString);
|
$this->view->entries = Application_Model_Nowplaying::GetDataGridData($viewType, $dateString);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
public function livestreamAction()
|
public function livestreamAction()
|
||||||
{
|
{
|
||||||
//use bare bones layout (no header bar or menu)
|
//use bare bones layout (no header bar or menu)
|
||||||
$this->_helper->layout->setLayout('bare');
|
$this->_helper->layout->setLayout('bare');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public function dayViewAction()
|
public function dayViewAction()
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
|
|
||||||
if(isset($pl_sess->id)) {
|
if(isset($pl_sess->id)) {
|
||||||
|
|
||||||
$pl = Playlist::Recall($pl_sess->id);
|
$pl = Application_Model_Playlist::Recall($pl_sess->id);
|
||||||
if($pl === FALSE) {
|
if($pl === FALSE) {
|
||||||
unset($pl_sess->id);
|
unset($pl_sess->id);
|
||||||
return;
|
return;
|
||||||
|
@ -48,7 +48,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
|
|
||||||
if(isset($pl_sess->id)) {
|
if(isset($pl_sess->id)) {
|
||||||
|
|
||||||
$pl = Playlist::Recall($pl_sess->id);
|
$pl = Application_Model_Playlist::Recall($pl_sess->id);
|
||||||
if($pl !== FALSE) {
|
if($pl !== FALSE) {
|
||||||
$this->closePlaylist($pl);
|
$this->closePlaylist($pl);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
|
||||||
$pl = Playlist::Recall($pl_id);
|
$pl = Application_Model_Playlist::Recall($pl_id);
|
||||||
if($pl === FALSE) {
|
if($pl === FALSE) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$pl_sess = $this->pl_sess;
|
$pl_sess = $this->pl_sess;
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
|
||||||
$pl = new Playlist();
|
$pl = new Application_Model_Playlist();
|
||||||
$pl->create("Untitled Playlist");
|
$pl->create("Untitled Playlist");
|
||||||
$pl->setPLMetaData('dc:creator', $userInfo->login);
|
$pl->setPLMetaData('dc:creator', $userInfo->login);
|
||||||
|
|
||||||
|
@ -285,11 +285,11 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
public function deleteAction()
|
public function deleteAction()
|
||||||
{
|
{
|
||||||
$id = $this->_getParam('id', null);
|
$id = $this->_getParam('id', null);
|
||||||
$pl = Playlist::Recall($id);
|
$pl = Application_Model_Playlist::Recall($id);
|
||||||
|
|
||||||
if ($pl !== FALSE) {
|
if ($pl !== FALSE) {
|
||||||
|
|
||||||
Playlist::Delete($id);
|
Application_Model_Playlist::Delete($id);
|
||||||
|
|
||||||
$pl_sess = $this->pl_sess;
|
$pl_sess = $this->pl_sess;
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
public function deleteActiveAction()
|
public function deleteActiveAction()
|
||||||
{
|
{
|
||||||
$pl = $this->getPlaylist();
|
$pl = $this->getPlaylist();
|
||||||
Playlist::Delete($pl->getId());
|
Application_Model_Playlist::Delete($pl->getId());
|
||||||
|
|
||||||
$pl_sess = $this->pl_sess;
|
$pl_sess = $this->pl_sess;
|
||||||
unset($pl_sess->id);
|
unset($pl_sess->id);
|
||||||
|
|
|
@ -26,7 +26,7 @@ class PluploadController extends Zend_Controller_Action
|
||||||
public function uploadAction()
|
public function uploadAction()
|
||||||
{
|
{
|
||||||
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
||||||
StoredFile::uploadFile($upload_dir);
|
Application_Model_StoredFile::uploadFile($upload_dir);
|
||||||
|
|
||||||
die('{"jsonrpc" : "2.0"}');
|
die('{"jsonrpc" : "2.0"}');
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class PluploadController extends Zend_Controller_Action
|
||||||
public function copyfileAction(){
|
public function copyfileAction(){
|
||||||
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
||||||
$filename = $this->_getParam('name');
|
$filename = $this->_getParam('name');
|
||||||
StoredFile::copyFileToStor($upload_dir, $filename);
|
Application_Model_StoredFile::copyFileToStor($upload_dir, $filename);
|
||||||
|
|
||||||
die('{"jsonrpc" : "2.0"}');
|
die('{"jsonrpc" : "2.0"}');
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
->addActionContext('reload-watch-directory', 'json')
|
->addActionContext('reload-watch-directory', 'json')
|
||||||
->addActionContext('remove-watch-directory', 'json')
|
->addActionContext('remove-watch-directory', 'json')
|
||||||
->addActionContext('is-import-in-progress', 'json')
|
->addActionContext('is-import-in-progress', 'json')
|
||||||
|
->addActionContext('change-stream-setting', 'json')
|
||||||
|
->addActionContext('get-liquidsoap-status', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +35,12 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]);
|
Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]);
|
||||||
Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]);
|
Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]);
|
||||||
Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]);
|
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::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]);
|
||||||
Application_Model_Preference::SetSoundCloudPassword($values["preferences_soundcloud"]["SoundCloudPassword"]);
|
Application_Model_Preference::SetSoundCloudPassword($values["preferences_soundcloud"]["SoundCloudPassword"]);
|
||||||
Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]);
|
Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]);
|
||||||
|
@ -60,24 +66,32 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$form = new Application_Form_SupportSettings();
|
$form = new Application_Form_SupportSettings();
|
||||||
|
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
if ($form->isValid($request->getPost())) {
|
$values = $request->getPost();
|
||||||
$values = $form->getValues();
|
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);
|
$form->Logo->receive();
|
||||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
$imagePath = $form->Logo->getFileName();
|
||||||
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);
|
|
||||||
|
|
||||||
|
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 = "<div class='success'>Support setting updated.</div>";
|
$this->view->statusMsg = "<div class='success'>Support setting updated.</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,20 +99,106 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
if($logo){
|
if($logo){
|
||||||
$this->view->logoImg = $logo;
|
$this->view->logoImg = $logo;
|
||||||
}
|
}
|
||||||
|
$privacyChecked = false;
|
||||||
|
if(Application_Model_Preference::GetPrivacyPolicyCheck() == 1){
|
||||||
|
$privacyChecked = true;
|
||||||
|
}
|
||||||
|
$this->view->privacyChecked = $privacyChecked;
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
|
//$form->render($this->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function directoryConfigAction()
|
public function directoryConfigAction()
|
||||||
|
{
|
||||||
|
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript');
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript');
|
||||||
|
|
||||||
|
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
|
||||||
|
|
||||||
|
$this->view->form = $watched_dirs_pref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function streamSettingAction()
|
||||||
{
|
{
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript');
|
|
||||||
|
|
||||||
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
|
// get current settings
|
||||||
|
$temp = Application_Model_StreamSetting::getStreamSetting();
|
||||||
|
$setting = array();
|
||||||
|
foreach ($temp as $t){
|
||||||
|
$setting[$t['keyname']] = $t['value'];
|
||||||
|
}
|
||||||
|
|
||||||
$this->view->form = $watched_dirs_pref;
|
// get predefined type and bitrate from pref table
|
||||||
|
$temp_types = Application_Model_Preference::GetStreamType();
|
||||||
|
$stream_types = array();
|
||||||
|
foreach ($temp_types as $type){
|
||||||
|
if(trim($type) == "ogg"){
|
||||||
|
$temp = "OGG/VORBIS";
|
||||||
|
}else{
|
||||||
|
$temp = strtoupper(trim($type));
|
||||||
|
}
|
||||||
|
$stream_types[trim($type)] = $temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
$temp_bitrate = Application_Model_Preference::GetStreamBitrate();
|
||||||
|
$max_bitrate = intval(Application_Model_Preference::GetMaxBitrate());
|
||||||
|
$stream_bitrates = array();
|
||||||
|
foreach ($temp_bitrate as $type){
|
||||||
|
if(intval($type) <= $max_bitrate){
|
||||||
|
$stream_bitrates[trim($type)] = strtoupper(trim($type))." Kbit/s";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
|
||||||
|
$form = new Application_Form_StreamSetting();
|
||||||
|
$form->setSetting($setting);
|
||||||
|
$form->startFrom();
|
||||||
|
for($i=1; $i<=$num_of_stream; $i++){
|
||||||
|
$subform = new Application_Form_StreamSettingSubForm();
|
||||||
|
$subform->setPrefix($i);
|
||||||
|
$subform->setSetting($setting);
|
||||||
|
$subform->setStreamTypes($stream_types);
|
||||||
|
$subform->setStreamBitrates($stream_bitrates);
|
||||||
|
$subform->startForm();
|
||||||
|
$form->addSubForm($subform, "s".$i."_subform");
|
||||||
|
}
|
||||||
|
if ($request->isPost()) {
|
||||||
|
$post_data = $request->getPost();
|
||||||
|
$error = false;
|
||||||
|
$values = array();
|
||||||
|
for($i=1; $i<=$num_of_stream; $i++){
|
||||||
|
if(!$form->getSubForm("s".$i."_subform")->isValid($post_data["s".$i."_data"])){
|
||||||
|
$error = true;
|
||||||
|
}else{
|
||||||
|
// getValues returne array of size 1, so reorganized it
|
||||||
|
foreach($form->getSubForm("s".$i."_subform")->getValues() as $key => $d){
|
||||||
|
$values[$key] = $d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($form->isValid($post_data['output_sound_device'])){
|
||||||
|
$values['output_sound_device'] = $form->getValue('output_sound_device');
|
||||||
|
}
|
||||||
|
if(!$error){
|
||||||
|
Application_Model_StreamSetting::setStreamSetting($values);
|
||||||
|
$data = array();
|
||||||
|
$data['setting'] = Application_Model_StreamSetting::getStreamSetting();
|
||||||
|
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
|
||||||
|
$this->view->statusMsg = "<div class='success'>Stream Setting Updated.</div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->view->num_stream = $num_of_stream;
|
||||||
|
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
|
||||||
|
$this->view->form = $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function serverBrowseAction()
|
public function serverBrowseAction()
|
||||||
|
@ -144,7 +244,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$element = $this->getRequest()->getParam("element");
|
$element = $this->getRequest()->getParam("element");
|
||||||
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||||
|
|
||||||
$res = MusicDir::setStorDir($chosen);
|
$res = Application_Model_MusicDir::setStorDir($chosen);
|
||||||
if($res['code'] != 0){
|
if($res['code'] != 0){
|
||||||
$watched_dirs_form->populate(array('storageFolder' => $chosen));
|
$watched_dirs_form->populate(array('storageFolder' => $chosen));
|
||||||
$watched_dirs_form->getElement($element)->setErrors(array($res['error']));
|
$watched_dirs_form->getElement($element)->setErrors(array($res['error']));
|
||||||
|
@ -159,7 +259,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$element = $this->getRequest()->getParam("element");
|
$element = $this->getRequest()->getParam("element");
|
||||||
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||||
|
|
||||||
$res = MusicDir::addWatchedDir($chosen);
|
$res = Application_Model_MusicDir::addWatchedDir($chosen);
|
||||||
if($res['code'] != 0){
|
if($res['code'] != 0){
|
||||||
$watched_dirs_form->populate(array('watchedFolder' => $chosen));
|
$watched_dirs_form->populate(array('watchedFolder' => $chosen));
|
||||||
$watched_dirs_form->getElement($element)->setErrors(array($res['error']));
|
$watched_dirs_form->getElement($element)->setErrors(array($res['error']));
|
||||||
|
@ -172,7 +272,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$chosen = $this->getRequest()->getParam("dir");
|
$chosen = $this->getRequest()->getParam("dir");
|
||||||
|
|
||||||
$dir = MusicDir::removeWatchedDir($chosen);
|
$dir = Application_Model_MusicDir::removeWatchedDir($chosen);
|
||||||
|
|
||||||
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||||
$this->view->subform = $watched_dirs_form->render();
|
$this->view->subform = $watched_dirs_form->render();
|
||||||
|
@ -186,6 +286,20 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
die(json_encode($res));
|
die(json_encode($res));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLiquidsoapStatusAction(){
|
||||||
|
$out = array();
|
||||||
|
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
|
||||||
|
for($i=1; $i<=$num_of_stream; $i++){
|
||||||
|
$status = Application_Model_StreamSetting::getLiquidsoapError($i);
|
||||||
|
$status = $status == NULL?"Problem with Liquidsoap...":$status;
|
||||||
|
if(!Application_Model_StreamSetting::getStreamEnabled($i)){
|
||||||
|
$status = "N/A";
|
||||||
|
}
|
||||||
|
$out[] = array("id"=>$i, "status"=>$status);
|
||||||
|
}
|
||||||
|
die(json_encode($out));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
->addActionContext('get-form', 'json')
|
->addActionContext('get-form', 'json')
|
||||||
->addActionContext('upload-to-sound-cloud', 'json')
|
->addActionContext('upload-to-sound-cloud', 'json')
|
||||||
->addActionContext('content-context-menu', 'json')
|
->addActionContext('content-context-menu', 'json')
|
||||||
|
->addActionContext('set-time-scale', 'json')
|
||||||
|
->addActionContext('set-time-interval', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
|
|
||||||
$this->sched_sess = new Zend_Session_Namespace("schedule");
|
$this->sched_sess = new Zend_Session_Namespace("schedule");
|
||||||
|
@ -47,17 +49,19 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js','text/javascript');
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');
|
||||||
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery-ui-timepicker.css');
|
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery-ui-timepicker.css');
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css');
|
$this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css');
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css');
|
$this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css');
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css');
|
$this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css');
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
|
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
|
||||||
|
$this->view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css');
|
||||||
|
|
||||||
Schedule::createNewFormSections($this->view);
|
Application_Model_Schedule::createNewFormSections($this->view);
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
$this->view->isAdmin = $user->isAdmin();
|
$this->view->isAdmin = $user->isAdmin();
|
||||||
$this->view->isProgramManager = $user->isUserType('P');
|
$this->view->isProgramManager = $user->isUserType('P');
|
||||||
}
|
}
|
||||||
|
@ -68,31 +72,31 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$end = $this->_getParam('end', null);
|
$end = $this->_getParam('end', null);
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)))
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)))
|
||||||
$editable = true;
|
$editable = true;
|
||||||
else
|
else
|
||||||
$editable = false;
|
$editable = false;
|
||||||
|
|
||||||
$this->view->events = Show::getFullCalendarEvents($start, $end, $editable);
|
$this->view->events = Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function moveShowAction()
|
public function moveShowAction()
|
||||||
{
|
{
|
||||||
$deltaDay = $this->_getParam('day');
|
$deltaDay = $this->_getParam('day');
|
||||||
$deltaMin = $this->_getParam('min');
|
$deltaMin = $this->_getParam('min');
|
||||||
$showInstanceId = $this->_getParam('showInstanceId');
|
$showInstanceId = $this->_getParam('showInstanceId');
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$show = new ShowInstance($showInstanceId);
|
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||||
$error = $show->moveShow($deltaDay, $deltaMin);
|
$error = $showInstance->moveShow($deltaDay, $deltaMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($error))
|
if(isset($error))
|
||||||
$this->view->error = $error;
|
$this->view->error = $error;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,10 +107,10 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$showInstanceId = $this->_getParam('showInstanceId');
|
$showInstanceId = $this->_getParam('showInstanceId');
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||||
$error = $show->resizeShow($deltaDay, $deltaMin);
|
$error = $show->resizeShow($deltaDay, $deltaMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,10 +123,10 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||||
$show->deleteShow();
|
$show->deleteShow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,60 +135,30 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$show_instance = $this->_getParam('id');
|
$show_instance = $this->_getParam('id');
|
||||||
$show_inst = new ShowInstance($show_instance);
|
$show_inst = new Application_Model_ShowInstance($show_instance);
|
||||||
|
|
||||||
$file = $show_inst->getRecordedFile();
|
$file = $show_inst->getRecordedFile();
|
||||||
|
$id = $file->getId();
|
||||||
if(is_null($file)) {
|
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
|
||||||
$this->view->error = "Recorded file does not exist";
|
// we should die with ui info
|
||||||
return;
|
die();
|
||||||
}
|
|
||||||
|
|
||||||
$show_name = $show_inst->getName();
|
|
||||||
$show_genre = $show_inst->getGenre();
|
|
||||||
$show_start_time = $show_inst->getShowStart();
|
|
||||||
|
|
||||||
if(Application_Model_Preference::GetDoSoundCloudUpload())
|
|
||||||
{
|
|
||||||
for($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) {
|
|
||||||
|
|
||||||
$show = new Show($show_inst->getShowId());
|
|
||||||
$description = $show->getDescription();
|
|
||||||
$hosts = $show->getHosts();
|
|
||||||
|
|
||||||
$tags = array_merge($hosts, array($show_name));
|
|
||||||
|
|
||||||
try {
|
|
||||||
$soundcloud = new ATSoundcloud();
|
|
||||||
$soundcloud_id = $soundcloud->uploadTrack($file->getFilePath(), $file->getName(), $description, $tags, $show_start_time, $show_genre);
|
|
||||||
$show_inst->setSoundCloudFileId($soundcloud_id);
|
|
||||||
$this->view->soundcloud_id = $soundcloud_id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
|
|
||||||
$code = $e->getHttpCode();
|
|
||||||
if(!in_array($code, array(0, 100))) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sleep($CC_CONFIG['soundcloud-connection-wait']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function makeContextMenuAction()
|
public function makeContextMenuAction()
|
||||||
{
|
{
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
$today_timestamp = date("Y-m-d H:i:s");
|
$epochNow = time();
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
$show = new ShowInstance($id);
|
$show = new Application_Model_ShowInstance($id);
|
||||||
|
|
||||||
$params = '/format/json/id/#id#';
|
$params = '/format/json/id/#id#';
|
||||||
|
|
||||||
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
|
$showStartDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowStart());
|
||||||
|
$showEndDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowEnd());
|
||||||
|
|
||||||
|
if ($epochNow < $showStartDateHelper->getTimestamp()) {
|
||||||
|
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId()) && !$show->isRecorded() && !$show->isRebroadcast()) {
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId()) && !$show->isRecorded() && !$show->isRebroadcast()) {
|
||||||
|
|
||||||
|
@ -202,25 +176,30 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
'callback' => 'window["buildContentDialog"]'), 'title' => 'Show Content');
|
'callback' => 'window["buildContentDialog"]'), 'title' => 'Show Content');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strtotime($show->getShowEnd()) <= strtotime($today_timestamp)
|
if ($showEndDateHelper->getTimestamp() <= $epochNow
|
||||||
&& is_null($show->getSoundCloudFileId())
|
|
||||||
&& $show->isRecorded()
|
&& $show->isRecorded()
|
||||||
&& Application_Model_Preference::GetDoSoundCloudUpload()) {
|
&& Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||||
$menu[] = array('action' => array('type' => 'fn',
|
if(is_null($show->getSoundCloudFileId())){
|
||||||
'callback' => "window['uploadToSoundCloud']($id)"),
|
$menu[] = array('action' => array('type' => 'fn',
|
||||||
'title' => 'Upload to Soundcloud');
|
'callback' => "window['uploadToSoundCloud']($id)"),
|
||||||
|
'title' => 'Upload to Soundcloud');
|
||||||
|
}else{
|
||||||
|
$menu[] = array('action' => array('type' => 'fn',
|
||||||
|
'callback' => "window['uploadToSoundCloud']($id)"),
|
||||||
|
'title' => 'Re-upload to Soundcloud');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (strtotime($show->getShowStart()) <= strtotime($today_timestamp) &&
|
if ($showStartDateHelper->getTimestamp() <= $epochNow &&
|
||||||
strtotime($today_timestamp) < strtotime($show->getShowEnd()) &&
|
$epochNow < $showEndDateHelper->getTimestamp() &&
|
||||||
$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$menu[] = array('action' => array('type' => 'fn',
|
$menu[] = array('action' => array('type' => 'fn',
|
||||||
'callback' => "window['confirmCancelShow']($id)"),
|
'callback' => "window['confirmCancelShow']($id)"),
|
||||||
'title' => 'Cancel Current Show');
|
'title' => 'Cancel Current Show');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
|
if ($epochNow < $showStartDateHelper->getTimestamp()) {
|
||||||
|
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
|
|
||||||
|
@ -248,8 +227,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||||
|
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
|
||||||
$show->scheduleShow(array($plId));
|
$show->scheduleShow(array($plId));
|
||||||
|
@ -267,8 +246,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||||
|
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId()))
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId()))
|
||||||
$show->clearShow();
|
$show->clearShow();
|
||||||
|
@ -276,19 +255,19 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function getCurrentPlaylistAction()
|
public function getCurrentPlaylistAction()
|
||||||
{
|
{
|
||||||
$this->view->entries = Schedule::GetPlayOrderRange();
|
$this->view->entries = Application_Model_Schedule::GetPlayOrderRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findPlaylistsAction()
|
public function findPlaylistsAction()
|
||||||
{
|
{
|
||||||
$post = $this->getRequest()->getPost();
|
$post = $this->getRequest()->getPost();
|
||||||
|
|
||||||
$show = new ShowInstance($this->sched_sess->showInstanceId);
|
$show = new Application_Model_ShowInstance($this->sched_sess->showInstanceId);
|
||||||
$playlists = $show->searchPlaylistsForShow($post);
|
$playlists = $show->searchPlaylistsForShow($post);
|
||||||
foreach( $playlists['aaData'] as &$data){
|
foreach( $playlists['aaData'] as &$data){
|
||||||
// calling two functions to format time to 1 decimal place
|
// calling two functions to format time to 1 decimal place
|
||||||
$sec = Playlist::playlistTimeToSeconds($data[4]);
|
$sec = Application_Model_Playlist::playlistTimeToSeconds($data[4]);
|
||||||
$data[4] = Playlist::secondsToPlaylistTime($sec);
|
$data[4] = Application_Model_Playlist::secondsToPlaylistTime($sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
//for datatables
|
//for datatables
|
||||||
|
@ -302,8 +281,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$search = $this->_getParam('search', null);
|
$search = $this->_getParam('search', null);
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||||
|
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
|
||||||
$show->removeGroupFromShow($group_id);
|
$show->removeGroupFromShow($group_id);
|
||||||
|
@ -321,12 +300,12 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
$this->sched_sess->showInstanceId = $showInstanceId;
|
$this->sched_sess->showInstanceId = $showInstanceId;
|
||||||
|
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||||
$start_timestamp = $show->getShowStart();
|
$start_timestamp = $show->getShowStart();
|
||||||
$end_timestamp = $show->getShowEnd();
|
$end_timestamp = $show->getShowEnd();
|
||||||
|
|
||||||
//check to make sure show doesn't overlap.
|
//check to make sure show doesn't overlap.
|
||||||
if(Show::getShows($start_timestamp, $end_timestamp, array($showInstanceId))) {
|
if(Application_Model_Show::getShows($start_timestamp, $end_timestamp, array($showInstanceId))) {
|
||||||
$this->view->error = "cannot schedule an overlapping show.";
|
$this->view->error = "cannot schedule an overlapping show.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -361,11 +340,11 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
public function showContentDialogAction()
|
public function showContentDialogAction()
|
||||||
{
|
{
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||||
|
|
||||||
$originalShowId = $show->isRebroadcast();
|
$originalShowId = $show->isRebroadcast();
|
||||||
if (!is_null($originalShowId)){
|
if (!is_null($originalShowId)){
|
||||||
$originalShow = new ShowInstance($originalShowId);
|
$originalShow = new Application_Model_ShowInstance($originalShowId);
|
||||||
$originalShowName = $originalShow->getName();
|
$originalShowName = $originalShow->getName();
|
||||||
$originalShowStart = $originalShow->getShowStart();
|
$originalShowStart = $originalShow->getShowStart();
|
||||||
|
|
||||||
|
@ -382,11 +361,13 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
public function editShowAction()
|
public function editShowAction()
|
||||||
{
|
{
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
if(!$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if(!$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
|
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
|
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
|
@ -394,31 +375,22 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$formWhen = new Application_Form_AddShowWhen();
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
$formRepeats = new Application_Form_AddShowRepeats();
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
$formStyle = new Application_Form_AddShowStyle();
|
$formStyle = new Application_Form_AddShowStyle();
|
||||||
$formRecord = new Application_Form_AddShowRR();
|
|
||||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
|
||||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
|
||||||
|
|
||||||
$formWhat->removeDecorator('DtDdWrapper');
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
$formWho->removeDecorator('DtDdWrapper');
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
$formWhen->removeDecorator('DtDdWrapper');
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
$formRepeats->removeDecorator('DtDdWrapper');
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
$formStyle->removeDecorator('DtDdWrapper');
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
$formRecord->removeDecorator('DtDdWrapper');
|
|
||||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
|
||||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
|
||||||
|
|
||||||
$this->view->what = $formWhat;
|
$this->view->what = $formWhat;
|
||||||
$this->view->when = $formWhen;
|
$this->view->when = $formWhen;
|
||||||
$this->view->repeats = $formRepeats;
|
$this->view->repeats = $formRepeats;
|
||||||
$this->view->who = $formWho;
|
$this->view->who = $formWho;
|
||||||
$this->view->style = $formStyle;
|
$this->view->style = $formStyle;
|
||||||
$this->view->rr = $formRecord;
|
|
||||||
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
|
||||||
$this->view->rebroadcast = $formRebroadcast;
|
|
||||||
$this->view->addNewShow = false;
|
$this->view->addNewShow = false;
|
||||||
|
|
||||||
$showInstance = new ShowInstance($showInstanceId);
|
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||||
$show = new Show($showInstance->getShowId());
|
$show = new Application_Model_Show($showInstance->getShowId());
|
||||||
|
|
||||||
$formWhat->populate(array('add_show_id' => $show->getId(),
|
$formWhat->populate(array('add_show_id' => $show->getId(),
|
||||||
'add_show_name' => $show->getName(),
|
'add_show_name' => $show->getName(),
|
||||||
|
@ -426,10 +398,16 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
'add_show_genre' => $show->getGenre(),
|
'add_show_genre' => $show->getGenre(),
|
||||||
'add_show_description' => $show->getDescription()));
|
'add_show_description' => $show->getDescription()));
|
||||||
|
|
||||||
$formWhen->populate(array('add_show_start_date' => $show->getStartDate(),
|
$startsDateTime = new DateTime($showInstance->getShowStart(), new DateTimeZone("UTC"));
|
||||||
'add_show_start_time' => DateHelper::removeSecondsFromTime($show->getStartTime()),
|
$endsDateTime = new DateTime($showInstance->getShowEnd(), new DateTimeZone("UTC"));
|
||||||
'add_show_end_date_no_repeat' => $show->getEndDate(),
|
|
||||||
'add_show_end_time' => DateHelper::removeSecondsFromTime($show->getEndTime()),
|
$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
|
$formWhen->populate(array('add_show_start_date' => $startsDateTime->format("Y-m-d"),
|
||||||
|
'add_show_start_time' => $startsDateTime->format("H:i"),
|
||||||
|
'add_show_end_date_no_repeat' => $endsDateTime->format("Y-m-d"),
|
||||||
|
'add_show_end_time' => $endsDateTime->format("H:i"),
|
||||||
'add_show_duration' => $show->getDuration(true),
|
'add_show_duration' => $show->getDuration(true),
|
||||||
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
|
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
|
||||||
|
|
||||||
|
@ -443,58 +421,71 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
array_push($days, $showDay->getDbDay());
|
array_push($days, $showDay->getDbDay());
|
||||||
}
|
}
|
||||||
|
|
||||||
$displayedEndDate = new DateTime($show->getRepeatingEndDate());
|
$displayedEndDate = new DateTime($show->getRepeatingEndDate(), new DateTimeZone("UTC"));
|
||||||
$displayedEndDate->sub(new DateInterval("P1D"));//end dates are stored non-inclusively.
|
$displayedEndDate->sub(new DateInterval("P1D"));//end dates are stored non-inclusively.
|
||||||
$displayedEndDate = $displayedEndDate->format("Y-m-d");
|
$displayedEndDate->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
$formRepeats->populate(array('add_show_repeat_type' => $show->getRepeatType(),
|
$formRepeats->populate(array('add_show_repeat_type' => $show->getRepeatType(),
|
||||||
'add_show_day_check' => $days,
|
'add_show_day_check' => $days,
|
||||||
'add_show_end_date' => $displayedEndDate,
|
'add_show_end_date' => $displayedEndDate->format("Y-m-d"),
|
||||||
'add_show_no_end' => ($show->getRepeatingEndDate() == '')));
|
'add_show_no_end' => ($show->getRepeatingEndDate() == '')));
|
||||||
|
|
||||||
$formRecord->populate(array('add_show_record' => $show->isRecorded(),
|
|
||||||
'add_show_rebroadcast' => $show->isRebroadcast()));
|
|
||||||
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$rebroadcastsRelative = $show->getRebroadcastsRelative();
|
|
||||||
$rebroadcastFormValues = array();
|
|
||||||
$i = 1;
|
|
||||||
foreach ($rebroadcastsRelative as $rebroadcast){
|
|
||||||
$rebroadcastFormValues["add_show_rebroadcast_date_$i"] = $rebroadcast['day_offset'];
|
|
||||||
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$formRebroadcast->populate($rebroadcastFormValues);
|
|
||||||
|
|
||||||
$rebroadcastsAbsolute = $show->getRebroadcastsAbsolute();
|
|
||||||
$rebroadcastAbsoluteFormValues = array();
|
|
||||||
$i = 1;
|
|
||||||
foreach ($rebroadcastsAbsolute as $rebroadcast){
|
|
||||||
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_date_absolute_$i"] = $rebroadcast['start_date'];
|
|
||||||
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
|
||||||
|
|
||||||
$hosts = array();
|
$hosts = array();
|
||||||
$showHosts = CcShowHostsQuery::create()->filterByDbShow($showInstance->getShowId())->find();
|
$showHosts = CcShowHostsQuery::create()->filterByDbShow($showInstance->getShowId())->find();
|
||||||
foreach($showHosts as $showHost){
|
foreach($showHosts as $showHost){
|
||||||
array_push($hosts, $showHost->getDbHost());
|
array_push($hosts, $showHost->getDbHost());
|
||||||
}
|
}
|
||||||
$formWho->populate(array('add_show_hosts' => $hosts));
|
$formWho->populate(array('add_show_hosts' => $hosts));
|
||||||
|
|
||||||
|
|
||||||
$formStyle->populate(array('add_show_background_color' => $show->getBackgroundColor(),
|
$formStyle->populate(array('add_show_background_color' => $show->getBackgroundColor(),
|
||||||
'add_show_color' => $show->getColor()));
|
'add_show_color' => $show->getColor()));
|
||||||
|
|
||||||
|
if(!$isSaas){
|
||||||
|
$formRecord = new Application_Form_AddShowRR();
|
||||||
|
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||||
|
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||||
|
|
||||||
|
$formRecord->removeDecorator('DtDdWrapper');
|
||||||
|
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
|
$this->view->rr = $formRecord;
|
||||||
|
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||||
|
$this->view->rebroadcast = $formRebroadcast;
|
||||||
|
|
||||||
|
$formRecord->populate(array('add_show_record' => $show->isRecorded(),
|
||||||
|
'add_show_rebroadcast' => $show->isRebroadcast()));
|
||||||
|
|
||||||
|
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$rebroadcastsRelative = $show->getRebroadcastsRelative();
|
||||||
|
$rebroadcastFormValues = array();
|
||||||
|
$i = 1;
|
||||||
|
foreach ($rebroadcastsRelative as $rebroadcast){
|
||||||
|
$rebroadcastFormValues["add_show_rebroadcast_date_$i"] = $rebroadcast['day_offset'];
|
||||||
|
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = Application_Model_DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$formRebroadcast->populate($rebroadcastFormValues);
|
||||||
|
|
||||||
|
$rebroadcastsAbsolute = $show->getRebroadcastsAbsolute();
|
||||||
|
$rebroadcastAbsoluteFormValues = array();
|
||||||
|
$i = 1;
|
||||||
|
foreach ($rebroadcastsAbsolute as $rebroadcast){
|
||||||
|
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_date_absolute_$i"] = $rebroadcast['start_date'];
|
||||||
|
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = Application_Model_DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
||||||
|
}
|
||||||
|
|
||||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||||
$this->view->entries = 5;
|
$this->view->entries = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormAction(){
|
public function getFormAction(){
|
||||||
Schedule::createNewFormSections($this->view);
|
Application_Model_Schedule::createNewFormSections($this->view);
|
||||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +499,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$data[$j["name"]] = $j["value"];
|
$data[$j["name"]] = $j["value"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$show = new Show($data['add_show_id']);
|
$show = new Application_Model_Show($data['add_show_id']);
|
||||||
|
|
||||||
$startDateModified = true;
|
$startDateModified = true;
|
||||||
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
|
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
|
||||||
|
@ -525,23 +516,20 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$data['add_show_day_check'] = null;
|
$data['add_show_day_check'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
|
$record = false;
|
||||||
|
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
$formWho = new Application_Form_AddShowWho();
|
$formWho = new Application_Form_AddShowWho();
|
||||||
$formWhen = new Application_Form_AddShowWhen();
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
$formRepeats = new Application_Form_AddShowRepeats();
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
$formStyle = new Application_Form_AddShowStyle();
|
$formStyle = new Application_Form_AddShowStyle();
|
||||||
$formRecord = new Application_Form_AddShowRR();
|
|
||||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
|
||||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
|
||||||
|
|
||||||
$formWhat->removeDecorator('DtDdWrapper');
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
$formWho->removeDecorator('DtDdWrapper');
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
$formWhen->removeDecorator('DtDdWrapper');
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
$formRepeats->removeDecorator('DtDdWrapper');
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
$formStyle->removeDecorator('DtDdWrapper');
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
$formRecord->removeDecorator('DtDdWrapper');
|
|
||||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
|
||||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
|
||||||
|
|
||||||
$what = $formWhat->isValid($data);
|
$what = $formWhat->isValid($data);
|
||||||
$when = $formWhen->isValid($data);
|
$when = $formWhen->isValid($data);
|
||||||
|
@ -572,70 +560,96 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$data["add_show_duration"] = $hValue.":".$mValue;
|
$data["add_show_duration"] = $hValue.":".$mValue;
|
||||||
|
|
||||||
|
if(!$isSaas){
|
||||||
|
$formRecord = new Application_Form_AddShowRR();
|
||||||
|
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||||
|
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||||
|
|
||||||
|
$formRecord->removeDecorator('DtDdWrapper');
|
||||||
|
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
|
//If show is a new show (not updated), then get
|
||||||
|
//isRecorded from POST data. Otherwise get it from
|
||||||
|
//the database since the user is not allowed to
|
||||||
|
//update this option.
|
||||||
|
if ($data['add_show_id'] != -1){
|
||||||
|
$data['add_show_record'] = $show->isRecorded();
|
||||||
|
$record = $formRecord->isValid($data);
|
||||||
|
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||||
|
} else {
|
||||||
|
$record = $formRecord->isValid($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($data["add_show_repeats"]) {
|
if($data["add_show_repeats"]) {
|
||||||
$repeats = $formRepeats->isValid($data);
|
$repeats = $formRepeats->isValid($data);
|
||||||
if($repeats) {
|
if($repeats) {
|
||||||
$repeats = $formRepeats->checkReliantFields($data);
|
$repeats = $formRepeats->checkReliantFields($data);
|
||||||
}
|
}
|
||||||
|
if(!$isSaas){
|
||||||
|
$formAbsoluteRebroadcast->reset();
|
||||||
|
//make it valid, results don't matter anyways.
|
||||||
|
$rebroadAb = 1;
|
||||||
|
|
||||||
$formAbsoluteRebroadcast->reset();
|
if ($data["add_show_rebroadcast"]) {
|
||||||
//make it valid, results don't matter anyways.
|
$rebroad = $formRebroadcast->isValid($data);
|
||||||
$rebroadAb = 1;
|
if($rebroad) {
|
||||||
|
$rebroad = $formRebroadcast->checkReliantFields($data);
|
||||||
if ($data["add_show_rebroadcast"]) {
|
}
|
||||||
$rebroad = $formRebroadcast->isValid($data);
|
}
|
||||||
if($rebroad) {
|
else {
|
||||||
$rebroad = $formRebroadcast->checkReliantFields($data);
|
$rebroad = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
$rebroad = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$formRebroadcast->reset();
|
|
||||||
//make it valid, results don't matter anyways.
|
|
||||||
$repeats = 1;
|
$repeats = 1;
|
||||||
$rebroad = 1;
|
if(!$isSaas){
|
||||||
|
$formRebroadcast->reset();
|
||||||
|
//make it valid, results don't matter anyways.
|
||||||
|
$rebroad = 1;
|
||||||
|
|
||||||
if ($data["add_show_rebroadcast"]) {
|
if ($data["add_show_rebroadcast"]) {
|
||||||
$rebroadAb = $formAbsoluteRebroadcast->isValid($data);
|
$rebroadAb = $formAbsoluteRebroadcast->isValid($data);
|
||||||
if($rebroadAb) {
|
if($rebroadAb) {
|
||||||
$rebroadAb = $formAbsoluteRebroadcast->checkReliantFields($data);
|
$rebroadAb = $formAbsoluteRebroadcast->checkReliantFields($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$rebroadAb = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
$rebroadAb = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$who = $formWho->isValid($data);
|
$who = $formWho->isValid($data);
|
||||||
$style = $formStyle->isValid($data);
|
$style = $formStyle->isValid($data);
|
||||||
|
if ($what && $when && $repeats && $who && $style) {
|
||||||
|
if(!$isSaas){
|
||||||
|
if($record && $rebroadAb && $rebroad){
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
|
Application_Model_Show::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
//If show is a new show (not updated), then get
|
//send back a new form for the user.
|
||||||
//isRecorded from POST data. Otherwise get it from
|
Application_Model_Schedule::createNewFormSections($this->view);
|
||||||
//the database since the user is not allowed to
|
|
||||||
//update this option.
|
|
||||||
$record = false;
|
|
||||||
if ($data['add_show_id'] != -1){
|
|
||||||
$data['add_show_record'] = $show->isRecorded();
|
|
||||||
$record = $formRecord->isValid($data);
|
|
||||||
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
|
|
||||||
} else {
|
|
||||||
$record = $formRecord->isValid($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($what && $when && $repeats && $who && $style && $record && $rebroadAb && $rebroad) {
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
}
|
||||||
$user = new User($userInfo->id);
|
}else{
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
Show::create($data);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
|
Application_Model_Show::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//send back a new form for the user.
|
||||||
|
Application_Model_Schedule::createNewFormSections($this->view);
|
||||||
|
|
||||||
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||||
}
|
}
|
||||||
|
|
||||||
//send back a new form for the user.
|
|
||||||
Schedule::createNewFormSections($this->view);
|
|
||||||
|
|
||||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->view->what = $formWhat;
|
$this->view->what = $formWhat;
|
||||||
|
@ -643,9 +657,11 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->view->repeats = $formRepeats;
|
$this->view->repeats = $formRepeats;
|
||||||
$this->view->who = $formWho;
|
$this->view->who = $formWho;
|
||||||
$this->view->style = $formStyle;
|
$this->view->style = $formStyle;
|
||||||
$this->view->rr = $formRecord;
|
if(!$isSaas){
|
||||||
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
$this->view->rr = $formRecord;
|
||||||
$this->view->rebroadcast = $formRebroadcast;
|
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||||
|
$this->view->rebroadcast = $formRebroadcast;
|
||||||
|
}
|
||||||
$this->view->addNewShow = true;
|
$this->view->addNewShow = true;
|
||||||
|
|
||||||
//the form still needs to be "update" since
|
//the form still needs to be "update" since
|
||||||
|
@ -664,13 +680,13 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
public function cancelShowAction()
|
public function cancelShowAction()
|
||||||
{
|
{
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
|
|
||||||
$showInstance = new ShowInstance($showInstanceId);
|
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||||
$show = new Show($showInstance->getShowId());
|
$show = new Application_Model_Show($showInstance->getShowId());
|
||||||
|
|
||||||
$show->cancelShow($showInstance->getShowStart());
|
$show->cancelShow($showInstance->getShowStart());
|
||||||
}
|
}
|
||||||
|
@ -679,13 +695,15 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
public function cancelCurrentShowAction()
|
public function cancelCurrentShowAction()
|
||||||
{
|
{
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||||
$show->clearShow();
|
$show->clearShow();
|
||||||
$show->deleteShow();
|
$show->deleteShow();
|
||||||
|
// send 'cancel-current-show' command to pypo
|
||||||
|
Application_Model_RabbitMq::SendMessageToPypo("cancel_current_show", array());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,15 +720,32 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
|
|
||||||
$file_id = $this->_getParam('id', null);
|
$file_id = $this->_getParam('id', null);
|
||||||
$file = StoredFile::Recall($file_id);
|
$file = Application_Model_StoredFile::Recall($file_id);
|
||||||
|
|
||||||
$url = $file->getFileURL().'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
|
$baseUrl = $this->getRequest()->getBaseUrl();
|
||||||
|
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
|
||||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||||
'title' => 'Download');
|
'title' => 'Download');
|
||||||
|
|
||||||
//returns format jjmenu is looking for.
|
//returns format jjmenu is looking for.
|
||||||
die(json_encode($menu));
|
die(json_encode($menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the user specific preference for which time scale to use in Calendar.
|
||||||
|
* This is only being used by schedule.js at the moment.
|
||||||
|
*/
|
||||||
|
public function setTimeScaleAction() {
|
||||||
|
Application_Model_Preference::SetCalendarTimeScale($this->_getParam('timeScale'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the user specific preference for which time interval to use in Calendar.
|
||||||
|
* This is only being used by schedule.js at the moment.
|
||||||
|
*/
|
||||||
|
public function setTimeIntervalAction() {
|
||||||
|
Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class SystemstatusController extends Zend_Controller_Action
|
||||||
|
{
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js','text/javascript');
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js','text/javascript');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function indexAction()
|
||||||
|
{
|
||||||
|
$services = array(
|
||||||
|
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
|
||||||
|
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||||
|
"show-recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
|
||||||
|
"media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus(),
|
||||||
|
"rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus()
|
||||||
|
);
|
||||||
|
|
||||||
|
$partitions = Application_Model_Systemstatus::GetDiskInfo();
|
||||||
|
|
||||||
|
$this->view->status = new StdClass;
|
||||||
|
$this->view->status->services = $services;
|
||||||
|
$this->view->status->partitions = $partitions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLogFileAction()
|
||||||
|
{
|
||||||
|
$log_files = array("pypo"=>"/var/log/airtime/pypo/pypo.log",
|
||||||
|
"liquidsoap"=>"/var/log/airtime/pypo-liquidsoap/ls_script.log",
|
||||||
|
"media-monitor"=>"/var/log/airtime/media-monitor/media-monitor.log",
|
||||||
|
"show-recorder"=>"/var/log/airtime/show-recorder/show-recorder.log",
|
||||||
|
"icecast2"=>"/var/log/icecast2/error.log");
|
||||||
|
|
||||||
|
$id = $this->_getParam('id');
|
||||||
|
Logging::log($id);
|
||||||
|
|
||||||
|
if (array_key_exists($id, $log_files)){
|
||||||
|
$filepath = $log_files[$id];
|
||||||
|
$filename = basename($filepath);
|
||||||
|
header("Content-Disposition: attachment; filename=$filename");
|
||||||
|
header("Content-Length: " . filesize($filepath));
|
||||||
|
// !! binary mode !!
|
||||||
|
$fp = fopen($filepath, 'rb');
|
||||||
|
|
||||||
|
//We can have multiple levels of output buffering. Need to
|
||||||
|
//keep looping until all have been disabled!!!
|
||||||
|
//http://www.php.net/manual/en/function.ob-end-flush.php
|
||||||
|
while (@ob_end_flush());
|
||||||
|
|
||||||
|
fpassthru($fp);
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
//make sure to exit here so that no other output is sent.
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,7 +34,7 @@ class UserController extends Zend_Controller_Action
|
||||||
|
|
||||||
$formdata = $form->getValues();
|
$formdata = $form->getValues();
|
||||||
if ($form->validateLogin($formdata)){
|
if ($form->validateLogin($formdata)){
|
||||||
$user = new User($formdata['user_id']);
|
$user = new Application_Model_User($formdata['user_id']);
|
||||||
$user->setFirstName($formdata['first_name']);
|
$user->setFirstName($formdata['first_name']);
|
||||||
$user->setLastName($formdata['last_name']);
|
$user->setLastName($formdata['last_name']);
|
||||||
$user->setLogin($formdata['login']);
|
$user->setLogin($formdata['login']);
|
||||||
|
@ -63,13 +63,13 @@ class UserController extends Zend_Controller_Action
|
||||||
public function getHostsAction()
|
public function getHostsAction()
|
||||||
{
|
{
|
||||||
$search = $this->_getParam('term');
|
$search = $this->_getParam('term');
|
||||||
$this->view->hosts = User::getHosts($search);
|
$this->view->hosts = Application_Model_User::getHosts($search);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserDataTableInfoAction()
|
public function getUserDataTableInfoAction()
|
||||||
{
|
{
|
||||||
$post = $this->getRequest()->getPost();
|
$post = $this->getRequest()->getPost();
|
||||||
$users = User::getUsersDataTablesInfo($post);
|
$users = Application_Model_User::getUsersDataTablesInfo($post);
|
||||||
|
|
||||||
die(json_encode($users));
|
die(json_encode($users));
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ class UserController extends Zend_Controller_Action
|
||||||
public function getUserDataAction()
|
public function getUserDataAction()
|
||||||
{
|
{
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
$this->view->entries = User::GetUserData($id);
|
$this->view->entries = Application_Model_User::GetUserData($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeUserAction()
|
public function removeUserAction()
|
||||||
|
@ -89,7 +89,7 @@ class UserController extends Zend_Controller_Action
|
||||||
$userId = $userInfo->id;
|
$userId = $userInfo->id;
|
||||||
|
|
||||||
if ($delId != $userId){
|
if ($delId != $userId){
|
||||||
$user = new User($delId);
|
$user = new Application_Model_User($delId);
|
||||||
$this->view->entries = $user->delete();
|
$this->view->entries = $user->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,10 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
|
||||||
{
|
{
|
||||||
public function dispatchLoopShutdown()
|
public function dispatchLoopShutdown()
|
||||||
{
|
{
|
||||||
RabbitMq::PushScheduleFinal();
|
if (Application_Model_RabbitMq::$doPush) {
|
||||||
|
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
|
||||||
|
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
|
||||||
|
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm
|
||||||
{
|
{
|
||||||
// Add record element
|
// Add record element
|
||||||
$this->addElement('checkbox', 'add_show_record', array(
|
$this->addElement('checkbox', 'add_show_record', array(
|
||||||
'label' => 'Record?',
|
'label' => 'Record from Line In?',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
{
|
{
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
// retrieves the length limit for each char field
|
||||||
|
// and store to assoc array
|
||||||
|
$maxLens = Application_Model_Show::GetMaxLengths();
|
||||||
|
|
||||||
// Hidden element to indicate whether the show is new or
|
// Hidden element to indicate whether the show is new or
|
||||||
// whether we are updating an existing show.
|
// whether we are updating an existing show.
|
||||||
$this->addElement('hidden', 'add_show_id', array(
|
$this->addElement('hidden', 'add_show_id', array(
|
||||||
|
@ -18,7 +21,8 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array('NotEmpty'),
|
'validators' => array('NotEmpty'),
|
||||||
'value' => 'Untitled Show'
|
'value' => 'Untitled Show',
|
||||||
|
'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add URL element
|
// Add URL element
|
||||||
|
@ -27,7 +31,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array('NotEmpty')
|
'validators' => array('NotEmpty', array('StringLength', false, array(0, $maxLens['url'])))
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add genre element
|
// Add genre element
|
||||||
|
@ -35,14 +39,16 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
'label' => 'Genre:',
|
'label' => 'Genre:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array(array('StringLength', false, array(0, $maxLens['genre'])))
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add the description element
|
// Add the description element
|
||||||
$this->addElement('textarea', 'add_show_description', array(
|
$this->addElement('textarea', 'add_show_description', array(
|
||||||
'label' => 'Description:',
|
'label' => 'Description:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'class' => 'input_text_area'
|
'class' => 'input_text_area',
|
||||||
|
'validators' => array(array('StringLength', false, array(0, $maxLens['description'])))
|
||||||
));
|
));
|
||||||
|
|
||||||
$descText = $this->getElement('add_show_description');
|
$descText = $this->getElement('add_show_description');
|
||||||
|
@ -53,7 +59,5 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
))));
|
))));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,10 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
$this->setDecorators(array(
|
||||||
|
array('ViewScript', array('viewScript' => 'form/add-show-when.phtml'))
|
||||||
|
));
|
||||||
|
|
||||||
// Add start date element
|
// Add start date element
|
||||||
$startDate = new Zend_Form_Element_Text('add_show_start_date');
|
$startDate = new Zend_Form_Element_Text('add_show_start_date');
|
||||||
$startDate->class = 'input_text';
|
$startDate->class = 'input_text';
|
||||||
|
@ -15,11 +19,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
->setValidators(array(
|
->setValidators(array(
|
||||||
'NotEmpty',
|
'NotEmpty',
|
||||||
array('date', false, array('YYYY-MM-DD'))))
|
array('date', false, array('YYYY-MM-DD'))))
|
||||||
->setDecorators(array(
|
->setDecorators(array('ViewHelper'));
|
||||||
array(array('open'=>'HtmlTag'), array('tag' => 'dd', 'openOnly'=>true)),
|
$startDate->setAttrib('alt', 'date');
|
||||||
'ViewHelper',
|
|
||||||
'Description',
|
|
||||||
array('Label', array('tag' =>'dt'))));
|
|
||||||
$this->addElement($startDate);
|
$this->addElement($startDate);
|
||||||
|
|
||||||
// Add start time element
|
// Add start time element
|
||||||
|
@ -32,10 +33,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
'NotEmpty',
|
'NotEmpty',
|
||||||
array('date', false, array('HH:mm')),
|
array('date', false, array('HH:mm')),
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array(
|
->setDecorators(array('ViewHelper'));
|
||||||
'ViewHelper',
|
$startTime->setAttrib('alt', 'time');
|
||||||
'Errors',
|
|
||||||
array(array('close'=>'HtmlTag'), array('tag' => 'dd', 'closeOnly'=>true))));
|
|
||||||
$this->addElement($startTime);
|
$this->addElement($startTime);
|
||||||
|
|
||||||
// Add end date element
|
// Add end date element
|
||||||
|
@ -48,11 +47,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
->setValidators(array(
|
->setValidators(array(
|
||||||
'NotEmpty',
|
'NotEmpty',
|
||||||
array('date', false, array('YYYY-MM-DD'))))
|
array('date', false, array('YYYY-MM-DD'))))
|
||||||
->setDecorators(array(
|
->setDecorators(array('ViewHelper'));
|
||||||
array(array('open'=>'HtmlTag'), array('tag' => 'dd', 'openOnly'=>true)),
|
$endDate->setAttrib('alt', 'date');
|
||||||
'ViewHelper',
|
|
||||||
'Description',
|
|
||||||
array('Label', array('tag' =>'dt'))));
|
|
||||||
$this->addElement($endDate);
|
$this->addElement($endDate);
|
||||||
|
|
||||||
// Add end time element
|
// Add end time element
|
||||||
|
@ -65,10 +61,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
'NotEmpty',
|
'NotEmpty',
|
||||||
array('date', false, array('HH:mm')),
|
array('date', false, array('HH:mm')),
|
||||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array(
|
->setDecorators(array('ViewHelper'));
|
||||||
'ViewHelper',
|
$endTime->setAttrib('alt', 'time');
|
||||||
'Errors',
|
|
||||||
array(array('close'=>'HtmlTag'), array('tag' => 'dd', 'closeOnly'=>true))));
|
|
||||||
$this->addElement($endTime);
|
$this->addElement($endTime);
|
||||||
|
|
||||||
// Add duration element
|
// Add duration element
|
||||||
|
@ -76,30 +70,30 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
'label' => 'Duration:',
|
'label' => 'Duration:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'value' => '01h00m',
|
'value' => '01h00m',
|
||||||
'readonly' => true
|
'readonly' => true,
|
||||||
|
'decorators' => array('ViewHelper')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add repeats element
|
// Add repeats element
|
||||||
$this->addElement('checkbox', 'add_show_repeats', array(
|
$this->addElement('checkbox', 'add_show_repeats', array(
|
||||||
'label' => 'Repeats?',
|
'label' => 'Repeats?',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
'decorators' => array('ViewHelper')
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData, $startDateModified) {
|
public function checkReliantFields($formData, $startDateModified) {
|
||||||
|
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
$now_timestamp = date("Y-m-d H:i:s");
|
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
||||||
$start_timestamp = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
|
||||||
|
|
||||||
$now_epoch = strtotime($now_timestamp);
|
|
||||||
$start_epoch = strtotime($start_timestamp);
|
|
||||||
|
|
||||||
|
//DateTime stores $start_time in the current timezone
|
||||||
|
$nowDateTime = new DateTime();
|
||||||
|
$showStartDateTime = new DateTime($start_time);
|
||||||
|
|
||||||
if ((($formData['add_show_id'] != -1) && $startDateModified) || ($formData['add_show_id'] == -1)){
|
if ((($formData['add_show_id'] != -1) && $startDateModified) || ($formData['add_show_id'] == -1)){
|
||||||
if($start_epoch < $now_epoch) {
|
if($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
||||||
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
@ -118,6 +112,5 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
|
||||||
return $valid;
|
return $valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
$hosts = User::getHosts();
|
$hosts = Application_Model_User::getHosts();
|
||||||
|
|
||||||
foreach ($hosts as $host) {
|
foreach ($hosts as $host) {
|
||||||
$options[$host['value']] = $host['label'];
|
$options[$host['value']] = $host['label'];
|
||||||
|
|
|
@ -34,7 +34,6 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
$firstName = new Zend_Form_Element_Text('first_name');
|
$firstName = new Zend_Form_Element_Text('first_name');
|
||||||
$firstName->setLabel('Firstname:');
|
$firstName->setLabel('Firstname:');
|
||||||
$firstName->setAttrib('class', 'input_text');
|
$firstName->setAttrib('class', 'input_text');
|
||||||
$firstName->setRequired(true);
|
|
||||||
$firstName->addFilter('StringTrim');
|
$firstName->addFilter('StringTrim');
|
||||||
$firstName->addValidator('NotEmpty');
|
$firstName->addValidator('NotEmpty');
|
||||||
$this->addElement($firstName);
|
$this->addElement($firstName);
|
||||||
|
@ -42,7 +41,6 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
$lastName = new Zend_Form_Element_Text('last_name');
|
$lastName = new Zend_Form_Element_Text('last_name');
|
||||||
$lastName->setLabel('Lastname:');
|
$lastName->setLabel('Lastname:');
|
||||||
$lastName->setAttrib('class', 'input_text');
|
$lastName->setAttrib('class', 'input_text');
|
||||||
$lastName->setRequired(true);
|
|
||||||
$lastName->addFilter('StringTrim');
|
$lastName->addFilter('StringTrim');
|
||||||
$lastName->addValidator('NotEmpty');
|
$lastName->addValidator('NotEmpty');
|
||||||
$this->addElement($lastName);
|
$this->addElement($lastName);
|
||||||
|
|
|
@ -29,21 +29,15 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
// Add title field
|
// Add title field
|
||||||
$this->addElement('text', 'track_title', array(
|
$this->addElement('text', 'track_title', array(
|
||||||
'label' => 'Title:',
|
'label' => 'Title:',
|
||||||
'required' => true,
|
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
|
||||||
'NotEmpty',
|
|
||||||
)
|
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add artist field
|
// Add artist field
|
||||||
$this->addElement('text', 'artist_name', array(
|
$this->addElement('text', 'artist_name', array(
|
||||||
'label' => 'Artist:',
|
'label' => 'Artist:',
|
||||||
'required' => true,
|
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array('NotEmpty')
|
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add album field
|
// Add album field
|
||||||
|
|
|
@ -58,8 +58,59 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
$third_party_api->setDecorators(array('ViewHelper'));
|
$third_party_api->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($third_party_api);
|
$this->addElement($third_party_api);
|
||||||
|
|
||||||
|
/* Form Element for setting the Timezone */
|
||||||
|
$timezone = new Zend_Form_Element_Select("timezone");
|
||||||
|
$timezone->setLabel("Timezone");
|
||||||
|
$timezone->setMultiOptions($this->getTimezones());
|
||||||
|
$timezone->setValue(Application_Model_Preference::GetTimezone());
|
||||||
|
$timezone->setDecorators(array('ViewHelper'));
|
||||||
|
$this->addElement($timezone);
|
||||||
|
|
||||||
|
/* Form Element for setting which day is the start of the week */
|
||||||
|
$week_start_day = new Zend_Form_Element_Select("weekStartDay");
|
||||||
|
$week_start_day->setLabel("Week Starts On");
|
||||||
|
$week_start_day->setMultiOptions($this->getWeekStartDays());
|
||||||
|
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
|
||||||
|
$week_start_day->setDecorators(array('ViewHelper'));
|
||||||
|
$this->addElement($week_start_day);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getTimezones(){
|
||||||
|
$regions = array(
|
||||||
|
'Africa' => DateTimeZone::AFRICA,
|
||||||
|
'America' => DateTimeZone::AMERICA,
|
||||||
|
'Antarctica' => DateTimeZone::ANTARCTICA,
|
||||||
|
'Asia' => DateTimeZone::ASIA,
|
||||||
|
'Atlantic' => DateTimeZone::ATLANTIC,
|
||||||
|
'Europe' => DateTimeZone::EUROPE,
|
||||||
|
'Indian' => DateTimeZone::INDIAN,
|
||||||
|
'Pacific' => DateTimeZone::PACIFIC
|
||||||
|
);
|
||||||
|
|
||||||
|
$tzlist = array();
|
||||||
|
|
||||||
|
foreach ($regions as $name => $mask){
|
||||||
|
$ids = DateTimeZone::listIdentifiers($mask);
|
||||||
|
foreach ($ids as $id){
|
||||||
|
$tzlist[$id] = str_replace("_", " ", $id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tzlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function getWeekStartDays() {
|
||||||
|
$days = array(
|
||||||
|
'Sunday',
|
||||||
|
'Monday',
|
||||||
|
'Tuesday',
|
||||||
|
'Wednesday',
|
||||||
|
'Thursday',
|
||||||
|
'Friday',
|
||||||
|
'Saturday'
|
||||||
|
);
|
||||||
|
return $days;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,15 +30,43 @@ class Application_Form_Login extends Zend_Form
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$recaptchaNeeded = false;
|
||||||
|
if(Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3){
|
||||||
|
$recaptchaNeeded = true;
|
||||||
|
}
|
||||||
|
if($recaptchaNeeded){
|
||||||
|
// recaptcha
|
||||||
|
$this->addRecaptcha();
|
||||||
|
}
|
||||||
|
|
||||||
// Add the submit button
|
// Add the submit button
|
||||||
$this->addElement('submit', 'submit', array(
|
$this->addElement('submit', 'submit', array(
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
'label' => 'Login',
|
'label' => 'Login',
|
||||||
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only'
|
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center'
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addRecaptcha(){
|
||||||
|
$pubKey = '6Ld4JsISAAAAAIxUKT4IjjOGi3DHqdoH2zk6WkYG';
|
||||||
|
$privKey = '6Ld4JsISAAAAAJynYlXdrE4hfTReTSxYFe5szdyv';
|
||||||
|
|
||||||
|
$recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey);
|
||||||
|
|
||||||
|
$captcha = new Zend_Form_Element_Captcha('captcha',
|
||||||
|
array(
|
||||||
|
'label' => 'Type the characters you see in the picture below.',
|
||||||
|
'captcha' => 'ReCaptcha',
|
||||||
|
'captchaOptions' => array(
|
||||||
|
'captcha' => 'ReCaptcha',
|
||||||
|
'service' => $recaptcha
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->addElement($captcha);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,15 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
$this->setAction('/Nowplaying');
|
$this->setAction('/Nowplaying');
|
||||||
$this->setMethod('post');
|
$this->setMethod('post');
|
||||||
|
|
||||||
$country_list = Application_Model_Preference::GetCountryList();
|
$country_list = Application_Model_Preference::GetCountryList();
|
||||||
|
|
||||||
|
$privacyChecked = false;
|
||||||
|
if(Application_Model_Preference::GetPrivacyPolicyCheck() == 1){
|
||||||
|
$privacyChecked = true;
|
||||||
|
}
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml')),
|
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml', 'privacyChecked'=>$privacyChecked)),
|
||||||
array('File', array('viewScript' => 'form/register-dialog.phtml', 'placement' => false)))
|
array('File', array('viewScript' => 'form/register-dialog.phtml', 'placement' => false)))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -143,5 +148,22 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($checkboxPrivacy);
|
$this->addElement($checkboxPrivacy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// overriding isValid function
|
||||||
|
public function isValid ($data)
|
||||||
|
{
|
||||||
|
$isValid = parent::isValid($data);
|
||||||
|
if($data['Publicise'] != 1){
|
||||||
|
$isValid = true;
|
||||||
|
}
|
||||||
|
if(isset($data["Privacy"])){
|
||||||
|
$checkPrivacy = $this->getElement('Privacy');
|
||||||
|
if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){
|
||||||
|
$checkPrivacy->addError("You have to agree to privacy policy.");
|
||||||
|
$isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $isValid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,33 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
//enable soundcloud uploads
|
//enable soundcloud uploads
|
||||||
$this->addElement('checkbox', 'UseSoundCloud', array(
|
$this->addElement('checkbox', 'UseSoundCloud', array(
|
||||||
'label' => 'Upload Recorded Shows To SoundCloud',
|
'label' => 'Automatically Upload Recorded Shows',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'value' => Application_Model_Preference::GetDoSoundCloudUpload(),
|
'value' => Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud(),
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
//enable soundcloud uploads option
|
||||||
|
$this->addElement('checkbox', 'UploadToSoundcloudOption', array(
|
||||||
|
'label' => 'Enable Soundcloud Upload',
|
||||||
|
'required' => false,
|
||||||
|
'value' => Application_Model_Preference::GetUploadToSoundcloudOption(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
//enable downloadable for soundcloud
|
||||||
|
$this->addElement('checkbox', 'SoundCloudDownloadbleOption', array(
|
||||||
|
'label' => 'Automatically Mark Files "Downloadable" on SoundCloud',
|
||||||
|
'required' => false,
|
||||||
|
'value' => Application_Model_Preference::GetSoundCloudDownloadbleOption(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
//SoundCloud Username
|
//SoundCloud Username
|
||||||
$this->addElement('text', 'SoundCloudUser', array(
|
$this->addElement('text', 'SoundCloudUser', array(
|
||||||
|
|
33
airtime_mvc/application/forms/StreamSetting.php
Normal file
33
airtime_mvc/application/forms/StreamSetting.php
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_StreamSetting extends Zend_Form
|
||||||
|
{
|
||||||
|
private $setting;
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSetting($setting){
|
||||||
|
$this->setting = $setting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function startFrom() {
|
||||||
|
$setting = $this->setting;
|
||||||
|
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
|
||||||
|
$output_sound_device->setLabel('Enabled')
|
||||||
|
->setRequired(false)
|
||||||
|
->setValue(($setting['output_sound_device'] == "true")?1:0)
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if (Application_Model_Preference::GetEnableStreamConf() == "false"){
|
||||||
|
$output_sound_device->setAttrib("readonly", true);
|
||||||
|
}
|
||||||
|
$this->addElement($output_sound_device);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isValid($data){
|
||||||
|
$this->populate(array("output_sound_device"=>$data));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
188
airtime_mvc/application/forms/StreamSettingSubForm.php
Normal file
188
airtime_mvc/application/forms/StreamSettingSubForm.php
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
<?php
|
||||||
|
class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
|
private $prefix;
|
||||||
|
private $setting;
|
||||||
|
private $stream_types;
|
||||||
|
private $stream_bitrates;
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPrefix($prefix){
|
||||||
|
$this->prefix = $prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSetting($setting){
|
||||||
|
$this->setting = $setting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStreamTypes($stream_types){
|
||||||
|
$this->stream_types = $stream_types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStreamBitrates($stream_bitrates){
|
||||||
|
$this->stream_bitrates = $stream_bitrates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function startForm(){
|
||||||
|
$prefix = "s".$this->prefix;
|
||||||
|
$stream_number = $this->prefix;
|
||||||
|
$setting = $this->setting;
|
||||||
|
$stream_types = $this->stream_types;
|
||||||
|
$stream_bitrates = $this->stream_bitrates;
|
||||||
|
|
||||||
|
$this->setIsArray(true);
|
||||||
|
$this->setElementsBelongTo($prefix."_data");
|
||||||
|
|
||||||
|
$disable_all = false;
|
||||||
|
if(Application_Model_Preference::GetEnableStreamConf() == "false"){
|
||||||
|
$disable_all = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$enable = new Zend_Form_Element_Checkbox('enable');
|
||||||
|
$enable->setLabel('Enabled:')
|
||||||
|
->setValue($setting[$prefix.'_output'] != 'disabled'?1:0)
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$enable->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($enable);
|
||||||
|
|
||||||
|
$type = new Zend_Form_Element_Select('type');
|
||||||
|
$type->setLabel("Stream Type:")
|
||||||
|
->setMultiOptions($stream_types)
|
||||||
|
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$type->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($type);
|
||||||
|
|
||||||
|
$bitrate = new Zend_Form_Element_Select('bitrate');
|
||||||
|
$bitrate->setLabel("Bit Rate:")
|
||||||
|
->setMultiOptions($stream_bitrates)
|
||||||
|
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$bitrate->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($type);
|
||||||
|
$this->addElement($bitrate);
|
||||||
|
|
||||||
|
$output = new Zend_Form_Element_Select('output');
|
||||||
|
$output->setLabel("Service Type:")
|
||||||
|
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"Shoutcast"))
|
||||||
|
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$output->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($output);
|
||||||
|
|
||||||
|
$host = new Zend_Form_Element_Text('host');
|
||||||
|
$host->setLabel("Server")
|
||||||
|
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$host->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($host);
|
||||||
|
|
||||||
|
$port = new Zend_Form_Element_Text('port');
|
||||||
|
$port->setLabel("Port")
|
||||||
|
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
|
||||||
|
->setValidators(array(new Zend_Validate_Between(array('min'=>0, 'max'=>99999))))
|
||||||
|
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$port->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($port);
|
||||||
|
|
||||||
|
$pass = new Zend_Form_Element_Text('pass');
|
||||||
|
$pass->setLabel("Password")
|
||||||
|
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$pass->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($pass);
|
||||||
|
|
||||||
|
$genre = new Zend_Form_Element_Text('genre');
|
||||||
|
$genre->setLabel("Genre")
|
||||||
|
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$genre->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($genre);
|
||||||
|
|
||||||
|
$url = new Zend_Form_Element_Text('url');
|
||||||
|
$url->setLabel("URL")
|
||||||
|
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$url->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($url);
|
||||||
|
|
||||||
|
$description = new Zend_Form_Element_Text('description');
|
||||||
|
$description->setLabel("Name/Description")
|
||||||
|
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$description->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($description);
|
||||||
|
|
||||||
|
$mount = new Zend_Form_Element_Text('mount');
|
||||||
|
$mount->setLabel("Mount Point")
|
||||||
|
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$mount->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($mount);
|
||||||
|
|
||||||
|
$user = new Zend_Form_Element_Text('user');
|
||||||
|
$user->setLabel("Username")
|
||||||
|
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
if($disable_all){
|
||||||
|
$user->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($user);
|
||||||
|
|
||||||
|
$liquidsopa_error_msg = "Getting infomation from the server..";
|
||||||
|
|
||||||
|
$this->setDecorators(array(
|
||||||
|
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "liquidsoap_error_msg"=>$liquidsopa_error_msg))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isValid ($data){
|
||||||
|
$isValid = parent::isValid($data);
|
||||||
|
if($data['enable'] == 1){
|
||||||
|
if($data['host'] == ''){
|
||||||
|
$element = $this->getElement("host");
|
||||||
|
$element->addError("Server cannot be empty.");
|
||||||
|
$isValid = false;
|
||||||
|
}
|
||||||
|
if($data['port'] == ''){
|
||||||
|
$element = $this->getElement("port");
|
||||||
|
$element->addError("Port cannot be empty.");
|
||||||
|
$isValid = false;
|
||||||
|
}
|
||||||
|
if($data['output'] == 'icecast'){
|
||||||
|
if($data['mount'] == ''){
|
||||||
|
$element = $this->getElement("mount");
|
||||||
|
$element->addError("Mount cannot be empty with Icecast server.");
|
||||||
|
$isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $isValid;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$country_list = Application_Model_Preference::GetCountryList();
|
$country_list = Application_Model_Preference::GetCountryList();
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/support-setting.phtml')),
|
array('ViewScript', array('viewScript' => 'form/support-setting.phtml')),
|
||||||
|
@ -105,6 +105,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
'minheight' => 200,
|
'minheight' => 200,
|
||||||
'maxwidth' => 600,
|
'maxwidth' => 600,
|
||||||
'maxheight' => 600));
|
'maxheight' => 600));
|
||||||
|
$upload->setAttrib('accept', 'image/jpeg,image/gif,image/png,image/jpg');
|
||||||
$this->addElement($upload);
|
$this->addElement($upload);
|
||||||
|
|
||||||
//enable support feedback
|
//enable support feedback
|
||||||
|
@ -157,14 +158,19 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
$this->addElement($submit);
|
$this->addElement($submit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// overwriting isValid function
|
// overriding isValid function
|
||||||
public function isValid ($data)
|
public function isValid ($data)
|
||||||
{
|
{
|
||||||
$isValid = parent::isValid($data);
|
$isValid = parent::isValid($data);
|
||||||
$checkPrivacy = $this->getElement('Privacy');
|
if($data['Publicise'] != 1){
|
||||||
if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){
|
$isValid = true;
|
||||||
$checkPrivacy->addError("You have to agree to privacy policy.");
|
}
|
||||||
$isValid = false;
|
if(isset($data["Privacy"])){
|
||||||
|
$checkPrivacy = $this->getElement('Privacy');
|
||||||
|
if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){
|
||||||
|
$checkPrivacy->addError("You have to agree to privacy policy.");
|
||||||
|
$isValid = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $isValid;
|
return $isValid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
$this->addElement('text', 'storageFolder', array(
|
$this->addElement('text', 'storageFolder', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'label' => 'Airtime\'s Storage Folder:',
|
'label' => 'Import Folder:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'value' => '',
|
'value' => '',
|
||||||
|
@ -22,7 +22,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
$this->addElement('text', 'watchedFolder', array(
|
$this->addElement('text', 'watchedFolder', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'label' => 'Choose a Folder to Watch:',
|
'label' => 'Watched Folders:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'value' => '',
|
'value' => '',
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<title>Livestream</title>
|
<title>Livestream</title>
|
||||||
|
<?php echo $this->headScript() ?>
|
||||||
|
<?php echo $this->headLink() ?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="content"><?php echo $this->layout()->content ?></div>
|
<div id="content"><?php echo $this->layout()->content ?></div>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<div id="Panel">
|
<div id="Panel">
|
||||||
<div class="logo"></div>
|
<div class="logo"></div>
|
||||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
|
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?>
|
||||||
|
|
||||||
<?php $partial = array('menu.phtml', 'default');
|
<?php $partial = array('menu.phtml', 'default');
|
||||||
$this->navigation()->menu()->setPartial($partial); ?>
|
$this->navigation()->menu()->setPartial($partial); ?>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<div id="Panel">
|
<div id="Panel">
|
||||||
<div class="logo"></div>
|
<div class="logo"></div>
|
||||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
|
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?>
|
||||||
|
|
||||||
<?php $partial = array('menu.phtml', 'default');
|
<?php $partial = array('menu.phtml', 'default');
|
||||||
$this->navigation()->menu()->setPartial($partial); ?>
|
$this->navigation()->menu()->setPartial($partial); ?>
|
||||||
|
@ -19,7 +19,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded"><?php echo $this->layout()->library ?></div>
|
<!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist-->
|
||||||
|
<div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div>
|
||||||
<div id="side_playlist" class="ui-widget ui-widget-content block-shadow omega-block"><?php echo $this->layout()->spl ?></div>
|
<div id="side_playlist" class="ui-widget ui-widget-content block-shadow omega-block"><?php echo $this->layout()->spl ?></div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -16,4 +16,9 @@ class Logging {
|
||||||
public static function setLogPath($path){
|
public static function setLogPath($path){
|
||||||
self::$_path = $path;
|
self::$_path = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function log($p_msg){
|
||||||
|
$logger = self::getLogger();
|
||||||
|
$logger->info($p_msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ class Application_Model_Dashboard
|
||||||
//after the last item in the schedule table, then return the show's
|
//after the last item in the schedule table, then return the show's
|
||||||
//name. Else return the last item from the schedule.
|
//name. Else return the last item from the schedule.
|
||||||
|
|
||||||
$showInstance = ShowInstance::GetLastShowInstance($p_timeNow);
|
$showInstance = Application_Model_ShowInstance::GetLastShowInstance($p_timeNow);
|
||||||
$row = Schedule::GetLastScheduleItem($p_timeNow);
|
$row = Application_Model_Schedule::GetLastScheduleItem($p_timeNow);
|
||||||
|
|
||||||
if (is_null($showInstance)){
|
if (is_null($showInstance)){
|
||||||
if (count($row) == 0){
|
if (count($row) == 0){
|
||||||
|
@ -53,10 +53,10 @@ class Application_Model_Dashboard
|
||||||
//name. Else return the last item from the schedule.
|
//name. Else return the last item from the schedule.
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
$showInstance = ShowInstance::GetCurrentShowInstance($p_timeNow);
|
$showInstance = Application_Model_ShowInstance::GetCurrentShowInstance($p_timeNow);
|
||||||
if (!is_null($showInstance)){
|
if (!is_null($showInstance)){
|
||||||
$instanceId = $showInstance->getShowInstanceId();
|
$instanceId = $showInstance->getShowInstanceId();
|
||||||
$row = Schedule::GetCurrentScheduleItem($p_timeNow, $instanceId);
|
$row = Application_Model_Schedule::GetCurrentScheduleItem($p_timeNow, $instanceId);
|
||||||
}
|
}
|
||||||
if (is_null($showInstance)){
|
if (is_null($showInstance)){
|
||||||
if (count($row) == 0){
|
if (count($row) == 0){
|
||||||
|
@ -98,8 +98,8 @@ class Application_Model_Dashboard
|
||||||
//after the last item in the schedule table, then return the show's
|
//after the last item in the schedule table, then return the show's
|
||||||
//name. Else return the last item from the schedule.
|
//name. Else return the last item from the schedule.
|
||||||
|
|
||||||
$showInstance = ShowInstance::GetNextShowInstance($p_timeNow);
|
$showInstance = Application_Model_ShowInstance::GetNextShowInstance($p_timeNow);
|
||||||
$row = Schedule::GetNextScheduleItem($p_timeNow);
|
$row = Application_Model_Schedule::GetNextScheduleItem($p_timeNow);
|
||||||
|
|
||||||
if (is_null($showInstance)){
|
if (is_null($showInstance)){
|
||||||
if (count($row) == 0){
|
if (count($row) == 0){
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class DateHelper
|
class Application_Model_DateHelper
|
||||||
{
|
{
|
||||||
private $_timestamp;
|
private $_dateTime;
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->_timestamp = date("U");
|
$this->_dateTime = date("U");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +15,19 @@ class DateHelper
|
||||||
*/
|
*/
|
||||||
function getTimestamp()
|
function getTimestamp()
|
||||||
{
|
{
|
||||||
return date("Y-m-d H:i:s", $this->_timestamp);
|
return date("Y-m-d H:i:s", $this->_dateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get time of object construction in the format
|
||||||
|
* YYYY-MM-DD HH:mm:ss
|
||||||
|
*/
|
||||||
|
function getUtcTimestamp()
|
||||||
|
{
|
||||||
|
$dateTime = new DateTime("@".$this->_dateTime);
|
||||||
|
$dateTime->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
|
||||||
|
return $dateTime->format("Y-m-d H:i:s");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +36,7 @@ class DateHelper
|
||||||
*/
|
*/
|
||||||
function getDate()
|
function getDate()
|
||||||
{
|
{
|
||||||
return date("Y-m-d", $this->_timestamp);
|
return date("Y-m-d", $this->_dateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +45,7 @@ class DateHelper
|
||||||
*/
|
*/
|
||||||
function getTime()
|
function getTime()
|
||||||
{
|
{
|
||||||
return date("H:i:s", $this->_timestamp);
|
return date("H:i:s", $this->_dateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,28 +53,30 @@ class DateHelper
|
||||||
*/
|
*/
|
||||||
function setDate($dateString)
|
function setDate($dateString)
|
||||||
{
|
{
|
||||||
$this->_timestamp = strtotime($dateString);
|
$this->_dateTime = strtotime($dateString);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Find the epoch timestamp difference from "now" to the beginning of today.
|
||||||
* Enter description here ...
|
|
||||||
*/
|
*/
|
||||||
function getNowDayStartDiff()
|
function getNowDayStartDiff()
|
||||||
{
|
{
|
||||||
$dayStartTS = strtotime(date("Y-m-d", $this->_timestamp));
|
$dayStartTs = ((int)($this->_dateTime/86400))*86400;
|
||||||
return $this->_timestamp - $dayStartTS;
|
return $this->_dateTime - $dayStartTs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the epoch timestamp difference from "now" to the end of today.
|
||||||
|
*/
|
||||||
function getNowDayEndDiff()
|
function getNowDayEndDiff()
|
||||||
{
|
{
|
||||||
$dayEndTS = strtotime(date("Y-m-d", $this->_timestamp+(86400)));
|
$dayEndTs = ((int)(($this->_dateTime+86400)/86400))*86400;
|
||||||
return $dayEndTS - $this->_timestamp;
|
return $dayEndTs - $this->_dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEpochTime()
|
function getEpochTime()
|
||||||
{
|
{
|
||||||
return $this->_timestamp;
|
return $this->_dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function TimeDiff($time1, $time2)
|
public static function TimeDiff($time1, $time2)
|
||||||
|
@ -100,31 +114,31 @@ class DateHelper
|
||||||
* format "hh:mm:ss". But when dealing with show times, we
|
* format "hh:mm:ss". But when dealing with show times, we
|
||||||
* do not care about the seconds.
|
* do not care about the seconds.
|
||||||
*
|
*
|
||||||
* @param int $p_timestamp
|
* @param int $p_dateTime
|
||||||
* The value which to format.
|
* The value which to format.
|
||||||
* @return int
|
* @return int
|
||||||
* The timestamp with the new format "hh:mm", or
|
* The timestamp with the new format "hh:mm", or
|
||||||
* the original input parameter, if it does not have
|
* the original input parameter, if it does not have
|
||||||
* the correct format.
|
* the correct format.
|
||||||
*/
|
*/
|
||||||
public static function removeSecondsFromTime($p_timestamp)
|
public static function removeSecondsFromTime($p_dateTime)
|
||||||
{
|
{
|
||||||
//Format is in hh:mm:ss. We want hh:mm
|
//Format is in hh:mm:ss. We want hh:mm
|
||||||
$timeExplode = explode(":", $p_timestamp);
|
$timeExplode = explode(":", $p_dateTime);
|
||||||
|
|
||||||
if (count($timeExplode) == 3)
|
if (count($timeExplode) == 3)
|
||||||
return $timeExplode[0].":".$timeExplode[1];
|
return $timeExplode[0].":".$timeExplode[1];
|
||||||
else
|
else
|
||||||
return $p_timestamp;
|
return $p_dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDateFromTimestamp($p_timestamp){
|
public static function getDateFromTimestamp($p_dateTime){
|
||||||
$explode = explode(" ", $p_timestamp);
|
$explode = explode(" ", $p_dateTime);
|
||||||
return $explode[0];
|
return $explode[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getTimeFromTimestamp($p_timestamp){
|
public static function getTimeFromTimestamp($p_dateTime){
|
||||||
$explode = explode(" ", $p_timestamp);
|
$explode = explode(" ", $p_dateTime);
|
||||||
return $explode[1];
|
return $explode[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,5 +171,33 @@ class DateHelper
|
||||||
|
|
||||||
return $totalSeconds;
|
return $totalSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function ConvertToUtcDateTime($p_dateString, $timezone){
|
||||||
|
$dateTime = new DateTime($p_dateString, new DateTimeZone($timezone));
|
||||||
|
$dateTime->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
|
||||||
|
return $dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function ConvertToSpecificTimezoneDateTime($p_dateString, $timezone){
|
||||||
|
$dateTime = new DateTime($p_dateString, new DateTimeZone("UTC"));
|
||||||
|
$dateTime->setTimezone(new DateTimeZone($timezone));
|
||||||
|
|
||||||
|
return $dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function ConvertToLocalDateTime($p_dateString){
|
||||||
|
$dateTime = new DateTime($p_dateString, new DateTimeZone("UTC"));
|
||||||
|
$dateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
|
return $dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function ConvertToLocalDateTimeString($p_dateString, $format="Y-m-d H:i:s"){
|
||||||
|
$dateTime = new DateTime($p_dateString, new DateTimeZone("UTC"));
|
||||||
|
$dateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
|
return $dateTime->format($format);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
45
airtime_mvc/application/models/LoginAttempts.php
Normal file
45
airtime_mvc/application/models/LoginAttempts.php
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
class Application_Model_LoginAttempts {
|
||||||
|
public function __construct(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function increaseAttempts($ip){
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "select count(*) from cc_login_attempts WHERE ip='$ip'";
|
||||||
|
$res = $CC_DBC->GetOne($sql);
|
||||||
|
if($res){
|
||||||
|
$sql = "UPDATE cc_login_attempts SET attempts=attempts+1 WHERE ip='$ip'";
|
||||||
|
$res = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$sql = "INSERT INTO cc_login_attempts (ip, attempts) values ('$ip', '1')";
|
||||||
|
$res = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAttempts($ip){
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "select attempts from cc_login_attempts WHERE ip='$ip'";
|
||||||
|
$res = $CC_DBC->GetOne($sql);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function resetAttempts($ip){
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "select count(*) from cc_login_attempts WHERE ip='$ip'";
|
||||||
|
$res = $CC_DBC->GetOne($sql);
|
||||||
|
if($res){
|
||||||
|
$sql = "DELETE FROM cc_login_attempts WHERE ip='$ip'";
|
||||||
|
$res = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class NestedDirectoryException extends Exception { }
|
class NestedDirectoryException extends Exception { }
|
||||||
|
|
||||||
class MusicDir {
|
class Application_Model_MusicDir {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @holds propel database object
|
* @holds propel database object
|
||||||
|
@ -54,11 +54,11 @@ class MusicDir {
|
||||||
$this->_dir->delete();
|
$this->_dir->delete();
|
||||||
|
|
||||||
foreach ($show_instances as $show_instance_row) {
|
foreach ($show_instances as $show_instance_row) {
|
||||||
$temp_show = new ShowInstance($show_instance_row["instance_id"]);
|
$temp_show = new Application_Model_ShowInstance($show_instance_row["instance_id"]);
|
||||||
$temp_show->updateScheduledTime();
|
$temp_show->updateScheduledTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -184,7 +184,7 @@ class MusicDir {
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data["directory"] = $p_path;
|
$data["directory"] = $p_path;
|
||||||
RabbitMq::SendMessageToMediaMonitor("new_watch", $data);
|
Application_Model_RabbitMq::SendMessageToMediaMonitor("new_watch", $data);
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ class MusicDir {
|
||||||
{
|
{
|
||||||
$dir = CcMusicDirsQuery::create()->findPK($pk);
|
$dir = CcMusicDirsQuery::create()->findPK($pk);
|
||||||
|
|
||||||
$mus_dir = new MusicDir($dir);
|
$mus_dir = new Application_Model_MusicDir($dir);
|
||||||
|
|
||||||
return $mus_dir;
|
return $mus_dir;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ class MusicDir {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$mus_dir = new MusicDir($dir);
|
$mus_dir = new Application_Model_MusicDir($dir);
|
||||||
return $mus_dir;
|
return $mus_dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,8 +222,7 @@ class MusicDir {
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
foreach($dirs as $dir) {
|
foreach($dirs as $dir) {
|
||||||
$tmp = new MusicDir($dir);
|
$result[] = new Application_Model_MusicDir($dir);
|
||||||
$result[] = $tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -235,7 +234,7 @@ class MusicDir {
|
||||||
->filterByType("stor")
|
->filterByType("stor")
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
$mus_dir = new MusicDir($dir);
|
$mus_dir = new Application_Model_MusicDir($dir);
|
||||||
|
|
||||||
return $mus_dir;
|
return $mus_dir;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +256,7 @@ class MusicDir {
|
||||||
$data = array();
|
$data = array();
|
||||||
$data["directory"] = $p_dir;
|
$data["directory"] = $p_dir;
|
||||||
$data["dir_id"] = $dirId;
|
$data["dir_id"] = $dirId;
|
||||||
RabbitMq::SendMessageToMediaMonitor("change_stor", $data);
|
Application_Model_RabbitMq::SendMessageToMediaMonitor("change_stor", $data);
|
||||||
return array("code"=>0);
|
return array("code"=>0);
|
||||||
}else{
|
}else{
|
||||||
return array("code"=>1, "error"=>"'$p_dir' is already set as the current storage dir or in the watched folders list.");
|
return array("code"=>1, "error"=>"'$p_dir' is already set as the current storage dir or in the watched folders list.");
|
||||||
|
@ -273,7 +272,7 @@ class MusicDir {
|
||||||
foreach($dirs as $dir) {
|
foreach($dirs as $dir) {
|
||||||
$directory = $dir->getDirectory();
|
$directory = $dir->getDirectory();
|
||||||
if (substr($p_filepath, 0, strlen($directory)) === $directory) {
|
if (substr($p_filepath, 0, strlen($directory)) === $directory) {
|
||||||
$mus_dir = new MusicDir($dir);
|
$mus_dir = new Application_Model_MusicDir($dir);
|
||||||
return $mus_dir;
|
return $mus_dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,15 +281,19 @@ class MusicDir {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function removeWatchedDir($p_dir){
|
public static function removeWatchedDir($p_dir){
|
||||||
$p_dir = realpath($p_dir)."/";
|
|
||||||
$dir = MusicDir::getDirByPath($p_dir);
|
$real_path = realpath($p_dir)."/";
|
||||||
|
if($real_path != "/"){
|
||||||
|
$p_dir = $real_path;
|
||||||
|
}
|
||||||
|
$dir = Application_Model_MusicDir::getDirByPath($p_dir);
|
||||||
if($dir == NULL){
|
if($dir == NULL){
|
||||||
return array("code"=>1,"error"=>"'$p_dir' doesn't exist in the watched list.");
|
return array("code"=>1,"error"=>"'$p_dir' doesn't exist in the watched list.");
|
||||||
}else{
|
}else{
|
||||||
$dir->remove();
|
$dir->remove();
|
||||||
$data = array();
|
$data = array();
|
||||||
$data["directory"] = $p_dir;
|
$data["directory"] = $p_dir;
|
||||||
RabbitMq::SendMessageToMediaMonitor("remove_watch", $data);
|
Application_Model_RabbitMq::SendMessageToMediaMonitor("remove_watch", $data);
|
||||||
return array("code"=>0);
|
return array("code"=>0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,21 +3,31 @@
|
||||||
class Application_Model_Nowplaying
|
class Application_Model_Nowplaying
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function CreateHeaderRow($p_showName, $p_showStart, $p_showEnd){
|
private static function CreateHeaderRow($p_showName, $p_showStart, $p_showEnd){
|
||||||
return array("h", "", $p_showStart, $p_showEnd, $p_showName, "", "", "", "", "", "");
|
return array("h", "", $p_showStart, $p_showEnd, $p_showName, "", "", "", "", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function CreateDatatableRows($p_dbRows){
|
private static function CreateDatatableRows($p_dbRows){
|
||||||
$dataTablesRows = array();
|
$dataTablesRows = array();
|
||||||
|
|
||||||
$date = new DateHelper;
|
$epochNow = time();
|
||||||
$timeNow = $date->getTimestamp();
|
|
||||||
|
|
||||||
foreach ($p_dbRows as $dbRow){
|
foreach ($p_dbRows as $dbRow){
|
||||||
|
|
||||||
|
$showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['show_starts']);
|
||||||
|
$showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['show_ends']);
|
||||||
|
$itemStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['item_starts']);
|
||||||
|
$itemEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['item_ends']);
|
||||||
|
|
||||||
|
$showStarts = $showStartDateTime->format("Y-m-d H:i:s");
|
||||||
|
$showEnds = $showEndDateTime->format("Y-m-d H:i:s");
|
||||||
|
$itemStarts = $itemStartDateTime->format("Y-m-d H:i:s");
|
||||||
|
$itemEnds = $itemEndDateTime->format("Y-m-d H:i:s");
|
||||||
|
|
||||||
$status = ($dbRow['show_ends'] < $dbRow['item_ends']) ? "x" : "";
|
$status = ($dbRow['show_ends'] < $dbRow['item_ends']) ? "x" : "";
|
||||||
|
|
||||||
$type = "a";
|
$type = "a";
|
||||||
$type .= ($dbRow['item_ends'] > $timeNow && $dbRow['item_starts'] <= $timeNow) ? "c" : "";
|
$type .= ($itemEndDateTime->getTimestamp() > $epochNow && $itemStartDateTime->getTimestamp() <= $epochNow) ? "c" : "";
|
||||||
|
|
||||||
// remove millisecond from the time format
|
// remove millisecond from the time format
|
||||||
$itemStart = explode('.', $dbRow['item_starts']);
|
$itemStart = explode('.', $dbRow['item_starts']);
|
||||||
|
@ -25,36 +35,36 @@ class Application_Model_Nowplaying
|
||||||
|
|
||||||
//format duration
|
//format duration
|
||||||
$duration = explode('.', $dbRow['clip_length']);
|
$duration = explode('.', $dbRow['clip_length']);
|
||||||
$formated = Application_Model_Nowplaying::FormatDuration($duration[0]);
|
$formatted = self::FormatDuration($duration[0]);
|
||||||
$dataTablesRows[] = array($type, $dbRow['show_starts'], $itemStart[0], $itemEnd[0],
|
$dataTablesRows[] = array($type, $showStarts, $itemStarts, $itemEnds,
|
||||||
$formated, $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'],
|
$formatted, $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'],
|
||||||
$dbRow['playlist_name'], $dbRow['show_name'], $status);
|
$dbRow['playlist_name'], $dbRow['show_name'], $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $dataTablesRows;
|
return $dataTablesRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function CreateGapRow($p_gapTime){
|
private static function CreateGapRow($p_gapTime){
|
||||||
return array("g", "", "", "", $p_gapTime, "", "", "", "", "", "");
|
return array("g", "", "", "", $p_gapTime, "", "", "", "", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function CreateRecordingRow($p_showInstance){
|
private static function CreateRecordingRow($p_showInstance){
|
||||||
return array("r", "", "", "", $p_showInstance->getName(), "", "", "", "", "", "");
|
return array("r", "", "", "", $p_showInstance->getName(), "", "", "", "", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetDataGridData($viewType, $dateString){
|
public static function GetDataGridData($viewType, $dateString){
|
||||||
|
|
||||||
if ($viewType == "now"){
|
if ($viewType == "now"){
|
||||||
$date = new DateHelper;
|
$dateTime = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
$timeNow = $date->getTimestamp();
|
$timeNow = $dateTime->format("Y-m-d H:i:s");
|
||||||
|
|
||||||
$startCutoff = 60;
|
$startCutoff = 60;
|
||||||
$endCutoff = 86400; //60*60*24 - seconds in a day
|
$endCutoff = 86400; //60*60*24 - seconds in a day
|
||||||
} else {
|
} else {
|
||||||
$date = new DateHelper;
|
$date = new Application_Model_DateHelper;
|
||||||
$time = $date->getTime();
|
$time = $date->getTime();
|
||||||
$date->setDate($dateString." ".$time);
|
$date->setDate($dateString." ".$time);
|
||||||
$timeNow = $date->getTimestamp();
|
$timeNow = $date->getUtcTimestamp();
|
||||||
|
|
||||||
$startCutoff = $date->getNowDayStartDiff();
|
$startCutoff = $date->getNowDayStartDiff();
|
||||||
$endCutoff = $date->getNowDayEndDiff();
|
$endCutoff = $date->getNowDayEndDiff();
|
||||||
|
@ -62,33 +72,36 @@ class Application_Model_Nowplaying
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
$showIds = ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff);
|
$showIds = Application_Model_ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff);
|
||||||
foreach ($showIds as $showId){
|
foreach ($showIds as $showId){
|
||||||
$instanceId = $showId['id'];
|
$instanceId = $showId['id'];
|
||||||
|
|
||||||
$si = new ShowInstance($instanceId);
|
$si = new Application_Model_ShowInstance($instanceId);
|
||||||
|
|
||||||
$showId = $si->getShowId();
|
$showId = $si->getShowId();
|
||||||
$show = new Show($showId);
|
$show = new Application_Model_Show($showId);
|
||||||
|
|
||||||
|
$showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowStart());
|
||||||
|
$showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowEnd());
|
||||||
|
|
||||||
//append show header row
|
//append show header row
|
||||||
$data[] = Application_Model_Nowplaying::CreateHeaderRow($show->getName(), $si->getShowStart(), $si->getShowEnd());
|
$data[] = self::CreateHeaderRow($show->getName(), $showStartDateTime->format("Y-m-d H:i:s"), $showEndDateTime->format("Y-m-d H:i:s"));
|
||||||
|
|
||||||
$scheduledItems = $si->getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff);
|
$scheduledItems = $si->getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff);
|
||||||
$dataTablesRows = Application_Model_Nowplaying::CreateDatatableRows($scheduledItems);
|
$dataTablesRows = self::CreateDatatableRows($scheduledItems);
|
||||||
|
|
||||||
//append show audio item rows
|
//append show audio item rows
|
||||||
$data = array_merge($data, $dataTablesRows);
|
$data = array_merge($data, $dataTablesRows);
|
||||||
|
|
||||||
//append show gap time row
|
//append show gap time row
|
||||||
$gapTime = Application_Model_Nowplaying::FormatDuration($si->getShowEndGapTime(), true);
|
$gapTime = self::FormatDuration($si->getShowEndGapTime(), true);
|
||||||
if ($si->isRecorded())
|
if ($si->isRecorded())
|
||||||
$data[] = Application_Model_Nowplaying::CreateRecordingRow($si);
|
$data[] = self::CreateRecordingRow($si);
|
||||||
else if ($gapTime > 0)
|
else if ($gapTime > 0)
|
||||||
$data[] = Application_Model_Nowplaying::CreateGapRow($gapTime);
|
$data[] = self::CreateGapRow($gapTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array("currentShow"=>Show_DAL::GetCurrentShow($timeNow), "rows"=>$data);
|
return array("currentShow"=>Application_Model_Show::GetCurrentShow($timeNow), "rows"=>$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function ShouldShowPopUp(){
|
public static function ShouldShowPopUp(){
|
||||||
|
@ -102,7 +115,7 @@ class Application_Model_Nowplaying
|
||||||
* default $time format should be in format of 00:00:00
|
* default $time format should be in format of 00:00:00
|
||||||
* if $inSecond = true, then $time should be in seconds
|
* if $inSecond = true, then $time should be in seconds
|
||||||
*/
|
*/
|
||||||
public static function FormatDuration($time, $inSecond=false){
|
private static function FormatDuration($time, $inSecond=false){
|
||||||
if($inSecond == false){
|
if($inSecond == false){
|
||||||
$duration = explode(':', $time);
|
$duration = explode(':', $time);
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -9,7 +9,7 @@ define('INDCH', ' ');
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
* @copyright 2010 Sourcefabric O.P.S.
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
*/
|
*/
|
||||||
class Playlist {
|
class Application_Model_Playlist {
|
||||||
|
|
||||||
// *** Variable stored in the database ***
|
// *** Variable stored in the database ***
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class Playlist {
|
||||||
if($pl === NULL)
|
if($pl === NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$storedPlaylist = new Playlist();
|
$storedPlaylist = new Application_Model_Playlist();
|
||||||
$storedPlaylist->id = $id;
|
$storedPlaylist->id = $id;
|
||||||
$storedPlaylist->name = $pl->getDbName();
|
$storedPlaylist->name = $pl->getDbName();
|
||||||
$storedPlaylist->state = $pl->getDbState();
|
$storedPlaylist->state = $pl->getDbState();
|
||||||
|
@ -187,7 +187,7 @@ class Playlist {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$pl->setDbName($p_newname);
|
$pl->setDbName($p_newname);
|
||||||
$pl->setDbMtime(new DateTime("now"));
|
$pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||||
$pl->save();
|
$pl->save();
|
||||||
|
|
||||||
$this->name = $p_newname;
|
$this->name = $p_newname;
|
||||||
|
@ -221,7 +221,7 @@ class Playlist {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$pl->setDbDescription($p_description);
|
$pl->setDbDescription($p_description);
|
||||||
$pl->setDbMtime(new DateTime("now"));
|
$pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||||
$pl->save();
|
$pl->save();
|
||||||
|
|
||||||
//$this->name = $p_newname;
|
//$this->name = $p_newname;
|
||||||
|
@ -254,7 +254,7 @@ class Playlist {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$pl->setDbState($p_state);
|
$pl->setDbState($p_state);
|
||||||
$pl->setDbMtime(new DateTime("now"));
|
$pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||||
|
|
||||||
$eb = (!is_null($p_editedby) ? $p_editedby : NULL);
|
$eb = (!is_null($p_editedby) ? $p_editedby : NULL);
|
||||||
$pl->setDbEditedby($eb);
|
$pl->setDbEditedby($eb);
|
||||||
|
@ -405,10 +405,10 @@ class Playlist {
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$files[$i] = $row->toArray(BasePeer::TYPE_FIELDNAME, true, true);
|
$files[$i] = $row->toArray(BasePeer::TYPE_FIELDNAME, true, true);
|
||||||
// display only upto 1 decimal place by calling secondsToPlaylistTime
|
// display only upto 1 decimal place by calling secondsToPlaylistTime
|
||||||
$clipSec = Playlist::playlistTimeToSeconds($files[$i]['cliplength']);
|
$clipSec = Application_Model_Playlist::playlistTimeToSeconds($files[$i]['cliplength']);
|
||||||
$files[$i]['cliplength'] = Playlist::secondsToPlaylistTime($clipSec);
|
$files[$i]['cliplength'] = Application_Model_Playlist::secondsToPlaylistTime($clipSec);
|
||||||
$offset += $clipSec;
|
$offset += $clipSec;
|
||||||
$files[$i]['offset'] = Playlist::secondsToPlaylistTime($offset);
|
$files[$i]['offset'] = Application_Model_Playlist::secondsToPlaylistTime($offset);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,8 +424,8 @@ class Playlist {
|
||||||
return '00:00:00';
|
return '00:00:00';
|
||||||
|
|
||||||
// calling two functions to format time to 1 decimal place
|
// calling two functions to format time to 1 decimal place
|
||||||
$sec = Playlist::playlistTimeToSeconds($res);
|
$sec = Application_Model_Playlist::playlistTimeToSeconds($res);
|
||||||
$res = Playlist::secondsToPlaylistTime($sec);
|
$res = Application_Model_Playlist::secondsToPlaylistTime($sec);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,12 +439,11 @@ class Playlist {
|
||||||
public function create($p_fname=NULL)
|
public function create($p_fname=NULL)
|
||||||
{
|
{
|
||||||
$this->name = !empty($p_fname) ? $p_fname : date("H:i:s");
|
$this->name = !empty($p_fname) ? $p_fname : date("H:i:s");
|
||||||
$this->mtime = new DateTime("now");
|
|
||||||
|
|
||||||
$pl = new CcPlaylist();
|
$pl = new CcPlaylist();
|
||||||
$pl->setDbName($this->name);
|
$pl->setDbName($this->name);
|
||||||
$pl->setDbState("incomplete");
|
$pl->setDbState("incomplete");
|
||||||
$pl->setDbMtime($this->mtime);
|
$pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
$pl->save();
|
$pl->save();
|
||||||
|
|
||||||
$this->id = $pl->getDbId();
|
$this->id = $pl->getDbId();
|
||||||
|
@ -467,7 +466,7 @@ class Playlist {
|
||||||
{
|
{
|
||||||
if ($val && $this->isEdited() !== FALSE) {
|
if ($val && $this->isEdited() !== FALSE) {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
'Playlist::lock: playlist already locked'
|
'Application_Model_Playlist::lock: playlist already locked'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$r = $this->setEditFlag($subjid, $val);
|
$r = $this->setEditFlag($subjid, $val);
|
||||||
|
@ -508,7 +507,7 @@ class Playlist {
|
||||||
public function addAudioClip($p_mediaId, $p_position=NULL, $p_fadeIn=NULL, $p_fadeOut=NULL, $p_clipLength=NULL, $p_cuein=NULL, $p_cueout=NULL)
|
public function addAudioClip($p_mediaId, $p_position=NULL, $p_fadeIn=NULL, $p_fadeOut=NULL, $p_clipLength=NULL, $p_cuein=NULL, $p_cueout=NULL)
|
||||||
{
|
{
|
||||||
//get audio clip.
|
//get audio clip.
|
||||||
$media = StoredFile::Recall($p_mediaId);
|
$media = Application_Model_StoredFile::Recall($p_mediaId);
|
||||||
if (is_null($media) || PEAR::isError($media)) {
|
if (is_null($media) || PEAR::isError($media)) {
|
||||||
return $media;
|
return $media;
|
||||||
}
|
}
|
||||||
|
@ -1000,430 +999,3 @@ class Playlist {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // class Playlist
|
} // class Playlist
|
||||||
|
|
||||||
/**
|
|
||||||
* @package Airtime
|
|
||||||
* @subpackage StorageServer
|
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
|
||||||
* @todo Rename this class PlaylistTag
|
|
||||||
*/
|
|
||||||
class PlaylistTagExport
|
|
||||||
{
|
|
||||||
public static function OutputToSmil(&$pl, $plt, $ind='')
|
|
||||||
{
|
|
||||||
$ind2 = $ind.INDCH;
|
|
||||||
$ind3 = $ind2.INDCH;
|
|
||||||
$ind4 = $ind3.INDCH;
|
|
||||||
$res = "";
|
|
||||||
foreach ($plt['children'] as $ple) {
|
|
||||||
switch ($ple['elementname']) {
|
|
||||||
case "playlistElement":
|
|
||||||
$r = PlaylistElementExport::OutputToSmil($pl, $ple, $ind4);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$res .= $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "metadata":
|
|
||||||
$r = PlaylistMetadataExport::OutputToSmil($pl, $ple, $ind4);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$res .= $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$res = "$ind<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n".
|
|
||||||
"$ind<smil xmlns=\"http://www.w3.org/2001/SMIL20/Language\">\n".
|
|
||||||
"$ind2<body>\n".
|
|
||||||
"$ind3<par>\n".
|
|
||||||
"$res".
|
|
||||||
"$ind3</par>\n".
|
|
||||||
"$ind2</body>\n".
|
|
||||||
"$ind</smil>\n";
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function OutputToM3u(&$pl, $plt, $ind='')
|
|
||||||
{
|
|
||||||
$res = "";
|
|
||||||
foreach ($plt['children'] as $ple) {
|
|
||||||
switch ($ple['elementname']) {
|
|
||||||
case"playlistElement":
|
|
||||||
$r = PlaylistElementExport::OutputToM3u($pl, $ple);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$res .= $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$res = "#EXTM3U\n$res";
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function OutputToRss(&$pl, $plt, $ind='')
|
|
||||||
{
|
|
||||||
$ind2 = $ind.INDCH;
|
|
||||||
$ind3 = $ind2.INDCH;
|
|
||||||
$res = "";
|
|
||||||
foreach ($plt['children'] as $ple) {
|
|
||||||
switch ($ple['elementname']) {
|
|
||||||
case "playlistElement":
|
|
||||||
$r = PlaylistElementExport::OutputToRss($pl, $ple, $ind3);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$res .= $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "metadata":
|
|
||||||
$r = PlaylistMetadataExport::OutputToRss($pl, $ple, $ind3);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$res .= $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$res = "$ind<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n".
|
|
||||||
"$ind<rss version=\"2.0\">\n".
|
|
||||||
"$ind2<channel>\n".
|
|
||||||
"$res".
|
|
||||||
"$ind2</channel>\n".
|
|
||||||
"$ind</rss>\n";
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @package Airtime
|
|
||||||
* @subpackage StorageServer
|
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
|
||||||
* @todo Rename this class "PlaylistElement"
|
|
||||||
*/
|
|
||||||
class PlaylistElementExport {
|
|
||||||
|
|
||||||
public static function OutputToSmil(&$pl, $ple, $ind='')
|
|
||||||
{
|
|
||||||
$acOrPl = NULL;
|
|
||||||
$finfo = array('fi'=>0, 'fo'=>0);
|
|
||||||
$ind2 = $ind.INDCH;
|
|
||||||
$ind3 = $ind2.INDCH;
|
|
||||||
$anim = '';
|
|
||||||
foreach ($ple['children'] as $ac) {
|
|
||||||
switch ($ac['elementname']) {
|
|
||||||
case "audioClip":
|
|
||||||
$r = PlaylistAudioClipExport::OutputToSmil($pl, $ac, $ind2);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$acOrPl = $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "playlist":
|
|
||||||
$gunid = $ac['attrs']['id'];
|
|
||||||
$pl2 = StoredFile::RecallByGunid($gunid);
|
|
||||||
if (is_null($pl2) || PEAR::isError($pl2)) {
|
|
||||||
return $pl2;
|
|
||||||
}
|
|
||||||
$r = $pl2->outputToSmil(FALSE);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$acOrPl = $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "fadeInfo":
|
|
||||||
$r = PlaylistFadeInfoExport::OutputToSmil($pl, $ac, $ind2);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$finfo = $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return PEAR::raiseError(
|
|
||||||
"PlaylistElementExport::OutputToSmil:".
|
|
||||||
" unknown tag {$ac['elementname']}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$beginS = Playlist::playlistTimeToSeconds($ple['attrs']['relativeOffset']);
|
|
||||||
$playlengthS = Playlist::playlistTimeToSeconds($acOrPl['playlength']);
|
|
||||||
$fadeOutS = Playlist::playlistTimeToSeconds($finfo['fo']);
|
|
||||||
$fiBeginS = 0;
|
|
||||||
$fiEndS = Playlist::playlistTimeToSeconds($finfo['fi']);
|
|
||||||
$foBeginS = ($playlengthS - $fadeOutS);
|
|
||||||
$foEndS = Playlist::playlistTimeToSeconds($acOrPl['playlength']);
|
|
||||||
foreach (array('fi','fo') as $ff) {
|
|
||||||
if (${$ff."EndS"} - ${$ff."BeginS"} > 0) {
|
|
||||||
$anim .= "{$ind2}<animate attributeName = \"soundLevel\"\n".
|
|
||||||
"{$ind3}from = \"".($ff == 'fi' ? 0 : 100)."%\"\n".
|
|
||||||
"{$ind3}to = \"".($ff == 'fi' ? 100 : 0)."%\"\n".
|
|
||||||
"{$ind3}calcMode = \"linear\"\n".
|
|
||||||
"{$ind3}begin = \"{${$ff."BeginS"}}s\"\n".
|
|
||||||
"{$ind3}end = \"{${$ff."EndS"}}s\"\n".
|
|
||||||
"{$ind3}fill = \"freeze\"\n".
|
|
||||||
"{$ind2}/>\n"
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$src = $acOrPl['src'];
|
|
||||||
$str = "$ind<audio src=\"$src\" begin=\"{$beginS}s\"".
|
|
||||||
($anim ? ">\n$anim$ind</audio>" : " />").
|
|
||||||
" <!-- {$acOrPl['type']}, {$acOrPl['gunid']}, {$acOrPl['playlength']} -->".
|
|
||||||
"\n";
|
|
||||||
return $str;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function OutputToM3u(&$pl, $ple, $ind='')
|
|
||||||
{
|
|
||||||
$acOrPl = NULL;
|
|
||||||
foreach ($ple['children'] as $ac) {
|
|
||||||
switch ($ac['elementname']) {
|
|
||||||
case "audioClip":
|
|
||||||
$r = PlaylistAudioClipExport::OutputToM3u($pl, $ac);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$acOrPl = $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "playlist":
|
|
||||||
$gunid = $ac['attrs']['id'];
|
|
||||||
$pl2 = StoredFile::RecallByGunid($gunid);
|
|
||||||
if (is_null($pl2) || PEAR::isError($pl2)) {
|
|
||||||
return $pl2;
|
|
||||||
}
|
|
||||||
$r = $pl2->outputToM3u(FALSE);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$acOrPl = $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (is_null($acOrPl)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
$playlength = ceil(Playlist::playlistTimeToSeconds($acOrPl['playlength']));
|
|
||||||
$title = $acOrPl['title'];
|
|
||||||
$uri = (isset($acOrPl['uri']) ? $acOrPl['uri'] : '???' );
|
|
||||||
$res = "#EXTINF: $playlength, $title\n";
|
|
||||||
$res .= "$uri\n";
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function OutputToRss(&$pl, $ple, $ind='')
|
|
||||||
{
|
|
||||||
$acOrPl = NULL;
|
|
||||||
$ind2 = $ind.INDCH;
|
|
||||||
$anim = '';
|
|
||||||
foreach ($ple['children'] as $ac) {
|
|
||||||
switch ($ac['elementname']) {
|
|
||||||
case "audioClip":
|
|
||||||
$r = PlaylistAudioClipExport::OutputToRss($pl, $ac, $ind2);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$acOrPl = $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "playlist":
|
|
||||||
$gunid = $ac['attrs']['id'];
|
|
||||||
$pl2 = StoredFile::RecallByGunid($gunid);
|
|
||||||
if (is_null($pl2) || PEAR::isError($pl2)) {
|
|
||||||
return $pl2;
|
|
||||||
}
|
|
||||||
$r = $pl2->outputToRss(FALSE);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
if (!is_null($r)) {
|
|
||||||
$acOrPl = $r;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "fadeInfo":
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return PEAR::raiseError(
|
|
||||||
"PlaylistElementExport::OutputToRss:".
|
|
||||||
" unknown tag {$ac['elementname']}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$title = (isset($acOrPl['title']) ? htmlspecialchars($acOrPl['title']) : '' );
|
|
||||||
$desc = (isset($acOrPl['desc']) ? htmlspecialchars($acOrPl['desc']) : '' );
|
|
||||||
$link = htmlspecialchars($acOrPl['src']);
|
|
||||||
$desc = '';
|
|
||||||
$str = "$ind<item>\n".
|
|
||||||
"$ind2<title>$title</title>\n".
|
|
||||||
"$ind2<description>$desc</description>\n".
|
|
||||||
"$ind2<link>$link</link>\n".
|
|
||||||
"$ind</item>\n";
|
|
||||||
return $str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @package Airtime
|
|
||||||
* @subpackage StorageServer
|
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
|
||||||
* @todo Rename this class to PlaylistAudioClip (notice the caps)
|
|
||||||
*/
|
|
||||||
class PlaylistAudioClipExport
|
|
||||||
{
|
|
||||||
|
|
||||||
public static function OutputToSmil(&$pl, $plac, $ind='')
|
|
||||||
{
|
|
||||||
$gunid = $plac['attrs']['id'];
|
|
||||||
$ac = StoredFile::RecallByGunid($gunid);
|
|
||||||
if (is_null($ac) || PEAR::isError($ac)) {
|
|
||||||
return $ac;
|
|
||||||
}
|
|
||||||
$RADext = $ac->getFileExtension();
|
|
||||||
if (PEAR::isError($RADext)) {
|
|
||||||
return $RADext;
|
|
||||||
}
|
|
||||||
return array(
|
|
||||||
'type' => 'audioclip',
|
|
||||||
'gunid' => $gunid,
|
|
||||||
'src' => AC_URL_RELPATH."$gunid.$RADext",
|
|
||||||
'playlength' => $plac['attrs']['playlength'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function OutputToM3u(&$pl, $plac, $ind='')
|
|
||||||
{
|
|
||||||
$gunid = $plac['attrs']['id'];
|
|
||||||
$ac = StoredFile::RecallByGunid($gunid);
|
|
||||||
if (is_null($ac) || PEAR::isError($ac)) {
|
|
||||||
return $ac;
|
|
||||||
}
|
|
||||||
$RADext = $ac->getFileExtension();
|
|
||||||
if (PEAR::isError($RADext)) {
|
|
||||||
return $RADext;
|
|
||||||
}
|
|
||||||
return array(
|
|
||||||
'playlength' => $plac['attrs']['playlength'],
|
|
||||||
'title' => $plac['attrs']['title'],
|
|
||||||
'uri' => AC_URL_RELPATH."$gunid.$RADext",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function OutputToRss(&$pl, $plac, $ind='')
|
|
||||||
{
|
|
||||||
$id = $plac['attrs']['id'];
|
|
||||||
$playlist = Playlist::Recall($id);
|
|
||||||
if (is_null($playlist) || PEAR::isError($playlist)) {
|
|
||||||
return $playlist;
|
|
||||||
}
|
|
||||||
$RADext = $playlist->getFileExtension();
|
|
||||||
if (PEAR::isError($RADext)) {
|
|
||||||
return $RADext;
|
|
||||||
}
|
|
||||||
$title = $playlist->getName();
|
|
||||||
$desc = $playlist->getPLMetaData("dc:description");
|
|
||||||
return array(
|
|
||||||
'type' => 'audioclip',
|
|
||||||
'gunid' => $id,
|
|
||||||
'src' => "http://XXX/YY/$id.$RADext",
|
|
||||||
'playlength' => $plac['attrs']['playlength'],
|
|
||||||
'title' => $title,
|
|
||||||
'desc' => $desc,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @package Airtime
|
|
||||||
* @subpackage StorageServer
|
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
|
||||||
* @todo Rename this class "PlaylistFadeInfo" (notive the caps)
|
|
||||||
*/
|
|
||||||
class PlaylistFadeInfoExport
|
|
||||||
{
|
|
||||||
|
|
||||||
public static function OutputToSmil(&$pl, $plfi, $ind='')
|
|
||||||
{
|
|
||||||
$r = array(
|
|
||||||
'fi'=>$plfi['attrs']['fadeIn'],
|
|
||||||
'fo'=>$plfi['attrs']['fadeOut'],
|
|
||||||
);
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function OutputToM3u(&$pl, $plfa, $ind='')
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function OutputToRss(&$pl, $plfa, $ind='')
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @package Airtime
|
|
||||||
* @subpackage StorageServer
|
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
|
||||||
* @todo Rename this class to PlaylistMetadata (notice the caps)
|
|
||||||
*/
|
|
||||||
class PlaylistMetadataExport
|
|
||||||
{
|
|
||||||
public static function OutputToSmil(&$pl, $md, $ind='')
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function OutputToM3u(&$pl, $md, $ind='')
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function OutputToRss(&$pl, $md, $ind='')
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
class Application_Model_Preference
|
class Application_Model_Preference
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function SetValue($key, $value){
|
public static function SetValue($key, $value, $isUserValue = false){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
//called from a daemon process
|
//called from a daemon process
|
||||||
|
@ -21,34 +21,58 @@ class Application_Model_Preference
|
||||||
//Check if key already exists
|
//Check if key already exists
|
||||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||||
." WHERE keystr = '$key'";
|
." WHERE keystr = '$key'";
|
||||||
|
|
||||||
|
//For user specific preference, check if id matches as well
|
||||||
|
if($isUserValue) {
|
||||||
|
$sql .= " AND subjid = '$id'";
|
||||||
|
}
|
||||||
|
|
||||||
$result = $CC_DBC->GetOne($sql);
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
if ($result == 1 && is_null($id)){
|
if($result == 1) {
|
||||||
$sql = "UPDATE cc_pref"
|
// result found
|
||||||
." SET subjid = NULL, valstr = '$value'"
|
if(is_null($id) || !$isUserValue) {
|
||||||
." WHERE keystr = '$key'";
|
// system pref
|
||||||
}
|
$sql = "UPDATE cc_pref"
|
||||||
else if ($result == 1 && !is_null($id)){
|
." SET subjid = NULL, valstr = '$value'"
|
||||||
$sql = "UPDATE cc_pref"
|
." WHERE keystr = '$key'";
|
||||||
." SET subjid = $id, valstr = '$value'"
|
} else {
|
||||||
." WHERE keystr = '$key'";
|
// user pref
|
||||||
}
|
$sql = "UPDATE cc_pref"
|
||||||
else if(is_null($id)) {
|
. " SET valstr = '$value'"
|
||||||
$sql = "INSERT INTO cc_pref (keystr, valstr)"
|
. " WHERE keystr = '$key' AND subjid = $id";
|
||||||
." VALUES ('$key', '$value')";
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
// result not found
|
||||||
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
if(is_null($id) || !$isUserValue) {
|
||||||
." VALUES ($id, '$key', '$value')";
|
// system pref
|
||||||
|
$sql = "INSERT INTO cc_pref (keystr, valstr)"
|
||||||
|
." VALUES ('$key', '$value')";
|
||||||
|
} else {
|
||||||
|
// user pref
|
||||||
|
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
||||||
|
." VALUES ($id, '$key', '$value')";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $CC_DBC->query($sql);
|
return $CC_DBC->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetValue($key){
|
public static function GetValue($key, $isUserValue = false){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
//Check if key already exists
|
//Check if key already exists
|
||||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||||
." WHERE keystr = '$key'";
|
." WHERE keystr = '$key'";
|
||||||
|
|
||||||
|
//For user specific preference, check if id matches as well
|
||||||
|
if($isUserValue) {
|
||||||
|
$auth = Zend_Auth::getInstance();
|
||||||
|
if($auth->hasIdentity()) {
|
||||||
|
$id = $auth->getIdentity()->id;
|
||||||
|
$sql .= " AND subjid = '$id'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result = $CC_DBC->GetOne($sql);
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
if ($result == 0)
|
if ($result == 0)
|
||||||
|
@ -56,10 +80,15 @@ class Application_Model_Preference
|
||||||
else {
|
else {
|
||||||
$sql = "SELECT valstr FROM cc_pref"
|
$sql = "SELECT valstr FROM cc_pref"
|
||||||
." WHERE keystr = '$key'";
|
." WHERE keystr = '$key'";
|
||||||
|
|
||||||
|
//For user specific preference, check if id matches as well
|
||||||
|
if($isUserValue && $auth->hasIdentity()) {
|
||||||
|
$sql .= " AND subjid = '$id'";
|
||||||
|
}
|
||||||
|
|
||||||
$result = $CC_DBC->GetOne($sql);
|
$result = $CC_DBC->GetOne($sql);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetHeadTitle(){
|
public static function GetHeadTitle(){
|
||||||
|
@ -69,7 +98,7 @@ class Application_Model_Preference
|
||||||
if (isset($defaultNamespace->title)) {
|
if (isset($defaultNamespace->title)) {
|
||||||
$title = $defaultNamespace->title;
|
$title = $defaultNamespace->title;
|
||||||
} else {
|
} else {
|
||||||
$title = Application_Model_Preference::GetValue("station_name");
|
$title = self::GetValue("station_name");
|
||||||
$defaultNamespace->title = $title;
|
$defaultNamespace->title = $title;
|
||||||
}
|
}
|
||||||
if (strlen($title) > 0)
|
if (strlen($title) > 0)
|
||||||
|
@ -79,109 +108,109 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetHeadTitle($title, $view){
|
public static function SetHeadTitle($title, $view){
|
||||||
Application_Model_Preference::SetValue("station_name", $title);
|
self::SetValue("station_name", $title);
|
||||||
$defaultNamespace = new Zend_Session_Namespace('title_name');
|
$defaultNamespace = new Zend_Session_Namespace('title_name');
|
||||||
$defaultNamespace->title = $title;
|
$defaultNamespace->title = $title;
|
||||||
RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
|
||||||
//set session variable to new station name so that html title is updated.
|
//set session variable to new station name so that html title is updated.
|
||||||
//should probably do this in a view helper to keep this controller as minimal as possible.
|
//should probably do this in a view helper to keep this controller as minimal as possible.
|
||||||
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject
|
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject
|
||||||
$view->headTitle(Application_Model_Preference::GetHeadTitle());
|
$view->headTitle(self::GetHeadTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetShowsPopulatedUntil($timestamp) {
|
public static function SetShowsPopulatedUntil($timestamp) {
|
||||||
Application_Model_Preference::SetValue("shows_populated_until", $timestamp);
|
self::SetValue("shows_populated_until", $timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetShowsPopulatedUntil() {
|
public static function GetShowsPopulatedUntil() {
|
||||||
return Application_Model_Preference::GetValue("shows_populated_until");
|
return self::GetValue("shows_populated_until");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetDefaultFade($fade) {
|
public static function SetDefaultFade($fade) {
|
||||||
Application_Model_Preference::SetValue("default_fade", $fade);
|
self::SetValue("default_fade", $fade);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetDefaultFade() {
|
public static function GetDefaultFade() {
|
||||||
return Application_Model_Preference::GetValue("default_fade");
|
return self::GetValue("default_fade");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStreamLabelFormat($type){
|
public static function SetStreamLabelFormat($type){
|
||||||
Application_Model_Preference::SetValue("stream_label_format", $type);
|
self::SetValue("stream_label_format", $type);
|
||||||
RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStreamLabelFormat(){
|
public static function GetStreamLabelFormat(){
|
||||||
return Application_Model_Preference::getValue("stream_label_format");
|
return self::getValue("stream_label_format");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationName(){
|
public static function GetStationName(){
|
||||||
return Application_Model_Preference::getValue("station_name");
|
return self::getValue("station_name");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetDoSoundCloudUpload($upload) {
|
public static function SetAutoUploadRecordedShowToSoundcloud($upload) {
|
||||||
Application_Model_Preference::SetValue("soundcloud_upload", $upload);
|
self::SetValue("soundcloud_auto_upload_recorded_show", $upload);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetDoSoundCloudUpload() {
|
public static function GetAutoUploadRecordedShowToSoundcloud() {
|
||||||
return Application_Model_Preference::GetValue("soundcloud_upload");
|
return self::GetValue("soundcloud_auto_upload_recorded_show");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetSoundCloudUser($user) {
|
public static function SetSoundCloudUser($user) {
|
||||||
Application_Model_Preference::SetValue("soundcloud_user", $user);
|
self::SetValue("soundcloud_user", $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSoundCloudUser() {
|
public static function GetSoundCloudUser() {
|
||||||
return Application_Model_Preference::GetValue("soundcloud_user");
|
return self::GetValue("soundcloud_user");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetSoundCloudPassword($password) {
|
public static function SetSoundCloudPassword($password) {
|
||||||
if (strlen($password) > 0)
|
if (strlen($password) > 0)
|
||||||
Application_Model_Preference::SetValue("soundcloud_password", $password);
|
self::SetValue("soundcloud_password", $password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSoundCloudPassword() {
|
public static function GetSoundCloudPassword() {
|
||||||
return Application_Model_Preference::GetValue("soundcloud_password");
|
return self::GetValue("soundcloud_password");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetSoundCloudTags($tags) {
|
public static function SetSoundCloudTags($tags) {
|
||||||
Application_Model_Preference::SetValue("soundcloud_tags", $tags);
|
self::SetValue("soundcloud_tags", $tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSoundCloudTags() {
|
public static function GetSoundCloudTags() {
|
||||||
return Application_Model_Preference::GetValue("soundcloud_tags");
|
return self::GetValue("soundcloud_tags");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetSoundCloudGenre($genre) {
|
public static function SetSoundCloudGenre($genre) {
|
||||||
Application_Model_Preference::SetValue("soundcloud_genre", $genre);
|
self::SetValue("soundcloud_genre", $genre);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSoundCloudGenre() {
|
public static function GetSoundCloudGenre() {
|
||||||
return Application_Model_Preference::GetValue("soundcloud_genre");
|
return self::GetValue("soundcloud_genre");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetSoundCloudTrackType($track_type) {
|
public static function SetSoundCloudTrackType($track_type) {
|
||||||
Application_Model_Preference::SetValue("soundcloud_tracktype", $track_type);
|
self::SetValue("soundcloud_tracktype", $track_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSoundCloudTrackType() {
|
public static function GetSoundCloudTrackType() {
|
||||||
return Application_Model_Preference::GetValue("soundcloud_tracktype");
|
return self::GetValue("soundcloud_tracktype");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetSoundCloudLicense($license) {
|
public static function SetSoundCloudLicense($license) {
|
||||||
Application_Model_Preference::SetValue("soundcloud_license", $license);
|
self::SetValue("soundcloud_license", $license);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSoundCloudLicense() {
|
public static function GetSoundCloudLicense() {
|
||||||
return Application_Model_Preference::GetValue("soundcloud_license");
|
return self::GetValue("soundcloud_license");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetAllow3rdPartyApi($bool) {
|
public static function SetAllow3rdPartyApi($bool) {
|
||||||
Application_Model_Preference::SetValue("third_party_api", $bool);
|
self::SetValue("third_party_api", $bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetAllow3rdPartyApi() {
|
public static function GetAllow3rdPartyApi() {
|
||||||
$val = Application_Model_Preference::GetValue("third_party_api");
|
$val = self::GetValue("third_party_api");
|
||||||
if (strlen($val) == 0){
|
if (strlen($val) == 0){
|
||||||
return "0";
|
return "0";
|
||||||
} else {
|
} else {
|
||||||
|
@ -190,91 +219,101 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetPhone($phone){
|
public static function SetPhone($phone){
|
||||||
Application_Model_Preference::SetValue("phone", $phone);
|
self::SetValue("phone", $phone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetPhone(){
|
public static function GetPhone(){
|
||||||
return Application_Model_Preference::GetValue("phone");
|
return self::GetValue("phone");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetEmail($email){
|
public static function SetEmail($email){
|
||||||
Application_Model_Preference::SetValue("email", $email);
|
self::SetValue("email", $email);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetEmail(){
|
public static function GetEmail(){
|
||||||
return Application_Model_Preference::GetValue("email");
|
return self::GetValue("email");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStationWebSite($site){
|
public static function SetStationWebSite($site){
|
||||||
Application_Model_Preference::SetValue("station_website", $site);
|
self::SetValue("station_website", $site);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationWebSite(){
|
public static function GetStationWebSite(){
|
||||||
return Application_Model_Preference::GetValue("station_website");
|
return self::GetValue("station_website");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetSupportFeedback($feedback){
|
public static function SetSupportFeedback($feedback){
|
||||||
Application_Model_Preference::SetValue("support_feedback", $feedback);
|
self::SetValue("support_feedback", $feedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSupportFeedback(){
|
public static function GetSupportFeedback(){
|
||||||
return Application_Model_Preference::GetValue("support_feedback");
|
return self::GetValue("support_feedback");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetPublicise($publicise){
|
public static function SetPublicise($publicise){
|
||||||
Application_Model_Preference::SetValue("publicise", $publicise);
|
self::SetValue("publicise", $publicise);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetPublicise(){
|
public static function GetPublicise(){
|
||||||
return Application_Model_Preference::GetValue("publicise");
|
return self::GetValue("publicise");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetRegistered($registered){
|
public static function SetRegistered($registered){
|
||||||
Application_Model_Preference::SetValue("registered", $registered);
|
self::SetValue("registered", $registered);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetRegistered(){
|
public static function GetRegistered(){
|
||||||
return Application_Model_Preference::GetValue("registered");
|
return self::GetValue("registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStationCountry($country){
|
public static function SetStationCountry($country){
|
||||||
Application_Model_Preference::SetValue("country", $country);
|
self::SetValue("country", $country);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationCountry(){
|
public static function GetStationCountry(){
|
||||||
return Application_Model_Preference::GetValue("country");
|
return self::GetValue("country");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStationCity($city){
|
public static function SetStationCity($city){
|
||||||
Application_Model_Preference::SetValue("city", $city);
|
self::SetValue("city", $city);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationCity(){
|
public static function GetStationCity(){
|
||||||
return Application_Model_Preference::GetValue("city");
|
return self::GetValue("city");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStationDescription($description){
|
public static function SetStationDescription($description){
|
||||||
Application_Model_Preference::SetValue("description", $description);
|
self::SetValue("description", $description);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationDescription(){
|
public static function GetStationDescription(){
|
||||||
return Application_Model_Preference::GetValue("description");
|
return self::GetValue("description");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetTimezone($timezone){
|
||||||
|
self::SetValue("timezone", $timezone);
|
||||||
|
date_default_timezone_set($timezone);
|
||||||
|
$md = array("timezone" => $timezone);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetTimezone(){
|
||||||
|
return self::GetValue("timezone");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetStationLogo($imagePath){
|
public static function SetStationLogo($imagePath){
|
||||||
if(!empty($imagePath)){
|
if(!empty($imagePath)){
|
||||||
$image = @file_get_contents($imagePath);
|
$image = @file_get_contents($imagePath);
|
||||||
$image = base64_encode($image);
|
$image = base64_encode($image);
|
||||||
Application_Model_Preference::SetValue("logoImage", $image);
|
self::SetValue("logoImage", $image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStationLogo(){
|
public static function GetStationLogo(){
|
||||||
return Application_Model_Preference::GetValue("logoImage");
|
return self::GetValue("logoImage");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetUniqueId(){
|
public static function GetUniqueId(){
|
||||||
return Application_Model_Preference::GetValue("uniqueId");
|
return self::GetValue("uniqueId");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetCountryList(){
|
public static function GetCountryList(){
|
||||||
|
@ -306,13 +345,13 @@ class Application_Model_Preference
|
||||||
|
|
||||||
$outputArray = array();
|
$outputArray = array();
|
||||||
|
|
||||||
$outputArray['STATION_NAME'] = Application_Model_Preference::GetStationName();
|
$outputArray['STATION_NAME'] = self::GetStationName();
|
||||||
$outputArray['PHONE'] = Application_Model_Preference::GetPhone();
|
$outputArray['PHONE'] = self::GetPhone();
|
||||||
$outputArray['EMAIL'] = Application_Model_Preference::GetEmail();
|
$outputArray['EMAIL'] = self::GetEmail();
|
||||||
$outputArray['STATION_WEB_SITE'] = Application_Model_Preference::GetStationWebSite();
|
$outputArray['STATION_WEB_SITE'] = self::GetStationWebSite();
|
||||||
$outputArray['STATION_COUNTRY'] = Application_Model_Preference::GetStationCountry();
|
$outputArray['STATION_COUNTRY'] = self::GetStationCountry();
|
||||||
$outputArray['STATION_CITY'] = Application_Model_Preference::GetStationCity();
|
$outputArray['STATION_CITY'] = self::GetStationCity();
|
||||||
$outputArray['STATION_DESCRIPTION'] = Application_Model_Preference::GetStationDescription();
|
$outputArray['STATION_DESCRIPTION'] = self::GetStationDescription();
|
||||||
|
|
||||||
// get web server info
|
// get web server info
|
||||||
if(isset($systemInfoArray["AIRTIME_VERSION_URL"])){
|
if(isset($systemInfoArray["AIRTIME_VERSION_URL"])){
|
||||||
|
@ -324,12 +363,12 @@ class Application_Model_Preference
|
||||||
$outputArray['WEB_SERVER'] = $headerInfo['Server'][0];
|
$outputArray['WEB_SERVER'] = $headerInfo['Server'][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$outputArray['NUM_OF_USERS'] = User::getUserCount();
|
$outputArray['NUM_OF_USERS'] = Application_Model_User::getUserCount();
|
||||||
$outputArray['NUM_OF_SONGS'] = StoredFile::getFileCount();
|
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
|
||||||
$outputArray['NUM_OF_PLAYLISTS'] = Playlist::getPlaylistCount();
|
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
|
||||||
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Schedule::getSchduledPlaylistCount();
|
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount();
|
||||||
$outputArray['NUM_OF_PAST_SHOWS'] = ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s"));
|
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s"));
|
||||||
$outputArray['UNIQUE_ID'] = Application_Model_Preference::GetUniqueId();
|
$outputArray['UNIQUE_ID'] = self::GetUniqueId();
|
||||||
|
|
||||||
$outputArray = array_merge($systemInfoArray, $outputArray);
|
$outputArray = array_merge($systemInfoArray, $outputArray);
|
||||||
|
|
||||||
|
@ -340,8 +379,8 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($returnArray){
|
if($returnArray){
|
||||||
$outputArray['PROMOTE'] = Application_Model_Preference::GetPublicise();
|
$outputArray['PROMOTE'] = self::GetPublicise();
|
||||||
$outputArray['LOGOIMG'] = Application_Model_Preference::GetStationLogo();
|
$outputArray['LOGOIMG'] = self::GetStationLogo();
|
||||||
return $outputArray;
|
return $outputArray;
|
||||||
}else{
|
}else{
|
||||||
return $outputString;
|
return $outputString;
|
||||||
|
@ -350,22 +389,168 @@ class Application_Model_Preference
|
||||||
|
|
||||||
public static function SetRemindMeDate($now){
|
public static function SetRemindMeDate($now){
|
||||||
$weekAfter = mktime(0, 0, 0, date("m") , date("d")+7, date("Y"));
|
$weekAfter = mktime(0, 0, 0, date("m") , date("d")+7, date("Y"));
|
||||||
Application_Model_Preference::SetValue("remindme", $weekAfter);
|
self::SetValue("remindme", $weekAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetRemindMeDate(){
|
public static function GetRemindMeDate(){
|
||||||
return Application_Model_Preference::GetValue("remindme");
|
return self::GetValue("remindme");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetImportTimestamp(){
|
public static function SetImportTimestamp(){
|
||||||
$now = time();
|
$now = time();
|
||||||
if(Application_Model_Preference::GetImportTimestamp()+5 < $now){
|
if(self::GetImportTimestamp()+5 < $now){
|
||||||
Application_Model_Preference::SetValue("import_timestamp", $now);
|
self::SetValue("import_timestamp", $now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetImportTimestamp(){
|
public static function GetImportTimestamp(){
|
||||||
return Application_Model_Preference::GetValue("import_timestamp");
|
return self::GetValue("import_timestamp");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function GetStreamType(){
|
||||||
|
$st = self::GetValue("stream_type");
|
||||||
|
return explode(',', $st);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetStreamBitrate(){
|
||||||
|
$sb = self::GetValue("stream_bitrate");
|
||||||
|
return explode(',', $sb);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetPrivacyPolicyCheck($flag){
|
||||||
|
self::SetValue("privacy_policy", $flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetPrivacyPolicyCheck(){
|
||||||
|
return self::GetValue("privacy_policy");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetNumOfStreams($num){
|
||||||
|
self::SetValue("num_of_streams", intval($num));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetNumOfStreams(){
|
||||||
|
return self::GetValue("num_of_streams");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetMaxBitrate($bitrate){
|
||||||
|
self::SetValue("max_bitrate", intval($bitrate));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetMaxBitrate(){
|
||||||
|
return self::GetValue("max_bitrate");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetPlanLevel($plan){
|
||||||
|
self::SetValue("plan_level", $plan);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetPlanLevel(){
|
||||||
|
return self::GetValue("plan_level");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetTrialEndingDate($date){
|
||||||
|
self::SetValue("trial_end_date", $date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetTrialEndingDate(){
|
||||||
|
return self::GetValue("trial_end_date");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetEnableStreamConf($bool){
|
||||||
|
self::SetValue("enable_stream_conf", $bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetEnableStreamConf(){
|
||||||
|
if(self::GetValue("enable_stream_conf") == Null){
|
||||||
|
return "true";
|
||||||
|
}
|
||||||
|
return self::GetValue("enable_stream_conf");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetAirtimeVersion(){
|
||||||
|
return self::GetValue("system_version");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetUploadToSoundcloudOption($upload) {
|
||||||
|
self::SetValue("soundcloud_upload_option", $upload);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetUploadToSoundcloudOption() {
|
||||||
|
return self::GetValue("soundcloud_upload_option");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetSoundCloudDownloadbleOption($upload) {
|
||||||
|
self::SetValue("soundcloud_downloadable", $upload);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetSoundCloudDownloadbleOption() {
|
||||||
|
return self::GetValue("soundcloud_downloadable");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetWeekStartDay($day) {
|
||||||
|
self::SetValue("week_start_day", $day);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetWeekStartDay() {
|
||||||
|
$val = self::GetValue("week_start_day");
|
||||||
|
if (strlen($val) == 0){
|
||||||
|
return "0";
|
||||||
|
} else {
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* User specific preferences start */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the time scale preference (day/week/month) in Calendar.
|
||||||
|
*
|
||||||
|
* @param $timeScale new time scale
|
||||||
|
*/
|
||||||
|
public static function SetCalendarTimeScale($timeScale) {
|
||||||
|
return self::SetValue("calendar_time_scale", $timeScale, true /* user specific */);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the time scale preference for the current user.
|
||||||
|
*/
|
||||||
|
public static function GetCalendarTimeScale() {
|
||||||
|
return self::GetValue("calendar_time_scale", true /* user specific */);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the number of entries to show preference in library under Playlist Builder.
|
||||||
|
*
|
||||||
|
* @param $numEntries new number of entries to show
|
||||||
|
*/
|
||||||
|
public static function SetLibraryNumEntries($numEntries) {
|
||||||
|
return self::SetValue("library_num_entries", $numEntries, true /* user specific */);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the number of entries to show preference in library under Playlist Builder.
|
||||||
|
*/
|
||||||
|
public static function GetLibraryNumEntries() {
|
||||||
|
return self::GetValue("library_num_entries", true /* user specific */);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the time interval preference in Calendar.
|
||||||
|
*
|
||||||
|
* @param $timeInterval new time interval
|
||||||
|
*/
|
||||||
|
public static function SetCalendarTimeInterval($timeInterval) {
|
||||||
|
return self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the time interval preference for the current user.
|
||||||
|
*/
|
||||||
|
public static function GetCalendarTimeInterval() {
|
||||||
|
return self::GetValue("calendar_time_interval", true /* user specific */);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* User specific preferences end */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @subpackage StorageServer
|
* @subpackage StorageServer
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
* @copyright 2010 Sourcefabric O.P.S.
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
* @see StoredFile
|
* @see Application_Model_StoredFile
|
||||||
*/
|
*/
|
||||||
/* ================== Prefs ================== */
|
/* ================== Prefs ================== */
|
||||||
class Prefs {
|
class Prefs {
|
||||||
|
@ -132,7 +132,7 @@ class Prefs {
|
||||||
function loadGroupPref($group, $key, $returnErrorIfKeyNotExists = true)
|
function loadGroupPref($group, $key, $returnErrorIfKeyNotExists = true)
|
||||||
{
|
{
|
||||||
// if sessid is would be used here fix Transport::cronCallMethod !
|
// if sessid is would be used here fix Transport::cronCallMethod !
|
||||||
$subjid = Subjects::GetSubjId($group);
|
$subjid = Application_Model_Subjects::GetSubjId($group);
|
||||||
if (PEAR::isError($subjid)) {
|
if (PEAR::isError($subjid)) {
|
||||||
return $subjid;
|
return $subjid;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ class Prefs {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
"Prefs::saveGroupPref: invalid session id", GBERR_SESS);
|
"Prefs::saveGroupPref: invalid session id", GBERR_SESS);
|
||||||
}
|
}
|
||||||
$gid = Subjects::GetSubjId($group);
|
$gid = Application_Model_Subjects::GetSubjId($group);
|
||||||
if (PEAR::isError($gid)) {
|
if (PEAR::isError($gid)) {
|
||||||
return $gid;
|
return $gid;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ class Prefs {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
"Prefs::saveGroupPref: invalid group name", GBERR_SESS);
|
"Prefs::saveGroupPref: invalid group name", GBERR_SESS);
|
||||||
}
|
}
|
||||||
$memb = Subjects::IsMemberOf($uid, $gid);
|
$memb = Application_Model_Subjects::IsMemberOf($uid, $gid);
|
||||||
if (PEAR::isError($memb)) {
|
if (PEAR::isError($memb)) {
|
||||||
return $memb;
|
return $memb;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ class Prefs {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
"Prefs::delGroupPref: invalid session id", GBERR_SESS);
|
"Prefs::delGroupPref: invalid session id", GBERR_SESS);
|
||||||
}
|
}
|
||||||
$gid = Subjects::GetSubjId($group);
|
$gid = Application_Model_Subjects::GetSubjId($group);
|
||||||
if (PEAR::isError($gid)) {
|
if (PEAR::isError($gid)) {
|
||||||
return $gid;
|
return $gid;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ class Prefs {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
"Prefs::delGroupPref: invalid group name", GBERR_SESS);
|
"Prefs::delGroupPref: invalid group name", GBERR_SESS);
|
||||||
}
|
}
|
||||||
$memb = Subjects::IsMemberOf($uid, $gid);
|
$memb = Application_Model_Subjects::IsMemberOf($uid, $gid);
|
||||||
if (PEAR::isError($memb)) {
|
if (PEAR::isError($memb)) {
|
||||||
return $memb;
|
return $memb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +1,39 @@
|
||||||
<?php
|
<?php
|
||||||
require_once 'php-amqplib/amqp.inc';
|
require_once 'php-amqplib/amqp.inc';
|
||||||
|
|
||||||
class RabbitMq
|
class Application_Model_RabbitMq
|
||||||
{
|
{
|
||||||
static private $doPush = FALSE;
|
static public $doPush = FALSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a flag to push the schedule at the end of the request.
|
* Sets a flag to push the schedule at the end of the request.
|
||||||
*/
|
*/
|
||||||
public static function PushSchedule() {
|
public static function PushSchedule() {
|
||||||
RabbitMq::$doPush = TRUE;
|
Application_Model_RabbitMq::$doPush = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static function SendMessageToPypo($event_type, $md)
|
||||||
* Push the current schedule to RabbitMQ, to be picked up by Pypo.
|
|
||||||
* Will push the schedule in the range from 24 hours ago to 24 hours
|
|
||||||
* in the future.
|
|
||||||
*/
|
|
||||||
public static function PushScheduleFinal()
|
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
if (RabbitMq::$doPush) {
|
|
||||||
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
|
||||||
$CC_CONFIG["rabbitmq"]["port"],
|
|
||||||
$CC_CONFIG["rabbitmq"]["user"],
|
|
||||||
$CC_CONFIG["rabbitmq"]["password"]);
|
|
||||||
$channel = $conn->channel();
|
|
||||||
$channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
|
|
||||||
|
|
||||||
$EXCHANGE = 'airtime-schedule';
|
$md["event_type"] = $event_type;
|
||||||
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
|
|
||||||
|
|
||||||
$data = json_encode(Schedule::GetScheduledPlaylists());
|
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
||||||
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
|
$CC_CONFIG["rabbitmq"]["port"],
|
||||||
|
$CC_CONFIG["rabbitmq"]["user"],
|
||||||
|
$CC_CONFIG["rabbitmq"]["password"]);
|
||||||
|
$channel = $conn->channel();
|
||||||
|
$channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
|
||||||
|
|
||||||
$channel->basic_publish($msg, $EXCHANGE);
|
$EXCHANGE = 'airtime-pypo';
|
||||||
$channel->close();
|
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||||
$conn->close();
|
|
||||||
|
|
||||||
self::SendMessageToShowRecorder("update_schedule");
|
$data = json_encode($md);
|
||||||
}
|
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
|
||||||
|
|
||||||
|
$channel->basic_publish($msg, $EXCHANGE);
|
||||||
|
$channel->close();
|
||||||
|
$conn->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SendMessageToMediaMonitor($event_type, $md)
|
public static function SendMessageToMediaMonitor($event_type, $md)
|
||||||
|
@ -80,13 +74,13 @@ class RabbitMq
|
||||||
$EXCHANGE = 'airtime-show-recorder';
|
$EXCHANGE = 'airtime-show-recorder';
|
||||||
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
|
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||||
|
|
||||||
$today_timestamp = date("Y-m-d H:i:s");
|
$now = new DateTime("@".time());
|
||||||
$now = new DateTime($today_timestamp);
|
$end_timestamp = new DateTime("@".(time() + 3600*2));
|
||||||
$end_timestamp = $now->add(new DateInterval("PT2H"));
|
|
||||||
$end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
|
|
||||||
$temp['event_type'] = $event_type;
|
$temp['event_type'] = $event_type;
|
||||||
|
$temp['server_timezone'] = Application_Model_Preference::GetTimezone();
|
||||||
if($event_type = "update_schedule"){
|
if($event_type = "update_schedule"){
|
||||||
$temp['shows'] = Show::getShows($today_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE);
|
$temp['shows'] = Application_Model_Show::getShows($now->format("Y-m-d H:i:s"), $end_timestamp->format("Y-m-d H:i:s"), $excludeInstance=NULL, $onlyRecord=TRUE);
|
||||||
}
|
}
|
||||||
$data = json_encode($temp);
|
$data = json_encode($temp);
|
||||||
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
|
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
|
||||||
|
|
|
@ -1,226 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("StoredFile.php");
|
|
||||||
|
|
||||||
class ScheduleGroup {
|
class Application_Model_Schedule {
|
||||||
|
|
||||||
private $groupId;
|
|
||||||
|
|
||||||
public function __construct($p_groupId = null) {
|
|
||||||
$this->groupId = $p_groupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if the schedule group exists in the DB.
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function exists() {
|
|
||||||
global $CC_CONFIG, $CC_DBC;
|
|
||||||
$sql = "SELECT COUNT(*) FROM ".$CC_CONFIG['scheduleTable']
|
|
||||||
." WHERE group_id=".$this->groupId;
|
|
||||||
$result = $CC_DBC->GetOne($sql);
|
|
||||||
if (PEAR::isError($result)) {
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
return $result != "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a music clip or playlist to the schedule.
|
|
||||||
*
|
|
||||||
* @param int $p_showInstance
|
|
||||||
* ID of the show.
|
|
||||||
* @param $p_datetime
|
|
||||||
* In the format YYYY-MM-DD HH:MM:SS.mmmmmm
|
|
||||||
* @param $p_audioFileId
|
|
||||||
* (optional, either this or $p_playlistId must be set) DB ID of the audio file
|
|
||||||
* @param $p_playlistId
|
|
||||||
* (optional, either this of $p_audioFileId must be set) DB ID of the playlist
|
|
||||||
* @param $p_options
|
|
||||||
* Does nothing at the moment.
|
|
||||||
*
|
|
||||||
* @return int|PEAR_Error
|
|
||||||
* Return PEAR_Error if the item could not be added.
|
|
||||||
* Error code 555 is a scheduling conflict.
|
|
||||||
*/
|
|
||||||
public function add($p_showInstance, $p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null) {
|
|
||||||
global $CC_CONFIG, $CC_DBC;
|
|
||||||
|
|
||||||
if (!is_null($p_audioFileId)) {
|
|
||||||
// Schedule a single audio track
|
|
||||||
|
|
||||||
// Load existing track
|
|
||||||
$track = StoredFile::Recall($p_audioFileId);
|
|
||||||
if (is_null($track)) {
|
|
||||||
return new PEAR_Error("Could not find audio track.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if there are any conflicts with existing entries
|
|
||||||
$metadata = $track->getMetadata();
|
|
||||||
$length = $metadata['MDATA_KEY_DURATION'];
|
|
||||||
if (empty($length)) {
|
|
||||||
return new PEAR_Error("Length is empty.");
|
|
||||||
}
|
|
||||||
// Insert into the table
|
|
||||||
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
|
|
||||||
|
|
||||||
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
|
|
||||||
." (instance_id, starts, ends, clip_length, group_id, file_id, cue_out)"
|
|
||||||
." VALUES ($p_showInstance, TIMESTAMP '$p_datetime', "
|
|
||||||
." (TIMESTAMP '$p_datetime' + INTERVAL '$length'),"
|
|
||||||
." '$length',"
|
|
||||||
." {$this->groupId}, $p_audioFileId, '$length')";
|
|
||||||
$result = $CC_DBC->query($sql);
|
|
||||||
if (PEAR::isError($result)) {
|
|
||||||
//var_dump($sql);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
elseif (!is_null($p_playlistId)){
|
|
||||||
// Schedule a whole playlist
|
|
||||||
|
|
||||||
// Load existing playlist
|
|
||||||
$playlist = Playlist::Recall($p_playlistId);
|
|
||||||
if (is_null($playlist)) {
|
|
||||||
return new PEAR_Error("Could not find playlist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if there are any conflicts with existing entries
|
|
||||||
$length = trim($playlist->getLength());
|
|
||||||
//var_dump($length);
|
|
||||||
if (empty($length)) {
|
|
||||||
return new PEAR_Error("Length is empty.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert all items into the schedule
|
|
||||||
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
|
|
||||||
$itemStartTime = $p_datetime;
|
|
||||||
|
|
||||||
$plItems = $playlist->getContents();
|
|
||||||
//var_dump($plItems);
|
|
||||||
foreach ($plItems as $row) {
|
|
||||||
$trackLength = $row["cliplength"];
|
|
||||||
//var_dump($trackLength);
|
|
||||||
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
|
|
||||||
." (instance_id, playlist_id, starts, ends, group_id, file_id,"
|
|
||||||
." clip_length, cue_in, cue_out, fade_in, fade_out)"
|
|
||||||
." VALUES ($p_showInstance, $p_playlistId, TIMESTAMP '$itemStartTime', "
|
|
||||||
." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'),"
|
|
||||||
." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}',"
|
|
||||||
." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')";
|
|
||||||
$result = $CC_DBC->query($sql);
|
|
||||||
if (PEAR::isError($result)) {
|
|
||||||
//var_dump($sql);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
$itemStartTime = $CC_DBC->getOne("SELECT TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RabbitMq::PushSchedule();
|
|
||||||
return $this->groupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addFileAfter($show_instance, $p_groupId, $p_audioFileId) {
|
|
||||||
global $CC_CONFIG, $CC_DBC;
|
|
||||||
// Get the end time for the given entry
|
|
||||||
$sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"]
|
|
||||||
." WHERE group_id=$p_groupId";
|
|
||||||
$startTime = $CC_DBC->GetOne($sql);
|
|
||||||
return $this->add($show_instance, $startTime, $p_audioFileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addPlaylistAfter($show_instance, $p_groupId, $p_playlistId) {
|
|
||||||
global $CC_CONFIG, $CC_DBC;
|
|
||||||
// Get the end time for the given entry
|
|
||||||
$sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"]
|
|
||||||
." WHERE group_id=$p_groupId";
|
|
||||||
|
|
||||||
$startTime = $CC_DBC->GetOne($sql);
|
|
||||||
return $this->add($show_instance, $startTime, null, $p_playlistId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the group from the schedule.
|
|
||||||
* Note: does not check if it is in the past, you can remove anything.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
* TRUE on success, false if there is no group ID defined.
|
|
||||||
*/
|
|
||||||
public function remove() {
|
|
||||||
global $CC_CONFIG, $CC_DBC;
|
|
||||||
if (is_null($this->groupId) || !is_numeric($this->groupId)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]
|
|
||||||
." WHERE group_id = ".$this->groupId;
|
|
||||||
//echo $sql;
|
|
||||||
$retVal = $CC_DBC->query($sql);
|
|
||||||
RabbitMq::PushSchedule();
|
|
||||||
return $retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the number of items in this group.
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function count() {
|
|
||||||
global $CC_CONFIG, $CC_DBC;
|
|
||||||
$sql = "SELECT COUNT(*) FROM {$CC_CONFIG['scheduleTable']}"
|
|
||||||
." WHERE group_id={$this->groupId}";
|
|
||||||
return $CC_DBC->GetOne($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the list of items in this group as a 2D array.
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getItems() {
|
|
||||||
global $CC_CONFIG, $CC_DBC;
|
|
||||||
$sql = "SELECT "
|
|
||||||
." st.id,"
|
|
||||||
." st.file_id,"
|
|
||||||
." st.cue_in,"
|
|
||||||
." st.cue_out,"
|
|
||||||
." st.clip_length,"
|
|
||||||
." st.fade_in,"
|
|
||||||
." st.fade_out,"
|
|
||||||
." st.starts,"
|
|
||||||
." st.ends"
|
|
||||||
." FROM $CC_CONFIG[scheduleTable] as st"
|
|
||||||
." LEFT JOIN $CC_CONFIG[showInstances] as si"
|
|
||||||
." ON st.instance_id = si.id"
|
|
||||||
." WHERE st.group_id=$this->groupId"
|
|
||||||
." AND st.starts < si.ends"
|
|
||||||
." ORDER BY st.starts";
|
|
||||||
return $CC_DBC->GetAll($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function notifyGroupStartPlay() {
|
|
||||||
global $CC_CONFIG, $CC_DBC;
|
|
||||||
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
|
||||||
." SET schedule_group_played=TRUE"
|
|
||||||
." WHERE group_id=".$this->groupId;
|
|
||||||
$retVal = $CC_DBC->query($sql);
|
|
||||||
return $retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function notifyMediaItemStartPlay($p_fileId) {
|
|
||||||
global $CC_CONFIG, $CC_DBC;
|
|
||||||
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
|
||||||
." SET media_item_played=TRUE"
|
|
||||||
." WHERE group_id=".$this->groupId
|
|
||||||
." AND file_id=".pg_escape_string($p_fileId);
|
|
||||||
$retVal = $CC_DBC->query($sql);
|
|
||||||
return $retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Schedule {
|
|
||||||
|
|
||||||
function __construct() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if there is nothing in the schedule for the given start time
|
* Return true if there is nothing in the schedule for the given start time
|
||||||
|
@ -235,7 +15,7 @@ class Schedule {
|
||||||
public static function isScheduleEmptyInRange($p_datetime, $p_length) {
|
public static function isScheduleEmptyInRange($p_datetime, $p_length) {
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
if (empty($p_length)) {
|
if (empty($p_length)) {
|
||||||
return new PEAR_Error("Schedule::isSchedulerEmptyInRange: param p_length is empty.");
|
return new PEAR_Error("Application_Model_Schedule::isSchedulerEmptyInRange: param p_length is empty.");
|
||||||
}
|
}
|
||||||
$sql = "SELECT COUNT(*) FROM ".$CC_CONFIG["scheduleTable"]
|
$sql = "SELECT COUNT(*) FROM ".$CC_CONFIG["scheduleTable"]
|
||||||
." WHERE (starts >= '$p_datetime') "
|
." WHERE (starts >= '$p_datetime') "
|
||||||
|
@ -307,9 +87,8 @@ class Schedule {
|
||||||
$row["id"] = $row["group_id"];
|
$row["id"] = $row["group_id"];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT MIN(st.name) AS name,"
|
$sql = "SELECT MIN(pt.creator) AS creator,"
|
||||||
." MIN(pt.creator) AS creator,"
|
." st.group_id,"
|
||||||
." st.group_id, "
|
|
||||||
." SUM(st.clip_length) AS clip_length,"
|
." SUM(st.clip_length) AS clip_length,"
|
||||||
." MIN(st.file_id) AS file_id,"
|
." MIN(st.file_id) AS file_id,"
|
||||||
." COUNT(*) as count,"
|
." COUNT(*) as count,"
|
||||||
|
@ -326,6 +105,7 @@ class Schedule {
|
||||||
." ON st.instance_id = si.id"
|
." ON st.instance_id = si.id"
|
||||||
." LEFT JOIN $CC_CONFIG[showTable] as sh"
|
." LEFT JOIN $CC_CONFIG[showTable] as sh"
|
||||||
." ON si.show_id = sh.id"
|
." ON si.show_id = sh.id"
|
||||||
|
//The next line ensures we only get songs that haven't ended yet
|
||||||
." WHERE (st.ends >= TIMESTAMP '$p_currentDateTime')"
|
." WHERE (st.ends >= TIMESTAMP '$p_currentDateTime')"
|
||||||
." AND (st.ends <= TIMESTAMP '$p_toDateTime')"
|
." AND (st.ends <= TIMESTAMP '$p_toDateTime')"
|
||||||
//next line makes sure that we aren't returning items that
|
//next line makes sure that we aren't returning items that
|
||||||
|
@ -363,18 +143,15 @@ class Schedule {
|
||||||
|
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$date = new DateHelper;
|
$date = new Application_Model_DateHelper;
|
||||||
$timeNow = $date->getTimestamp();
|
$timeNow = $date->getUtcTimestamp();
|
||||||
return array("env"=>APPLICATION_ENV,
|
return array("env"=>APPLICATION_ENV,
|
||||||
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
"schedulerTime"=>$timeNow,
|
||||||
//"previous"=>Schedule::GetScheduledItemData($timeNow, -1, $prev, "24 hours"),
|
|
||||||
//"current"=>Schedule::GetScheduledItemData($timeNow, 0),
|
|
||||||
//"next"=>Schedule::GetScheduledItemData($timeNow, 1, $next, "48 hours"),
|
|
||||||
"previous"=>Application_Model_Dashboard::GetPreviousItem($timeNow),
|
"previous"=>Application_Model_Dashboard::GetPreviousItem($timeNow),
|
||||||
"current"=>Application_Model_Dashboard::GetCurrentItem($timeNow),
|
"current"=>Application_Model_Dashboard::GetCurrentItem($timeNow),
|
||||||
"next"=>Application_Model_Dashboard::GetNextItem($timeNow),
|
"next"=>Application_Model_Dashboard::GetNextItem($timeNow),
|
||||||
"currentShow"=>Show_DAL::GetCurrentShow($timeNow),
|
"currentShow"=>Application_Model_Show::GetCurrentShow($timeNow),
|
||||||
"nextShow"=>Show_DAL::GetNextShows($timeNow, 1),
|
"nextShow"=>Application_Model_Show::GetNextShows($timeNow, 1),
|
||||||
"timezone"=> date("T"),
|
"timezone"=> date("T"),
|
||||||
"timezoneOffset"=> date("Z"));
|
"timezoneOffset"=> date("Z"));
|
||||||
}
|
}
|
||||||
|
@ -660,21 +437,21 @@ class Schedule {
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
if (is_null($p_fromDateTime)) {
|
if (is_null($p_fromDateTime)) {
|
||||||
$t1 = new DateTime();
|
$t1 = new DateTime("@".time());
|
||||||
$range_start = $t1->format("Y-m-d H:i:s");
|
$range_start = $t1->format("Y-m-d H:i:s");
|
||||||
} else {
|
} else {
|
||||||
$range_start = Schedule::PypoTimeToAirtimeTime($p_fromDateTime);
|
$range_start = Application_Model_Schedule::PypoTimeToAirtimeTime($p_fromDateTime);
|
||||||
}
|
}
|
||||||
if (is_null($p_fromDateTime)) {
|
if (is_null($p_fromDateTime)) {
|
||||||
$t2 = new DateTime();
|
$t2 = new DateTime("@".time());
|
||||||
$t2->add(new DateInterval("PT24H"));
|
$t2->add(new DateInterval("PT24H"));
|
||||||
$range_end = $t2->format("Y-m-d H:i:s");
|
$range_end = $t2->format("Y-m-d H:i:s");
|
||||||
} else {
|
} else {
|
||||||
$range_end = Schedule::PypoTimeToAirtimeTime($p_toDateTime);
|
$range_end = Application_Model_Schedule::PypoTimeToAirtimeTime($p_toDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scheduler wants everything in a playlist
|
// Scheduler wants everything in a playlist
|
||||||
$data = Schedule::GetItems($range_start, $range_end, true);
|
$data = Application_Model_Schedule::GetItems($range_start, $range_end, true);
|
||||||
$playlists = array();
|
$playlists = array();
|
||||||
|
|
||||||
if (is_array($data)){
|
if (is_array($data)){
|
||||||
|
@ -685,50 +462,51 @@ class Schedule {
|
||||||
$start = substr($start, 0, 19);
|
$start = substr($start, 0, 19);
|
||||||
|
|
||||||
//Start time is the array key, needs to be in the format "YYYY-MM-DD-HH-mm-ss"
|
//Start time is the array key, needs to be in the format "YYYY-MM-DD-HH-mm-ss"
|
||||||
$pkey = Schedule::AirtimeTimeToPypoTime($start);
|
$pkey = Application_Model_Schedule::AirtimeTimeToPypoTime($start);
|
||||||
$timestamp = strtotime($start);
|
$timestamp = strtotime($start);
|
||||||
$playlists[$pkey]['source'] = "PLAYLIST";
|
$playlists[$pkey]['source'] = "PLAYLIST";
|
||||||
$playlists[$pkey]['x_ident'] = $dx['group_id'];
|
$playlists[$pkey]['x_ident'] = $dx['group_id'];
|
||||||
//$playlists[$pkey]['subtype'] = '1'; // Just needs to be between 1 and 4 inclusive
|
|
||||||
$playlists[$pkey]['timestamp'] = $timestamp;
|
$playlists[$pkey]['timestamp'] = $timestamp;
|
||||||
$playlists[$pkey]['duration'] = $dx['clip_length'];
|
$playlists[$pkey]['duration'] = $dx['clip_length'];
|
||||||
$playlists[$pkey]['played'] = '0';
|
$playlists[$pkey]['played'] = '0';
|
||||||
$playlists[$pkey]['schedule_id'] = $dx['group_id'];
|
$playlists[$pkey]['schedule_id'] = $dx['group_id'];
|
||||||
$playlists[$pkey]['show_name'] = $dx['show_name'];
|
$playlists[$pkey]['show_name'] = $dx['show_name'];
|
||||||
$playlists[$pkey]['show_start'] = Schedule::AirtimeTimeToPypoTime($dx['show_start']);
|
$playlists[$pkey]['show_start'] = Application_Model_Schedule::AirtimeTimeToPypoTime($dx['show_start']);
|
||||||
$playlists[$pkey]['show_end'] = Schedule::AirtimeTimeToPypoTime($dx['show_end']);
|
$playlists[$pkey]['show_end'] = Application_Model_Schedule::AirtimeTimeToPypoTime($dx['show_end']);
|
||||||
$playlists[$pkey]['user_id'] = 0;
|
$playlists[$pkey]['user_id'] = 0;
|
||||||
$playlists[$pkey]['id'] = $dx['group_id'];
|
$playlists[$pkey]['id'] = $dx['group_id'];
|
||||||
$playlists[$pkey]['start'] = Schedule::AirtimeTimeToPypoTime($dx["start"]);
|
$playlists[$pkey]['start'] = Application_Model_Schedule::AirtimeTimeToPypoTime($dx["start"]);
|
||||||
$playlists[$pkey]['end'] = Schedule::AirtimeTimeToPypoTime($dx["end"]);
|
$playlists[$pkey]['end'] = Application_Model_Schedule::AirtimeTimeToPypoTime($dx["end"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ksort($playlists);
|
||||||
|
|
||||||
foreach ($playlists as &$playlist)
|
foreach ($playlists as &$playlist)
|
||||||
{
|
{
|
||||||
$scheduleGroup = new ScheduleGroup($playlist["schedule_id"]);
|
$scheduleGroup = new Application_Model_ScheduleGroup($playlist["schedule_id"]);
|
||||||
$items = $scheduleGroup->getItems();
|
$items = $scheduleGroup->getItems();
|
||||||
$medias = array();
|
$medias = array();
|
||||||
foreach ($items as $item)
|
foreach ($items as $item)
|
||||||
{
|
{
|
||||||
$storedFile = StoredFile::Recall($item["file_id"]);
|
$storedFile = Application_Model_StoredFile::Recall($item["file_id"]);
|
||||||
$uri = $storedFile->getFileUrl();
|
$uri = $storedFile->getFileUrlUsingConfigAddress();
|
||||||
|
|
||||||
$starts = Schedule::AirtimeTimeToPypoTime($item["starts"]);
|
$starts = Application_Model_Schedule::AirtimeTimeToPypoTime($item["starts"]);
|
||||||
$medias[$starts] = array(
|
$medias[$starts] = array(
|
||||||
'row_id' => $item["id"],
|
'row_id' => $item["id"],
|
||||||
'id' => $storedFile->getGunid(),
|
'id' => $storedFile->getGunid(),
|
||||||
'uri' => $uri,
|
'uri' => $uri,
|
||||||
'fade_in' => Schedule::WallTimeToMillisecs($item["fade_in"]),
|
'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]),
|
||||||
'fade_out' => Schedule::WallTimeToMillisecs($item["fade_out"]),
|
'fade_out' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_out"]),
|
||||||
'fade_cross' => 0,
|
'fade_cross' => 0,
|
||||||
'cue_in' => DateHelper::CalculateLengthInSeconds($item["cue_in"]),
|
'cue_in' => Application_Model_DateHelper::CalculateLengthInSeconds($item["cue_in"]),
|
||||||
'cue_out' => DateHelper::CalculateLengthInSeconds($item["cue_out"]),
|
'cue_out' => Application_Model_DateHelper::CalculateLengthInSeconds($item["cue_out"]),
|
||||||
'export_source' => 'scheduler',
|
'export_source' => 'scheduler',
|
||||||
'start' => $starts,
|
'start' => $starts,
|
||||||
'end' => Schedule::AirtimeTimeToPypoTime($item["ends"])
|
'end' => Application_Model_Schedule::AirtimeTimeToPypoTime($item["ends"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
ksort($medias);
|
||||||
$playlist['medias'] = $medias;
|
$playlist['medias'] = $medias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +518,6 @@ class Schedule {
|
||||||
$result['stream_metadata'] = array();
|
$result['stream_metadata'] = array();
|
||||||
$result['stream_metadata']['format'] = Application_Model_Preference::GetStreamLabelFormat();
|
$result['stream_metadata']['format'] = Application_Model_Preference::GetStreamLabelFormat();
|
||||||
$result['stream_metadata']['station_name'] = Application_Model_Preference::GetStationName();
|
$result['stream_metadata']['station_name'] = Application_Model_Preference::GetStationName();
|
||||||
$result['server_timezone'] = date('O');
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -752,33 +529,25 @@ class Schedule {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createNewFormSections($p_view){
|
public static function createNewFormSections($p_view){
|
||||||
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
|
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
$formWho = new Application_Form_AddShowWho();
|
$formWho = new Application_Form_AddShowWho();
|
||||||
$formWhen = new Application_Form_AddShowWhen();
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
$formRepeats = new Application_Form_AddShowRepeats();
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
$formStyle = new Application_Form_AddShowStyle();
|
$formStyle = new Application_Form_AddShowStyle();
|
||||||
$formRecord = new Application_Form_AddShowRR();
|
|
||||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
|
||||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
|
||||||
|
|
||||||
$formWhat->removeDecorator('DtDdWrapper');
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
$formWho->removeDecorator('DtDdWrapper');
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
$formWhen->removeDecorator('DtDdWrapper');
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
$formRepeats->removeDecorator('DtDdWrapper');
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
$formStyle->removeDecorator('DtDdWrapper');
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
$formRecord->removeDecorator('DtDdWrapper');
|
|
||||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
|
||||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
|
||||||
|
|
||||||
$p_view->what = $formWhat;
|
$p_view->what = $formWhat;
|
||||||
$p_view->when = $formWhen;
|
$p_view->when = $formWhen;
|
||||||
$p_view->repeats = $formRepeats;
|
$p_view->repeats = $formRepeats;
|
||||||
$p_view->who = $formWho;
|
$p_view->who = $formWho;
|
||||||
$p_view->style = $formStyle;
|
$p_view->style = $formStyle;
|
||||||
$p_view->rr = $formRecord;
|
|
||||||
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
|
||||||
$p_view->rebroadcast = $formRebroadcast;
|
|
||||||
$p_view->addNewShow = true;
|
|
||||||
|
|
||||||
$formWhat->populate(array('add_show_id' => '-1'));
|
$formWhat->populate(array('add_show_id' => '-1'));
|
||||||
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
|
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
|
||||||
|
@ -788,6 +557,21 @@ class Schedule {
|
||||||
'add_show_duration' => '1h'));
|
'add_show_duration' => '1h'));
|
||||||
|
|
||||||
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
|
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
|
||||||
|
|
||||||
|
if(!$isSaas){
|
||||||
|
$formRecord = new Application_Form_AddShowRR();
|
||||||
|
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||||
|
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||||
|
|
||||||
|
$formRecord->removeDecorator('DtDdWrapper');
|
||||||
|
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
|
$p_view->rr = $formRecord;
|
||||||
|
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||||
|
$p_view->rebroadcast = $formRebroadcast;
|
||||||
|
}
|
||||||
|
$p_view->addNewShow = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
216
airtime_mvc/application/models/ScheduleGroup.php
Normal file
216
airtime_mvc/application/models/ScheduleGroup.php
Normal file
|
@ -0,0 +1,216 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Model_ScheduleGroup {
|
||||||
|
|
||||||
|
private $groupId;
|
||||||
|
|
||||||
|
public function __construct($p_groupId = null) {
|
||||||
|
$this->groupId = $p_groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the schedule group exists in the DB.
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function exists() {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "SELECT COUNT(*) FROM ".$CC_CONFIG['scheduleTable']
|
||||||
|
." WHERE group_id=".$this->groupId;
|
||||||
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
return $result != "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a music clip or playlist to the schedule.
|
||||||
|
*
|
||||||
|
* @param int $p_showInstance
|
||||||
|
* ID of the show.
|
||||||
|
* @param $p_datetime
|
||||||
|
* In the format YYYY-MM-DD HH:MM:SS.mmmmmm
|
||||||
|
* @param $p_audioFileId
|
||||||
|
* (optional, either this or $p_playlistId must be set) DB ID of the audio file
|
||||||
|
* @param $p_playlistId
|
||||||
|
* (optional, either this of $p_audioFileId must be set) DB ID of the playlist
|
||||||
|
* @param $p_options
|
||||||
|
* Does nothing at the moment.
|
||||||
|
*
|
||||||
|
* @return int|PEAR_Error
|
||||||
|
* Return PEAR_Error if the item could not be added.
|
||||||
|
* Error code 555 is a scheduling conflict.
|
||||||
|
*/
|
||||||
|
public function add($p_showInstance, $p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null) {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
if (!is_null($p_audioFileId)) {
|
||||||
|
// Schedule a single audio track
|
||||||
|
|
||||||
|
// Load existing track
|
||||||
|
$track = Application_Model_StoredFile::Recall($p_audioFileId);
|
||||||
|
if (is_null($track)) {
|
||||||
|
return new PEAR_Error("Could not find audio track.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if there are any conflicts with existing entries
|
||||||
|
$metadata = $track->getMetadata();
|
||||||
|
$length = $metadata['MDATA_KEY_DURATION'];
|
||||||
|
if (empty($length)) {
|
||||||
|
return new PEAR_Error("Length is empty.");
|
||||||
|
}
|
||||||
|
// Insert into the table
|
||||||
|
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
|
||||||
|
|
||||||
|
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
|
||||||
|
." (instance_id, starts, ends, clip_length, group_id, file_id, cue_out)"
|
||||||
|
." VALUES ($p_showInstance, TIMESTAMP '$p_datetime', "
|
||||||
|
." (TIMESTAMP '$p_datetime' + INTERVAL '$length'),"
|
||||||
|
." '$length',"
|
||||||
|
." {$this->groupId}, $p_audioFileId, '$length')";
|
||||||
|
$result = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
//var_dump($sql);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif (!is_null($p_playlistId)){
|
||||||
|
// Schedule a whole playlist
|
||||||
|
|
||||||
|
// Load existing playlist
|
||||||
|
$playlist = Application_Model_Playlist::Recall($p_playlistId);
|
||||||
|
if (is_null($playlist)) {
|
||||||
|
return new PEAR_Error("Could not find playlist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if there are any conflicts with existing entries
|
||||||
|
$length = trim($playlist->getLength());
|
||||||
|
//var_dump($length);
|
||||||
|
if (empty($length)) {
|
||||||
|
return new PEAR_Error("Length is empty.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert all items into the schedule
|
||||||
|
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
|
||||||
|
$itemStartTime = $p_datetime;
|
||||||
|
|
||||||
|
$plItems = $playlist->getContents();
|
||||||
|
//var_dump($plItems);
|
||||||
|
foreach ($plItems as $row) {
|
||||||
|
$trackLength = $row["cliplength"];
|
||||||
|
//var_dump($trackLength);
|
||||||
|
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
|
||||||
|
." (instance_id, playlist_id, starts, ends, group_id, file_id,"
|
||||||
|
." clip_length, cue_in, cue_out, fade_in, fade_out)"
|
||||||
|
." VALUES ($p_showInstance, $p_playlistId, TIMESTAMP '$itemStartTime', "
|
||||||
|
." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'),"
|
||||||
|
." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}',"
|
||||||
|
." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')";
|
||||||
|
$result = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
//var_dump($sql);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
$itemStartTime = $CC_DBC->getOne("SELECT TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
return $this->groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addFileAfter($show_instance, $p_groupId, $p_audioFileId) {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
// Get the end time for the given entry
|
||||||
|
$sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"]
|
||||||
|
." WHERE group_id=$p_groupId";
|
||||||
|
$startTime = $CC_DBC->GetOne($sql);
|
||||||
|
return $this->add($show_instance, $startTime, $p_audioFileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPlaylistAfter($show_instance, $p_groupId, $p_playlistId) {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
// Get the end time for the given entry
|
||||||
|
$sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"]
|
||||||
|
." WHERE group_id=$p_groupId";
|
||||||
|
|
||||||
|
$startTime = $CC_DBC->GetOne($sql);
|
||||||
|
return $this->add($show_instance, $startTime, null, $p_playlistId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the group from the schedule.
|
||||||
|
* Note: does not check if it is in the past, you can remove anything.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
* TRUE on success, false if there is no group ID defined.
|
||||||
|
*/
|
||||||
|
public function remove() {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
if (is_null($this->groupId) || !is_numeric($this->groupId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]
|
||||||
|
." WHERE group_id = ".$this->groupId;
|
||||||
|
//echo $sql;
|
||||||
|
$retVal = $CC_DBC->query($sql);
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
return $retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of items in this group.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function count() {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "SELECT COUNT(*) FROM {$CC_CONFIG['scheduleTable']}"
|
||||||
|
." WHERE group_id={$this->groupId}";
|
||||||
|
return $CC_DBC->GetOne($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the list of items in this group as a 2D array.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getItems() {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "SELECT "
|
||||||
|
." st.id,"
|
||||||
|
." st.file_id,"
|
||||||
|
." st.cue_in,"
|
||||||
|
." st.cue_out,"
|
||||||
|
." st.clip_length,"
|
||||||
|
." st.fade_in,"
|
||||||
|
." st.fade_out,"
|
||||||
|
." st.starts,"
|
||||||
|
." st.ends"
|
||||||
|
." FROM $CC_CONFIG[scheduleTable] as st"
|
||||||
|
." LEFT JOIN $CC_CONFIG[showInstances] as si"
|
||||||
|
." ON st.instance_id = si.id"
|
||||||
|
." WHERE st.group_id=$this->groupId"
|
||||||
|
." AND st.starts < si.ends"
|
||||||
|
." ORDER BY st.starts";
|
||||||
|
return $CC_DBC->GetAll($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function notifyGroupStartPlay() {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
||||||
|
." SET schedule_group_played=TRUE"
|
||||||
|
." WHERE group_id=".$this->groupId;
|
||||||
|
$retVal = $CC_DBC->query($sql);
|
||||||
|
return $retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function notifyMediaItemStartPlay($p_fileId) {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
||||||
|
." SET media_item_played=TRUE"
|
||||||
|
." WHERE group_id=".$this->groupId
|
||||||
|
." AND file_id=".pg_escape_string($p_fileId);
|
||||||
|
$retVal = $CC_DBC->query($sql);
|
||||||
|
return $retVal;
|
||||||
|
}
|
||||||
|
}
|
25
airtime_mvc/application/models/ServiceRegister.php
Normal file
25
airtime_mvc/application/models/ServiceRegister.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
class Application_Model_ServiceRegister {
|
||||||
|
|
||||||
|
public static function Register($p_componentName, $p_ipAddress){
|
||||||
|
|
||||||
|
$component = CcServiceRegisterQuery::create()->findOneByDbName($p_componentName);
|
||||||
|
|
||||||
|
if ($component == NULL){
|
||||||
|
$component = new CcServiceRegister();
|
||||||
|
$component->setDbName($p_componentName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Need to convert ipv6 to ipv4 since Monit server does not appear
|
||||||
|
// to allow access via an ipv6 address.
|
||||||
|
// http://[::1]:2812 does not respond.
|
||||||
|
// Bug: http://savannah.nongnu.org/bugs/?27608
|
||||||
|
if ($p_ipAddress == "::1"){
|
||||||
|
$p_ipAddress = "127.0.0.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
$component->setDbIp($p_ipAddress);
|
||||||
|
$component->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
638
airtime_mvc/application/models/ShowInstance.php
Normal file
638
airtime_mvc/application/models/ShowInstance.php
Normal file
|
@ -0,0 +1,638 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Model_ShowInstance {
|
||||||
|
|
||||||
|
private $_instanceId;
|
||||||
|
private $_showInstance;
|
||||||
|
|
||||||
|
public function __construct($instanceId)
|
||||||
|
{
|
||||||
|
$this->_instanceId = $instanceId;
|
||||||
|
$this->_showInstance = CcShowInstancesQuery::create()->findPK($instanceId);
|
||||||
|
|
||||||
|
if (is_null($this->_showInstance)){
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShowId()
|
||||||
|
{
|
||||||
|
return $this->_showInstance->getDbShowId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShowInstanceId()
|
||||||
|
{
|
||||||
|
return $this->_instanceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShow(){
|
||||||
|
return new Application_Model_Show($this->getShowId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isRebroadcast()
|
||||||
|
{
|
||||||
|
return $this->_showInstance->getDbOriginalShow();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isRecorded()
|
||||||
|
{
|
||||||
|
return $this->_showInstance->getDbRecord();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
$show = CcShowQuery::create()->findPK($this->getShowId());
|
||||||
|
return $show->getDbName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGenre()
|
||||||
|
{
|
||||||
|
$show = CcShowQuery::create()->findPK($this->getShowId());
|
||||||
|
return $show->getDbGenre();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShowStart()
|
||||||
|
{
|
||||||
|
return $this->_showInstance->getDbStarts();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShowEnd()
|
||||||
|
{
|
||||||
|
return $this->_showInstance->getDbEnds();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStartDate()
|
||||||
|
{
|
||||||
|
$showStart = $this->getShowStart();
|
||||||
|
$showStartExplode = explode(" ", $showStart);
|
||||||
|
return $showStartExplode[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStartTime()
|
||||||
|
{
|
||||||
|
$showStart = $this->getShowStart();
|
||||||
|
$showStartExplode = explode(" ", $showStart);
|
||||||
|
|
||||||
|
return $showStartExplode[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSoundCloudFileId($p_soundcloud_id)
|
||||||
|
{
|
||||||
|
$file = Application_Model_StoredFile::Recall($this->_showInstance->getDbRecordedFile());
|
||||||
|
$file->setSoundCloudFileId($p_soundcloud_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSoundCloudFileId()
|
||||||
|
{
|
||||||
|
$file = Application_Model_StoredFile::Recall($this->_showInstance->getDbRecordedFile());
|
||||||
|
return $file->getSoundCloudId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecordedFile()
|
||||||
|
{
|
||||||
|
$file_id = $this->_showInstance->getDbRecordedFile();
|
||||||
|
|
||||||
|
if(isset($file_id)) {
|
||||||
|
$file = Application_Model_StoredFile::Recall($file_id);
|
||||||
|
|
||||||
|
if (PEAR::isError($file)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(file_exists($file->getFilePath())) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setShowStart($start)
|
||||||
|
{
|
||||||
|
$this->_showInstance->setDbStarts($start)
|
||||||
|
->save();
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setShowEnd($end)
|
||||||
|
{
|
||||||
|
$this->_showInstance->setDbEnds($end)
|
||||||
|
->save();
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateScheduledTime()
|
||||||
|
{
|
||||||
|
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
|
||||||
|
$this->_showInstance->updateDbTimeFilled($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function correctScheduleStartTimes(){
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$instance_id = $this->getShowInstanceId();
|
||||||
|
$sql = "SELECT starts from cc_schedule"
|
||||||
|
." WHERE instance_id = $instance_id"
|
||||||
|
." ORDER BY starts"
|
||||||
|
." LIMIT 1";
|
||||||
|
|
||||||
|
$scheduleStarts = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
if (!is_null($scheduleStarts)){
|
||||||
|
$scheduleStartsEpoch = strtotime($scheduleStarts);
|
||||||
|
$showStartsEpoch = strtotime($this->getShowStart());
|
||||||
|
|
||||||
|
$diff = $showStartsEpoch - $scheduleStartsEpoch;
|
||||||
|
|
||||||
|
if ($diff != 0){
|
||||||
|
$sql = "UPDATE cc_schedule"
|
||||||
|
." SET starts = starts + INTERVAL '$diff' second,"
|
||||||
|
." ends = ends + INTERVAL '$diff' second"
|
||||||
|
." WHERE instance_id = $instance_id";
|
||||||
|
|
||||||
|
$CC_DBC->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function moveShow($deltaDay, $deltaMin)
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
if ($this->getShow()->isRepeating()){
|
||||||
|
return "Can't drag and drop repeating shows";
|
||||||
|
}
|
||||||
|
|
||||||
|
$hours = $deltaMin/60;
|
||||||
|
if($hours > 0)
|
||||||
|
$hours = floor($hours);
|
||||||
|
else
|
||||||
|
$hours = ceil($hours);
|
||||||
|
|
||||||
|
$mins = abs($deltaMin%60);
|
||||||
|
|
||||||
|
$today_timestamp = time();
|
||||||
|
$starts = $this->getShowStart();
|
||||||
|
$ends = $this->getShowEnd();
|
||||||
|
|
||||||
|
$startsDateTime = new DateTime($starts, new DateTimeZone("UTC"));
|
||||||
|
|
||||||
|
if($today_timestamp > $startsDateTime->getTimestamp()) {
|
||||||
|
return "Can't move a past show";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT timestamp '{$starts}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
|
||||||
|
$new_starts = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
|
||||||
|
$new_ends = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
$newStartsDateTime = new DateTime($new_starts, new DateTimeZone("UTC"));
|
||||||
|
if($today_timestamp > $newStartsDateTime->getTimestamp()) {
|
||||||
|
return "Can't move show into past";
|
||||||
|
}
|
||||||
|
|
||||||
|
$overlap = Application_Model_Show::getShows($new_starts, $new_ends, array($this->_instanceId));
|
||||||
|
|
||||||
|
if(count($overlap) > 0) {
|
||||||
|
return "Should not overlap shows";
|
||||||
|
}
|
||||||
|
|
||||||
|
$rebroadcast = $this->isRebroadcast();
|
||||||
|
if($rebroadcast) {
|
||||||
|
$sql = "SELECT timestamp '{$new_starts}' < (SELECT starts FROM cc_show_instances WHERE id = {$rebroadcast})";
|
||||||
|
$isBeforeRecordedOriginal = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
if($isBeforeRecordedOriginal === 't'){
|
||||||
|
return "Cannot move a rebroadcast show before its original";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setShowStart($new_starts);
|
||||||
|
$this->setShowEnd($new_ends);
|
||||||
|
$this->correctScheduleStartTimes();
|
||||||
|
|
||||||
|
$show = new Application_Model_Show($this->getShowId());
|
||||||
|
if(!$show->isRepeating()){
|
||||||
|
$show->setShowFirstShow($new_starts);
|
||||||
|
$show->setShowLastShow($new_ends);
|
||||||
|
}
|
||||||
|
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resizeShow($deltaDay, $deltaMin)
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$hours = $deltaMin/60;
|
||||||
|
if($hours > 0)
|
||||||
|
$hours = floor($hours);
|
||||||
|
else
|
||||||
|
$hours = ceil($hours);
|
||||||
|
|
||||||
|
$mins = abs($deltaMin%60);
|
||||||
|
|
||||||
|
$today_timestamp = date("Y-m-d H:i:s");
|
||||||
|
$starts = $this->getShowStart();
|
||||||
|
$ends = $this->getShowEnd();
|
||||||
|
|
||||||
|
if(strtotime($today_timestamp) > strtotime($starts)) {
|
||||||
|
return "can't resize a past show";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
|
||||||
|
$new_ends = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
//only need to check overlap if show increased in size.
|
||||||
|
if(strtotime($new_ends) > strtotime($ends)) {
|
||||||
|
$overlap = Application_Model_Show::getShows($ends, $new_ends);
|
||||||
|
|
||||||
|
if(count($overlap) > 0) {
|
||||||
|
return "Should not overlap shows";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//with overbooking no longer need to check already scheduled content still fits.
|
||||||
|
|
||||||
|
//must update length of all rebroadcast instances.
|
||||||
|
if($this->isRecorded()) {
|
||||||
|
$sql = "UPDATE cc_show_instances SET ends = (ends + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
|
||||||
|
WHERE rebroadcast = 1 AND instance_id = {$this->_instanceId}";
|
||||||
|
$CC_DBC->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setShowEnd($new_ends);
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the group ID for this show.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private function getLastGroupId()
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "SELECT group_id FROM cc_schedule WHERE instance_id = '{$this->_instanceId}' ORDER BY ends DESC LIMIT 1";
|
||||||
|
$res = $CC_DBC->GetOne($sql);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a playlist as the last item of the current show.
|
||||||
|
*
|
||||||
|
* @param int $plId
|
||||||
|
* Playlist ID.
|
||||||
|
*/
|
||||||
|
public function addPlaylistToShow($plId)
|
||||||
|
{
|
||||||
|
$sched = new Application_Model_ScheduleGroup();
|
||||||
|
$lastGroupId = $this->getLastGroupId();
|
||||||
|
|
||||||
|
if (is_null($lastGroupId)) {
|
||||||
|
$groupId = $sched->add($this->_instanceId, $this->getShowStart(), null, $plId);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$groupId = $sched->addPlaylistAfter($this->_instanceId, $lastGroupId, $plId);
|
||||||
|
}
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
$this->updateScheduledTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a media file as the last item in the show.
|
||||||
|
*
|
||||||
|
* @param int $file_id
|
||||||
|
*/
|
||||||
|
public function addFileToShow($file_id)
|
||||||
|
{
|
||||||
|
$sched = new Application_Model_ScheduleGroup();
|
||||||
|
$lastGroupId = $this->getLastGroupId();
|
||||||
|
|
||||||
|
if (is_null($lastGroupId)) {
|
||||||
|
$groupId = $sched->add($this->_instanceId, $this->getShowStart(), $file_id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$groupId = $sched->addFileAfter($this->_instanceId, $lastGroupId, $file_id);
|
||||||
|
}
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
$this->updateScheduledTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the given playlists to the show.
|
||||||
|
*
|
||||||
|
* @param array $plIds
|
||||||
|
* An array of playlist IDs.
|
||||||
|
*/
|
||||||
|
public function scheduleShow($plIds)
|
||||||
|
{
|
||||||
|
foreach ($plIds as $plId) {
|
||||||
|
$this->addPlaylistToShow($plId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeGroupFromShow($group_id)
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT MAX(ends) as end_timestamp, (MAX(ends) - MIN(starts)) as length
|
||||||
|
FROM cc_schedule
|
||||||
|
WHERE group_id = '{$group_id}'";
|
||||||
|
|
||||||
|
$groupBoundry = $CC_DBC->GetRow($sql);
|
||||||
|
|
||||||
|
$group = CcScheduleQuery::create()
|
||||||
|
->filterByDbGroupId($group_id)
|
||||||
|
->delete();
|
||||||
|
|
||||||
|
$sql = "UPDATE cc_schedule
|
||||||
|
SET starts = (starts - INTERVAL '{$groupBoundry["length"]}'), ends = (ends - INTERVAL '{$groupBoundry["length"]}')
|
||||||
|
WHERE starts >= '{$groupBoundry["end_timestamp"]}' AND instance_id = {$this->_instanceId}";
|
||||||
|
|
||||||
|
$CC_DBC->query($sql);
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
$this->updateScheduledTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clearShow()
|
||||||
|
{
|
||||||
|
CcScheduleQuery::create()
|
||||||
|
->filterByDbInstanceId($this->_instanceId)
|
||||||
|
->delete();
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
$this->updateScheduledTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteShow()
|
||||||
|
{
|
||||||
|
// see if it was recording show
|
||||||
|
$recording = CcShowInstancesQuery::create()
|
||||||
|
->findPK($this->_instanceId)
|
||||||
|
->getDbRecord();
|
||||||
|
CcShowInstancesQuery::create()
|
||||||
|
->findPK($this->_instanceId)
|
||||||
|
->delete();
|
||||||
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
if($recording){
|
||||||
|
Application_Model_RabbitMq::SendMessageToShowRecorder("cancel_recording");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRecordedFile($file_id)
|
||||||
|
{
|
||||||
|
$showInstance = CcShowInstancesQuery::create()
|
||||||
|
->findPK($this->_instanceId);
|
||||||
|
$showInstance->setDbRecordedFile($file_id)
|
||||||
|
->save();
|
||||||
|
|
||||||
|
$rebroadcasts = CcShowInstancesQuery::create()
|
||||||
|
->filterByDbOriginalShow($this->_instanceId)
|
||||||
|
->find();
|
||||||
|
|
||||||
|
foreach ($rebroadcasts as $rebroadcast) {
|
||||||
|
|
||||||
|
$rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId());
|
||||||
|
$rebroad->addFileToShow($file_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTimeScheduled()
|
||||||
|
{
|
||||||
|
$time = $this->_showInstance->getDbTimeFilled();
|
||||||
|
|
||||||
|
if(is_null($time)) {
|
||||||
|
$time = "00:00:00";
|
||||||
|
}
|
||||||
|
return $time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPercentScheduled()
|
||||||
|
{
|
||||||
|
$start_timestamp = $this->getShowStart();
|
||||||
|
$end_timestamp = $this->getShowEnd();
|
||||||
|
$time_filled = $this->getTimeScheduled();
|
||||||
|
|
||||||
|
$s_epoch = strtotime($start_timestamp);
|
||||||
|
$e_epoch = strtotime($end_timestamp);
|
||||||
|
$i_epoch = Application_Model_Schedule::WallTimeToMillisecs($time_filled) / 1000;
|
||||||
|
|
||||||
|
$percent = ceil(($i_epoch / ($e_epoch - $s_epoch)) * 100);
|
||||||
|
|
||||||
|
if ($percent > 100)
|
||||||
|
$percent = 100;
|
||||||
|
|
||||||
|
return $percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShowLength()
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$start_timestamp = $this->getShowStart();
|
||||||
|
$end_timestamp = $this->getShowEnd();
|
||||||
|
|
||||||
|
$sql = "SELECT TIMESTAMP '{$end_timestamp}' - TIMESTAMP '{$start_timestamp}' ";
|
||||||
|
$length = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
return $length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchPlaylistsForShow($datatables)
|
||||||
|
{
|
||||||
|
return Application_Model_StoredFile::searchPlaylistsForSchedule($datatables);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShowListContent()
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT *
|
||||||
|
FROM (cc_schedule AS s LEFT JOIN cc_files AS f ON f.id = s.file_id
|
||||||
|
LEFT JOIN cc_playlist AS p ON p.id = s.playlist_id )
|
||||||
|
|
||||||
|
WHERE s.instance_id = '{$this->_instanceId}' ORDER BY starts";
|
||||||
|
|
||||||
|
return $CC_DBC->GetAll($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShowContent()
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$res = $this->getShowListContent();
|
||||||
|
|
||||||
|
if(count($res) <= 0) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
$items = array();
|
||||||
|
$currGroupId = -1;
|
||||||
|
$pl_counter = -1;
|
||||||
|
$f_counter = -1;
|
||||||
|
foreach ($res as $row) {
|
||||||
|
if($currGroupId != $row["group_id"]){
|
||||||
|
$currGroupId = $row["group_id"];
|
||||||
|
$pl_counter = $pl_counter + 1;
|
||||||
|
$f_counter = -1;
|
||||||
|
|
||||||
|
$items[$pl_counter]["pl_name"] = $row["name"];
|
||||||
|
$items[$pl_counter]["pl_creator"] = $row["creator"];
|
||||||
|
$items[$pl_counter]["pl_description"] = $row["description"];
|
||||||
|
$items[$pl_counter]["pl_group"] = $row["group_id"];
|
||||||
|
|
||||||
|
$sql = "SELECT SUM(clip_length) FROM cc_schedule WHERE group_id = '{$currGroupId}'";
|
||||||
|
$length = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
$items[$pl_counter]["pl_length"] = $length;
|
||||||
|
}
|
||||||
|
$f_counter = $f_counter + 1;
|
||||||
|
|
||||||
|
$items[$pl_counter]["pl_content"][$f_counter]["f_name"] = $row["track_title"];
|
||||||
|
$items[$pl_counter]["pl_content"][$f_counter]["f_artist"] = $row["artist_name"];
|
||||||
|
$items[$pl_counter]["pl_content"][$f_counter]["f_length"] = $row["length"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetShowsInstancesIdsInRange($p_timeNow, $p_start, $p_end)
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT id FROM cc_show_instances AS si "
|
||||||
|
."WHERE ("
|
||||||
|
."(si.starts < TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds' "
|
||||||
|
."AND si.ends > TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds') "
|
||||||
|
."OR (si.starts > TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds' "
|
||||||
|
."AND si.ends < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') "
|
||||||
|
."OR (si.starts < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds' "
|
||||||
|
."AND si.ends > TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') "
|
||||||
|
.") "
|
||||||
|
." ORDER BY si.starts";
|
||||||
|
|
||||||
|
$rows = $CC_DBC->GetAll($sql);
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getScheduleItemsInRange($timeNow, $start, $end)
|
||||||
|
{
|
||||||
|
global $CC_DBC, $CC_CONFIG;
|
||||||
|
|
||||||
|
$instanceId = $this->_instanceId;
|
||||||
|
|
||||||
|
$sql = "SELECT"
|
||||||
|
." si.starts as show_starts,"
|
||||||
|
." si.ends as show_ends,"
|
||||||
|
." si.rebroadcast as rebroadcast,"
|
||||||
|
." st.starts as item_starts,"
|
||||||
|
." st.ends as item_ends,"
|
||||||
|
." st.clip_length as clip_length,"
|
||||||
|
." ft.track_title as track_title,"
|
||||||
|
." ft.artist_name as artist_name,"
|
||||||
|
." ft.album_title as album_title,"
|
||||||
|
." s.name as show_name,"
|
||||||
|
." si.id as instance_id,"
|
||||||
|
." pt.name as playlist_name"
|
||||||
|
." FROM $CC_CONFIG[showInstances] si"
|
||||||
|
." LEFT JOIN $CC_CONFIG[scheduleTable] st"
|
||||||
|
." ON st.instance_id = si.id"
|
||||||
|
." LEFT JOIN $CC_CONFIG[playListTable] pt"
|
||||||
|
." ON st.playlist_id = pt.id"
|
||||||
|
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
||||||
|
." ON st.file_id = ft.id"
|
||||||
|
." LEFT JOIN $CC_CONFIG[showTable] s"
|
||||||
|
." ON si.show_id = s.id"
|
||||||
|
." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')"
|
||||||
|
." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')"
|
||||||
|
." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))"
|
||||||
|
." AND (st.starts < si.ends)"
|
||||||
|
." AND si.id = $instanceId"
|
||||||
|
." ORDER BY si.starts, st.starts";
|
||||||
|
|
||||||
|
return $CC_DBC->GetAll($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLastAudioItemEnd(){
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT ends FROM cc_schedule "
|
||||||
|
."WHERE instance_id = {$this->_instanceId} "
|
||||||
|
."ORDER BY ends DESC "
|
||||||
|
."LIMIT 1";
|
||||||
|
|
||||||
|
return $CC_DBC->GetOne($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShowEndGapTime(){
|
||||||
|
$showEnd = $this->getShowEnd();
|
||||||
|
$lastItemEnd = $this->getLastAudioItemEnd();
|
||||||
|
|
||||||
|
if (is_null($lastItemEnd)){
|
||||||
|
$lastItemEnd = $this->getShowStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$diff = strtotime($showEnd) - strtotime($lastItemEnd);
|
||||||
|
|
||||||
|
return ($diff < 0) ? 0 : $diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetLastShowInstance($p_timeNow){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT si.id"
|
||||||
|
." FROM $CC_CONFIG[showInstances] si"
|
||||||
|
." WHERE si.ends < TIMESTAMP '$p_timeNow'"
|
||||||
|
." ORDER BY si.ends DESC"
|
||||||
|
." LIMIT 1";
|
||||||
|
|
||||||
|
$id = $CC_DBC->GetOne($sql);
|
||||||
|
if (is_null($id)){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return new Application_Model_ShowInstance($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetCurrentShowInstance($p_timeNow){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT si.id"
|
||||||
|
." FROM $CC_CONFIG[showInstances] si"
|
||||||
|
." WHERE si.starts <= TIMESTAMP '$p_timeNow'"
|
||||||
|
." AND si.ends > TIMESTAMP '$p_timeNow'"
|
||||||
|
." LIMIT 1";
|
||||||
|
|
||||||
|
$id = $CC_DBC->GetOne($sql);
|
||||||
|
if (is_null($id)){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return new Application_Model_ShowInstance($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetNextShowInstance($p_timeNow){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
$sql = "SELECT si.id"
|
||||||
|
." FROM $CC_CONFIG[showInstances] si"
|
||||||
|
." WHERE si.starts > TIMESTAMP '$p_timeNow'"
|
||||||
|
." ORDER BY si.starts"
|
||||||
|
." LIMIT 1";
|
||||||
|
|
||||||
|
$id = $CC_DBC->GetOne($sql);
|
||||||
|
if (is_null($id)){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return new Application_Model_ShowInstance($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns number of show instances that ends later than $day
|
||||||
|
public static function GetShowInstanceCount($day){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "SELECT count(*) as cnt FROM $CC_CONFIG[showInstances] WHERE ends < '$day'";
|
||||||
|
return $CC_DBC->GetOne($sql);
|
||||||
|
}
|
||||||
|
}
|
|
@ -61,7 +61,7 @@ class SmilPlaylist {
|
||||||
return $lspl;
|
return $lspl;
|
||||||
}
|
}
|
||||||
require_once("Playlist.php");
|
require_once("Playlist.php");
|
||||||
$pl =& Playlist::create($gb, $plid, "imported_SMIL");
|
$pl =& Application_Model_Playlist::create($gb, $plid, "imported_SMIL");
|
||||||
if (PEAR::isError($pl)) {
|
if (PEAR::isError($pl)) {
|
||||||
return $pl;
|
return $pl;
|
||||||
}
|
}
|
||||||
|
@ -220,14 +220,14 @@ class SmilPlaylistAudioElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($fadeIn > 0 || $fadeOut > 0) {
|
if ($fadeIn > 0 || $fadeOut > 0) {
|
||||||
$fiGunid = StoredFile::CreateGunid();
|
$fiGunid = Application_Model_StoredFile::CreateGunid();
|
||||||
$fadeIn = Playlist::secondsToPlaylistTime($fadeIn);
|
$fadeIn = Application_Model_Playlist::secondsToPlaylistTime($fadeIn);
|
||||||
$fadeOut = Playlist::secondsToPlaylistTime($fadeOut);
|
$fadeOut = Application_Model_Playlist::secondsToPlaylistTime($fadeOut);
|
||||||
$fInfo = "$ind2<fadeInfo id=\"$fiGunid\" fadeIn=\"$fadeIn\" fadeOut=\"$fadeOut\"/>\n";
|
$fInfo = "$ind2<fadeInfo id=\"$fiGunid\" fadeIn=\"$fadeIn\" fadeOut=\"$fadeOut\"/>\n";
|
||||||
} else {
|
} else {
|
||||||
$fInfo = '';
|
$fInfo = '';
|
||||||
}
|
}
|
||||||
$plElGunid = StoredFile::CreateGunid();
|
$plElGunid = Application_Model_StoredFile::CreateGunid();
|
||||||
$acGunid = $gunid;
|
$acGunid = $gunid;
|
||||||
$type = 'audioClip';
|
$type = 'audioClip';
|
||||||
if (preg_match("|\.([a-zA-Z0-9]+)$|", $uri, $va)) {
|
if (preg_match("|\.([a-zA-Z0-9]+)$|", $uri, $va)) {
|
||||||
|
@ -244,7 +244,7 @@ class SmilPlaylistAudioElement {
|
||||||
}
|
}
|
||||||
//break;
|
//break;
|
||||||
default:
|
default:
|
||||||
$ac = StoredFile::RecallByGunid($gunid);
|
$ac = Application_Model_StoredFile::RecallByGunid($gunid);
|
||||||
if (is_null($ac) || PEAR::isError($ac)) {
|
if (is_null($ac) || PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -257,10 +257,10 @@ class SmilPlaylistAudioElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = basename($tree->attrs['src']->val);
|
$title = basename($tree->attrs['src']->val);
|
||||||
$offset = Playlist::secondsToPlaylistTime($tree->attrs['begin']->val);
|
$offset = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['begin']->val);
|
||||||
$clipStart = Playlist::secondsToPlaylistTime($tree->attrs['clipStart']->val);
|
$clipStart = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['clipStart']->val);
|
||||||
$clipEnd = Playlist::secondsToPlaylistTime($tree->attrs['clipEnd']->val);
|
$clipEnd = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['clipEnd']->val);
|
||||||
$clipLength = Playlist::secondsToPlaylistTime($tree->attrs['clipLength']->val);
|
$clipLength = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['clipLength']->val);
|
||||||
$res = "$ind<playlistElement id=\"$plElGunid\" relativeOffset=\"$offset\" clipStart=\"$clipStart\" clipEnd=\"$clipEnd\" clipLength=\"$clipLength\">\n".
|
$res = "$ind<playlistElement id=\"$plElGunid\" relativeOffset=\"$offset\" clipStart=\"$clipStart\" clipEnd=\"$clipEnd\" clipLength=\"$clipLength\">\n".
|
||||||
"$ind2<$type id=\"$acGunid\" playlength=\"$playlength\" title=\"$title\"/>\n".
|
"$ind2<$type id=\"$acGunid\" playlength=\"$playlength\" title=\"$title\"/>\n".
|
||||||
$fInfo.
|
$fInfo.
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'soundcloud-api/Services/Soundcloud.php';
|
require_once 'soundcloud-api/Services/Soundcloud.php';
|
||||||
|
|
||||||
class ATSoundcloud {
|
class Application_Model_Soundcloud {
|
||||||
|
|
||||||
private $_soundcloud;
|
private $_soundcloud;
|
||||||
|
|
||||||
|
@ -18,11 +17,6 @@ class ATSoundcloud {
|
||||||
$username = Application_Model_Preference::GetSoundCloudUser();
|
$username = Application_Model_Preference::GetSoundCloudUser();
|
||||||
$password = Application_Model_Preference::GetSoundCloudPassword();
|
$password = Application_Model_Preference::GetSoundCloudPassword();
|
||||||
|
|
||||||
if($username === "" || $password === "")
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$token = $this->_soundcloud->accessTokenResourceOwner($username, $password);
|
$token = $this->_soundcloud->accessTokenResourceOwner($username, $password);
|
||||||
|
|
||||||
return $token;
|
return $token;
|
||||||
|
@ -40,13 +34,15 @@ class ATSoundcloud {
|
||||||
$tags = Application_Model_Preference::GetSoundCloudTags();
|
$tags = Application_Model_Preference::GetSoundCloudTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$downloadable = Application_Model_Preference::GetSoundCloudDownloadbleOption() == '1'?true:false;
|
||||||
|
|
||||||
$track_data = array(
|
$track_data = array(
|
||||||
'track[sharing]' => 'private',
|
'track[sharing]' => 'private',
|
||||||
'track[title]' => $filename,
|
'track[title]' => $filename,
|
||||||
'track[asset_data]' => '@' . $filepath,
|
'track[asset_data]' => '@' . $filepath,
|
||||||
'track[tag_list]' => $tags,
|
'track[tag_list]' => $tags,
|
||||||
'track[description]' => $description,
|
'track[description]' => $description,
|
||||||
'track[downloadable]' => true,
|
'track[downloadable]' => $downloadable,
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -87,7 +83,7 @@ class ATSoundcloud {
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
return $response["id"];
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StoredFile class
|
* Application_Model_StoredFile class
|
||||||
*
|
*
|
||||||
* @package Airtime
|
* @package Airtime
|
||||||
* @subpackage StorageServer
|
* @subpackage StorageServer
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
* @see MetaData
|
* @see MetaData
|
||||||
*/
|
*/
|
||||||
class StoredFile {
|
class Application_Model_StoredFile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @holds propel database object
|
* @holds propel database object
|
||||||
|
@ -286,7 +286,7 @@ class StoredFile {
|
||||||
$playlists = array();
|
$playlists = array();
|
||||||
if (is_array($ids) && count($ids) > 0) {
|
if (is_array($ids) && count($ids) > 0) {
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$playlists[] = Playlist::Recall($id);
|
$playlists[] = Application_Model_Playlist::Recall($id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $playlists;
|
return $playlists;
|
||||||
|
@ -310,7 +310,7 @@ class StoredFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Playlist::DeleteFileFromAllPlaylists($this->getId());
|
Application_Model_Playlist::DeleteFileFromAllPlaylists($this->getId());
|
||||||
$this->_file->delete();
|
$this->_file->delete();
|
||||||
|
|
||||||
if (isset($res)) {
|
if (isset($res)) {
|
||||||
|
@ -338,7 +338,7 @@ class StoredFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the file is scheduled to be played in the future
|
// Check if the file is scheduled to be played in the future
|
||||||
if (Schedule::IsFileScheduledInTheFuture($this->getId())) {
|
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->getId())) {
|
||||||
return PEAR::raiseError('Cannot delete a file that is scheduled in the future.');
|
return PEAR::raiseError('Cannot delete a file that is scheduled in the future.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,10 +395,10 @@ class StoredFile {
|
||||||
{
|
{
|
||||||
$mime = $this->_file->getDbMime();
|
$mime = $this->_file->getDbMime();
|
||||||
|
|
||||||
if ($mime == "audio/vorbis") {
|
if ($mime == "audio/vorbis" || $mime == "application/ogg") {
|
||||||
return "ogg";
|
return "ogg";
|
||||||
}
|
}
|
||||||
else if ($mime == "audio/mp3") {
|
else if ($mime == "audio/mp3" || $mime == "audio/mpeg") {
|
||||||
return "mp3";
|
return "mp3";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,7 @@ class StoredFile {
|
||||||
*/
|
*/
|
||||||
public function getFilePath()
|
public function getFilePath()
|
||||||
{
|
{
|
||||||
$music_dir = MusicDir::getDirByPK($this->_file->getDbDirectory());
|
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
||||||
$filepath = $this->_file->getDbFilepath();
|
$filepath = $this->_file->getDbFilepath();
|
||||||
|
|
||||||
return $music_dir->getDirectory().$filepath;
|
return $music_dir->getDirectory().$filepath;
|
||||||
|
@ -423,11 +423,11 @@ class StoredFile {
|
||||||
*/
|
*/
|
||||||
public function setFilePath($p_filepath)
|
public function setFilePath($p_filepath)
|
||||||
{
|
{
|
||||||
$path_info = MusicDir::splitFilePath($p_filepath);
|
$path_info = Application_Model_MusicDir::splitFilePath($p_filepath);
|
||||||
if (is_null($path_info)) {
|
if (is_null($path_info)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
$musicDir = MusicDir::getDirByPath($path_info[0]);
|
$musicDir = Application_Model_MusicDir::getDirByPath($path_info[0]);
|
||||||
|
|
||||||
$this->_file->setDbDirectory($musicDir->getId());
|
$this->_file->setDbDirectory($musicDir->getId());
|
||||||
$this->_file->setDbFilepath($path_info[1]);
|
$this->_file->setDbFilepath($path_info[1]);
|
||||||
|
@ -435,12 +435,32 @@ class StoredFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the URL to access this file.
|
* Get the URL to access this file using the server name/address that
|
||||||
|
* this PHP script was invoked through.
|
||||||
*/
|
*/
|
||||||
public function getFileUrl()
|
public function getFileUrl()
|
||||||
{
|
{
|
||||||
|
$serverName = $_SERVER['SERVER_NAME'];
|
||||||
|
$serverPort = $_SERVER['SERVER_PORT'];
|
||||||
|
|
||||||
|
return $this->constructGetFileUrl($serverName, $serverPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the URL to access this file using the server name/address that
|
||||||
|
* is specified in the airtime.conf config file.
|
||||||
|
*/
|
||||||
|
public function getFileUrlUsingConfigAddress(){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
return "http://$CC_CONFIG[baseUrl]:$CC_CONFIG[basePort]/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
|
||||||
|
$serverName = $CC_CONFIG['baseUrl'];
|
||||||
|
$serverPort = $CC_CONFIG['basePort'];
|
||||||
|
|
||||||
|
return $this->constructGetFileUrl($serverName, $serverPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function constructGetFileUrl($p_serverName, $p_serverPort){
|
||||||
|
return "http://$p_serverName:$p_serverPort/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -457,7 +477,7 @@ class StoredFile {
|
||||||
$file = new CcFiles();
|
$file = new CcFiles();
|
||||||
$file->setDbGunid(md5(uniqid("", true)));
|
$file->setDbGunid(md5(uniqid("", true)));
|
||||||
|
|
||||||
$storedFile = new StoredFile();
|
$storedFile = new Application_Model_StoredFile();
|
||||||
$storedFile->_file = $file;
|
$storedFile->_file = $file;
|
||||||
|
|
||||||
if(isset($md['MDATA_KEY_FILEPATH'])) {
|
if(isset($md['MDATA_KEY_FILEPATH'])) {
|
||||||
|
@ -488,7 +508,7 @@ class StoredFile {
|
||||||
* global unique id of file
|
* global unique id of file
|
||||||
* @param string $p_md5sum
|
* @param string $p_md5sum
|
||||||
* MD5 sum of the file
|
* MD5 sum of the file
|
||||||
* @return StoredFile|NULL
|
* @return Application_Model_StoredFile|NULL
|
||||||
* Return NULL if the object doesnt exist in the DB.
|
* Return NULL if the object doesnt exist in the DB.
|
||||||
*/
|
*/
|
||||||
public static function Recall($p_id=null, $p_gunid=null, $p_md5sum=null, $p_filepath=null)
|
public static function Recall($p_id=null, $p_gunid=null, $p_md5sum=null, $p_filepath=null)
|
||||||
|
@ -507,12 +527,12 @@ class StoredFile {
|
||||||
->findOne();
|
->findOne();
|
||||||
}
|
}
|
||||||
else if (isset($p_filepath)) {
|
else if (isset($p_filepath)) {
|
||||||
$path_info = MusicDir::splitFilePath($p_filepath);
|
$path_info = Application_Model_MusicDir::splitFilePath($p_filepath);
|
||||||
|
|
||||||
if (is_null($path_info)) {
|
if (is_null($path_info)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$music_dir = MusicDir::getDirByPath($path_info[0]);
|
$music_dir = Application_Model_MusicDir::getDirByPath($path_info[0]);
|
||||||
|
|
||||||
$file = CcFilesQuery::create()
|
$file = CcFilesQuery::create()
|
||||||
->filterByDbDirectory($music_dir->getId())
|
->filterByDbDirectory($music_dir->getId())
|
||||||
|
@ -524,7 +544,7 @@ class StoredFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($file)) {
|
if (isset($file)) {
|
||||||
$storedFile = new StoredFile();
|
$storedFile = new Application_Model_StoredFile();
|
||||||
$storedFile->_file = $file;
|
$storedFile->_file = $file;
|
||||||
|
|
||||||
return $storedFile;
|
return $storedFile;
|
||||||
|
@ -545,34 +565,55 @@ class StoredFile {
|
||||||
*
|
*
|
||||||
* @param string $p_gunid
|
* @param string $p_gunid
|
||||||
* global unique id of file
|
* global unique id of file
|
||||||
* @return StoredFile|NULL
|
* @return Application_Model_StoredFile|NULL
|
||||||
*/
|
*/
|
||||||
public static function RecallByGunid($p_gunid)
|
public static function RecallByGunid($p_gunid)
|
||||||
{
|
{
|
||||||
return StoredFile::Recall(null, $p_gunid);
|
return Application_Model_StoredFile::Recall(null, $p_gunid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the StoredFile by looking up the MD5 value.
|
* Fetch the Application_Model_StoredFile by looking up the MD5 value.
|
||||||
*
|
*
|
||||||
* @param string $p_md5sum
|
* @param string $p_md5sum
|
||||||
* @return StoredFile|NULL
|
* @return Application_Model_StoredFile|NULL
|
||||||
*/
|
*/
|
||||||
public static function RecallByMd5($p_md5sum)
|
public static function RecallByMd5($p_md5sum)
|
||||||
{
|
{
|
||||||
return StoredFile::Recall(null, null, $p_md5sum);
|
return Application_Model_StoredFile::Recall(null, null, $p_md5sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the StoredFile by looking up its filepath.
|
* Fetch the Application_Model_StoredFile by looking up its filepath.
|
||||||
*
|
*
|
||||||
* @param string $p_filepath path of file stored in Airtime.
|
* @param string $p_filepath path of file stored in Airtime.
|
||||||
* @return StoredFile|NULL
|
* @return Application_Model_StoredFile|NULL
|
||||||
*/
|
*/
|
||||||
public static function RecallByFilepath($p_filepath)
|
public static function RecallByFilepath($p_filepath)
|
||||||
{
|
{
|
||||||
return StoredFile::Recall(null, null, null, $p_filepath);
|
return Application_Model_StoredFile::Recall(null, null, null, $p_filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function RecallByPartialFilepath($partial_path){
|
||||||
|
$path_info = Application_Model_MusicDir::splitFilePath($partial_path);
|
||||||
|
|
||||||
|
if (is_null($path_info)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$music_dir = Application_Model_MusicDir::getDirByPath($path_info[0]);
|
||||||
|
|
||||||
|
$files = CcFilesQuery::create()
|
||||||
|
->filterByDbDirectory($music_dir->getId())
|
||||||
|
->filterByDbFilepath("$path_info[1]%")
|
||||||
|
->find();
|
||||||
|
$res = array();
|
||||||
|
foreach ($files as $file){
|
||||||
|
$storedFile = new Application_Model_StoredFile();
|
||||||
|
$storedFile->_file = $file;
|
||||||
|
$res[] = $storedFile;
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function searchFilesForPlaylistBuilder($datatables) {
|
public static function searchFilesForPlaylistBuilder($datatables) {
|
||||||
|
@ -614,7 +655,7 @@ class StoredFile {
|
||||||
|
|
||||||
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS";
|
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS";
|
||||||
|
|
||||||
return StoredFile::searchFiles($fromTable, $datatables);
|
return Application_Model_StoredFile::searchFiles($fromTable, $datatables);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,7 +665,7 @@ class StoredFile {
|
||||||
//$datatables["optWhere"][] = "INTERVAL '{$time_remaining}' > INTERVAL '00:00:00'";
|
//$datatables["optWhere"][] = "INTERVAL '{$time_remaining}' > INTERVAL '00:00:00'";
|
||||||
$datatables["optWhere"][] = "plt.length > INTERVAL '00:00:00'";
|
$datatables["optWhere"][] = "plt.length > INTERVAL '00:00:00'";
|
||||||
|
|
||||||
return StoredFile::searchFiles($fromTable, $datatables);
|
return Application_Model_StoredFile::searchFiles($fromTable, $datatables);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function searchFiles($fromTable, $data)
|
public static function searchFiles($fromTable, $data)
|
||||||
|
@ -728,7 +769,7 @@ class StoredFile {
|
||||||
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
|
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
|
||||||
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
|
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
|
||||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||||
|
Logging::log(__FILE__.":uploadFile(): filename=$fileName to $p_targetDir");
|
||||||
// Clean the fileName for security reasons
|
// Clean the fileName for security reasons
|
||||||
//this needs fixing for songs not in ascii.
|
//this needs fixing for songs not in ascii.
|
||||||
//$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
|
//$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
|
||||||
|
@ -799,7 +840,7 @@ class StoredFile {
|
||||||
/*$audio_file = $p_targetDir . DIRECTORY_SEPARATOR . $fileName;
|
/*$audio_file = $p_targetDir . DIRECTORY_SEPARATOR . $fileName;
|
||||||
|
|
||||||
$md5 = md5_file($audio_file);
|
$md5 = md5_file($audio_file);
|
||||||
$duplicate = StoredFile::RecallByMd5($md5);
|
$duplicate = Application_Model_StoredFile::RecallByMd5($md5);
|
||||||
if ($duplicate) {
|
if ($duplicate) {
|
||||||
if (PEAR::isError($duplicate)) {
|
if (PEAR::isError($duplicate)) {
|
||||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": ' . $duplicate->getMessage() .'}}');
|
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": ' . $duplicate->getMessage() .'}}');
|
||||||
|
@ -810,7 +851,7 @@ class StoredFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$storDir = MusicDir::getStorDir();
|
$storDir = Application_Model_MusicDir::getStorDir();
|
||||||
$stor = $storDir->getDirectory();
|
$stor = $storDir->getDirectory();
|
||||||
|
|
||||||
$stor .= "/organize";
|
$stor .= "/organize";
|
||||||
|
@ -823,20 +864,20 @@ class StoredFile {
|
||||||
|
|
||||||
public static function copyFileToStor($p_targetDir, $fileName){
|
public static function copyFileToStor($p_targetDir, $fileName){
|
||||||
$audio_file = $p_targetDir . DIRECTORY_SEPARATOR . $fileName;
|
$audio_file = $p_targetDir . DIRECTORY_SEPARATOR . $fileName;
|
||||||
|
Logging::log('copyFileToStor: moving file '.$audio_file);
|
||||||
$md5 = md5_file($audio_file);
|
$md5 = md5_file($audio_file);
|
||||||
$duplicate = StoredFile::RecallByMd5($md5);
|
$duplicate = Application_Model_StoredFile::RecallByMd5($md5);
|
||||||
if ($duplicate) {
|
if ($duplicate) {
|
||||||
if (PEAR::isError($duplicate)) {
|
if (PEAR::isError($duplicate)) {
|
||||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": ' . $duplicate->getMessage() .'}}');
|
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": ' . $duplicate->getMessage() .'}}');
|
||||||
}
|
}
|
||||||
if (file_exists($duplicate->getFilePath())) {
|
if (file_exists($duplicate->getFilePath())) {
|
||||||
$duplicateName = $duplicate->getMetadataValue('MDATA_KEY_TITLE');
|
$duplicateName = $duplicate->getMetadataValue('MDATA_KEY_TITLE');
|
||||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "An identical audioclip named ' . $duplicateName . ' already exists in the storage server."}}');
|
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "An identical audioclip named \"' . $duplicateName . '\" already exists on the server."}}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$storDir = MusicDir::getStorDir();
|
$storDir = Application_Model_MusicDir::getStorDir();
|
||||||
$stor = $storDir->getDirectory();
|
$stor = $storDir->getDirectory();
|
||||||
|
|
||||||
$stor .= "/organize";
|
$stor .= "/organize";
|
||||||
|
@ -844,6 +885,7 @@ class StoredFile {
|
||||||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||||
|
|
||||||
$r = @copy($audio_file, $audio_stor);
|
$r = @copy($audio_file, $audio_stor);
|
||||||
|
//$r = @unlink($audio_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFileCount()
|
public static function getFileCount()
|
||||||
|
@ -875,5 +917,84 @@ class StoredFile {
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setSoundCloudLinkToFile($link_to_file)
|
||||||
|
{
|
||||||
|
$this->_file->setDbSoundCloudLinkToFile($link_to_file)
|
||||||
|
->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSoundCloudLinkToFile(){
|
||||||
|
return $this->_file->getDbSoundCloudLinkToFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSoundCloudFileId($p_soundcloud_id)
|
||||||
|
{
|
||||||
|
$this->_file->setDbSoundCloudId($p_soundcloud_id)
|
||||||
|
->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSoundCloudId(){
|
||||||
|
return $this->_file->getDbSoundCloudId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSoundCloudErrorCode($code){
|
||||||
|
$this->_file->setDbSoundCloudErrorCode($code)
|
||||||
|
->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSoundCloudErrorCode(){
|
||||||
|
return $this->_file->getDbSoundCloudErrorCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSoundCloudErrorMsg($msg){
|
||||||
|
$this->_file->setDbSoundCloudErrorMsg($msg)
|
||||||
|
->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSoundCloudErrorMsg(){
|
||||||
|
return $this->_file->getDbSoundCloudErrorMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uploadToSoundCloud()
|
||||||
|
{
|
||||||
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
$file = $this->_file;
|
||||||
|
if(is_null($file)) {
|
||||||
|
return "File does not exist";
|
||||||
|
}
|
||||||
|
if(Application_Model_Preference::GetUploadToSoundcloudOption())
|
||||||
|
{
|
||||||
|
for($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) {
|
||||||
|
$description = $file->getDbTrackTitle();
|
||||||
|
$tag = array();
|
||||||
|
$genre = $file->getDbGenre();
|
||||||
|
$release = $file->getDbYear();
|
||||||
|
try {
|
||||||
|
$soundcloud = new Application_Model_Soundcloud();
|
||||||
|
$soundcloud_res = $soundcloud->uploadTrack($this->getFilePath(), $this->getName(), $description, $tag, $release, $genre);
|
||||||
|
$this->setSoundCloudFileId($soundcloud_res['id']);
|
||||||
|
$this->setSoundCloudLinkToFile($soundcloud_res['permalink_url']);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep($CC_CONFIG['soundcloud-connection-wait']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
124
airtime_mvc/application/models/StreamSetting.php
Normal file
124
airtime_mvc/application/models/StreamSetting.php
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
<?php
|
||||||
|
class Application_Model_StreamSetting {
|
||||||
|
|
||||||
|
/* Returns the id's of all streams that are enabled in an array. An
|
||||||
|
* example of the array returned in JSON notation is ["s1", "s2", "s3"] */
|
||||||
|
public static function getEnabledStreamIds(){
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "SELECT * "
|
||||||
|
."FROM cc_stream_setting "
|
||||||
|
."WHERE keyname LIKE '%_output' "
|
||||||
|
."AND value != 'disabled'";
|
||||||
|
|
||||||
|
$rows = $CC_DBC->getAll($sql);
|
||||||
|
$ids = array();
|
||||||
|
|
||||||
|
foreach ($rows as $row){
|
||||||
|
$ids[] = substr($row["keyname"], 0, strpos($row["keyname"], "_"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Logging::log(print_r($ids, true));
|
||||||
|
|
||||||
|
return $ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns all information related to a specific stream. An example
|
||||||
|
* of a stream id is 's1' or 's2'. */
|
||||||
|
public static function getStreamData($p_streamId){
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "SELECT * "
|
||||||
|
."FROM cc_stream_setting "
|
||||||
|
."WHERE keyname LIKE '${p_streamId}_%'";
|
||||||
|
|
||||||
|
$rows = $CC_DBC->getAll($sql);
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
foreach($rows as $row){
|
||||||
|
$data[$row["keyname"]] = $row["value"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getStreamSetting(){
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "SELECT *"
|
||||||
|
." FROM cc_stream_setting"
|
||||||
|
." WHERE keyname not like '%_error'";
|
||||||
|
|
||||||
|
$rows = $CC_DBC->getAll($sql);
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setStreamSetting($data){
|
||||||
|
global $CC_DBC;
|
||||||
|
foreach($data as $key=>$d){
|
||||||
|
if($key == "output_sound_device"){
|
||||||
|
$v = $d == 1?"true":"false";
|
||||||
|
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$key'";
|
||||||
|
$CC_DBC->query($sql);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$temp = explode('_', $key);
|
||||||
|
$prefix = $temp[0];
|
||||||
|
foreach($d as $k=>$v){
|
||||||
|
$keyname = $prefix."_".$k;
|
||||||
|
if( $k == 'output'){
|
||||||
|
if( $d["enable"] == 0){
|
||||||
|
$v = 'disabled';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$v = trim($v);
|
||||||
|
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
||||||
|
$CC_DBC->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setLiquidsoapError($stream_id, $msg){
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$keyname = "s".$stream_id."_liquidsoap_error";
|
||||||
|
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
||||||
|
." WHERE keyname = '$keyname'";
|
||||||
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
if ($result == 1){
|
||||||
|
$sql = "UPDATE cc_stream_setting"
|
||||||
|
." SET value = '$msg'"
|
||||||
|
." WHERE keyname = '$keyname'";
|
||||||
|
}else{
|
||||||
|
$sql = "INSERT INTO cc_stream_setting (keyname, value, type)"
|
||||||
|
." VALUES ('$keyname', '$msg', 'string')";
|
||||||
|
}
|
||||||
|
$res = $CC_DBC->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLiquidsoapError($stream_id){
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$keyname = "s".$stream_id."_liquidsoap_error";
|
||||||
|
$sql = "SELECT value FROM cc_stream_setting"
|
||||||
|
." WHERE keyname = '$keyname'";
|
||||||
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getStreamEnabled($stream_id){
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$keyname = "s".$stream_id."_output";
|
||||||
|
$sql = "SELECT value FROM cc_stream_setting"
|
||||||
|
." WHERE keyname = '$keyname'";
|
||||||
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
|
if($result == 'disabled'){
|
||||||
|
$result = false;
|
||||||
|
}else{
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ define('ALIBERR_BADSMEMB', 21);
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
* @copyright 2010 Sourcefabric O.P.S.
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
*/
|
*/
|
||||||
class Subjects {
|
class Application_Model_Subjects {
|
||||||
|
|
||||||
/* ======================================================= public methods */
|
/* ======================================================= public methods */
|
||||||
|
|
||||||
|
@ -118,6 +118,38 @@ class Subjects {
|
||||||
return (intval($res) > 0);
|
return (intval($res) > 0);
|
||||||
} // fn isMemberOf
|
} // fn isMemberOf
|
||||||
|
|
||||||
|
public static function increaseLoginAttempts($login){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = login_attempts+1"
|
||||||
|
." WHERE login='$login'";
|
||||||
|
$res = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
return (intval($res) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function resetLoginAttempts($login){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = '0'"
|
||||||
|
." WHERE login='$login'";
|
||||||
|
$res = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
return (intval($res) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLoginAttempts($login){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "SELECT login_attempts FROM ".$CC_CONFIG['subjTable']." WHERE login='$login'";
|
||||||
|
$res = $CC_DBC->getOne($sql);
|
||||||
|
Logging::log($res);
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
} // class Subjects
|
} // class Subjects
|
||||||
|
|
||||||
|
|
208
airtime_mvc/application/models/Systemstatus.php
Normal file
208
airtime_mvc/application/models/Systemstatus.php
Normal file
|
@ -0,0 +1,208 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Model_Systemstatus
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function GetMonitStatus($p_ip){
|
||||||
|
|
||||||
|
$url = "http://$p_ip:2812/_status?format=xml";
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_USERPWD, "admin:monit");
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
$docRoot = null;
|
||||||
|
if ($result != ""){
|
||||||
|
$xmlDoc = new DOMDocument();
|
||||||
|
$xmlDoc->loadXML($result);
|
||||||
|
$docRoot = $xmlDoc->documentElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $docRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function ExtractServiceInformation($p_docRoot, $p_serviceName){
|
||||||
|
|
||||||
|
$starting = array(
|
||||||
|
"name"=>"",
|
||||||
|
"process_id"=>"STARTING...",
|
||||||
|
"uptime_seconds"=>"-1",
|
||||||
|
"status"=>true,
|
||||||
|
"memory_perc"=>"0%",
|
||||||
|
"memory_kb"=>"0",
|
||||||
|
"cpu_perc"=>"0%");
|
||||||
|
|
||||||
|
$notRunning = array(
|
||||||
|
"name"=>$p_serviceName,
|
||||||
|
"process_id"=>"FAILED",
|
||||||
|
"uptime_seconds"=>"-1",
|
||||||
|
"status"=>false,
|
||||||
|
"memory_perc"=>"0%",
|
||||||
|
"memory_kb"=>"0",
|
||||||
|
"cpu_perc"=>"0%"
|
||||||
|
);
|
||||||
|
$data = $notRunning;
|
||||||
|
|
||||||
|
|
||||||
|
if (!is_null($p_docRoot)){
|
||||||
|
foreach ($p_docRoot->getElementsByTagName("service") AS $item)
|
||||||
|
{
|
||||||
|
if ($item->getElementsByTagName("name")->item(0)->nodeValue == $p_serviceName){
|
||||||
|
|
||||||
|
$monitor = $item->getElementsByTagName("monitor");
|
||||||
|
if ($monitor->length > 0){
|
||||||
|
$status = $monitor->item(0)->nodeValue;
|
||||||
|
if ($status == "2"){
|
||||||
|
$data = $starting;
|
||||||
|
} else if ($status == 0){
|
||||||
|
$data = $notRunning;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$process_id = $item->getElementsByTagName("name");
|
||||||
|
if ($process_id->length > 0){
|
||||||
|
$data["name"] = $process_id->item(0)->nodeValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$process_id = $item->getElementsByTagName("pid");
|
||||||
|
if ($process_id->length > 0){
|
||||||
|
$data["process_id"] = $process_id->item(0)->nodeValue;
|
||||||
|
$data["status"] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$uptime = $item->getElementsByTagName("uptime");
|
||||||
|
if ($uptime->length > 0){
|
||||||
|
$data["uptime_seconds"] = $uptime->item(0)->nodeValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$memory = $item->getElementsByTagName("memory");
|
||||||
|
if ($memory->length > 0){
|
||||||
|
$data["memory_perc"] = $memory->item(0)->getElementsByTagName("percenttotal")->item(0)->nodeValue."%";
|
||||||
|
$data["memory_kb"] = $memory->item(0)->getElementsByTagName("kilobytetotal")->item(0)->nodeValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cpu = $item->getElementsByTagName("cpu");
|
||||||
|
if ($cpu->length > 0){
|
||||||
|
$data["cpu_perc"] = $cpu->item(0)->getElementsByTagName("percent")->item(0)->nodeValue."%";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetPlatformInfo(){
|
||||||
|
$data = array("release"=>"UNKNOWN",
|
||||||
|
"machine"=>"UNKNOWN",
|
||||||
|
"memory"=>"UNKNOWN",
|
||||||
|
"swap"=>"UNKNOWN");
|
||||||
|
|
||||||
|
$docRoot = self::GetMonitStatus("localhost");
|
||||||
|
if (!is_null($docRoot)){
|
||||||
|
foreach ($docRoot->getElementsByTagName("platform") AS $item)
|
||||||
|
{
|
||||||
|
$data["release"] = $item->getElementsByTagName("release")->item(0)->nodeValue;
|
||||||
|
$data["machine"] = $item->getElementsByTagName("machine")->item(0)->nodeValue;
|
||||||
|
$data["memory"] = $item->getElementsByTagName("memory")->item(0)->nodeValue;
|
||||||
|
$data["swap"] = $item->getElementsByTagName("swap")->item(0)->nodeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetPypoStatus(){
|
||||||
|
|
||||||
|
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
||||||
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
|
$data = self::ExtractServiceInformation($docRoot, "airtime-playout");
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetLiquidsoapStatus(){
|
||||||
|
|
||||||
|
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
||||||
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
|
$data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap");
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetShowRecorderStatus(){
|
||||||
|
|
||||||
|
$component = CcServiceRegisterQuery::create()->findOneByDbName("show-recorder");
|
||||||
|
if (is_null($component)){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
|
$data = self::ExtractServiceInformation($docRoot, "airtime-show-recorder");
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetMediaMonitorStatus(){
|
||||||
|
|
||||||
|
$component = CcServiceRegisterQuery::create()->findOneByDbName("media-monitor");
|
||||||
|
if (is_null($component)){
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
$ip = $component->getDbIp();
|
||||||
|
|
||||||
|
$docRoot = self::GetMonitStatus($ip);
|
||||||
|
$data = self::ExtractServiceInformation($docRoot, "airtime-media-monitor");
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetIcecastStatus(){
|
||||||
|
$docRoot = self::GetMonitStatus("localhost");
|
||||||
|
$data = self::ExtractServiceInformation($docRoot, "icecast2");
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetRabbitMqStatus(){
|
||||||
|
$docRoot = self::GetMonitStatus("localhost");
|
||||||
|
$data = self::ExtractServiceInformation($docRoot, "rabbitmq-server");
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetDiskInfo(){
|
||||||
|
/* First lets get all the watched directories. Then we can group them
|
||||||
|
* into the same paritions by comparing the partition sizes. */
|
||||||
|
$musicDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||||
|
$musicDirs[] = Application_Model_MusicDir::getStorDir();
|
||||||
|
|
||||||
|
|
||||||
|
$partions = array();
|
||||||
|
|
||||||
|
foreach($musicDirs as $md){
|
||||||
|
$totalSpace = disk_total_space($md->getDirectory());
|
||||||
|
|
||||||
|
if (!isset($partitions[$totalSpace])){
|
||||||
|
$partitions[$totalSpace] = new StdClass;
|
||||||
|
$partitions[$totalSpace]->totalSpace = $totalSpace;
|
||||||
|
$partitions[$totalSpace]->totalFreeSpace = disk_free_space($md->getDirectory());
|
||||||
|
}
|
||||||
|
|
||||||
|
$partitions[$totalSpace]->dirs[] = $md->getDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_values($partitions);
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ define('UTYPE_ADMIN', 'A');
|
||||||
define('UTYPE_GUEST', 'G');
|
define('UTYPE_GUEST', 'G');
|
||||||
define('UTYPE_PROGRAM_MANAGER', 'P');
|
define('UTYPE_PROGRAM_MANAGER', 'P');
|
||||||
|
|
||||||
class User {
|
class Application_Model_User {
|
||||||
|
|
||||||
private $_userInstance;
|
private $_userInstance;
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ class User {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getHosts($search=NULL) {
|
public static function getHosts($search=NULL) {
|
||||||
return User::getUsers(array('H'), $search);
|
return Application_Model_User::getUsers(array('H'), $search);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUsersDataTablesInfo($datatables_post) {
|
public static function getUsersDataTablesInfo($datatables_post) {
|
||||||
|
@ -232,7 +232,7 @@ class User {
|
||||||
$username = $auth->getIdentity()->login;
|
$username = $auth->getIdentity()->login;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = StoredFile::searchFiles($fromTable, $datatables_post);
|
$res = Application_Model_StoredFile::searchFiles($fromTable, $datatables_post);
|
||||||
|
|
||||||
// mark record which is for the current user
|
// mark record which is for the current user
|
||||||
foreach($res['aaData'] as &$record){
|
foreach($res['aaData'] as &$record){
|
18
airtime_mvc/application/models/airtime/CcLoginAttempts.php
Normal file
18
airtime_mvc/application/models/airtime/CcLoginAttempts.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'cc_login_attempts' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcLoginAttempts extends BaseCcLoginAttempts {
|
||||||
|
|
||||||
|
} // CcLoginAttempts
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_login_attempts' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcLoginAttemptsPeer extends BaseCcLoginAttemptsPeer {
|
||||||
|
|
||||||
|
} // CcLoginAttemptsPeer
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_login_attempts' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcLoginAttemptsQuery extends BaseCcLoginAttemptsQuery {
|
||||||
|
|
||||||
|
} // CcLoginAttemptsQuery
|
18
airtime_mvc/application/models/airtime/CcServiceRegister.php
Normal file
18
airtime_mvc/application/models/airtime/CcServiceRegister.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'cc_service_register' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcServiceRegister extends BaseCcServiceRegister {
|
||||||
|
|
||||||
|
} // CcServiceRegister
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_service_register' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcServiceRegisterPeer extends BaseCcServiceRegisterPeer {
|
||||||
|
|
||||||
|
} // CcServiceRegisterPeer
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_service_register' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcServiceRegisterQuery extends BaseCcServiceRegisterQuery {
|
||||||
|
|
||||||
|
} // CcServiceRegisterQuery
|
18
airtime_mvc/application/models/airtime/CcStreamSetting.php
Normal file
18
airtime_mvc/application/models/airtime/CcStreamSetting.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'cc_stream_setting' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcStreamSetting extends BaseCcStreamSetting {
|
||||||
|
|
||||||
|
} // CcStreamSetting
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_stream_setting' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcStreamSettingPeer extends BaseCcStreamSettingPeer {
|
||||||
|
|
||||||
|
} // CcStreamSettingPeer
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_stream_setting' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime
|
||||||
|
*/
|
||||||
|
class CcStreamSettingQuery extends BaseCcStreamSettingQuery {
|
||||||
|
|
||||||
|
} // CcStreamSettingQuery
|
|
@ -93,6 +93,10 @@ class CcFilesTableMap extends TableMap {
|
||||||
$this->addColumn('SUBJECT', 'DbSubject', 'VARCHAR', false, 512, null);
|
$this->addColumn('SUBJECT', 'DbSubject', 'VARCHAR', false, 512, null);
|
||||||
$this->addColumn('CONTRIBUTOR', 'DbContributor', 'VARCHAR', false, 512, null);
|
$this->addColumn('CONTRIBUTOR', 'DbContributor', 'VARCHAR', false, 512, null);
|
||||||
$this->addColumn('LANGUAGE', 'DbLanguage', 'VARCHAR', false, 512, null);
|
$this->addColumn('LANGUAGE', 'DbLanguage', 'VARCHAR', false, 512, null);
|
||||||
|
$this->addColumn('SOUNDCLOUD_ID', 'DbSoundcloudId', 'INTEGER', false, null, null);
|
||||||
|
$this->addColumn('SOUNDCLOUD_ERROR_CODE', 'DbSoundcloudErrorCode', 'INTEGER', false, null, null);
|
||||||
|
$this->addColumn('SOUNDCLOUD_ERROR_MSG', 'DbSoundcloudErrorMsg', 'VARCHAR', false, 512, null);
|
||||||
|
$this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 512, null);
|
||||||
// validators
|
// validators
|
||||||
} // initialize()
|
} // initialize()
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'cc_login_attempts' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This map class is used by Propel to do runtime db structure discovery.
|
||||||
|
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||||
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||||
|
* (i.e. if it's a text column type).
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.map
|
||||||
|
*/
|
||||||
|
class CcLoginAttemptsTableMap extends TableMap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'airtime.map.CcLoginAttemptsTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the table attributes, columns and validators
|
||||||
|
* Relations are not initialized by this method since they are lazy loaded
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// attributes
|
||||||
|
$this->setName('cc_login_attempts');
|
||||||
|
$this->setPhpName('CcLoginAttempts');
|
||||||
|
$this->setClassname('CcLoginAttempts');
|
||||||
|
$this->setPackage('airtime');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addPrimaryKey('IP', 'DbIP', 'VARCHAR', true, 32, null);
|
||||||
|
$this->addColumn('ATTEMPTS', 'DbAttempts', 'INTEGER', false, null, 0);
|
||||||
|
// validators
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
} // CcLoginAttemptsTableMap
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'cc_service_register' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This map class is used by Propel to do runtime db structure discovery.
|
||||||
|
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||||
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||||
|
* (i.e. if it's a text column type).
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.map
|
||||||
|
*/
|
||||||
|
class CcServiceRegisterTableMap extends TableMap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'airtime.map.CcServiceRegisterTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the table attributes, columns and validators
|
||||||
|
* Relations are not initialized by this method since they are lazy loaded
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// attributes
|
||||||
|
$this->setName('cc_service_register');
|
||||||
|
$this->setPhpName('CcServiceRegister');
|
||||||
|
$this->setClassname('CcServiceRegister');
|
||||||
|
$this->setPackage('airtime');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addPrimaryKey('NAME', 'DbName', 'VARCHAR', true, 32, null);
|
||||||
|
$this->addColumn('IP', 'DbIp', 'VARCHAR', true, 18, null);
|
||||||
|
// validators
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
} // CcServiceRegisterTableMap
|
|
@ -42,6 +42,7 @@ class CcShowDaysTableMap extends TableMap {
|
||||||
$this->addColumn('FIRST_SHOW', 'DbFirstShow', 'DATE', true, null, null);
|
$this->addColumn('FIRST_SHOW', 'DbFirstShow', 'DATE', true, null, null);
|
||||||
$this->addColumn('LAST_SHOW', 'DbLastShow', 'DATE', false, null, null);
|
$this->addColumn('LAST_SHOW', 'DbLastShow', 'DATE', false, null, null);
|
||||||
$this->addColumn('START_TIME', 'DbStartTime', 'TIME', true, null, null);
|
$this->addColumn('START_TIME', 'DbStartTime', 'TIME', true, null, null);
|
||||||
|
$this->addColumn('TIMEZONE', 'DbTimezone', 'VARCHAR', true, 255, null);
|
||||||
$this->addColumn('DURATION', 'DbDuration', 'VARCHAR', true, 255, null);
|
$this->addColumn('DURATION', 'DbDuration', 'VARCHAR', true, 255, null);
|
||||||
$this->addColumn('DAY', 'DbDay', 'TINYINT', false, null, null);
|
$this->addColumn('DAY', 'DbDay', 'TINYINT', false, null, null);
|
||||||
$this->addColumn('REPEAT_TYPE', 'DbRepeatType', 'TINYINT', true, null, null);
|
$this->addColumn('REPEAT_TYPE', 'DbRepeatType', 'TINYINT', true, null, null);
|
||||||
|
|
|
@ -46,7 +46,6 @@ class CcShowInstancesTableMap extends TableMap {
|
||||||
$this->addColumn('REBROADCAST', 'DbRebroadcast', 'TINYINT', false, null, 0);
|
$this->addColumn('REBROADCAST', 'DbRebroadcast', 'TINYINT', false, null, 0);
|
||||||
$this->addForeignKey('INSTANCE_ID', 'DbOriginalShow', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
|
$this->addForeignKey('INSTANCE_ID', 'DbOriginalShow', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
|
||||||
$this->addForeignKey('FILE_ID', 'DbRecordedFile', 'INTEGER', 'cc_files', 'ID', false, null, null);
|
$this->addForeignKey('FILE_ID', 'DbRecordedFile', 'INTEGER', 'cc_files', 'ID', false, null, null);
|
||||||
$this->addColumn('SOUNDCLOUD_ID', 'DbSoundCloudId', 'INTEGER', false, null, null);
|
|
||||||
$this->addColumn('TIME_FILLED', 'DbTimeFilled', 'TIME', false, null, null);
|
$this->addColumn('TIME_FILLED', 'DbTimeFilled', 'TIME', false, null, null);
|
||||||
// validators
|
// validators
|
||||||
} // initialize()
|
} // initialize()
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'cc_stream_setting' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This map class is used by Propel to do runtime db structure discovery.
|
||||||
|
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||||
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||||
|
* (i.e. if it's a text column type).
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.map
|
||||||
|
*/
|
||||||
|
class CcStreamSettingTableMap extends TableMap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'airtime.map.CcStreamSettingTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the table attributes, columns and validators
|
||||||
|
* Relations are not initialized by this method since they are lazy loaded
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// attributes
|
||||||
|
$this->setName('cc_stream_setting');
|
||||||
|
$this->setPhpName('CcStreamSetting');
|
||||||
|
$this->setClassname('CcStreamSetting');
|
||||||
|
$this->setPackage('airtime');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addPrimaryKey('KEYNAME', 'DbKeyName', 'VARCHAR', true, 64, null);
|
||||||
|
$this->addColumn('VALUE', 'DbValue', 'VARCHAR', false, 255, null);
|
||||||
|
$this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 16, null);
|
||||||
|
// validators
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
} // CcStreamSettingTableMap
|
|
@ -49,6 +49,7 @@ class CcSubjsTableMap extends TableMap {
|
||||||
$this->addColumn('SKYPE_CONTACT', 'DbSkypeContact', 'VARCHAR', false, 255, null);
|
$this->addColumn('SKYPE_CONTACT', 'DbSkypeContact', 'VARCHAR', false, 255, null);
|
||||||
$this->addColumn('JABBER_CONTACT', 'DbJabberContact', 'VARCHAR', false, 255, null);
|
$this->addColumn('JABBER_CONTACT', 'DbJabberContact', 'VARCHAR', false, 255, null);
|
||||||
$this->addColumn('EMAIL', 'DbEmail', 'VARCHAR', false, 255, null);
|
$this->addColumn('EMAIL', 'DbEmail', 'VARCHAR', false, 255, null);
|
||||||
|
$this->addColumn('LOGIN_ATTEMPTS', 'DbLoginAttempts', 'INTEGER', false, null, 0);
|
||||||
// validators
|
// validators
|
||||||
} // initialize()
|
} // initialize()
|
||||||
|
|
||||||
|
|
|
@ -360,6 +360,30 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
protected $language;
|
protected $language;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the soundcloud_id field.
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $soundcloud_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the soundcloud_error_code field.
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $soundcloud_error_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the soundcloud_error_msg field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $soundcloud_error_msg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the soundcloud_link_to_file field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $soundcloud_link_to_file;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var CcSubjs
|
* @var CcSubjs
|
||||||
*/
|
*/
|
||||||
|
@ -1021,6 +1045,46 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
return $this->language;
|
return $this->language;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [soundcloud_id] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getDbSoundcloudId()
|
||||||
|
{
|
||||||
|
return $this->soundcloud_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [soundcloud_error_code] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getDbSoundcloudErrorCode()
|
||||||
|
{
|
||||||
|
return $this->soundcloud_error_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [soundcloud_error_msg] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDbSoundcloudErrorMsg()
|
||||||
|
{
|
||||||
|
return $this->soundcloud_error_msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [soundcloud_link_to_file] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDbSoundcloudLinkToFile()
|
||||||
|
{
|
||||||
|
return $this->soundcloud_link_to_file;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [id] column.
|
* Set the value of [id] column.
|
||||||
*
|
*
|
||||||
|
@ -2187,6 +2251,86 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
return $this;
|
return $this;
|
||||||
} // setDbLanguage()
|
} // setDbLanguage()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [soundcloud_id] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return CcFiles 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[] = CcFilesPeer::SOUNDCLOUD_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDbSoundcloudId()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [soundcloud_error_code] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return CcFiles The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setDbSoundcloudErrorCode($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->soundcloud_error_code !== $v) {
|
||||||
|
$this->soundcloud_error_code = $v;
|
||||||
|
$this->modifiedColumns[] = CcFilesPeer::SOUNDCLOUD_ERROR_CODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDbSoundcloudErrorCode()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [soundcloud_error_msg] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return CcFiles The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setDbSoundcloudErrorMsg($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->soundcloud_error_msg !== $v) {
|
||||||
|
$this->soundcloud_error_msg = $v;
|
||||||
|
$this->modifiedColumns[] = CcFilesPeer::SOUNDCLOUD_ERROR_MSG;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDbSoundcloudErrorMsg()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [soundcloud_link_to_file] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return CcFiles The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setDbSoundcloudLinkToFile($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->soundcloud_link_to_file !== $v) {
|
||||||
|
$this->soundcloud_link_to_file = $v;
|
||||||
|
$this->modifiedColumns[] = CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDbSoundcloudLinkToFile()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the columns in this object are only set to default values.
|
* Indicates whether the columns in this object are only set to default values.
|
||||||
*
|
*
|
||||||
|
@ -2298,6 +2442,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
$this->subject = ($row[$startcol + 52] !== null) ? (string) $row[$startcol + 52] : null;
|
$this->subject = ($row[$startcol + 52] !== null) ? (string) $row[$startcol + 52] : null;
|
||||||
$this->contributor = ($row[$startcol + 53] !== null) ? (string) $row[$startcol + 53] : null;
|
$this->contributor = ($row[$startcol + 53] !== null) ? (string) $row[$startcol + 53] : null;
|
||||||
$this->language = ($row[$startcol + 54] !== null) ? (string) $row[$startcol + 54] : null;
|
$this->language = ($row[$startcol + 54] !== null) ? (string) $row[$startcol + 54] : null;
|
||||||
|
$this->soundcloud_id = ($row[$startcol + 55] !== null) ? (int) $row[$startcol + 55] : null;
|
||||||
|
$this->soundcloud_error_code = ($row[$startcol + 56] !== null) ? (int) $row[$startcol + 56] : null;
|
||||||
|
$this->soundcloud_error_msg = ($row[$startcol + 57] !== null) ? (string) $row[$startcol + 57] : null;
|
||||||
|
$this->soundcloud_link_to_file = ($row[$startcol + 58] !== null) ? (string) $row[$startcol + 58] : null;
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
|
@ -2306,7 +2454,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 55; // 55 = CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS).
|
return $startcol + 59; // 59 = CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating CcFiles object", $e);
|
throw new PropelException("Error populating CcFiles object", $e);
|
||||||
|
@ -2869,6 +3017,18 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
case 54:
|
case 54:
|
||||||
return $this->getDbLanguage();
|
return $this->getDbLanguage();
|
||||||
break;
|
break;
|
||||||
|
case 55:
|
||||||
|
return $this->getDbSoundcloudId();
|
||||||
|
break;
|
||||||
|
case 56:
|
||||||
|
return $this->getDbSoundcloudErrorCode();
|
||||||
|
break;
|
||||||
|
case 57:
|
||||||
|
return $this->getDbSoundcloudErrorMsg();
|
||||||
|
break;
|
||||||
|
case 58:
|
||||||
|
return $this->getDbSoundcloudLinkToFile();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
break;
|
break;
|
||||||
|
@ -2948,6 +3108,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
$keys[52] => $this->getDbSubject(),
|
$keys[52] => $this->getDbSubject(),
|
||||||
$keys[53] => $this->getDbContributor(),
|
$keys[53] => $this->getDbContributor(),
|
||||||
$keys[54] => $this->getDbLanguage(),
|
$keys[54] => $this->getDbLanguage(),
|
||||||
|
$keys[55] => $this->getDbSoundcloudId(),
|
||||||
|
$keys[56] => $this->getDbSoundcloudErrorCode(),
|
||||||
|
$keys[57] => $this->getDbSoundcloudErrorMsg(),
|
||||||
|
$keys[58] => $this->getDbSoundcloudLinkToFile(),
|
||||||
);
|
);
|
||||||
if ($includeForeignObjects) {
|
if ($includeForeignObjects) {
|
||||||
if (null !== $this->aCcSubjs) {
|
if (null !== $this->aCcSubjs) {
|
||||||
|
@ -3152,6 +3316,18 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
case 54:
|
case 54:
|
||||||
$this->setDbLanguage($value);
|
$this->setDbLanguage($value);
|
||||||
break;
|
break;
|
||||||
|
case 55:
|
||||||
|
$this->setDbSoundcloudId($value);
|
||||||
|
break;
|
||||||
|
case 56:
|
||||||
|
$this->setDbSoundcloudErrorCode($value);
|
||||||
|
break;
|
||||||
|
case 57:
|
||||||
|
$this->setDbSoundcloudErrorMsg($value);
|
||||||
|
break;
|
||||||
|
case 58:
|
||||||
|
$this->setDbSoundcloudLinkToFile($value);
|
||||||
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3231,6 +3407,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
if (array_key_exists($keys[52], $arr)) $this->setDbSubject($arr[$keys[52]]);
|
if (array_key_exists($keys[52], $arr)) $this->setDbSubject($arr[$keys[52]]);
|
||||||
if (array_key_exists($keys[53], $arr)) $this->setDbContributor($arr[$keys[53]]);
|
if (array_key_exists($keys[53], $arr)) $this->setDbContributor($arr[$keys[53]]);
|
||||||
if (array_key_exists($keys[54], $arr)) $this->setDbLanguage($arr[$keys[54]]);
|
if (array_key_exists($keys[54], $arr)) $this->setDbLanguage($arr[$keys[54]]);
|
||||||
|
if (array_key_exists($keys[55], $arr)) $this->setDbSoundcloudId($arr[$keys[55]]);
|
||||||
|
if (array_key_exists($keys[56], $arr)) $this->setDbSoundcloudErrorCode($arr[$keys[56]]);
|
||||||
|
if (array_key_exists($keys[57], $arr)) $this->setDbSoundcloudErrorMsg($arr[$keys[57]]);
|
||||||
|
if (array_key_exists($keys[58], $arr)) $this->setDbSoundcloudLinkToFile($arr[$keys[58]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3297,6 +3477,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
if ($this->isColumnModified(CcFilesPeer::SUBJECT)) $criteria->add(CcFilesPeer::SUBJECT, $this->subject);
|
if ($this->isColumnModified(CcFilesPeer::SUBJECT)) $criteria->add(CcFilesPeer::SUBJECT, $this->subject);
|
||||||
if ($this->isColumnModified(CcFilesPeer::CONTRIBUTOR)) $criteria->add(CcFilesPeer::CONTRIBUTOR, $this->contributor);
|
if ($this->isColumnModified(CcFilesPeer::CONTRIBUTOR)) $criteria->add(CcFilesPeer::CONTRIBUTOR, $this->contributor);
|
||||||
if ($this->isColumnModified(CcFilesPeer::LANGUAGE)) $criteria->add(CcFilesPeer::LANGUAGE, $this->language);
|
if ($this->isColumnModified(CcFilesPeer::LANGUAGE)) $criteria->add(CcFilesPeer::LANGUAGE, $this->language);
|
||||||
|
if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_ID)) $criteria->add(CcFilesPeer::SOUNDCLOUD_ID, $this->soundcloud_id);
|
||||||
|
if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_ERROR_CODE)) $criteria->add(CcFilesPeer::SOUNDCLOUD_ERROR_CODE, $this->soundcloud_error_code);
|
||||||
|
if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_ERROR_MSG)) $criteria->add(CcFilesPeer::SOUNDCLOUD_ERROR_MSG, $this->soundcloud_error_msg);
|
||||||
|
if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE)) $criteria->add(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE, $this->soundcloud_link_to_file);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
|
@ -3412,6 +3596,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
$copyObj->setDbSubject($this->subject);
|
$copyObj->setDbSubject($this->subject);
|
||||||
$copyObj->setDbContributor($this->contributor);
|
$copyObj->setDbContributor($this->contributor);
|
||||||
$copyObj->setDbLanguage($this->language);
|
$copyObj->setDbLanguage($this->language);
|
||||||
|
$copyObj->setDbSoundcloudId($this->soundcloud_id);
|
||||||
|
$copyObj->setDbSoundcloudErrorCode($this->soundcloud_error_code);
|
||||||
|
$copyObj->setDbSoundcloudErrorMsg($this->soundcloud_error_msg);
|
||||||
|
$copyObj->setDbSoundcloudLinkToFile($this->soundcloud_link_to_file);
|
||||||
|
|
||||||
if ($deepCopy) {
|
if ($deepCopy) {
|
||||||
// important: temporarily setNew(false) because this affects the behavior of
|
// important: temporarily setNew(false) because this affects the behavior of
|
||||||
|
@ -4066,6 +4254,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
$this->subject = null;
|
$this->subject = null;
|
||||||
$this->contributor = null;
|
$this->contributor = null;
|
||||||
$this->language = null;
|
$this->language = null;
|
||||||
|
$this->soundcloud_id = null;
|
||||||
|
$this->soundcloud_error_code = null;
|
||||||
|
$this->soundcloud_error_msg = null;
|
||||||
|
$this->soundcloud_link_to_file = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
$this->clearAllReferences();
|
$this->clearAllReferences();
|
||||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcFilesPeer {
|
||||||
const TM_CLASS = 'CcFilesTableMap';
|
const TM_CLASS = 'CcFilesTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 55;
|
const NUM_COLUMNS = 59;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
@ -196,6 +196,18 @@ abstract class BaseCcFilesPeer {
|
||||||
/** the column name for the LANGUAGE field */
|
/** the column name for the LANGUAGE field */
|
||||||
const LANGUAGE = 'cc_files.LANGUAGE';
|
const LANGUAGE = 'cc_files.LANGUAGE';
|
||||||
|
|
||||||
|
/** the column name for the SOUNDCLOUD_ID field */
|
||||||
|
const SOUNDCLOUD_ID = 'cc_files.SOUNDCLOUD_ID';
|
||||||
|
|
||||||
|
/** the column name for the SOUNDCLOUD_ERROR_CODE field */
|
||||||
|
const SOUNDCLOUD_ERROR_CODE = 'cc_files.SOUNDCLOUD_ERROR_CODE';
|
||||||
|
|
||||||
|
/** the column name for the SOUNDCLOUD_ERROR_MSG field */
|
||||||
|
const SOUNDCLOUD_ERROR_MSG = 'cc_files.SOUNDCLOUD_ERROR_MSG';
|
||||||
|
|
||||||
|
/** the column name for the SOUNDCLOUD_LINK_TO_FILE field */
|
||||||
|
const SOUNDCLOUD_LINK_TO_FILE = 'cc_files.SOUNDCLOUD_LINK_TO_FILE';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An identiy map to hold any loaded instances of CcFiles objects.
|
* An identiy map to hold any loaded instances of CcFiles objects.
|
||||||
* This must be public so that other peer classes can access this when hydrating from JOIN
|
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||||
|
@ -212,12 +224,12 @@ abstract class BaseCcFilesPeer {
|
||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
private static $fieldNames = array (
|
private static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbGunid', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbState', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbMd5', 'DbTrackTitle', 'DbArtistName', 'DbBitRate', 'DbSampleRate', 'DbFormat', 'DbLength', 'DbAlbumTitle', 'DbGenre', 'DbComments', 'DbYear', 'DbTrackNumber', 'DbChannels', 'DbUrl', 'DbBpm', 'DbRating', 'DbEncodedBy', 'DbDiscNumber', 'DbMood', 'DbLabel', 'DbComposer', 'DbEncoder', 'DbChecksum', 'DbLyrics', 'DbOrchestra', 'DbConductor', 'DbLyricist', 'DbOriginalLyricist', 'DbRadioStationName', 'DbInfoUrl', 'DbArtistUrl', 'DbAudioSourceUrl', 'DbRadioStationUrl', 'DbBuyThisUrl', 'DbIsrcNumber', 'DbCatalogNumber', 'DbOriginalArtist', 'DbCopyright', 'DbReportDatetime', 'DbReportLocation', 'DbReportOrganization', 'DbSubject', 'DbContributor', 'DbLanguage', ),
|
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbGunid', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbState', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbMd5', 'DbTrackTitle', 'DbArtistName', 'DbBitRate', 'DbSampleRate', 'DbFormat', 'DbLength', 'DbAlbumTitle', 'DbGenre', 'DbComments', 'DbYear', 'DbTrackNumber', 'DbChannels', 'DbUrl', 'DbBpm', 'DbRating', 'DbEncodedBy', 'DbDiscNumber', 'DbMood', 'DbLabel', 'DbComposer', 'DbEncoder', 'DbChecksum', 'DbLyrics', 'DbOrchestra', 'DbConductor', 'DbLyricist', 'DbOriginalLyricist', 'DbRadioStationName', 'DbInfoUrl', 'DbArtistUrl', 'DbAudioSourceUrl', 'DbRadioStationUrl', 'DbBuyThisUrl', 'DbIsrcNumber', 'DbCatalogNumber', 'DbOriginalArtist', 'DbCopyright', 'DbReportDatetime', 'DbReportLocation', 'DbReportOrganization', 'DbSubject', 'DbContributor', 'DbLanguage', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbGunid', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbState', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbMd5', 'dbTrackTitle', 'dbArtistName', 'dbBitRate', 'dbSampleRate', 'dbFormat', 'dbLength', 'dbAlbumTitle', 'dbGenre', 'dbComments', 'dbYear', 'dbTrackNumber', 'dbChannels', 'dbUrl', 'dbBpm', 'dbRating', 'dbEncodedBy', 'dbDiscNumber', 'dbMood', 'dbLabel', 'dbComposer', 'dbEncoder', 'dbChecksum', 'dbLyrics', 'dbOrchestra', 'dbConductor', 'dbLyricist', 'dbOriginalLyricist', 'dbRadioStationName', 'dbInfoUrl', 'dbArtistUrl', 'dbAudioSourceUrl', 'dbRadioStationUrl', 'dbBuyThisUrl', 'dbIsrcNumber', 'dbCatalogNumber', 'dbOriginalArtist', 'dbCopyright', 'dbReportDatetime', 'dbReportLocation', 'dbReportOrganization', 'dbSubject', 'dbContributor', 'dbLanguage', ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbGunid', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbState', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbMd5', 'dbTrackTitle', 'dbArtistName', 'dbBitRate', 'dbSampleRate', 'dbFormat', 'dbLength', 'dbAlbumTitle', 'dbGenre', 'dbComments', 'dbYear', 'dbTrackNumber', 'dbChannels', 'dbUrl', 'dbBpm', 'dbRating', 'dbEncodedBy', 'dbDiscNumber', 'dbMood', 'dbLabel', 'dbComposer', 'dbEncoder', 'dbChecksum', 'dbLyrics', 'dbOrchestra', 'dbConductor', 'dbLyricist', 'dbOriginalLyricist', 'dbRadioStationName', 'dbInfoUrl', 'dbArtistUrl', 'dbAudioSourceUrl', 'dbRadioStationUrl', 'dbBuyThisUrl', 'dbIsrcNumber', 'dbCatalogNumber', 'dbOriginalArtist', 'dbCopyright', 'dbReportDatetime', 'dbReportLocation', 'dbReportOrganization', 'dbSubject', 'dbContributor', 'dbLanguage', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', ),
|
||||||
BasePeer::TYPE_COLNAME => array (self::ID, self::GUNID, self::NAME, self::MIME, self::FTYPE, self::DIRECTORY, self::FILEPATH, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::MD5, self::TRACK_TITLE, self::ARTIST_NAME, self::BIT_RATE, self::SAMPLE_RATE, self::FORMAT, self::LENGTH, self::ALBUM_TITLE, self::GENRE, self::COMMENTS, self::YEAR, self::TRACK_NUMBER, self::CHANNELS, self::URL, self::BPM, self::RATING, self::ENCODED_BY, self::DISC_NUMBER, self::MOOD, self::LABEL, self::COMPOSER, self::ENCODER, self::CHECKSUM, self::LYRICS, self::ORCHESTRA, self::CONDUCTOR, self::LYRICIST, self::ORIGINAL_LYRICIST, self::RADIO_STATION_NAME, self::INFO_URL, self::ARTIST_URL, self::AUDIO_SOURCE_URL, self::RADIO_STATION_URL, self::BUY_THIS_URL, self::ISRC_NUMBER, self::CATALOG_NUMBER, self::ORIGINAL_ARTIST, self::COPYRIGHT, self::REPORT_DATETIME, self::REPORT_LOCATION, self::REPORT_ORGANIZATION, self::SUBJECT, self::CONTRIBUTOR, self::LANGUAGE, ),
|
BasePeer::TYPE_COLNAME => array (self::ID, self::GUNID, self::NAME, self::MIME, self::FTYPE, self::DIRECTORY, self::FILEPATH, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::MD5, self::TRACK_TITLE, self::ARTIST_NAME, self::BIT_RATE, self::SAMPLE_RATE, self::FORMAT, self::LENGTH, self::ALBUM_TITLE, self::GENRE, self::COMMENTS, self::YEAR, self::TRACK_NUMBER, self::CHANNELS, self::URL, self::BPM, self::RATING, self::ENCODED_BY, self::DISC_NUMBER, self::MOOD, self::LABEL, self::COMPOSER, self::ENCODER, self::CHECKSUM, self::LYRICS, self::ORCHESTRA, self::CONDUCTOR, self::LYRICIST, self::ORIGINAL_LYRICIST, self::RADIO_STATION_NAME, self::INFO_URL, self::ARTIST_URL, self::AUDIO_SOURCE_URL, self::RADIO_STATION_URL, self::BUY_THIS_URL, self::ISRC_NUMBER, self::CATALOG_NUMBER, self::ORIGINAL_ARTIST, self::COPYRIGHT, self::REPORT_DATETIME, self::REPORT_LOCATION, self::REPORT_ORGANIZATION, self::SUBJECT, self::CONTRIBUTOR, self::LANGUAGE, self::SOUNDCLOUD_ID, self::SOUNDCLOUD_ERROR_CODE, self::SOUNDCLOUD_ERROR_MSG, self::SOUNDCLOUD_LINK_TO_FILE, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'GUNID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'STATE', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'GUNID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'STATE', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id', 'gunid', 'name', 'mime', 'ftype', 'directory', 'filepath', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', ),
|
BasePeer::TYPE_FIELDNAME => array ('id', 'gunid', 'name', 'mime', 'ftype', 'directory', 'filepath', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,12 +239,12 @@ abstract class BaseCcFilesPeer {
|
||||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
private static $fieldKeys = array (
|
private static $fieldKeys = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbGunid' => 1, 'DbName' => 2, 'DbMime' => 3, 'DbFtype' => 4, 'DbDirectory' => 5, 'DbFilepath' => 6, 'DbState' => 7, 'DbCurrentlyaccessing' => 8, 'DbEditedby' => 9, 'DbMtime' => 10, 'DbMd5' => 11, 'DbTrackTitle' => 12, 'DbArtistName' => 13, 'DbBitRate' => 14, 'DbSampleRate' => 15, 'DbFormat' => 16, 'DbLength' => 17, 'DbAlbumTitle' => 18, 'DbGenre' => 19, 'DbComments' => 20, 'DbYear' => 21, 'DbTrackNumber' => 22, 'DbChannels' => 23, 'DbUrl' => 24, 'DbBpm' => 25, 'DbRating' => 26, 'DbEncodedBy' => 27, 'DbDiscNumber' => 28, 'DbMood' => 29, 'DbLabel' => 30, 'DbComposer' => 31, 'DbEncoder' => 32, 'DbChecksum' => 33, 'DbLyrics' => 34, 'DbOrchestra' => 35, 'DbConductor' => 36, 'DbLyricist' => 37, 'DbOriginalLyricist' => 38, 'DbRadioStationName' => 39, 'DbInfoUrl' => 40, 'DbArtistUrl' => 41, 'DbAudioSourceUrl' => 42, 'DbRadioStationUrl' => 43, 'DbBuyThisUrl' => 44, 'DbIsrcNumber' => 45, 'DbCatalogNumber' => 46, 'DbOriginalArtist' => 47, 'DbCopyright' => 48, 'DbReportDatetime' => 49, 'DbReportLocation' => 50, 'DbReportOrganization' => 51, 'DbSubject' => 52, 'DbContributor' => 53, 'DbLanguage' => 54, ),
|
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbGunid' => 1, 'DbName' => 2, 'DbMime' => 3, 'DbFtype' => 4, 'DbDirectory' => 5, 'DbFilepath' => 6, 'DbState' => 7, 'DbCurrentlyaccessing' => 8, 'DbEditedby' => 9, 'DbMtime' => 10, 'DbMd5' => 11, 'DbTrackTitle' => 12, 'DbArtistName' => 13, 'DbBitRate' => 14, 'DbSampleRate' => 15, 'DbFormat' => 16, 'DbLength' => 17, 'DbAlbumTitle' => 18, 'DbGenre' => 19, 'DbComments' => 20, 'DbYear' => 21, 'DbTrackNumber' => 22, 'DbChannels' => 23, 'DbUrl' => 24, 'DbBpm' => 25, 'DbRating' => 26, 'DbEncodedBy' => 27, 'DbDiscNumber' => 28, 'DbMood' => 29, 'DbLabel' => 30, 'DbComposer' => 31, 'DbEncoder' => 32, 'DbChecksum' => 33, 'DbLyrics' => 34, 'DbOrchestra' => 35, 'DbConductor' => 36, 'DbLyricist' => 37, 'DbOriginalLyricist' => 38, 'DbRadioStationName' => 39, 'DbInfoUrl' => 40, 'DbArtistUrl' => 41, 'DbAudioSourceUrl' => 42, 'DbRadioStationUrl' => 43, 'DbBuyThisUrl' => 44, 'DbIsrcNumber' => 45, 'DbCatalogNumber' => 46, 'DbOriginalArtist' => 47, 'DbCopyright' => 48, 'DbReportDatetime' => 49, 'DbReportLocation' => 50, 'DbReportOrganization' => 51, 'DbSubject' => 52, 'DbContributor' => 53, 'DbLanguage' => 54, 'DbSoundcloudId' => 55, 'DbSoundcloudErrorCode' => 56, 'DbSoundcloudErrorMsg' => 57, 'DbSoundcloudLinkToFile' => 58, ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbGunid' => 1, 'dbName' => 2, 'dbMime' => 3, 'dbFtype' => 4, 'dbDirectory' => 5, 'dbFilepath' => 6, 'dbState' => 7, 'dbCurrentlyaccessing' => 8, 'dbEditedby' => 9, 'dbMtime' => 10, 'dbMd5' => 11, 'dbTrackTitle' => 12, 'dbArtistName' => 13, 'dbBitRate' => 14, 'dbSampleRate' => 15, 'dbFormat' => 16, 'dbLength' => 17, 'dbAlbumTitle' => 18, 'dbGenre' => 19, 'dbComments' => 20, 'dbYear' => 21, 'dbTrackNumber' => 22, 'dbChannels' => 23, 'dbUrl' => 24, 'dbBpm' => 25, 'dbRating' => 26, 'dbEncodedBy' => 27, 'dbDiscNumber' => 28, 'dbMood' => 29, 'dbLabel' => 30, 'dbComposer' => 31, 'dbEncoder' => 32, 'dbChecksum' => 33, 'dbLyrics' => 34, 'dbOrchestra' => 35, 'dbConductor' => 36, 'dbLyricist' => 37, 'dbOriginalLyricist' => 38, 'dbRadioStationName' => 39, 'dbInfoUrl' => 40, 'dbArtistUrl' => 41, 'dbAudioSourceUrl' => 42, 'dbRadioStationUrl' => 43, 'dbBuyThisUrl' => 44, 'dbIsrcNumber' => 45, 'dbCatalogNumber' => 46, 'dbOriginalArtist' => 47, 'dbCopyright' => 48, 'dbReportDatetime' => 49, 'dbReportLocation' => 50, 'dbReportOrganization' => 51, 'dbSubject' => 52, 'dbContributor' => 53, 'dbLanguage' => 54, ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbGunid' => 1, 'dbName' => 2, 'dbMime' => 3, 'dbFtype' => 4, 'dbDirectory' => 5, 'dbFilepath' => 6, 'dbState' => 7, 'dbCurrentlyaccessing' => 8, 'dbEditedby' => 9, 'dbMtime' => 10, 'dbMd5' => 11, 'dbTrackTitle' => 12, 'dbArtistName' => 13, 'dbBitRate' => 14, 'dbSampleRate' => 15, 'dbFormat' => 16, 'dbLength' => 17, 'dbAlbumTitle' => 18, 'dbGenre' => 19, 'dbComments' => 20, 'dbYear' => 21, 'dbTrackNumber' => 22, 'dbChannels' => 23, 'dbUrl' => 24, 'dbBpm' => 25, 'dbRating' => 26, 'dbEncodedBy' => 27, 'dbDiscNumber' => 28, 'dbMood' => 29, 'dbLabel' => 30, 'dbComposer' => 31, 'dbEncoder' => 32, 'dbChecksum' => 33, 'dbLyrics' => 34, 'dbOrchestra' => 35, 'dbConductor' => 36, 'dbLyricist' => 37, 'dbOriginalLyricist' => 38, 'dbRadioStationName' => 39, 'dbInfoUrl' => 40, 'dbArtistUrl' => 41, 'dbAudioSourceUrl' => 42, 'dbRadioStationUrl' => 43, 'dbBuyThisUrl' => 44, 'dbIsrcNumber' => 45, 'dbCatalogNumber' => 46, 'dbOriginalArtist' => 47, 'dbCopyright' => 48, 'dbReportDatetime' => 49, 'dbReportLocation' => 50, 'dbReportOrganization' => 51, 'dbSubject' => 52, 'dbContributor' => 53, 'dbLanguage' => 54, 'dbSoundcloudId' => 55, 'dbSoundcloudErrorCode' => 56, 'dbSoundcloudErrorMsg' => 57, 'dbSoundcloudLinkToFile' => 58, ),
|
||||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::GUNID => 1, self::NAME => 2, self::MIME => 3, self::FTYPE => 4, self::DIRECTORY => 5, self::FILEPATH => 6, self::STATE => 7, self::CURRENTLYACCESSING => 8, self::EDITEDBY => 9, self::MTIME => 10, self::MD5 => 11, self::TRACK_TITLE => 12, self::ARTIST_NAME => 13, self::BIT_RATE => 14, self::SAMPLE_RATE => 15, self::FORMAT => 16, self::LENGTH => 17, self::ALBUM_TITLE => 18, self::GENRE => 19, self::COMMENTS => 20, self::YEAR => 21, self::TRACK_NUMBER => 22, self::CHANNELS => 23, self::URL => 24, self::BPM => 25, self::RATING => 26, self::ENCODED_BY => 27, self::DISC_NUMBER => 28, self::MOOD => 29, self::LABEL => 30, self::COMPOSER => 31, self::ENCODER => 32, self::CHECKSUM => 33, self::LYRICS => 34, self::ORCHESTRA => 35, self::CONDUCTOR => 36, self::LYRICIST => 37, self::ORIGINAL_LYRICIST => 38, self::RADIO_STATION_NAME => 39, self::INFO_URL => 40, self::ARTIST_URL => 41, self::AUDIO_SOURCE_URL => 42, self::RADIO_STATION_URL => 43, self::BUY_THIS_URL => 44, self::ISRC_NUMBER => 45, self::CATALOG_NUMBER => 46, self::ORIGINAL_ARTIST => 47, self::COPYRIGHT => 48, self::REPORT_DATETIME => 49, self::REPORT_LOCATION => 50, self::REPORT_ORGANIZATION => 51, self::SUBJECT => 52, self::CONTRIBUTOR => 53, self::LANGUAGE => 54, ),
|
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::GUNID => 1, self::NAME => 2, self::MIME => 3, self::FTYPE => 4, self::DIRECTORY => 5, self::FILEPATH => 6, self::STATE => 7, self::CURRENTLYACCESSING => 8, self::EDITEDBY => 9, self::MTIME => 10, self::MD5 => 11, self::TRACK_TITLE => 12, self::ARTIST_NAME => 13, self::BIT_RATE => 14, self::SAMPLE_RATE => 15, self::FORMAT => 16, self::LENGTH => 17, self::ALBUM_TITLE => 18, self::GENRE => 19, self::COMMENTS => 20, self::YEAR => 21, self::TRACK_NUMBER => 22, self::CHANNELS => 23, self::URL => 24, self::BPM => 25, self::RATING => 26, self::ENCODED_BY => 27, self::DISC_NUMBER => 28, self::MOOD => 29, self::LABEL => 30, self::COMPOSER => 31, self::ENCODER => 32, self::CHECKSUM => 33, self::LYRICS => 34, self::ORCHESTRA => 35, self::CONDUCTOR => 36, self::LYRICIST => 37, self::ORIGINAL_LYRICIST => 38, self::RADIO_STATION_NAME => 39, self::INFO_URL => 40, self::ARTIST_URL => 41, self::AUDIO_SOURCE_URL => 42, self::RADIO_STATION_URL => 43, self::BUY_THIS_URL => 44, self::ISRC_NUMBER => 45, self::CATALOG_NUMBER => 46, self::ORIGINAL_ARTIST => 47, self::COPYRIGHT => 48, self::REPORT_DATETIME => 49, self::REPORT_LOCATION => 50, self::REPORT_ORGANIZATION => 51, self::SUBJECT => 52, self::CONTRIBUTOR => 53, self::LANGUAGE => 54, self::SOUNDCLOUD_ID => 55, self::SOUNDCLOUD_ERROR_CODE => 56, self::SOUNDCLOUD_ERROR_MSG => 57, self::SOUNDCLOUD_LINK_TO_FILE => 58, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'GUNID' => 1, 'NAME' => 2, 'MIME' => 3, 'FTYPE' => 4, 'DIRECTORY' => 5, 'FILEPATH' => 6, 'STATE' => 7, 'CURRENTLYACCESSING' => 8, 'EDITEDBY' => 9, 'MTIME' => 10, 'MD5' => 11, 'TRACK_TITLE' => 12, 'ARTIST_NAME' => 13, 'BIT_RATE' => 14, 'SAMPLE_RATE' => 15, 'FORMAT' => 16, 'LENGTH' => 17, 'ALBUM_TITLE' => 18, 'GENRE' => 19, 'COMMENTS' => 20, 'YEAR' => 21, 'TRACK_NUMBER' => 22, 'CHANNELS' => 23, 'URL' => 24, 'BPM' => 25, 'RATING' => 26, 'ENCODED_BY' => 27, 'DISC_NUMBER' => 28, 'MOOD' => 29, 'LABEL' => 30, 'COMPOSER' => 31, 'ENCODER' => 32, 'CHECKSUM' => 33, 'LYRICS' => 34, 'ORCHESTRA' => 35, 'CONDUCTOR' => 36, 'LYRICIST' => 37, 'ORIGINAL_LYRICIST' => 38, 'RADIO_STATION_NAME' => 39, 'INFO_URL' => 40, 'ARTIST_URL' => 41, 'AUDIO_SOURCE_URL' => 42, 'RADIO_STATION_URL' => 43, 'BUY_THIS_URL' => 44, 'ISRC_NUMBER' => 45, 'CATALOG_NUMBER' => 46, 'ORIGINAL_ARTIST' => 47, 'COPYRIGHT' => 48, 'REPORT_DATETIME' => 49, 'REPORT_LOCATION' => 50, 'REPORT_ORGANIZATION' => 51, 'SUBJECT' => 52, 'CONTRIBUTOR' => 53, 'LANGUAGE' => 54, ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'GUNID' => 1, 'NAME' => 2, 'MIME' => 3, 'FTYPE' => 4, 'DIRECTORY' => 5, 'FILEPATH' => 6, 'STATE' => 7, 'CURRENTLYACCESSING' => 8, 'EDITEDBY' => 9, 'MTIME' => 10, 'MD5' => 11, 'TRACK_TITLE' => 12, 'ARTIST_NAME' => 13, 'BIT_RATE' => 14, 'SAMPLE_RATE' => 15, 'FORMAT' => 16, 'LENGTH' => 17, 'ALBUM_TITLE' => 18, 'GENRE' => 19, 'COMMENTS' => 20, 'YEAR' => 21, 'TRACK_NUMBER' => 22, 'CHANNELS' => 23, 'URL' => 24, 'BPM' => 25, 'RATING' => 26, 'ENCODED_BY' => 27, 'DISC_NUMBER' => 28, 'MOOD' => 29, 'LABEL' => 30, 'COMPOSER' => 31, 'ENCODER' => 32, 'CHECKSUM' => 33, 'LYRICS' => 34, 'ORCHESTRA' => 35, 'CONDUCTOR' => 36, 'LYRICIST' => 37, 'ORIGINAL_LYRICIST' => 38, 'RADIO_STATION_NAME' => 39, 'INFO_URL' => 40, 'ARTIST_URL' => 41, 'AUDIO_SOURCE_URL' => 42, 'RADIO_STATION_URL' => 43, 'BUY_THIS_URL' => 44, 'ISRC_NUMBER' => 45, 'CATALOG_NUMBER' => 46, 'ORIGINAL_ARTIST' => 47, 'COPYRIGHT' => 48, 'REPORT_DATETIME' => 49, 'REPORT_LOCATION' => 50, 'REPORT_ORGANIZATION' => 51, 'SUBJECT' => 52, 'CONTRIBUTOR' => 53, 'LANGUAGE' => 54, 'SOUNDCLOUD_ID' => 55, 'SOUNDCLOUD_ERROR_CODE' => 56, 'SOUNDCLOUD_ERROR_MSG' => 57, 'SOUNDCLOUD_LINK_TO_FILE' => 58, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'gunid' => 1, 'name' => 2, 'mime' => 3, 'ftype' => 4, 'directory' => 5, 'filepath' => 6, 'state' => 7, 'currentlyaccessing' => 8, 'editedby' => 9, 'mtime' => 10, 'md5' => 11, 'track_title' => 12, 'artist_name' => 13, 'bit_rate' => 14, 'sample_rate' => 15, 'format' => 16, 'length' => 17, 'album_title' => 18, 'genre' => 19, 'comments' => 20, 'year' => 21, 'track_number' => 22, 'channels' => 23, 'url' => 24, 'bpm' => 25, 'rating' => 26, 'encoded_by' => 27, 'disc_number' => 28, 'mood' => 29, 'label' => 30, 'composer' => 31, 'encoder' => 32, 'checksum' => 33, 'lyrics' => 34, 'orchestra' => 35, 'conductor' => 36, 'lyricist' => 37, 'original_lyricist' => 38, 'radio_station_name' => 39, 'info_url' => 40, 'artist_url' => 41, 'audio_source_url' => 42, 'radio_station_url' => 43, 'buy_this_url' => 44, 'isrc_number' => 45, 'catalog_number' => 46, 'original_artist' => 47, 'copyright' => 48, 'report_datetime' => 49, 'report_location' => 50, 'report_organization' => 51, 'subject' => 52, 'contributor' => 53, 'language' => 54, ),
|
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'gunid' => 1, 'name' => 2, 'mime' => 3, 'ftype' => 4, 'directory' => 5, 'filepath' => 6, 'state' => 7, 'currentlyaccessing' => 8, 'editedby' => 9, 'mtime' => 10, 'md5' => 11, 'track_title' => 12, 'artist_name' => 13, 'bit_rate' => 14, 'sample_rate' => 15, 'format' => 16, 'length' => 17, 'album_title' => 18, 'genre' => 19, 'comments' => 20, 'year' => 21, 'track_number' => 22, 'channels' => 23, 'url' => 24, 'bpm' => 25, 'rating' => 26, 'encoded_by' => 27, 'disc_number' => 28, 'mood' => 29, 'label' => 30, 'composer' => 31, 'encoder' => 32, 'checksum' => 33, 'lyrics' => 34, 'orchestra' => 35, 'conductor' => 36, 'lyricist' => 37, 'original_lyricist' => 38, 'radio_station_name' => 39, 'info_url' => 40, 'artist_url' => 41, 'audio_source_url' => 42, 'radio_station_url' => 43, 'buy_this_url' => 44, 'isrc_number' => 45, 'catalog_number' => 46, 'original_artist' => 47, 'copyright' => 48, 'report_datetime' => 49, 'report_location' => 50, 'report_organization' => 51, 'subject' => 52, 'contributor' => 53, 'language' => 54, 'soundcloud_id' => 55, 'soundcloud_error_code' => 56, 'soundcloud_error_msg' => 57, 'soundcloud_link_to_file' => 58, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -359,6 +371,10 @@ abstract class BaseCcFilesPeer {
|
||||||
$criteria->addSelectColumn(CcFilesPeer::SUBJECT);
|
$criteria->addSelectColumn(CcFilesPeer::SUBJECT);
|
||||||
$criteria->addSelectColumn(CcFilesPeer::CONTRIBUTOR);
|
$criteria->addSelectColumn(CcFilesPeer::CONTRIBUTOR);
|
||||||
$criteria->addSelectColumn(CcFilesPeer::LANGUAGE);
|
$criteria->addSelectColumn(CcFilesPeer::LANGUAGE);
|
||||||
|
$criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ID);
|
||||||
|
$criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ERROR_CODE);
|
||||||
|
$criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ERROR_MSG);
|
||||||
|
$criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
$criteria->addSelectColumn($alias . '.GUNID');
|
$criteria->addSelectColumn($alias . '.GUNID');
|
||||||
|
@ -415,6 +431,10 @@ abstract class BaseCcFilesPeer {
|
||||||
$criteria->addSelectColumn($alias . '.SUBJECT');
|
$criteria->addSelectColumn($alias . '.SUBJECT');
|
||||||
$criteria->addSelectColumn($alias . '.CONTRIBUTOR');
|
$criteria->addSelectColumn($alias . '.CONTRIBUTOR');
|
||||||
$criteria->addSelectColumn($alias . '.LANGUAGE');
|
$criteria->addSelectColumn($alias . '.LANGUAGE');
|
||||||
|
$criteria->addSelectColumn($alias . '.SOUNDCLOUD_ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.SOUNDCLOUD_ERROR_CODE');
|
||||||
|
$criteria->addSelectColumn($alias . '.SOUNDCLOUD_ERROR_MSG');
|
||||||
|
$criteria->addSelectColumn($alias . '.SOUNDCLOUD_LINK_TO_FILE');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,10 @@
|
||||||
* @method CcFilesQuery orderByDbSubject($order = Criteria::ASC) Order by the subject column
|
* @method CcFilesQuery orderByDbSubject($order = Criteria::ASC) Order by the subject column
|
||||||
* @method CcFilesQuery orderByDbContributor($order = Criteria::ASC) Order by the contributor column
|
* @method CcFilesQuery orderByDbContributor($order = Criteria::ASC) Order by the contributor column
|
||||||
* @method CcFilesQuery orderByDbLanguage($order = Criteria::ASC) Order by the language column
|
* @method CcFilesQuery orderByDbLanguage($order = Criteria::ASC) Order by the language column
|
||||||
|
* @method CcFilesQuery orderByDbSoundcloudId($order = Criteria::ASC) Order by the soundcloud_id column
|
||||||
|
* @method CcFilesQuery orderByDbSoundcloudErrorCode($order = Criteria::ASC) Order by the soundcloud_error_code column
|
||||||
|
* @method CcFilesQuery orderByDbSoundcloudErrorMsg($order = Criteria::ASC) Order by the soundcloud_error_msg column
|
||||||
|
* @method CcFilesQuery orderByDbSoundcloudLinkToFile($order = Criteria::ASC) Order by the soundcloud_link_to_file column
|
||||||
*
|
*
|
||||||
* @method CcFilesQuery groupByDbId() Group by the id column
|
* @method CcFilesQuery groupByDbId() Group by the id column
|
||||||
* @method CcFilesQuery groupByDbGunid() Group by the gunid column
|
* @method CcFilesQuery groupByDbGunid() Group by the gunid column
|
||||||
|
@ -117,6 +121,10 @@
|
||||||
* @method CcFilesQuery groupByDbSubject() Group by the subject column
|
* @method CcFilesQuery groupByDbSubject() Group by the subject column
|
||||||
* @method CcFilesQuery groupByDbContributor() Group by the contributor column
|
* @method CcFilesQuery groupByDbContributor() Group by the contributor column
|
||||||
* @method CcFilesQuery groupByDbLanguage() Group by the language column
|
* @method CcFilesQuery groupByDbLanguage() Group by the language column
|
||||||
|
* @method CcFilesQuery groupByDbSoundcloudId() Group by the soundcloud_id column
|
||||||
|
* @method CcFilesQuery groupByDbSoundcloudErrorCode() Group by the soundcloud_error_code column
|
||||||
|
* @method CcFilesQuery groupByDbSoundcloudErrorMsg() Group by the soundcloud_error_msg column
|
||||||
|
* @method CcFilesQuery groupByDbSoundcloudLinkToFile() Group by the soundcloud_link_to_file column
|
||||||
*
|
*
|
||||||
* @method CcFilesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
* @method CcFilesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
* @method CcFilesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
* @method CcFilesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
@ -200,6 +208,10 @@
|
||||||
* @method CcFiles findOneByDbSubject(string $subject) Return the first CcFiles filtered by the subject column
|
* @method CcFiles findOneByDbSubject(string $subject) Return the first CcFiles filtered by the subject column
|
||||||
* @method CcFiles findOneByDbContributor(string $contributor) Return the first CcFiles filtered by the contributor column
|
* @method CcFiles findOneByDbContributor(string $contributor) Return the first CcFiles filtered by the contributor column
|
||||||
* @method CcFiles findOneByDbLanguage(string $language) Return the first CcFiles filtered by the language column
|
* @method CcFiles findOneByDbLanguage(string $language) Return the first CcFiles filtered by the language column
|
||||||
|
* @method CcFiles findOneByDbSoundcloudId(int $soundcloud_id) Return the first CcFiles filtered by the soundcloud_id column
|
||||||
|
* @method CcFiles findOneByDbSoundcloudErrorCode(int $soundcloud_error_code) Return the first CcFiles filtered by the soundcloud_error_code column
|
||||||
|
* @method CcFiles findOneByDbSoundcloudErrorMsg(string $soundcloud_error_msg) Return the first CcFiles filtered by the soundcloud_error_msg column
|
||||||
|
* @method CcFiles findOneByDbSoundcloudLinkToFile(string $soundcloud_link_to_file) Return the first CcFiles filtered by the soundcloud_link_to_file column
|
||||||
*
|
*
|
||||||
* @method array findByDbId(int $id) Return CcFiles objects filtered by the id column
|
* @method array findByDbId(int $id) Return CcFiles objects filtered by the id column
|
||||||
* @method array findByDbGunid(string $gunid) Return CcFiles objects filtered by the gunid column
|
* @method array findByDbGunid(string $gunid) Return CcFiles objects filtered by the gunid column
|
||||||
|
@ -256,6 +268,10 @@
|
||||||
* @method array findByDbSubject(string $subject) Return CcFiles objects filtered by the subject column
|
* @method array findByDbSubject(string $subject) Return CcFiles objects filtered by the subject column
|
||||||
* @method array findByDbContributor(string $contributor) Return CcFiles objects filtered by the contributor column
|
* @method array findByDbContributor(string $contributor) Return CcFiles objects filtered by the contributor column
|
||||||
* @method array findByDbLanguage(string $language) Return CcFiles objects filtered by the language column
|
* @method array findByDbLanguage(string $language) Return CcFiles objects filtered by the language column
|
||||||
|
* @method array findByDbSoundcloudId(int $soundcloud_id) Return CcFiles objects filtered by the soundcloud_id column
|
||||||
|
* @method array findByDbSoundcloudErrorCode(int $soundcloud_error_code) Return CcFiles objects filtered by the soundcloud_error_code column
|
||||||
|
* @method array findByDbSoundcloudErrorMsg(string $soundcloud_error_msg) Return CcFiles objects filtered by the soundcloud_error_msg column
|
||||||
|
* @method array findByDbSoundcloudLinkToFile(string $soundcloud_link_to_file) Return CcFiles objects filtered by the soundcloud_link_to_file column
|
||||||
*
|
*
|
||||||
* @package propel.generator.airtime.om
|
* @package propel.generator.airtime.om
|
||||||
*/
|
*/
|
||||||
|
@ -1633,6 +1649,112 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
||||||
return $this->addUsingAlias(CcFilesPeer::LANGUAGE, $dbLanguage, $comparison);
|
return $this->addUsingAlias(CcFilesPeer::LANGUAGE, $dbLanguage, $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 CcFilesQuery 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(CcFilesPeer::SOUNDCLOUD_ID, $dbSoundcloudId['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($dbSoundcloudId['max'])) {
|
||||||
|
$this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ID, $dbSoundcloudId['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ID, $dbSoundcloudId, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the soundcloud_error_code column
|
||||||
|
*
|
||||||
|
* @param int|array $dbSoundcloudErrorCode 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 CcFilesQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByDbSoundcloudErrorCode($dbSoundcloudErrorCode = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($dbSoundcloudErrorCode)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($dbSoundcloudErrorCode['min'])) {
|
||||||
|
$this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ERROR_CODE, $dbSoundcloudErrorCode['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($dbSoundcloudErrorCode['max'])) {
|
||||||
|
$this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ERROR_CODE, $dbSoundcloudErrorCode['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ERROR_CODE, $dbSoundcloudErrorCode, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the soundcloud_error_msg column
|
||||||
|
*
|
||||||
|
* @param string $dbSoundcloudErrorMsg 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 CcFilesQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByDbSoundcloudErrorMsg($dbSoundcloudErrorMsg = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($dbSoundcloudErrorMsg)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $dbSoundcloudErrorMsg)) {
|
||||||
|
$dbSoundcloudErrorMsg = str_replace('*', '%', $dbSoundcloudErrorMsg);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ERROR_MSG, $dbSoundcloudErrorMsg, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the soundcloud_link_to_file column
|
||||||
|
*
|
||||||
|
* @param string $dbSoundcloudLinkToFile 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 CcFilesQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByDbSoundcloudLinkToFile($dbSoundcloudLinkToFile = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($dbSoundcloudLinkToFile)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $dbSoundcloudLinkToFile)) {
|
||||||
|
$dbSoundcloudLinkToFile = str_replace('*', '%', $dbSoundcloudLinkToFile);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE, $dbSoundcloudLinkToFile, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related CcSubjs object
|
* Filter the query by a related CcSubjs object
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,735 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a row from the 'cc_login_attempts' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peer class name
|
||||||
|
*/
|
||||||
|
const PEER = 'CcLoginAttemptsPeer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Peer class.
|
||||||
|
* Instance provides a convenient way of calling static methods on a class
|
||||||
|
* that calling code may not be able to identify.
|
||||||
|
* @var CcLoginAttemptsPeer
|
||||||
|
*/
|
||||||
|
protected static $peer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the ip field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $ip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the attempts field.
|
||||||
|
* Note: this column has a database default value of: 0
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $attempts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
|
* by another object which falls in this transaction.
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $alreadyInSave = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to prevent endless validation loop, if this object is referenced
|
||||||
|
* by another object which falls in this transaction.
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $alreadyInValidation = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies default values to this object.
|
||||||
|
* This method should be called from the object's constructor (or
|
||||||
|
* equivalent initialization method).
|
||||||
|
* @see __construct()
|
||||||
|
*/
|
||||||
|
public function applyDefaultValues()
|
||||||
|
{
|
||||||
|
$this->attempts = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseCcLoginAttempts object.
|
||||||
|
* @see applyDefaults()
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->applyDefaultValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [ip] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDbIP()
|
||||||
|
{
|
||||||
|
return $this->ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [attempts] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getDbAttempts()
|
||||||
|
{
|
||||||
|
return $this->attempts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [ip] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return CcLoginAttempts 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[] = CcLoginAttemptsPeer::IP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDbIP()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [attempts] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return CcLoginAttempts The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setDbAttempts($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->attempts !== $v || $this->isNew()) {
|
||||||
|
$this->attempts = $v;
|
||||||
|
$this->modifiedColumns[] = CcLoginAttemptsPeer::ATTEMPTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDbAttempts()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the columns in this object are only set to default values.
|
||||||
|
*
|
||||||
|
* This method can be used in conjunction with isModified() to indicate whether an object is both
|
||||||
|
* modified _and_ has some values set which are non-default.
|
||||||
|
*
|
||||||
|
* @return boolean Whether the columns in this object are only been set with default values.
|
||||||
|
*/
|
||||||
|
public function hasOnlyDefaultValues()
|
||||||
|
{
|
||||||
|
if ($this->attempts !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise, everything was equal, so return TRUE
|
||||||
|
return true;
|
||||||
|
} // hasOnlyDefaultValues()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hydrates (populates) the object variables with values from the database resultset.
|
||||||
|
*
|
||||||
|
* An offset (0-based "start column") is specified so that objects can be hydrated
|
||||||
|
* with a subset of the columns in the resultset rows. This is needed, for example,
|
||||||
|
* for results of JOIN queries where the resultset row includes columns from two or
|
||||||
|
* more tables.
|
||||||
|
*
|
||||||
|
* @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
|
||||||
|
* @param int $startcol 0-based offset column which indicates which restultset column to start with.
|
||||||
|
* @param boolean $rehydrate Whether this object is being re-hydrated from the database.
|
||||||
|
* @return int next starting column
|
||||||
|
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
|
||||||
|
*/
|
||||||
|
public function hydrate($row, $startcol = 0, $rehydrate = false)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$this->ip = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null;
|
||||||
|
$this->attempts = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
|
||||||
|
$this->resetModified();
|
||||||
|
|
||||||
|
$this->setNew(false);
|
||||||
|
|
||||||
|
if ($rehydrate) {
|
||||||
|
$this->ensureConsistency();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $startcol + 2; // 2 = CcLoginAttemptsPeer::NUM_COLUMNS - CcLoginAttemptsPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new PropelException("Error populating CcLoginAttempts 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(CcLoginAttemptsPeer::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 = CcLoginAttemptsPeer::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(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
$con->beginTransaction();
|
||||||
|
try {
|
||||||
|
$ret = $this->preDelete($con);
|
||||||
|
if ($ret) {
|
||||||
|
CcLoginAttemptsQuery::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(CcLoginAttemptsPeer::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);
|
||||||
|
CcLoginAttemptsPeer::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 = CcLoginAttemptsPeer::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 <code>true</code> is returned; otherwise
|
||||||
|
* an aggreagated array of ValidationFailed objects will be returned.
|
||||||
|
*
|
||||||
|
* @param array $columns Array of column names to validate.
|
||||||
|
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> 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
|
|
@ -0,0 +1,735 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base static class for performing query and update operations on the 'cc_login_attempts' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcLoginAttemptsPeer {
|
||||||
|
|
||||||
|
/** the default database name for this class */
|
||||||
|
const DATABASE_NAME = 'airtime';
|
||||||
|
|
||||||
|
/** the table name for this class */
|
||||||
|
const TABLE_NAME = 'cc_login_attempts';
|
||||||
|
|
||||||
|
/** the related Propel class for this table */
|
||||||
|
const OM_CLASS = 'CcLoginAttempts';
|
||||||
|
|
||||||
|
/** A class that can be returned by this peer. */
|
||||||
|
const CLASS_DEFAULT = 'airtime.CcLoginAttempts';
|
||||||
|
|
||||||
|
/** the related TableMap class for this table */
|
||||||
|
const TM_CLASS = 'CcLoginAttemptsTableMap';
|
||||||
|
|
||||||
|
/** The total number of columns. */
|
||||||
|
const NUM_COLUMNS = 2;
|
||||||
|
|
||||||
|
/** The number of lazy-loaded columns. */
|
||||||
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
|
/** the column name for the IP field */
|
||||||
|
const IP = 'cc_login_attempts.IP';
|
||||||
|
|
||||||
|
/** the column name for the ATTEMPTS field */
|
||||||
|
const ATTEMPTS = 'cc_login_attempts.ATTEMPTS';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An identiy map to hold any loaded instances of CcLoginAttempts objects.
|
||||||
|
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||||
|
* queries.
|
||||||
|
* @var array CcLoginAttempts[]
|
||||||
|
*/
|
||||||
|
public static $instances = array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of fieldnames
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
|
*/
|
||||||
|
private static $fieldNames = array (
|
||||||
|
BasePeer::TYPE_PHPNAME => 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.
|
||||||
|
* <code>
|
||||||
|
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
|
||||||
|
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||||
|
* </code>
|
||||||
|
* @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();
|
||||||
|
|
|
@ -0,0 +1,205 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'cc_login_attempts' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method CcLoginAttemptsQuery orderByDbIP($order = Criteria::ASC) Order by the ip column
|
||||||
|
* @method CcLoginAttemptsQuery orderByDbAttempts($order = Criteria::ASC) Order by the attempts column
|
||||||
|
*
|
||||||
|
* @method CcLoginAttemptsQuery groupByDbIP() Group by the ip column
|
||||||
|
* @method CcLoginAttemptsQuery groupByDbAttempts() Group by the attempts column
|
||||||
|
*
|
||||||
|
* @method CcLoginAttemptsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method CcLoginAttemptsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method CcLoginAttemptsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method CcLoginAttempts findOne(PropelPDO $con = null) Return the first CcLoginAttempts matching the query
|
||||||
|
* @method CcLoginAttempts findOneOrCreate(PropelPDO $con = null) Return the first CcLoginAttempts matching the query, or a new CcLoginAttempts object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method CcLoginAttempts findOneByDbIP(string $ip) Return the first CcLoginAttempts filtered by the ip column
|
||||||
|
* @method CcLoginAttempts findOneByDbAttempts(int $attempts) Return the first CcLoginAttempts filtered by the attempts column
|
||||||
|
*
|
||||||
|
* @method array findByDbIP(string $ip) Return CcLoginAttempts objects filtered by the ip column
|
||||||
|
* @method array findByDbAttempts(int $attempts) Return CcLoginAttempts objects filtered by the attempts column
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseCcLoginAttemptsQuery object.
|
||||||
|
*
|
||||||
|
* @param string $dbName The dabase name
|
||||||
|
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||||
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||||
|
*/
|
||||||
|
public function __construct($dbName = 'airtime', $modelName = 'CcLoginAttempts', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new CcLoginAttemptsQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return CcLoginAttemptsQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof CcLoginAttemptsQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new CcLoginAttemptsQuery();
|
||||||
|
if (null !== $modelAlias) {
|
||||||
|
$query->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
|
||||||
|
* <code>
|
||||||
|
* $obj = $c->findPk(12, $con);
|
||||||
|
* </code>
|
||||||
|
* @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
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||||
|
* </code>
|
||||||
|
* @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
|
|
@ -0,0 +1,708 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a row from the 'cc_service_register' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcServiceRegister extends BaseObject implements Persistent
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peer class name
|
||||||
|
*/
|
||||||
|
const PEER = 'CcServiceRegisterPeer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Peer class.
|
||||||
|
* Instance provides a convenient way of calling static methods on a class
|
||||||
|
* that calling code may not be able to identify.
|
||||||
|
* @var CcServiceRegisterPeer
|
||||||
|
*/
|
||||||
|
protected static $peer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the name field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the ip field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $ip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
|
* by another object which falls in this transaction.
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $alreadyInSave = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to prevent endless validation loop, if this object is referenced
|
||||||
|
* by another object which falls in this transaction.
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $alreadyInValidation = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [name] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDbName()
|
||||||
|
{
|
||||||
|
return $this->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 <code>true</code> is returned; otherwise
|
||||||
|
* an aggreagated array of ValidationFailed objects will be returned.
|
||||||
|
*
|
||||||
|
* @param array $columns Array of column names to validate.
|
||||||
|
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> 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
|
|
@ -0,0 +1,735 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base static class for performing query and update operations on the 'cc_service_register' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcServiceRegisterPeer {
|
||||||
|
|
||||||
|
/** the default database name for this class */
|
||||||
|
const DATABASE_NAME = 'airtime';
|
||||||
|
|
||||||
|
/** the table name for this class */
|
||||||
|
const TABLE_NAME = 'cc_service_register';
|
||||||
|
|
||||||
|
/** the related Propel class for this table */
|
||||||
|
const OM_CLASS = 'CcServiceRegister';
|
||||||
|
|
||||||
|
/** A class that can be returned by this peer. */
|
||||||
|
const CLASS_DEFAULT = 'airtime.CcServiceRegister';
|
||||||
|
|
||||||
|
/** the related TableMap class for this table */
|
||||||
|
const TM_CLASS = 'CcServiceRegisterTableMap';
|
||||||
|
|
||||||
|
/** The total number of columns. */
|
||||||
|
const NUM_COLUMNS = 2;
|
||||||
|
|
||||||
|
/** The number of lazy-loaded columns. */
|
||||||
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
|
/** the column name for the NAME field */
|
||||||
|
const NAME = 'cc_service_register.NAME';
|
||||||
|
|
||||||
|
/** the column name for the IP field */
|
||||||
|
const IP = 'cc_service_register.IP';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An identiy map to hold any loaded instances of CcServiceRegister objects.
|
||||||
|
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||||
|
* queries.
|
||||||
|
* @var array CcServiceRegister[]
|
||||||
|
*/
|
||||||
|
public static $instances = array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of fieldnames
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
|
*/
|
||||||
|
private static $fieldNames = array (
|
||||||
|
BasePeer::TYPE_PHPNAME => 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.
|
||||||
|
* <code>
|
||||||
|
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
|
||||||
|
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||||
|
* </code>
|
||||||
|
* @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();
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'cc_service_register' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method CcServiceRegisterQuery orderByDbName($order = Criteria::ASC) Order by the name column
|
||||||
|
* @method CcServiceRegisterQuery orderByDbIp($order = Criteria::ASC) Order by the ip column
|
||||||
|
*
|
||||||
|
* @method CcServiceRegisterQuery groupByDbName() Group by the name column
|
||||||
|
* @method CcServiceRegisterQuery groupByDbIp() Group by the ip column
|
||||||
|
*
|
||||||
|
* @method CcServiceRegisterQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method CcServiceRegisterQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method CcServiceRegisterQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method CcServiceRegister findOne(PropelPDO $con = null) Return the first CcServiceRegister matching the query
|
||||||
|
* @method CcServiceRegister findOneOrCreate(PropelPDO $con = null) Return the first CcServiceRegister matching the query, or a new CcServiceRegister object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method CcServiceRegister findOneByDbName(string $name) Return the first CcServiceRegister filtered by the name column
|
||||||
|
* @method CcServiceRegister findOneByDbIp(string $ip) Return the first CcServiceRegister filtered by the ip column
|
||||||
|
*
|
||||||
|
* @method array findByDbName(string $name) Return CcServiceRegister objects filtered by the name column
|
||||||
|
* @method array findByDbIp(string $ip) Return CcServiceRegister objects filtered by the ip column
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcServiceRegisterQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseCcServiceRegisterQuery object.
|
||||||
|
*
|
||||||
|
* @param string $dbName The dabase name
|
||||||
|
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||||
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||||
|
*/
|
||||||
|
public function __construct($dbName = 'airtime', $modelName = 'CcServiceRegister', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new CcServiceRegisterQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return CcServiceRegisterQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof CcServiceRegisterQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new CcServiceRegisterQuery();
|
||||||
|
if (null !== $modelAlias) {
|
||||||
|
$query->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
|
||||||
|
* <code>
|
||||||
|
* $obj = $c->findPk(12, $con);
|
||||||
|
* </code>
|
||||||
|
* @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
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||||
|
* </code>
|
||||||
|
* @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
|
|
@ -48,6 +48,12 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
protected $start_time;
|
protected $start_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the timezone field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $timezone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the duration field.
|
* The value for the duration field.
|
||||||
* @var string
|
* @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.
|
* Get the [duration] column value.
|
||||||
*
|
*
|
||||||
|
@ -484,6 +500,26 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
|
||||||
return $this;
|
return $this;
|
||||||
} // setDbStartTime()
|
} // 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.
|
* 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->first_show = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
|
||||||
$this->last_show = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : 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->start_time = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
|
||||||
$this->duration = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
|
$this->timezone = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
|
||||||
$this->day = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
|
$this->duration = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
|
||||||
$this->repeat_type = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
|
$this->day = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
|
||||||
$this->next_pop_date = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
|
$this->repeat_type = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
|
||||||
$this->show_id = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
|
$this->next_pop_date = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
|
||||||
$this->record = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : 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->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
|
@ -691,7 +728,7 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
|
||||||
$this->ensureConsistency();
|
$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) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating CcShowDays object", $e);
|
throw new PropelException("Error populating CcShowDays object", $e);
|
||||||
|
@ -1031,21 +1068,24 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
|
||||||
return $this->getDbStartTime();
|
return $this->getDbStartTime();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
return $this->getDbDuration();
|
return $this->getDbTimezone();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
return $this->getDbDay();
|
return $this->getDbDuration();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
return $this->getDbRepeatType();
|
return $this->getDbDay();
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
return $this->getDbNextPopDate();
|
return $this->getDbRepeatType();
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
return $this->getDbShowId();
|
return $this->getDbNextPopDate();
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
|
return $this->getDbShowId();
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
return $this->getDbRecord();
|
return $this->getDbRecord();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1076,12 +1116,13 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
|
||||||
$keys[1] => $this->getDbFirstShow(),
|
$keys[1] => $this->getDbFirstShow(),
|
||||||
$keys[2] => $this->getDbLastShow(),
|
$keys[2] => $this->getDbLastShow(),
|
||||||
$keys[3] => $this->getDbStartTime(),
|
$keys[3] => $this->getDbStartTime(),
|
||||||
$keys[4] => $this->getDbDuration(),
|
$keys[4] => $this->getDbTimezone(),
|
||||||
$keys[5] => $this->getDbDay(),
|
$keys[5] => $this->getDbDuration(),
|
||||||
$keys[6] => $this->getDbRepeatType(),
|
$keys[6] => $this->getDbDay(),
|
||||||
$keys[7] => $this->getDbNextPopDate(),
|
$keys[7] => $this->getDbRepeatType(),
|
||||||
$keys[8] => $this->getDbShowId(),
|
$keys[8] => $this->getDbNextPopDate(),
|
||||||
$keys[9] => $this->getDbRecord(),
|
$keys[9] => $this->getDbShowId(),
|
||||||
|
$keys[10] => $this->getDbRecord(),
|
||||||
);
|
);
|
||||||
if ($includeForeignObjects) {
|
if ($includeForeignObjects) {
|
||||||
if (null !== $this->aCcShow) {
|
if (null !== $this->aCcShow) {
|
||||||
|
@ -1131,21 +1172,24 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
|
||||||
$this->setDbStartTime($value);
|
$this->setDbStartTime($value);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
$this->setDbDuration($value);
|
$this->setDbTimezone($value);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
$this->setDbDay($value);
|
$this->setDbDuration($value);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
$this->setDbRepeatType($value);
|
$this->setDbDay($value);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
$this->setDbNextPopDate($value);
|
$this->setDbRepeatType($value);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
$this->setDbShowId($value);
|
$this->setDbNextPopDate($value);
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
|
$this->setDbShowId($value);
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
$this->setDbRecord($value);
|
$this->setDbRecord($value);
|
||||||
break;
|
break;
|
||||||
} // switch()
|
} // 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[1], $arr)) $this->setDbFirstShow($arr[$keys[1]]);
|
||||||
if (array_key_exists($keys[2], $arr)) $this->setDbLastShow($arr[$keys[2]]);
|
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[3], $arr)) $this->setDbStartTime($arr[$keys[3]]);
|
||||||
if (array_key_exists($keys[4], $arr)) $this->setDbDuration($arr[$keys[4]]);
|
if (array_key_exists($keys[4], $arr)) $this->setDbTimezone($arr[$keys[4]]);
|
||||||
if (array_key_exists($keys[5], $arr)) $this->setDbDay($arr[$keys[5]]);
|
if (array_key_exists($keys[5], $arr)) $this->setDbDuration($arr[$keys[5]]);
|
||||||
if (array_key_exists($keys[6], $arr)) $this->setDbRepeatType($arr[$keys[6]]);
|
if (array_key_exists($keys[6], $arr)) $this->setDbDay($arr[$keys[6]]);
|
||||||
if (array_key_exists($keys[7], $arr)) $this->setDbNextPopDate($arr[$keys[7]]);
|
if (array_key_exists($keys[7], $arr)) $this->setDbRepeatType($arr[$keys[7]]);
|
||||||
if (array_key_exists($keys[8], $arr)) $this->setDbShowId($arr[$keys[8]]);
|
if (array_key_exists($keys[8], $arr)) $this->setDbNextPopDate($arr[$keys[8]]);
|
||||||
if (array_key_exists($keys[9], $arr)) $this->setDbRecord($arr[$keys[9]]);
|
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::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::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::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::DURATION)) $criteria->add(CcShowDaysPeer::DURATION, $this->duration);
|
||||||
if ($this->isColumnModified(CcShowDaysPeer::DAY)) $criteria->add(CcShowDaysPeer::DAY, $this->day);
|
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);
|
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->setDbFirstShow($this->first_show);
|
||||||
$copyObj->setDbLastShow($this->last_show);
|
$copyObj->setDbLastShow($this->last_show);
|
||||||
$copyObj->setDbStartTime($this->start_time);
|
$copyObj->setDbStartTime($this->start_time);
|
||||||
|
$copyObj->setDbTimezone($this->timezone);
|
||||||
$copyObj->setDbDuration($this->duration);
|
$copyObj->setDbDuration($this->duration);
|
||||||
$copyObj->setDbDay($this->day);
|
$copyObj->setDbDay($this->day);
|
||||||
$copyObj->setDbRepeatType($this->repeat_type);
|
$copyObj->setDbRepeatType($this->repeat_type);
|
||||||
|
@ -1374,6 +1421,7 @@ abstract class BaseCcShowDays extends BaseObject implements Persistent
|
||||||
$this->first_show = null;
|
$this->first_show = null;
|
||||||
$this->last_show = null;
|
$this->last_show = null;
|
||||||
$this->start_time = null;
|
$this->start_time = null;
|
||||||
|
$this->timezone = null;
|
||||||
$this->duration = null;
|
$this->duration = null;
|
||||||
$this->day = null;
|
$this->day = null;
|
||||||
$this->repeat_type = null;
|
$this->repeat_type = null;
|
||||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcShowDaysPeer {
|
||||||
const TM_CLASS = 'CcShowDaysTableMap';
|
const TM_CLASS = 'CcShowDaysTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 10;
|
const NUM_COLUMNS = 11;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
@ -43,6 +43,9 @@ abstract class BaseCcShowDaysPeer {
|
||||||
/** the column name for the START_TIME field */
|
/** the column name for the START_TIME field */
|
||||||
const START_TIME = 'cc_show_days.START_TIME';
|
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 */
|
/** the column name for the DURATION field */
|
||||||
const DURATION = 'cc_show_days.DURATION';
|
const DURATION = 'cc_show_days.DURATION';
|
||||||
|
|
||||||
|
@ -77,12 +80,12 @@ abstract class BaseCcShowDaysPeer {
|
||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
private static $fieldNames = array (
|
private static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFirstShow', 'DbLastShow', 'DbStartTime', 'DbDuration', 'DbDay', 'DbRepeatType', 'DbNextPopDate', 'DbShowId', 'DbRecord', ),
|
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFirstShow', 'DbLastShow', 'DbStartTime', 'DbTimezone', 'DbDuration', 'DbDay', 'DbRepeatType', 'DbNextPopDate', 'DbShowId', 'DbRecord', ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFirstShow', 'dbLastShow', 'dbStartTime', '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::DURATION, self::DAY, self::REPEAT_TYPE, self::NEXT_POP_DATE, self::SHOW_ID, self::RECORD, ),
|
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', 'DURATION', 'DAY', 'REPEAT_TYPE', 'NEXT_POP_DATE', 'SHOW_ID', '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', '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, )
|
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
|
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
private static $fieldKeys = array (
|
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_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, 'dbDuration' => 4, 'dbDay' => 5, 'dbRepeatType' => 6, 'dbNextPopDate' => 7, 'dbShowId' => 8, 'dbRecord' => 9, ),
|
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::DURATION => 4, self::DAY => 5, self::REPEAT_TYPE => 6, self::NEXT_POP_DATE => 7, self::SHOW_ID => 8, self::RECORD => 9, ),
|
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, 'DURATION' => 4, 'DAY' => 5, 'REPEAT_TYPE' => 6, 'NEXT_POP_DATE' => 7, 'SHOW_ID' => 8, 'RECORD' => 9, ),
|
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, '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, '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, )
|
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::FIRST_SHOW);
|
||||||
$criteria->addSelectColumn(CcShowDaysPeer::LAST_SHOW);
|
$criteria->addSelectColumn(CcShowDaysPeer::LAST_SHOW);
|
||||||
$criteria->addSelectColumn(CcShowDaysPeer::START_TIME);
|
$criteria->addSelectColumn(CcShowDaysPeer::START_TIME);
|
||||||
|
$criteria->addSelectColumn(CcShowDaysPeer::TIMEZONE);
|
||||||
$criteria->addSelectColumn(CcShowDaysPeer::DURATION);
|
$criteria->addSelectColumn(CcShowDaysPeer::DURATION);
|
||||||
$criteria->addSelectColumn(CcShowDaysPeer::DAY);
|
$criteria->addSelectColumn(CcShowDaysPeer::DAY);
|
||||||
$criteria->addSelectColumn(CcShowDaysPeer::REPEAT_TYPE);
|
$criteria->addSelectColumn(CcShowDaysPeer::REPEAT_TYPE);
|
||||||
|
@ -184,6 +188,7 @@ abstract class BaseCcShowDaysPeer {
|
||||||
$criteria->addSelectColumn($alias . '.FIRST_SHOW');
|
$criteria->addSelectColumn($alias . '.FIRST_SHOW');
|
||||||
$criteria->addSelectColumn($alias . '.LAST_SHOW');
|
$criteria->addSelectColumn($alias . '.LAST_SHOW');
|
||||||
$criteria->addSelectColumn($alias . '.START_TIME');
|
$criteria->addSelectColumn($alias . '.START_TIME');
|
||||||
|
$criteria->addSelectColumn($alias . '.TIMEZONE');
|
||||||
$criteria->addSelectColumn($alias . '.DURATION');
|
$criteria->addSelectColumn($alias . '.DURATION');
|
||||||
$criteria->addSelectColumn($alias . '.DAY');
|
$criteria->addSelectColumn($alias . '.DAY');
|
||||||
$criteria->addSelectColumn($alias . '.REPEAT_TYPE');
|
$criteria->addSelectColumn($alias . '.REPEAT_TYPE');
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
* @method CcShowDaysQuery orderByDbFirstShow($order = Criteria::ASC) Order by the first_show column
|
* @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 orderByDbLastShow($order = Criteria::ASC) Order by the last_show column
|
||||||
* @method CcShowDaysQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time 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 orderByDbDuration($order = Criteria::ASC) Order by the duration column
|
||||||
* @method CcShowDaysQuery orderByDbDay($order = Criteria::ASC) Order by the day column
|
* @method CcShowDaysQuery orderByDbDay($order = Criteria::ASC) Order by the day column
|
||||||
* @method CcShowDaysQuery orderByDbRepeatType($order = Criteria::ASC) Order by the repeat_type 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 groupByDbFirstShow() Group by the first_show column
|
||||||
* @method CcShowDaysQuery groupByDbLastShow() Group by the last_show column
|
* @method CcShowDaysQuery groupByDbLastShow() Group by the last_show column
|
||||||
* @method CcShowDaysQuery groupByDbStartTime() Group by the start_time 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 groupByDbDuration() Group by the duration column
|
||||||
* @method CcShowDaysQuery groupByDbDay() Group by the day column
|
* @method CcShowDaysQuery groupByDbDay() Group by the day column
|
||||||
* @method CcShowDaysQuery groupByDbRepeatType() Group by the repeat_type 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 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 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 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 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 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
|
* @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 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 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 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 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 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
|
* @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);
|
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
|
* Filter the query on the duration column
|
||||||
*
|
*
|
||||||
|
|
|
@ -74,12 +74,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
protected $file_id;
|
protected $file_id;
|
||||||
|
|
||||||
/**
|
|
||||||
* The value for the soundcloud_id field.
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
protected $soundcloud_id;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the time_filled field.
|
* The value for the time_filled field.
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -273,16 +267,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
return $this->file_id;
|
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.
|
* Get the [optionally formatted] temporal [time_filled] column value.
|
||||||
*
|
*
|
||||||
|
@ -546,26 +530,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
return $this;
|
return $this;
|
||||||
} // setDbRecordedFile()
|
} // 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.
|
* 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->rebroadcast = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
|
||||||
$this->instance_id = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : 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->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 + 8] !== null) ? (string) $row[$startcol + 8] : null;
|
||||||
$this->time_filled = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
|
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
|
@ -673,7 +636,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
$this->ensureConsistency();
|
$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) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating CcShowInstances object", $e);
|
throw new PropelException("Error populating CcShowInstances object", $e);
|
||||||
|
@ -1095,9 +1058,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
return $this->getDbRecordedFile();
|
return $this->getDbRecordedFile();
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
return $this->getDbSoundCloudId();
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
return $this->getDbTimeFilled();
|
return $this->getDbTimeFilled();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1132,8 +1092,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
$keys[5] => $this->getDbRebroadcast(),
|
$keys[5] => $this->getDbRebroadcast(),
|
||||||
$keys[6] => $this->getDbOriginalShow(),
|
$keys[6] => $this->getDbOriginalShow(),
|
||||||
$keys[7] => $this->getDbRecordedFile(),
|
$keys[7] => $this->getDbRecordedFile(),
|
||||||
$keys[8] => $this->getDbSoundCloudId(),
|
$keys[8] => $this->getDbTimeFilled(),
|
||||||
$keys[9] => $this->getDbTimeFilled(),
|
|
||||||
);
|
);
|
||||||
if ($includeForeignObjects) {
|
if ($includeForeignObjects) {
|
||||||
if (null !== $this->aCcShow) {
|
if (null !== $this->aCcShow) {
|
||||||
|
@ -1201,9 +1160,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
$this->setDbRecordedFile($value);
|
$this->setDbRecordedFile($value);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
$this->setDbSoundCloudId($value);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
$this->setDbTimeFilled($value);
|
$this->setDbTimeFilled($value);
|
||||||
break;
|
break;
|
||||||
} // switch()
|
} // 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[5], $arr)) $this->setDbRebroadcast($arr[$keys[5]]);
|
||||||
if (array_key_exists($keys[6], $arr)) $this->setDbOriginalShow($arr[$keys[6]]);
|
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[7], $arr)) $this->setDbRecordedFile($arr[$keys[7]]);
|
||||||
if (array_key_exists($keys[8], $arr)) $this->setDbSoundCloudId($arr[$keys[8]]);
|
if (array_key_exists($keys[8], $arr)) $this->setDbTimeFilled($arr[$keys[8]]);
|
||||||
if (array_key_exists($keys[9], $arr)) $this->setDbTimeFilled($arr[$keys[9]]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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::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::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::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);
|
if ($this->isColumnModified(CcShowInstancesPeer::TIME_FILLED)) $criteria->add(CcShowInstancesPeer::TIME_FILLED, $this->time_filled);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
|
@ -1329,7 +1283,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
$copyObj->setDbRebroadcast($this->rebroadcast);
|
$copyObj->setDbRebroadcast($this->rebroadcast);
|
||||||
$copyObj->setDbOriginalShow($this->instance_id);
|
$copyObj->setDbOriginalShow($this->instance_id);
|
||||||
$copyObj->setDbRecordedFile($this->file_id);
|
$copyObj->setDbRecordedFile($this->file_id);
|
||||||
$copyObj->setDbSoundCloudId($this->soundcloud_id);
|
|
||||||
$copyObj->setDbTimeFilled($this->time_filled);
|
$copyObj->setDbTimeFilled($this->time_filled);
|
||||||
|
|
||||||
if ($deepCopy) {
|
if ($deepCopy) {
|
||||||
|
@ -1847,7 +1800,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
$this->rebroadcast = null;
|
$this->rebroadcast = null;
|
||||||
$this->instance_id = null;
|
$this->instance_id = null;
|
||||||
$this->file_id = null;
|
$this->file_id = null;
|
||||||
$this->soundcloud_id = null;
|
|
||||||
$this->time_filled = null;
|
$this->time_filled = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcShowInstancesPeer {
|
||||||
const TM_CLASS = 'CcShowInstancesTableMap';
|
const TM_CLASS = 'CcShowInstancesTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 10;
|
const NUM_COLUMNS = 9;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
@ -55,9 +55,6 @@ abstract class BaseCcShowInstancesPeer {
|
||||||
/** the column name for the FILE_ID field */
|
/** the column name for the FILE_ID field */
|
||||||
const FILE_ID = 'cc_show_instances.FILE_ID';
|
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 */
|
/** the column name for the TIME_FILLED field */
|
||||||
const TIME_FILLED = 'cc_show_instances.TIME_FILLED';
|
const TIME_FILLED = 'cc_show_instances.TIME_FILLED';
|
||||||
|
|
||||||
|
@ -77,12 +74,12 @@ abstract class BaseCcShowInstancesPeer {
|
||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
private static $fieldNames = array (
|
private static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbSoundCloudId', 'DbTimeFilled', ),
|
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', 'dbSoundCloudId', '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::SOUNDCLOUD_ID, self::TIME_FILLED, ),
|
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', 'SOUNDCLOUD_ID', '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', 'soundcloud_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, 9, )
|
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
|
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
private static $fieldKeys = array (
|
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_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, 'dbSoundCloudId' => 8, 'dbTimeFilled' => 9, ),
|
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::SOUNDCLOUD_ID => 8, self::TIME_FILLED => 9, ),
|
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::SHOW_ID => 3, self::RECORD => 4, self::REBROADCAST => 5, self::INSTANCE_ID => 6, self::FILE_ID => 7, self::TIME_FILLED => 8, ),
|
||||||
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_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, '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, 'time_filled' => 8, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
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::REBROADCAST);
|
||||||
$criteria->addSelectColumn(CcShowInstancesPeer::INSTANCE_ID);
|
$criteria->addSelectColumn(CcShowInstancesPeer::INSTANCE_ID);
|
||||||
$criteria->addSelectColumn(CcShowInstancesPeer::FILE_ID);
|
$criteria->addSelectColumn(CcShowInstancesPeer::FILE_ID);
|
||||||
$criteria->addSelectColumn(CcShowInstancesPeer::SOUNDCLOUD_ID);
|
|
||||||
$criteria->addSelectColumn(CcShowInstancesPeer::TIME_FILLED);
|
$criteria->addSelectColumn(CcShowInstancesPeer::TIME_FILLED);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
|
@ -188,7 +184,6 @@ abstract class BaseCcShowInstancesPeer {
|
||||||
$criteria->addSelectColumn($alias . '.REBROADCAST');
|
$criteria->addSelectColumn($alias . '.REBROADCAST');
|
||||||
$criteria->addSelectColumn($alias . '.INSTANCE_ID');
|
$criteria->addSelectColumn($alias . '.INSTANCE_ID');
|
||||||
$criteria->addSelectColumn($alias . '.FILE_ID');
|
$criteria->addSelectColumn($alias . '.FILE_ID');
|
||||||
$criteria->addSelectColumn($alias . '.SOUNDCLOUD_ID');
|
|
||||||
$criteria->addSelectColumn($alias . '.TIME_FILLED');
|
$criteria->addSelectColumn($alias . '.TIME_FILLED');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
* @method CcShowInstancesQuery orderByDbRebroadcast($order = Criteria::ASC) Order by the rebroadcast column
|
* @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 orderByDbOriginalShow($order = Criteria::ASC) Order by the instance_id column
|
||||||
* @method CcShowInstancesQuery orderByDbRecordedFile($order = Criteria::ASC) Order by the file_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 orderByDbTimeFilled($order = Criteria::ASC) Order by the time_filled column
|
||||||
*
|
*
|
||||||
* @method CcShowInstancesQuery groupByDbId() Group by the id column
|
* @method CcShowInstancesQuery groupByDbId() Group by the id column
|
||||||
|
@ -25,7 +24,6 @@
|
||||||
* @method CcShowInstancesQuery groupByDbRebroadcast() Group by the rebroadcast column
|
* @method CcShowInstancesQuery groupByDbRebroadcast() Group by the rebroadcast column
|
||||||
* @method CcShowInstancesQuery groupByDbOriginalShow() Group by the instance_id column
|
* @method CcShowInstancesQuery groupByDbOriginalShow() Group by the instance_id column
|
||||||
* @method CcShowInstancesQuery groupByDbRecordedFile() Group by the file_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 groupByDbTimeFilled() Group by the time_filled column
|
||||||
*
|
*
|
||||||
* @method CcShowInstancesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
* @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 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 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 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 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
|
* @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 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 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 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
|
* @method array findByDbTimeFilled(string $time_filled) Return CcShowInstances objects filtered by the time_filled column
|
||||||
*
|
*
|
||||||
* @package propel.generator.airtime.om
|
* @package propel.generator.airtime.om
|
||||||
|
@ -419,37 +415,6 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria
|
||||||
return $this->addUsingAlias(CcShowInstancesPeer::FILE_ID, $dbRecordedFile, $comparison);
|
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
|
* Filter the query on the time_filled column
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,756 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a row from the 'cc_stream_setting' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcStreamSetting extends BaseObject implements Persistent
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peer class name
|
||||||
|
*/
|
||||||
|
const PEER = 'CcStreamSettingPeer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Peer class.
|
||||||
|
* Instance provides a convenient way of calling static methods on a class
|
||||||
|
* that calling code may not be able to identify.
|
||||||
|
* @var CcStreamSettingPeer
|
||||||
|
*/
|
||||||
|
protected static $peer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the keyname field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $keyname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the value field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the type field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
|
* by another object which falls in this transaction.
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $alreadyInSave = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to prevent endless validation loop, if this object is referenced
|
||||||
|
* by another object which falls in this transaction.
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $alreadyInValidation = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [keyname] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDbKeyName()
|
||||||
|
{
|
||||||
|
return $this->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 <code>true</code> is returned; otherwise
|
||||||
|
* an aggreagated array of ValidationFailed objects will be returned.
|
||||||
|
*
|
||||||
|
* @param array $columns Array of column names to validate.
|
||||||
|
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> 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
|
|
@ -0,0 +1,740 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base static class for performing query and update operations on the 'cc_stream_setting' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcStreamSettingPeer {
|
||||||
|
|
||||||
|
/** the default database name for this class */
|
||||||
|
const DATABASE_NAME = 'airtime';
|
||||||
|
|
||||||
|
/** the table name for this class */
|
||||||
|
const TABLE_NAME = 'cc_stream_setting';
|
||||||
|
|
||||||
|
/** the related Propel class for this table */
|
||||||
|
const OM_CLASS = 'CcStreamSetting';
|
||||||
|
|
||||||
|
/** A class that can be returned by this peer. */
|
||||||
|
const CLASS_DEFAULT = 'airtime.CcStreamSetting';
|
||||||
|
|
||||||
|
/** the related TableMap class for this table */
|
||||||
|
const TM_CLASS = 'CcStreamSettingTableMap';
|
||||||
|
|
||||||
|
/** The total number of columns. */
|
||||||
|
const NUM_COLUMNS = 3;
|
||||||
|
|
||||||
|
/** The number of lazy-loaded columns. */
|
||||||
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
|
/** the column name for the KEYNAME field */
|
||||||
|
const KEYNAME = 'cc_stream_setting.KEYNAME';
|
||||||
|
|
||||||
|
/** the column name for the VALUE field */
|
||||||
|
const VALUE = 'cc_stream_setting.VALUE';
|
||||||
|
|
||||||
|
/** the column name for the TYPE field */
|
||||||
|
const TYPE = 'cc_stream_setting.TYPE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An identiy map to hold any loaded instances of CcStreamSetting objects.
|
||||||
|
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||||
|
* queries.
|
||||||
|
* @var array CcStreamSetting[]
|
||||||
|
*/
|
||||||
|
public static $instances = array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of fieldnames
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
|
*/
|
||||||
|
private static $fieldNames = array (
|
||||||
|
BasePeer::TYPE_PHPNAME => 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.
|
||||||
|
* <code>
|
||||||
|
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
|
||||||
|
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||||
|
* </code>
|
||||||
|
* @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();
|
||||||
|
|
|
@ -0,0 +1,222 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'cc_stream_setting' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method CcStreamSettingQuery orderByDbKeyName($order = Criteria::ASC) Order by the keyname column
|
||||||
|
* @method CcStreamSettingQuery orderByDbValue($order = Criteria::ASC) Order by the value column
|
||||||
|
* @method CcStreamSettingQuery orderByDbType($order = Criteria::ASC) Order by the type column
|
||||||
|
*
|
||||||
|
* @method CcStreamSettingQuery groupByDbKeyName() Group by the keyname column
|
||||||
|
* @method CcStreamSettingQuery groupByDbValue() Group by the value column
|
||||||
|
* @method CcStreamSettingQuery groupByDbType() Group by the type column
|
||||||
|
*
|
||||||
|
* @method CcStreamSettingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method CcStreamSettingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method CcStreamSettingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method CcStreamSetting findOne(PropelPDO $con = null) Return the first CcStreamSetting matching the query
|
||||||
|
* @method CcStreamSetting findOneOrCreate(PropelPDO $con = null) Return the first CcStreamSetting matching the query, or a new CcStreamSetting object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method CcStreamSetting findOneByDbKeyName(string $keyname) Return the first CcStreamSetting filtered by the keyname column
|
||||||
|
* @method CcStreamSetting findOneByDbValue(string $value) Return the first CcStreamSetting filtered by the value column
|
||||||
|
* @method CcStreamSetting findOneByDbType(string $type) Return the first CcStreamSetting filtered by the type column
|
||||||
|
*
|
||||||
|
* @method array findByDbKeyName(string $keyname) Return CcStreamSetting objects filtered by the keyname column
|
||||||
|
* @method array findByDbValue(string $value) Return CcStreamSetting objects filtered by the value column
|
||||||
|
* @method array findByDbType(string $type) Return CcStreamSetting objects filtered by the type column
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcStreamSettingQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseCcStreamSettingQuery object.
|
||||||
|
*
|
||||||
|
* @param string $dbName The dabase name
|
||||||
|
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||||
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||||
|
*/
|
||||||
|
public function __construct($dbName = 'airtime', $modelName = 'CcStreamSetting', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new CcStreamSettingQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return CcStreamSettingQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof CcStreamSettingQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new CcStreamSettingQuery();
|
||||||
|
if (null !== $modelAlias) {
|
||||||
|
$query->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
|
||||||
|
* <code>
|
||||||
|
* $obj = $c->findPk(12, $con);
|
||||||
|
* </code>
|
||||||
|
* @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
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||||
|
* </code>
|
||||||
|
* @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
|
|
@ -95,6 +95,13 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
protected $email;
|
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.
|
* @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->type = 'U';
|
||||||
$this->first_name = '';
|
$this->first_name = '';
|
||||||
$this->last_name = '';
|
$this->last_name = '';
|
||||||
|
$this->login_attempts = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -325,6 +333,16 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
|
||||||
return $this->email;
|
return $this->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [login_attempts] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getDbLoginAttempts()
|
||||||
|
{
|
||||||
|
return $this->login_attempts;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [id] column.
|
* Set the value of [id] column.
|
||||||
*
|
*
|
||||||
|
@ -603,6 +621,26 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
|
||||||
return $this;
|
return $this;
|
||||||
} // setDbEmail()
|
} // 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.
|
* 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->login_attempts !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise, everything was equal, so return TRUE
|
// otherwise, everything was equal, so return TRUE
|
||||||
return true;
|
return true;
|
||||||
} // hasOnlyDefaultValues()
|
} // 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->skype_contact = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
|
||||||
$this->jabber_contact = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : 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->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->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
|
@ -674,7 +717,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
|
||||||
$this->ensureConsistency();
|
$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) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating CcSubjs object", $e);
|
throw new PropelException("Error populating CcSubjs object", $e);
|
||||||
|
@ -1132,6 +1175,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
|
||||||
case 10:
|
case 10:
|
||||||
return $this->getDbEmail();
|
return $this->getDbEmail();
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
return $this->getDbLoginAttempts();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
break;
|
break;
|
||||||
|
@ -1166,6 +1212,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
|
||||||
$keys[8] => $this->getDbSkypeContact(),
|
$keys[8] => $this->getDbSkypeContact(),
|
||||||
$keys[9] => $this->getDbJabberContact(),
|
$keys[9] => $this->getDbJabberContact(),
|
||||||
$keys[10] => $this->getDbEmail(),
|
$keys[10] => $this->getDbEmail(),
|
||||||
|
$keys[11] => $this->getDbLoginAttempts(),
|
||||||
);
|
);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -1230,6 +1277,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
|
||||||
case 10:
|
case 10:
|
||||||
$this->setDbEmail($value);
|
$this->setDbEmail($value);
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
$this->setDbLoginAttempts($value);
|
||||||
|
break;
|
||||||
} // switch()
|
} // 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[8], $arr)) $this->setDbSkypeContact($arr[$keys[8]]);
|
||||||
if (array_key_exists($keys[9], $arr)) $this->setDbJabberContact($arr[$keys[9]]);
|
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[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::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::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::EMAIL)) $criteria->add(CcSubjsPeer::EMAIL, $this->email);
|
||||||
|
if ($this->isColumnModified(CcSubjsPeer::LOGIN_ATTEMPTS)) $criteria->add(CcSubjsPeer::LOGIN_ATTEMPTS, $this->login_attempts);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
|
@ -1358,6 +1410,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
|
||||||
$copyObj->setDbSkypeContact($this->skype_contact);
|
$copyObj->setDbSkypeContact($this->skype_contact);
|
||||||
$copyObj->setDbJabberContact($this->jabber_contact);
|
$copyObj->setDbJabberContact($this->jabber_contact);
|
||||||
$copyObj->setDbEmail($this->email);
|
$copyObj->setDbEmail($this->email);
|
||||||
|
$copyObj->setDbLoginAttempts($this->login_attempts);
|
||||||
|
|
||||||
if ($deepCopy) {
|
if ($deepCopy) {
|
||||||
// important: temporarily setNew(false) because this affects the behavior of
|
// 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->skype_contact = null;
|
||||||
$this->jabber_contact = null;
|
$this->jabber_contact = null;
|
||||||
$this->email = null;
|
$this->email = null;
|
||||||
|
$this->login_attempts = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
$this->clearAllReferences();
|
$this->clearAllReferences();
|
||||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcSubjsPeer {
|
||||||
const TM_CLASS = 'CcSubjsTableMap';
|
const TM_CLASS = 'CcSubjsTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 11;
|
const NUM_COLUMNS = 12;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
@ -64,6 +64,9 @@ abstract class BaseCcSubjsPeer {
|
||||||
/** the column name for the EMAIL field */
|
/** the column name for the EMAIL field */
|
||||||
const EMAIL = 'cc_subjs.EMAIL';
|
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.
|
* 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
|
* 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'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
private static $fieldNames = array (
|
private static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbLogin', 'DbPass', 'DbType', 'DbFirstName', 'DbLastName', 'DbLastlogin', 'DbLastfail', 'DbSkypeContact', 'DbJabberContact', 'DbEmail', ),
|
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', ),
|
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, ),
|
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', ),
|
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', ),
|
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, )
|
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
|
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
private static $fieldKeys = array (
|
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_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, ),
|
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, ),
|
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, ),
|
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, ),
|
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, )
|
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::SKYPE_CONTACT);
|
||||||
$criteria->addSelectColumn(CcSubjsPeer::JABBER_CONTACT);
|
$criteria->addSelectColumn(CcSubjsPeer::JABBER_CONTACT);
|
||||||
$criteria->addSelectColumn(CcSubjsPeer::EMAIL);
|
$criteria->addSelectColumn(CcSubjsPeer::EMAIL);
|
||||||
|
$criteria->addSelectColumn(CcSubjsPeer::LOGIN_ATTEMPTS);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
$criteria->addSelectColumn($alias . '.LOGIN');
|
$criteria->addSelectColumn($alias . '.LOGIN');
|
||||||
|
@ -195,6 +199,7 @@ abstract class BaseCcSubjsPeer {
|
||||||
$criteria->addSelectColumn($alias . '.SKYPE_CONTACT');
|
$criteria->addSelectColumn($alias . '.SKYPE_CONTACT');
|
||||||
$criteria->addSelectColumn($alias . '.JABBER_CONTACT');
|
$criteria->addSelectColumn($alias . '.JABBER_CONTACT');
|
||||||
$criteria->addSelectColumn($alias . '.EMAIL');
|
$criteria->addSelectColumn($alias . '.EMAIL');
|
||||||
|
$criteria->addSelectColumn($alias . '.LOGIN_ATTEMPTS');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* @method CcSubjsQuery orderByDbSkypeContact($order = Criteria::ASC) Order by the skype_contact column
|
* @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 orderByDbJabberContact($order = Criteria::ASC) Order by the jabber_contact column
|
||||||
* @method CcSubjsQuery orderByDbEmail($order = Criteria::ASC) Order by the email 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 groupByDbId() Group by the id column
|
||||||
* @method CcSubjsQuery groupByDbLogin() Group by the login column
|
* @method CcSubjsQuery groupByDbLogin() Group by the login column
|
||||||
|
@ -29,6 +30,7 @@
|
||||||
* @method CcSubjsQuery groupByDbSkypeContact() Group by the skype_contact column
|
* @method CcSubjsQuery groupByDbSkypeContact() Group by the skype_contact column
|
||||||
* @method CcSubjsQuery groupByDbJabberContact() Group by the jabber_contact column
|
* @method CcSubjsQuery groupByDbJabberContact() Group by the jabber_contact column
|
||||||
* @method CcSubjsQuery groupByDbEmail() Group by the email 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 leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
* @method CcSubjsQuery rightJoin($relation) Adds a RIGHT 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 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 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 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 findByDbId(int $id) Return CcSubjs objects filtered by the id column
|
||||||
* @method array findByDbLogin(string $login) Return CcSubjs objects filtered by the login 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 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 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 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
|
* @package propel.generator.airtime.om
|
||||||
*/
|
*/
|
||||||
|
@ -452,6 +456,37 @@ abstract class BaseCcSubjsQuery extends ModelCriteria
|
||||||
return $this->addUsingAlias(CcSubjsPeer::EMAIL, $dbEmail, $comparison);
|
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
|
* Filter the query by a related CcAccess object
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,214 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once (dirname(__FILE__).'/Crontab.php');
|
|
||||||
require_once (dirname(__FILE__).'/../../conf.php');
|
|
||||||
/**
|
|
||||||
* This class can call a PHP function from crontab.
|
|
||||||
* Example:
|
|
||||||
* <pre>
|
|
||||||
* $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();
|
|
||||||
* </pre>
|
|
||||||
* @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)).'"';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Cron jobs handling abstract class
|
|
||||||
*
|
|
||||||
* @package Airtime
|
|
||||||
* @subpackage StorageServer.Cron
|
|
||||||
*/
|
|
||||||
class CronJob
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The croncall.php call this function after the objectcreation.
|
|
||||||
*/
|
|
||||||
function execute()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue